ceph-iscsi: notify rbd target services

When the iscsi gateway or the ceph configuration file change then we
need to notify the rbd target api/gw services to be restarted.
This patch also merges the rbd-target-api and rbd-target-gw handler
into a single file and listen.

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
pull/4608/head
Dimitri Savineau 2019-10-09 16:50:09 -04:00 committed by Guillaume Abrioux
parent 68a3dac7cd
commit bc701860d5
6 changed files with 35 additions and 35 deletions

View File

@ -91,6 +91,7 @@
- restart ceph rgws
- restart ceph mgrs
- restart ceph rbdmirrors
- restart ceph rbd-target-api-gw
- name: "ensure fetch directory exists"
run_once: true
@ -149,3 +150,4 @@
- restart ceph rgws
- restart ceph mgrs
- restart ceph rbdmirrors
- restart ceph rbd-target-api-gw

View File

@ -49,12 +49,7 @@
when: iscsi_gw_group_name in group_names
listen: "restart ceph tcmu-runner"
- name: rbd-target-gw handler
include_tasks: handler_rbd_target_gw.yml
- name: rbd-target-api and rbd-target-gw handler
include_tasks: handler_rbd_target_api_gw.yml
when: iscsi_gw_group_name in group_names
listen: "restart ceph rbd-target-gw"
- name: rbd-target-api handler
include_tasks: handler_rbd_target_api.yml
when: iscsi_gw_group_name in group_names
listen: "restart ceph rbd-target-api"
listen: "restart ceph rbd-target-api-gw"

View File

@ -24,3 +24,29 @@
- name: set _rbd_target_api_handler_called after restart
set_fact:
_rbd_target_api_handler_called: False
- name: set _rbd_target_gw_handler_called before restart
set_fact:
_rbd_target_gw_handler_called: True
- name: copy rbd-target-gw restart script
template:
src: restart_rbd_target_gw.sh.j2
dest: /tmp/restart_rbd_target_gw.sh
owner: root
group: root
mode: 0750
- name: restart rbd-target-gw
command: /usr/bin/env bash /tmp/restart_rbd_target_gw.sh
when:
- ceph_rbd_target_gw_stat.get('rc') == 0
- hostvars[item]['_rbd_target_gw_handler_called'] | default(False) | bool
- ceph_rbd_target_gw_stat.get('stdout_lines', [])|length != 0
with_items: "{{ groups[iscsi_gw_group_name] }}"
delegate_to: "{{ item }}"
run_once: True
- name: set _rbd_target_gw_handler_called after restart
set_fact:
_rbd_target_gw_handler_called: False

View File

@ -1,26 +0,0 @@
---
- name: set _rbd_target_gw_handler_called before restart
set_fact:
_rbd_target_gw_handler_called: True
- name: copy rbd-target-gw restart script
template:
src: restart_rbd_target_gw.sh.j2
dest: /tmp/restart_rbd_target_gw.sh
owner: root
group: root
mode: 0750
- name: restart rbd-target-gw
command: /usr/bin/env bash /tmp/restart_rbd_target_gw.sh
when:
- ceph_rbd_target_gw_stat.get('rc') == 0
- hostvars[item]['_rbd_target_gw_handler_called'] | default(False) | bool
- ceph_rbd_target_gw_stat.get('stdout_lines', [])|length != 0
with_items: "{{ groups[iscsi_gw_group_name] }}"
delegate_to: "{{ item }}"
run_once: True
- name: set _rbd_target_gw_handler_called after restart
set_fact:
_rbd_target_gw_handler_called: False

View File

@ -28,6 +28,7 @@
dest: /etc/ceph/iscsi-gateway.cfg
config_type: ini
config_overrides: '{{ iscsi_conf_overrides }}'
notify: restart ceph rbd-target-api-gw
- name: set_fact container_exec_cmd
set_fact:

View File

@ -11,4 +11,6 @@
- tcmu-runner
- rbd-target-gw
- rbd-target-api
notify: restart ceph {{ item }}
notify:
- restart ceph tcmu-runner
- restart ceph rbd-target-api-gw