diff --git a/infrastructure-playbooks/add-osd.yml b/infrastructure-playbooks/add-osd.yml index 9acf83e8f..fa5a2f460 100644 --- a/infrastructure-playbooks/add-osd.yml +++ b/infrastructure-playbooks/add-osd.yml @@ -24,8 +24,7 @@ vars: delegate_facts_host: True - tasks: - # pre-tasks for following import + pre_tasks: - name: gather facts setup: when: @@ -42,6 +41,7 @@ when: - delegate_facts_host | bool + tasks: - import_role: name: ceph-defaults @@ -52,8 +52,7 @@ gather_facts: False become: True - tasks: - # pre-tasks for following import + pre_tasks: # this task is needed so we can skip the openstack_config.yml include in roles/ceph-osd - name: set_fact add_osd set_fact: @@ -65,6 +64,7 @@ run_once: True changed_when: False + tasks: - import_role: name: ceph-defaults @@ -88,7 +88,7 @@ - import_role: name: ceph-osd - # post-tasks for preceding import + post_tasks: - name: unset noup flag command: "{{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd unset noup" delegate_to: "{{ groups['mons'][0] }}" diff --git a/infrastructure-playbooks/shrink-osd-ceph-disk.yml b/infrastructure-playbooks/shrink-osd-ceph-disk.yml index e3985932f..b6adcaa6c 100644 --- a/infrastructure-playbooks/shrink-osd-ceph-disk.yml +++ b/infrastructure-playbooks/shrink-osd-ceph-disk.yml @@ -34,8 +34,7 @@ vars: mon_group_name: mons osd_group_name: osds - tasks: - # pre-task for following import + pre_tasks: - name: exit playbook, if user did not mean to shrink cluster fail: msg: "Exiting shrink-osd playbook, no osd(s) was/were removed.. @@ -52,10 +51,11 @@ -e osd_to_kill=0,1,2,3 argument." when: osd_to_kill is not defined + tasks: - import_role: name: ceph-defaults - # post-task for preceding import + post_tasks: - name: "set_fact docker_exec_cmd build {{ container_binary }} exec command (containerized)" set_fact: docker_exec_cmd: "{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }}" diff --git a/infrastructure-playbooks/shrink-osd.yml b/infrastructure-playbooks/shrink-osd.yml index 59466efbe..40b0c0d66 100644 --- a/infrastructure-playbooks/shrink-osd.yml +++ b/infrastructure-playbooks/shrink-osd.yml @@ -38,8 +38,7 @@ mon_group_name: mons osd_group_name: osds - tasks: - # pre-task for following import + pre_tasks: - name: exit playbook, if user did not mean to shrink cluster fail: msg: "Exiting shrink-osd playbook, no osd(s) was/were removed.. @@ -56,10 +55,11 @@ -e osd_to_kill=0,1,2,3 argument." when: osd_to_kill is not defined + tasks: - import_role: name: ceph-defaults - # post-task for preceding import + post_tasks: - name: set_fact docker_exec_cmd build docker exec command (containerized) set_fact: docker_exec_cmd: "{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }}" diff --git a/infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml b/infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml index d701dda76..e702d8c35 100644 --- a/infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml +++ b/infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml @@ -56,8 +56,7 @@ - "{{ mon_group_name|default('mons') }}" serial: 1 become: true - tasks: - # pre-tasks for following import - + pre_tasks: - name: select a running monitor set_fact: mon_host={{ item }} with_items: "{{ groups[mon_group_name] }}" @@ -112,6 +111,7 @@ changed_when: false failed_when: false + tasks: - import_role: name: ceph-defaults - import_role: @@ -121,7 +121,6 @@ - import_role: name: ceph-mon - # post-tasks for preceding import - post_tasks: # We don't do a container test by running 'docker exec ...' since not all the monitors have switched to containers yet. # Thus, we continue to use the 'ceph' binary from the host, there is no issue with that. @@ -145,8 +144,7 @@ serial: 1 become: true - tasks: - # pre-tasks for following import - + pre_tasks: # failed_when: false is here because if we're # working with a jewel cluster then ceph mgr # will not exist @@ -174,6 +172,7 @@ - /var/lib/ceph - /etc/ceph + tasks: - import_role: name: ceph-defaults @@ -200,12 +199,11 @@ serial: 1 become: true - tasks: + pre_tasks: - import_role: name: ceph-defaults - # pre-tasks for following importing - name: collect running osds and ceph-disk unit(s) shell: | systemctl list-units | grep "loaded active" | grep -Eo 'ceph-osd@[0-9]+.service|ceph-disk@dev-[a-z]{3,4}[0-9]{1}.service|ceph-volume|ceph\.target' @@ -290,6 +288,7 @@ when: - osd_running.rc != 0 + tasks: - import_role: name: ceph-defaults @@ -302,7 +301,7 @@ - import_role: name: ceph-osd - # post-task for preceding import - + post_tasks: - name: get num_pgs command: > {{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }} ceph --cluster {{ cluster }} -s --format json @@ -335,9 +334,8 @@ serial: 1 become: true - tasks: + pre_tasks: - # pre-tasks for following inmport - name: stop non-containerized ceph mds(s) service: name: "ceph-mds@{{ ansible_hostname }}" @@ -361,6 +359,7 @@ - /var/lib/ceph - /etc/ceph + tasks: - import_role: name: ceph-defaults @@ -385,9 +384,8 @@ serial: 1 become: true - tasks: + pre_tasks: - # pre-tasks for following import - - name: stop non-containerized ceph rgw(s) service: name: "ceph-radosgw@rgw.{{ ansible_hostname }}" @@ -411,6 +409,7 @@ - /var/lib/ceph - /etc/ceph + tasks: - import_role: name: ceph-defaults @@ -435,8 +434,7 @@ serial: 1 become: true - tasks: - # pre-tasks for following import - + pre_tasks: - name: stop non-containerized ceph rbd mirror(s) service: name: "ceph-rbd-mirror@rbd-mirror.{{ ansible_hostname }}" @@ -460,6 +458,7 @@ - /var/lib/ceph - /etc/ceph + tasks: - import_role: name: ceph-defaults @@ -484,9 +483,8 @@ serial: 1 become: true - tasks: + pre_tasks: - # pre-tasks for following import - # failed_when: false is here because if we're # working with a jewel cluster then ceph nfs # will not exist @@ -514,6 +512,7 @@ - /var/lib/ceph - /etc/ceph + tasks: - import_role: name: ceph-defaults diff --git a/infrastructure-playbooks/take-over-existing-cluster.yml b/infrastructure-playbooks/take-over-existing-cluster.yml index 7f70112a7..4ef8b4f0c 100644 --- a/infrastructure-playbooks/take-over-existing-cluster.yml +++ b/infrastructure-playbooks/take-over-existing-cluster.yml @@ -35,7 +35,7 @@ - import_role: name: ceph-defaults - # post-tasks for preceding import - + post_tasks: - name: get the name of the existing ceph cluster shell: | basename $(grep --exclude '*.bak' -R fsid /etc/ceph/ | egrep -o '^[^.]*' | head -n 1) diff --git a/infrastructure-playbooks/untested-by-ci/replace-osd.yml b/infrastructure-playbooks/untested-by-ci/replace-osd.yml index 8fce11d70..fc364097d 100644 --- a/infrastructure-playbooks/untested-by-ci/replace-osd.yml +++ b/infrastructure-playbooks/untested-by-ci/replace-osd.yml @@ -37,8 +37,7 @@ vars: mon_group_name: mons osd_group_name: osds - tasks: - # pre-tasks for following import - + pre_tasks: - name: exit playbook, if user did not mean to replace the osd(s) fail: msg: "Exiting replace-osd playbook, no osd(s) was/were replaced.. @@ -55,10 +54,11 @@ -e osd_to_replace=0,1,2,3 argument." when: osd_to_replace is not defined + tasks: - import_role: name: ceph-defaults - # post-tasks for preceding import - + post_tasks: - name: set_fact docker_exec_cmd build docker exec command (containerized) set_fact: docker_exec_cmd: "docker exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }}" diff --git a/site.yml.sample b/site.yml.sample index 677e55160..b963f2df2 100644 --- a/site.yml.sample +++ b/site.yml.sample @@ -24,8 +24,7 @@ vars: delegate_facts_host: True - tasks: - # pre-tasks for following imports - + pre_tasks: # If we can't get python2 installed before any module is used we will fail # so just try what we can to get it installed - name: check for python2 @@ -72,6 +71,7 @@ - ansible_distribution == 'Fedora' - ansible_distribution_major_version|int >= 23 + tasks: - import_role: name: ceph-defaults - import_role: @@ -83,8 +83,7 @@ gather_facts: false become: True any_errors_fatal: true - tasks: - # pre-tasks for following imports - + pre_tasks: - name: set ceph monitor install 'In Progress' run_once: true set_stats: @@ -93,6 +92,7 @@ status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" + tasks: - import_role: name: ceph-defaults tags: ['ceph_update_config'] @@ -108,7 +108,7 @@ - import_role: name: ceph-mgr - # post-tasks for preceding imports - + post_tasks: - name: set ceph monitor install 'Complete' run_once: true set_stats: @@ -121,8 +121,7 @@ gather_facts: false become: True any_errors_fatal: true - tasks: - # pre-tasks for following imports - + pre_tasks: - name: set ceph manager install 'In Progress' run_once: true set_stats: @@ -131,6 +130,7 @@ status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" + tasks: - import_role: name: ceph-defaults tags: ['ceph_update_config'] @@ -144,7 +144,7 @@ - import_role: name: ceph-mgr - # post-tasks for following imports - + post_tasks: - name: set ceph manager install 'Complete' run_once: true set_stats: @@ -157,8 +157,7 @@ gather_facts: false become: True any_errors_fatal: true - tasks: - # pre-tasks for following imports - + pre_tasks: - name: set ceph agent install 'In Progress' run_once: true set_stats: @@ -167,6 +166,7 @@ status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" + tasks: - import_role: name: ceph-defaults tags: ['ceph_update_config'] @@ -180,7 +180,7 @@ - import_role: name: ceph-agent - # post-tasks for following imports - + post_tasks: - name: set ceph agent install 'Complete' run_once: true set_stats: @@ -193,8 +193,7 @@ gather_facts: false become: True any_errors_fatal: true - tasks: - # pre-tasks for following imports - + pre_tasks: - name: set ceph osd install 'In Progress' run_once: true set_stats: @@ -203,6 +202,7 @@ status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" + tasks: - import_role: name: ceph-defaults tags: ['ceph_update_config'] @@ -216,7 +216,7 @@ - import_role: name: ceph-osd - # post-tasks for following imports - + post_tasks: - name: set ceph osd install 'Complete' run_once: true set_stats: @@ -229,8 +229,7 @@ gather_facts: false become: True any_errors_fatal: true - tasks: - # pre-tasks for following imports - + pre_tasks: - name: set ceph mds install 'In Progress' run_once: true set_stats: @@ -239,6 +238,7 @@ status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" + tasks: - import_role: name: ceph-defaults tags: ['ceph_update_config'] @@ -252,7 +252,7 @@ - import_role: name: ceph-mds - # post-tasks for following imports - + post_tasks: - name: set ceph mds install 'Complete' run_once: true set_stats: @@ -265,8 +265,7 @@ gather_facts: false become: True any_errors_fatal: true - tasks: - # pre-tasks for following imports - + pre_tasks: - name: set ceph rgw install 'In Progress' run_once: true set_stats: @@ -275,6 +274,7 @@ status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" + tasks: - import_role: name: ceph-defaults tags: ['ceph_update_config'] @@ -288,7 +288,7 @@ - import_role: name: ceph-rgw - # post-tasks for following imports - + post_tasks: - name: set ceph rgw install 'Complete' run_once: true set_stats: @@ -301,8 +301,7 @@ gather_facts: false become: True any_errors_fatal: true - tasks: - # pre-tasks for following imports - + pre_tasks: - name: set ceph nfs install 'In Progress' run_once: true set_stats: @@ -311,6 +310,7 @@ status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" + tasks: - import_role: name: ceph-defaults tags: ['ceph_update_config'] @@ -324,7 +324,7 @@ - import_role: name: ceph-nfs - # post-tasks for following imports - + post_tasks: - name: set ceph nfs install 'Complete' run_once: true set_stats: @@ -337,8 +337,7 @@ gather_facts: false become: True any_errors_fatal: true - tasks: - # pre-tasks for following imports - + pre_tasks: - name: set ceph rbd mirror install 'In Progress' run_once: true set_stats: @@ -347,6 +346,7 @@ status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" + tasks: - import_role: name: ceph-defaults tags: ['ceph_update_config'] @@ -360,7 +360,7 @@ - import_role: name: ceph-rbd-mirror - # post-tasks for following imports - + post_tasks: - name: set ceph rbd mirror install 'Complete' run_once: true set_stats: @@ -373,8 +373,7 @@ gather_facts: false become: True any_errors_fatal: true - tasks: - # pre-tasks for following imports - + pre_tasks: - name: set ceph client install 'In Progress' run_once: true set_stats: @@ -383,6 +382,7 @@ status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" + tasks: - import_role: name: ceph-defaults tags: ['ceph_update_config'] @@ -396,7 +396,7 @@ - import_role: name: ceph-client - # post-tasks for following imports - + post_tasks: - name: set ceph client install 'Complete' run_once: true set_stats: @@ -411,8 +411,7 @@ gather_facts: false become: True any_errors_fatal: true - tasks: - # pre-tasks for following imports - + pre_tasks: - name: set ceph iscsi gateway install 'In Progress' run_once: true set_stats: @@ -421,6 +420,7 @@ status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" + tasks: - import_role: name: ceph-defaults tags: ['ceph_update_config'] @@ -436,7 +436,7 @@ - import_role: name: ceph-iscsi-gw - # post-tasks for following imports - + post_tasks: - name: set ceph iscsi gw install 'Complete' run_once: true set_stats: