merge task blocks if their execution is based on same conditions

Signed-off-by: Rishabh Dave <ridave@redhat.com>
pull/3764/head
Rishabh Dave 2019-03-28 14:17:26 +05:30 committed by mergify[bot]
parent e0beaf123a
commit 4241b6403f
2 changed files with 52 additions and 51 deletions

View File

@ -54,48 +54,50 @@
tags: tags:
with_pkg with_pkg
- name: red hat 7 based systems tasks - name: red hat based systems tasks
when: when:
- ansible_os_family == 'RedHat' - ansible_os_family == 'RedHat'
- ansible_distribution_major_version == '7'
block: block:
- name: install python-docker-py on red hat / centos - name: red hat 7 based systems tasks
package:
name: ['docker', 'python-docker-py']
state: present
register: result
until: result is succeeded
tags:
with_pkg
- name: pause after docker install before starting (on openstack vms)
pause: seconds=5
when: when:
- ceph_docker_on_openstack - ansible_distribution_major_version == '7'
tags: block:
with_pkg - name: install python-docker-py on red hat / centos
package:
name: ['docker', 'python-docker-py']
state: present
register: result
until: result is succeeded
tags:
with_pkg
- name: start docker service - name: pause after docker install before starting (on openstack vms)
service: pause: seconds=5
name: docker when:
state: started - ceph_docker_on_openstack
enabled: yes tags:
tags: with_pkg
with_pkg
- name: red hat 8 based systems tasks - name: start docker service
when: service:
- ansible_os_family == 'RedHat' name: docker
- ansible_distribution_major_version == '8' state: started
block: enabled: yes
- name: install podman tags:
package: with_pkg
name: 'podman'
state: present - name: red hat 8 based systems tasks
register: result when:
until: result is succeeded - ansible_distribution_major_version == '8'
tags: block:
with_pkg - name: install podman
package:
name: 'podman'
state: present
register: result
until: result is succeeded
tags:
with_pkg
- name: ensure tmpfiles.d is present - name: ensure tmpfiles.d is present
lineinfile: lineinfile:

View File

@ -62,18 +62,17 @@
- "{{ groups.get(mon_group_name) if groups.get(mgr_group_name, []) | length == 0 else groups.get(mgr_group_name, []) }}" - "{{ groups.get(mon_group_name) if groups.get(mgr_group_name, []) | length == 0 else groups.get(mgr_group_name, []) }}"
delegate_to: "{{ groups[mon_group_name][0] }}" delegate_to: "{{ groups[mon_group_name][0] }}"
- name: copy keys to the ansible server - name: copy keys to the ansible server
fetch: fetch:
src: "{{ item }}" src: "{{ item }}"
dest: "{{ fetch_directory }}/{{ fsid }}/{{ item }}" dest: "{{ fetch_directory }}/{{ fsid }}/{{ item }}"
flat: yes flat: yes
with_items: with_items:
- /var/lib/ceph/bootstrap-osd/{{ cluster }}.keyring - /var/lib/ceph/bootstrap-osd/{{ cluster }}.keyring
- /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring - /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring
- /var/lib/ceph/bootstrap-mds/{{ cluster }}.keyring - /var/lib/ceph/bootstrap-mds/{{ cluster }}.keyring
- /var/lib/ceph/bootstrap-rbd/{{ cluster }}.keyring - /var/lib/ceph/bootstrap-rbd/{{ cluster }}.keyring
- /var/lib/ceph/bootstrap-rbd-mirror/{{ cluster }}.keyring - /var/lib/ceph/bootstrap-rbd-mirror/{{ cluster }}.keyring
- /etc/ceph/{{ cluster }}.client.admin.keyring - /etc/ceph/{{ cluster }}.client.admin.keyring
when: when:
- cephx - inventory_hostname == groups[mon_group_name] | last
- inventory_hostname == groups[mon_group_name] | last