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:
with_pkg
- name: red hat 7 based systems tasks
- name: red hat based systems tasks
when:
- ansible_os_family == 'RedHat'
- ansible_distribution_major_version == '7'
block:
- 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: pause after docker install before starting (on openstack vms)
pause: seconds=5
- name: red hat 7 based systems tasks
when:
- ceph_docker_on_openstack
tags:
with_pkg
- ansible_distribution_major_version == '7'
block:
- 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
service:
name: docker
state: started
enabled: yes
tags:
with_pkg
- name: pause after docker install before starting (on openstack vms)
pause: seconds=5
when:
- ceph_docker_on_openstack
tags:
with_pkg
- name: red hat 8 based systems tasks
when:
- ansible_os_family == 'RedHat'
- ansible_distribution_major_version == '8'
block:
- name: install podman
package:
name: 'podman'
state: present
register: result
until: result is succeeded
tags:
with_pkg
- name: start docker service
service:
name: docker
state: started
enabled: yes
tags:
with_pkg
- name: red hat 8 based systems tasks
when:
- ansible_distribution_major_version == '8'
block:
- name: install podman
package:
name: 'podman'
state: present
register: result
until: result is succeeded
tags:
with_pkg
- name: ensure tmpfiles.d is present
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, []) }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
- name: copy keys to the ansible server
fetch:
src: "{{ item }}"
dest: "{{ fetch_directory }}/{{ fsid }}/{{ item }}"
flat: yes
with_items:
- /var/lib/ceph/bootstrap-osd/{{ cluster }}.keyring
- /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring
- /var/lib/ceph/bootstrap-mds/{{ cluster }}.keyring
- /var/lib/ceph/bootstrap-rbd/{{ cluster }}.keyring
- /var/lib/ceph/bootstrap-rbd-mirror/{{ cluster }}.keyring
- /etc/ceph/{{ cluster }}.client.admin.keyring
when:
- cephx
- inventory_hostname == groups[mon_group_name] | last
- name: copy keys to the ansible server
fetch:
src: "{{ item }}"
dest: "{{ fetch_directory }}/{{ fsid }}/{{ item }}"
flat: yes
with_items:
- /var/lib/ceph/bootstrap-osd/{{ cluster }}.keyring
- /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring
- /var/lib/ceph/bootstrap-mds/{{ cluster }}.keyring
- /var/lib/ceph/bootstrap-rbd/{{ cluster }}.keyring
- /var/lib/ceph/bootstrap-rbd-mirror/{{ cluster }}.keyring
- /etc/ceph/{{ cluster }}.client.admin.keyring
when:
- inventory_hostname == groups[mon_group_name] | last