Merge pull request #367 from msambol/stat_module

Use stat module instead of shell
pull/369/head
Leseb 2015-08-06 11:29:00 +02:00
commit a8c1309e72
4 changed files with 19 additions and 19 deletions

View File

@ -284,13 +284,13 @@
when: migration_completed.stat.exists == False when: migration_completed.stat.exists == False
- name: Check if sysvinit - name: Check if sysvinit
shell: stat /var/lib/ceph/osd/ceph-*/sysvinit stat: path=/var/lib/ceph/osd/ceph-*/sysvinit
register: osdsysvinit register: osdsysvinit
failed_when: false failed_when: false
changed_when: False changed_when: False
- name: Check if upstart - name: Check if upstart
shell: stat /var/lib/ceph/osd/ceph-*/upstart stat: path=/var/lib/ceph/osd/ceph-*/upstart
register: osdupstart register: osdupstart
failed_when: false failed_when: false
changed_when: False changed_when: False
@ -329,14 +329,14 @@
service: > service: >
name=ceph-osd-all name=ceph-osd-all
state=stopped state=stopped
when: osdupstart.rc == 0 and migration_completed.stat.exists == False when: osdupstart.stat.exists and migration_completed.stat.exists == False
- name: Gracefully stop the OSDs (Sysvinit) - name: Gracefully stop the OSDs (Sysvinit)
service: > service: >
name=ceph name=ceph
state=stopped state=stopped
args=mon args=mon
when: osdsysvinit.rc == 0 and migration_completed.stat.exists == False when: osdsysvinit.stat.exists and migration_completed.stat.exists == False
- name: Wait for the OSDs to be down - name: Wait for the OSDs to be down
local_action: > local_action: >

View File

@ -5,63 +5,63 @@
- name: restart ceph mons - name: restart ceph mons
command: service ceph restart mon command: service ceph restart mon
when: when:
socket.rc == 0 and socket.stat.exists and
ansible_distribution != 'Ubuntu' and ansible_distribution != 'Ubuntu' and
mon_group_name in group_names mon_group_name in group_names
- name: restart ceph mons on ubuntu - name: restart ceph mons on ubuntu
command: restart ceph-mon-all command: restart ceph-mon-all
when: when:
socket.rc == 0 and socket.stat.exists and
ansible_distribution == 'Ubuntu' and ansible_distribution == 'Ubuntu' and
mon_group_name in group_names mon_group_name in group_names
- name: restart ceph osds - name: restart ceph osds
command: service ceph restart osd command: service ceph restart osd
when: when:
socket.rc == 0 and socket.stat.exists and
ansible_distribution != 'Ubuntu' and ansible_distribution != 'Ubuntu' and
osd_group_name in group_names osd_group_name in group_names
- name: restart ceph osds on ubuntu - name: restart ceph osds on ubuntu
command: restart ceph-osd-all command: restart ceph-osd-all
when: when:
socket.rc == 0 and socket.stat.exists and
ansible_distribution == 'Ubuntu' and ansible_distribution == 'Ubuntu' and
osd_group_name in group_names osd_group_name in group_names
- name: restart ceph mdss on ubuntu - name: restart ceph mdss on ubuntu
command: restart ceph-mds-all command: restart ceph-mds-all
when: when:
socket.rc == 0 and socket.stat.exists and
ansible_distribution == 'Ubuntu' and ansible_distribution == 'Ubuntu' and
mds_group_name in group_names mds_group_name in group_names
- name: restart ceph mdss - name: restart ceph mdss
command: service ceph restart mds command: service ceph restart mds
when: when:
socket.rc == 0 and socket.stat.exists and
ansible_distribution != 'Ubuntu' and ansible_distribution != 'Ubuntu' and
mds_group_name in group_names mds_group_name in group_names
- name: restart ceph rgws on ubuntu - name: restart ceph rgws on ubuntu
command: restart ceph-all command: restart ceph-all
when: when:
socketrgw.rc == 0 and socketrgw.stat.exists and
ansible_distribution == 'Ubuntu' and ansible_distribution == 'Ubuntu' and
rgw_group_name in group_names rgw_group_name in group_names
- name: restart ceph rgws - name: restart ceph rgws
command: /etc/init.d/radosgw restart command: /etc/init.d/radosgw restart
when: when:
socketrgw.rc == 0 and socketrgw.stat.exists and
ansible_distribution != 'Ubuntu' and ansible_distribution != 'Ubuntu' and
rgw_group_name in group_names rgw_group_name in group_names
- name: restart ceph rgws on red hat - name: restart ceph rgws on red hat
command: /etc/init.d/ceph-radosgw restart command: /etc/init.d/ceph-radosgw restart
when: when:
socketrgw.rc == 0 and socketrgw.stat.exists and
ansible_os_family == 'RedHat' and ansible_os_family == 'RedHat' and
rgw_group_name in group_names rgw_group_name in group_names

View File

@ -38,13 +38,13 @@
rgw_group_name in group_names rgw_group_name in group_names
- name: check for a ceph socket - name: check for a ceph socket
shell: "stat /var/run/ceph/*.asok > /dev/null 2>&1" stat: path=/var/run/ceph/*.asok
changed_when: false changed_when: false
failed_when: false failed_when: false
register: socket register: socket
- name: check for a rados gateway socket - name: check for a rados gateway socket
shell: "stat {{ rbd_client_admin_socket_path }}*.asok > /dev/null 2>&1" stat: path={{ rbd_client_admin_socket_path }}*.asok
changed_when: false changed_when: false
failed_when: false failed_when: false
register: socketrgw register: socketrgw

View File

@ -90,12 +90,12 @@
post_tasks: post_tasks:
- name: Check if sysvinit - name: Check if sysvinit
shell: stat /var/lib/ceph/osd/ceph-*/sysvinit stat: path=/var/lib/ceph/osd/ceph-*/sysvinit
register: osdsysvinit register: osdsysvinit
failed_when: false failed_when: false
- name: Check if upstart - name: Check if upstart
shell: stat /var/lib/ceph/osd/ceph-*/upstart stat: path=/var/lib/ceph/osd/ceph-*/upstart
register: osdupstart register: osdupstart
failed_when: false failed_when: false
@ -103,14 +103,14 @@
service: > service: >
name=ceph-osd-all name=ceph-osd-all
state=restarted state=restarted
when: osdupstart.rc == 0 when: osdupstart.stat.exists
- name: Gracefully stop the OSDs (Sysvinit) - name: Gracefully stop the OSDs (Sysvinit)
service: > service: >
name=ceph name=ceph
state=restarted state=restarted
args=osd args=osd
when: osdsysvinit.rc == 0 when: osdsysvinit.stat.exists
- name: Waiting for clean PGs... - name: Waiting for clean PGs...
shell: > shell: >