mirror of https://github.com/ceph/ceph-ansible.git
purge: stop rgw instances by iteration
It looks like that the service module doesn't support wildcard anymore
for stopping/disabling multiple services.
fatal: [rgw0]: FAILED! => changed=false
msg: 'This module does not currently support using glob patterns,
found ''*'' in service name: ceph-radosgw@*'
...ignoring
Instead we should iterate over the rgw_instances list.
Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit 9d3b49293d
)
pull/5113/head
parent
eb2fba79fc
commit
e037e99bd2
|
@ -296,13 +296,20 @@
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
- import_role:
|
||||||
|
name: ceph-defaults
|
||||||
|
|
||||||
- name: stop ceph rgws with systemd
|
- import_role:
|
||||||
service:
|
name: ceph-facts
|
||||||
name: ceph-radosgw@rgw.*
|
tasks_from: set_radosgw_address
|
||||||
state: stopped
|
|
||||||
enabled: no
|
- name: stop ceph rgws with systemd
|
||||||
failed_when: false
|
service:
|
||||||
|
name: "ceph-radosgw@rgw.{{ ansible_hostname }}.{{ item.instance_name }}"
|
||||||
|
state: stopped
|
||||||
|
enabled: no
|
||||||
|
failed_when: false
|
||||||
|
with_items: "{{ rgw_instances }}"
|
||||||
|
|
||||||
|
|
||||||
- name: purge ceph rbd-mirror cluster
|
- name: purge ceph rbd-mirror cluster
|
||||||
|
|
|
@ -193,18 +193,25 @@
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
- import_role:
|
||||||
|
name: ceph-defaults
|
||||||
|
|
||||||
- name: disable ceph rgw service
|
- import_role:
|
||||||
service:
|
name: ceph-facts
|
||||||
name: "ceph-radosgw@*"
|
tasks_from: set_radosgw_address
|
||||||
state: stopped
|
|
||||||
enabled: no
|
|
||||||
ignore_errors: true
|
|
||||||
|
|
||||||
- name: remove ceph rgw service
|
- name: disable ceph rgw service
|
||||||
file:
|
service:
|
||||||
path: /etc/systemd/system/ceph-radosgw@.service
|
name: "ceph-radosgw@rgw.{{ ansible_hostname }}.{{ item.instance_name }}"
|
||||||
state: absent
|
state: stopped
|
||||||
|
enabled: no
|
||||||
|
failed_when: false
|
||||||
|
with_items: "{{ rgw_instances }}"
|
||||||
|
|
||||||
|
- name: remove ceph rgw service
|
||||||
|
file:
|
||||||
|
path: /etc/systemd/system/ceph-radosgw@.service
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
|
||||||
- name: purge ceph rbd-mirror cluster
|
- name: purge ceph rbd-mirror cluster
|
||||||
|
|
|
@ -331,12 +331,6 @@
|
||||||
import_tasks: set_radosgw_address.yml
|
import_tasks: set_radosgw_address.yml
|
||||||
when: inventory_hostname in groups.get(rgw_group_name, [])
|
when: inventory_hostname in groups.get(rgw_group_name, [])
|
||||||
|
|
||||||
- name: set_fact rgw_instances
|
|
||||||
set_fact:
|
|
||||||
rgw_instances: "{{ rgw_instances|default([]) | union([{'instance_name': 'rgw' + item|string, 'radosgw_address': _radosgw_address, 'radosgw_frontend_port': radosgw_frontend_port|int + item|int}]) }}"
|
|
||||||
with_sequence: start=0 end={{ radosgw_num_instances|int - 1 }}
|
|
||||||
when: inventory_hostname in groups.get(rgw_group_name, [])
|
|
||||||
|
|
||||||
- name: set ntp service name depending on OS family
|
- name: set ntp service name depending on OS family
|
||||||
block:
|
block:
|
||||||
- name: set ntp service name for Debian family
|
- name: set ntp service name for Debian family
|
||||||
|
|
|
@ -41,3 +41,8 @@
|
||||||
set_fact:
|
set_fact:
|
||||||
_radosgw_address: "{{ hostvars[inventory_hostname][_interface][ip_version][0]['address'] }}"
|
_radosgw_address: "{{ hostvars[inventory_hostname][_interface][ip_version][0]['address'] }}"
|
||||||
when: ip_version == 'ipv6'
|
when: ip_version == 'ipv6'
|
||||||
|
|
||||||
|
- name: set_fact rgw_instances
|
||||||
|
set_fact:
|
||||||
|
rgw_instances: "{{ rgw_instances|default([]) | union([{'instance_name': 'rgw' + item|string, 'radosgw_address': _radosgw_address, 'radosgw_frontend_port': radosgw_frontend_port|int + item|int}]) }}"
|
||||||
|
with_sequence: start=0 end={{ radosgw_num_instances|int - 1 }}
|
||||||
|
|
|
@ -6,5 +6,6 @@
|
||||||
|
|
||||||
- name: restart rgw
|
- name: restart rgw
|
||||||
service:
|
service:
|
||||||
name: ceph-radosgw@*
|
name: "ceph-radosgw@rgw.{{ ansible_hostname }}.{{ item.instance_name }}"
|
||||||
state: restarted
|
state: restarted
|
||||||
|
with_items: "{{ rgw_instances }}"
|
||||||
|
|
Loading…
Reference in New Issue