diff --git a/infrastructure-playbooks/add-osd.yml b/infrastructure-playbooks/add-osd.yml index edf15ebc5..bbb7bfc46 100644 --- a/infrastructure-playbooks/add-osd.yml +++ b/infrastructure-playbooks/add-osd.yml @@ -24,7 +24,8 @@ vars: delegate_facts_host: True - pre_tasks: + tasks: + # pre-tasks for following import - name: gather facts setup: when: @@ -41,15 +42,20 @@ when: - delegate_facts_host | bool - roles: - - ceph-defaults - - ceph-validate + - import_role: + name: ceph-defaults + private: false + + - import_role: + name: ceph-validate + private: false - hosts: osds gather_facts: False become: True - pre_tasks: + tasks: + # pre-tasks for following import # this task is needed so we can skip the openstack_config.yml include in roles/ceph-osd - name: set_fact add_osd set_fact: @@ -61,20 +67,39 @@ run_once: True changed_when: False - roles: - - role: ceph-defaults - - role: ceph-handler - - role: ceph-infra - - role: ceph-docker-common - when: containerized_deployment | bool - - role: ceph-common - when: not containerized_deployment | bool - - role: ceph-config - - role: ceph-osd + - import_role: + name: ceph-defaults + private: false - post_tasks: + - import_role: + name: ceph-handler + private: false + + - import_role: + name: ceph-infra + private: false + + - import_role: + name: ceph-docker-common + private: false + when: containerized_deployment | bool + + - import_role: + name: ceph-common + private: false + when: not containerized_deployment | bool + + - import_role: + name: ceph-config + private: false + + - import_role: + name: ceph-osd + private: false + + # post-tasks for preceding import - name: unset noup flag command: "{{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd unset noup" delegate_to: "{{ groups['mons'][0] }}" run_once: True - changed_when: False \ No newline at end of file + changed_when: False diff --git a/infrastructure-playbooks/rgw-standalone.yml b/infrastructure-playbooks/rgw-standalone.yml index 409d3282a..bc9868dc7 100644 --- a/infrastructure-playbooks/rgw-standalone.yml +++ b/infrastructure-playbooks/rgw-standalone.yml @@ -5,12 +5,20 @@ # and collect keys from a mon to bootstrap the rgw nodes - hosts: mons become: True - roles: - - ceph-defaults - - ceph-fetch-keys + tasks: + - import_role: + name: ceph-defaults + private: false + - import_role: + name: ceph-fetch-keys + private: false - hosts: rgws become: True - roles: - - ceph-defaults - - ceph-rgw + tasks: + - import_role: + name: ceph-defaults + private: false + - import_role: + name: ceph-rgw + private: false diff --git a/infrastructure-playbooks/rolling_update.yml b/infrastructure-playbooks/rolling_update.yml index e06dd40d3..5555a5c3e 100644 --- a/infrastructure-playbooks/rolling_update.yml +++ b/infrastructure-playbooks/rolling_update.yml @@ -79,19 +79,15 @@ - set_fact: rolling_update=true - name: upgrade ceph mon cluster - vars: health_mon_check_retries: 5 health_mon_check_delay: 15 upgrade_ceph_packages: True - hosts: - "{{ mon_group_name|default('mons') }}" - serial: 1 become: True - - pre_tasks: + tasks: - name: set mon_host_count set_fact: mon_host_count={{ groups[mon_group_name] | length }} @@ -123,15 +119,27 @@ when: - not containerized_deployment - roles: - - ceph-defaults - - ceph-handler - - { role: ceph-common, when: not containerized_deployment } - - { role: ceph-docker-common, when: containerized_deployment } - - ceph-config - - ceph-mon + - import_role: + name: ceph-defaults + private: false + - import_role: + name: ceph-handler + private: false + - import_role: + name: ceph-common + private: false + when: not containerized_deployment + - import_role: + name: ceph-docker-common + private: false + when: containerized_deployment + - import_role: + name: ceph-config + private: false + - import_role: + name: ceph-mon + private: false - post_tasks: - name: start ceph mon systemd: name: ceph-mon@{{ monitor_name }} @@ -208,18 +216,14 @@ - name: upgrade ceph mgr node - vars: upgrade_ceph_packages: True ceph_release: "{{ ceph_stable_release }}" - hosts: - "{{ mgr_group_name|default('mgrs') }}" - serial: 1 become: True - - pre_tasks: + tasks: - name: non container - get current fsid command: "ceph --cluster {{ cluster }} fsid" register: cluster_uuid_non_container @@ -294,15 +298,27 @@ when: - not containerized_deployment - roles: - - ceph-defaults - - ceph-handler - - { role: ceph-common, when: not containerized_deployment } - - { role: ceph-docker-common, when: containerized_deployment } - - ceph-config - - ceph-mgr + - import_role: + name: ceph-defaults + private: false + - import_role: + name: ceph-handler + private: false + - import_role: + name: ceph-common + private: false + when: not containerized_deployment + - import_role: + name: ceph-docker-common + private: false + when: containerized_deployment + - import_role: + name: ceph-config + private: false + - import_role: + name: ceph-mgr + private: false - post_tasks: - name: start ceph mgr systemd: name: ceph-mgr@{{ ansible_hostname }} @@ -322,7 +338,6 @@ - name: upgrade ceph osds cluster - vars: health_osd_check_retries: 40 health_osd_check_delay: 30 @@ -330,11 +345,9 @@ hosts: - "{{ osd_group_name|default('osds') }}" - serial: 1 become: True - - pre_tasks: + tasks: - name: get osd numbers - non container shell: "if [ -d /var/lib/ceph/osd ] ; then ls /var/lib/ceph/osd | sed 's/.*-//' ; fi" register: osd_ids @@ -356,15 +369,27 @@ when: - not containerized_deployment - roles: - - ceph-defaults - - ceph-handler - - { role: ceph-common, when: not containerized_deployment } - - { role: ceph-docker-common, when: containerized_deployment } - - ceph-config - - ceph-osd + - import_role: + name: ceph-defaults + private: false + - import_role: + name: ceph-handler + private: false + - import_role: + name: ceph-common + private: false + when: not containerized_deployment + - import_role: + name: ceph-docker-common + private: false + when: containerized_deployment + - import_role: + name: ceph-config + private: false + - import_role: + name: ceph-osd + private: false - post_tasks: - name: get osd numbers shell: "if [ -d /var/lib/ceph/osd ] ; then ls /var/lib/ceph/osd | sed 's/.*-//' ; fi" register: osd_ids @@ -441,10 +466,11 @@ become: True - roles: - - ceph-defaults - tasks: + - import_role: + name: ceph-defaults + private: false + - name: set_fact docker_exec_cmd_osd set_fact: docker_exec_cmd_update_osd: "docker exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }}" @@ -478,17 +504,13 @@ - ceph_versions_osd | string is search("ceph version 12") - name: upgrade ceph mdss cluster - vars: upgrade_ceph_packages: True - hosts: - "{{ mds_group_name|default('mdss') }}" - serial: 1 become: True - - pre_tasks: + tasks: - name: stop ceph mds systemd: name: ceph-mds@{{ ansible_hostname }} @@ -497,15 +519,27 @@ when: - not containerized_deployment - roles: - - ceph-defaults - - ceph-handler - - { role: ceph-common, when: not containerized_deployment } - - { role: ceph-docker-common, when: containerized_deployment } - - ceph-config - - ceph-mds + - import_role: + name: ceph-defaults + private: false + - import_role: + name: ceph-handler + private: false + - import_role: + name: ceph-common + private: false + when: not containerized_deployment + - import_role: + name: ceph-docker-common + private: false + when: containerized_deployment + - import_role: + name: ceph-config + private: false + - import_role: + name: ceph-mds + private: false - post_tasks: - name: start ceph mds systemd: name: ceph-mds@{{ ansible_hostname }} @@ -525,17 +559,13 @@ - name: upgrade ceph rgws cluster - vars: upgrade_ceph_packages: True - hosts: - "{{ rgw_group_name|default('rgws') }}" - serial: 1 become: True - - pre_tasks: + tasks: - name: stop ceph rgw systemd: name: ceph-radosgw@rgw.{{ ansible_hostname }} @@ -544,15 +574,27 @@ when: - not containerized_deployment - roles: - - ceph-defaults - - ceph-handler - - { role: ceph-common, when: not containerized_deployment } - - { role: ceph-docker-common, when: containerized_deployment } - - ceph-config - - ceph-rgw + - import_role: + name: ceph-defaults + private: false + - import_role: + name: ceph-handler + private: false + - import_role: + name: ceph-common + private: false + when: not containerized_deployment + - import_role: + name: ceph-docker-common + private: false + when: containerized_deployment + - import_role: + name: ceph-config + private: false + - import_role: + name: ceph-rgw + private: false - post_tasks: - name: start ceph rgw systemd: name: ceph-radosgw@rgw.{{ ansible_hostname }} @@ -572,17 +614,13 @@ - name: upgrade ceph rbd mirror node - vars: upgrade_ceph_packages: True - hosts: - "{{ rbd_mirror_group_name|default('rbdmirrors') }}" - serial: 1 become: True - - pre_tasks: + tasks: # NOTE(leseb): these tasks have a 'failed_when: false' # in case we run before luminous or after - name: stop ceph rbd mirror before luminous @@ -599,15 +637,27 @@ enabled: yes failed_when: false - roles: - - ceph-defaults - - ceph-handler - - { role: ceph-common, when: not containerized_deployment } - - { role: ceph-docker-common, when: containerized_deployment } - - ceph-config - - ceph-rbd-mirror + - import_role: + name: ceph-defaults + private: false + - import_role: + name: ceph-handler + private: false + - import_role: + name: ceph-common + private: false + when: not containerized_deployment + - import_role: + name: ceph-docker-common + private: false + when: containerized_deployment + - import_role: + name: ceph-config + private: false + - import_role: + name: ceph-rbd-mirror + private: false - post_tasks: - name: start ceph rbd mirror systemd: name: "ceph-rbd-mirror@rbd-mirror.{{ ansible_hostname }}" @@ -627,17 +677,13 @@ - name: upgrade ceph nfs node - vars: upgrade_ceph_packages: True - hosts: - "{{ nfs_group_name|default('nfss') }}" - serial: 1 become: True - - pre_tasks: + tasks: # failed_when: false is here so that if we upgrade # from a version of ceph that does not have nfs-ganesha # then this task will not fail @@ -650,15 +696,27 @@ when: - not containerized_deployment - roles: - - ceph-defaults - - ceph-handler - - { role: ceph-common, when: not containerized_deployment } - - { role: ceph-docker-common, when: containerized_deployment } - - ceph-config - - ceph-nfs + - import_role: + name: ceph-defaults + private: false + - import_role: + name: ceph-handler + private: false + - import_role: + name: ceph-common + private: false + when: not containerized_deployment + - import_role: + name: ceph-docker-common + private: false + when: containerized_deployment + - import_role: + name: ceph-config + private: false + - import_role: + name: ceph-nfs + private: false - post_tasks: - name: start nfs gateway systemd: name: nfs-ganesha @@ -680,18 +738,14 @@ - name: upgrade ceph iscsi gateway node - vars: upgrade_ceph_packages: True - hosts: - "{{ iscsi_gw_group_name|default('iscsigws') }}" - iscsi-gws # for backward compatibility only! - serial: 1 become: True - - pre_tasks: + tasks: # failed_when: false is here so that if we upgrade # from a version of ceph that does not have iscsi gws # then this task will not fail @@ -704,15 +758,27 @@ when: - not containerized_deployment - roles: - - ceph-defaults - - ceph-handler - - { role: ceph-common, when: not containerized_deployment } - - { role: ceph-docker-common, when: containerized_deployment } - - ceph-config - - ceph-iscsi-gw + - import_role: + name: ceph-defaults + private: false + - import_role: + name: ceph-handler + private: false + - import_role: + name: ceph-common + private: false + when: not containerized_deployment + - import_role: + name: ceph-docker-common + private: false + when: containerized_deployment + - import_role: + name: ceph-config + private: false + - import_role: + name: ceph-iscsi-gw + private: false - post_tasks: - name: start rbd-target-gw systemd: name: rbd-target-gw @@ -723,36 +789,43 @@ - name: upgrade ceph client node - vars: upgrade_ceph_packages: True - hosts: - "{{ client_group_name|default('clients') }}" - serial: 1 become: True - - roles: - - ceph-defaults - - ceph-handler - - { role: ceph-common, when: not containerized_deployment } - - { role: ceph-docker-common, when: containerized_deployment } - - ceph-config - - ceph-client + tasks: + - import_role: + name: ceph-defaults + private: false + - import_role: + name: ceph-handler + private: false + - import_role: + name: ceph-common + private: false + when: not containerized_deployment + - import_role: + name: ceph-docker-common + private: false + when: containerized_deployment + - import_role: + name: ceph-config + private: false + - import_role: + name: ceph-client + private: false - name: show ceph status - hosts: - "{{ mon_group_name|default('mons') }}" - become: True - - roles: - - ceph-defaults - tasks: + - import_role: + name: ceph-defaults + private: false - name: set_fact docker_exec_cmd_status set_fact: docker_exec_cmd_status: "docker exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }}" diff --git a/infrastructure-playbooks/shrink-mon.yml b/infrastructure-playbooks/shrink-mon.yml index 8ead8da76..e513ab975 100644 --- a/infrastructure-playbooks/shrink-mon.yml +++ b/infrastructure-playbooks/shrink-mon.yml @@ -23,22 +23,19 @@ - debug: msg="gather facts on all Ceph hosts for following reference" - name: confirm whether user really meant to remove monitor from the ceph cluster - hosts: - localhost - become: true - vars_prompt: - name: ireallymeanit prompt: Are you sure you want to shrink the cluster? default: 'no' private: no - vars: mon_group_name: mons - pre_tasks: + tasks: + # pre task for following import - name: exit playbook, if only one monitor is present in cluster fail: msg: "You are about to shrink the only monitor present in the cluster. @@ -70,10 +67,11 @@ when: - ireallymeanit != 'yes' - roles: - - ceph-defaults + - import_role: + name: ceph-defaults + private: false - post_tasks: + # post_tasks for preceding import - name: pick a monitor different than the one we want to remove set_fact: mon_host: "{{ item }}" diff --git a/infrastructure-playbooks/shrink-osd.yml b/infrastructure-playbooks/shrink-osd.yml index 50e97a422..641180cdb 100644 --- a/infrastructure-playbooks/shrink-osd.yml +++ b/infrastructure-playbooks/shrink-osd.yml @@ -22,23 +22,19 @@ - debug: msg="gather facts on all Ceph hosts for following reference" - name: confirm whether user really meant to remove osd(s) from the cluster - hosts: - localhost - become: true - vars_prompt: - name: ireallymeanit prompt: Are you sure you want to shrink the cluster? default: 'no' private: no - vars: mon_group_name: mons osd_group_name: osds - - pre_tasks: + tasks: + # pre-task for following import - name: exit playbook, if user did not mean to shrink cluster fail: msg: "Exiting shrink-osd playbook, no osd(s) was/were removed.. @@ -55,11 +51,11 @@ -e osd_to_kill=0,1,2,3 argument." when: osd_to_kill is not defined - roles: - - ceph-defaults - - post_tasks: + - import_role: + name: ceph-defaults + private: false + # post-task for preceding import - 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/infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml b/infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml index 2c87394b5..02c2fbd23 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 @@ -47,20 +47,17 @@ with_items: "{{ groups['all'] }}" - name: switching from non-containerized to containerized ceph mon - vars: health_mon_check_retries: 5 health_mon_check_delay: 15 containerized_deployment: true mon_group_name: mons - hosts: - "{{ mon_group_name|default('mons') }}" - serial: 1 become: true - - pre_tasks: + tasks: + # pre-tasks for following import - - name: select a running monitor set_fact: mon_host={{ item }} with_items: "{{ groups[mon_group_name] }}" @@ -115,13 +112,20 @@ changed_when: false failed_when: false - roles: - - ceph-defaults - - ceph-handler - - ceph-docker-common - - ceph-mon + - import_role: + name: ceph-defaults + private: false + - import_role: + name: ceph-handler + private: false + - import_role: + name: ceph-docker-common + private: false + - import_role: + name: ceph-mon + private: false - post_tasks: + # post-tasks for preceding import - # 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. - name: non container | waiting for the monitor to join the quorum... @@ -144,8 +148,8 @@ serial: 1 become: true - - pre_tasks: + tasks: + # pre-tasks for following import - # failed_when: false is here because if we're # working with a jewel cluster then ceph mgr # will not exist @@ -173,11 +177,21 @@ - /var/lib/ceph - /etc/ceph - roles: - - ceph-defaults - - ceph-handler - - ceph-docker-common - - ceph-mgr + - import_role: + name: ceph-defaults + private: false + + - import_role: + name: ceph-handler + private: false + + - import_role: + name: ceph-docker-common + private: false + + - import_role: + name: ceph-mgr + private: false - name: switching from non-containerized to containerized ceph osd @@ -193,9 +207,9 @@ serial: 1 become: true + tasks: - - pre_tasks: + # 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' @@ -288,13 +302,23 @@ when: - item.1.get("rc", 0) != 0 - roles: - - ceph-defaults - - ceph-handler - - ceph-docker-common - - ceph-osd + - import_role: + name: ceph-defaults + private: false - post_tasks: + - import_role: + name: ceph-handler + private: false + + - import_role: + name: ceph-docker-common + private: false + + - import_role: + name: ceph-osd + private: false + + # post-task for preceding import - - name: get num_pgs command: docker exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }} ceph --cluster "{{ cluster }}" -s --format json register: ceph_pgs @@ -325,8 +349,9 @@ 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 }}" @@ -350,11 +375,21 @@ - /var/lib/ceph - /etc/ceph - roles: - - ceph-defaults - - ceph-handler - - ceph-docker-common - - ceph-mds + - import_role: + name: ceph-defaults + private: false + + - import_role: + name: ceph-handler + private: false + + - import_role: + name: ceph-docker-common + private: false + + - import_role: + name: ceph-mds + private: false - name: switching from non-containerized to containerized ceph rgw @@ -368,8 +403,9 @@ 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 }}" @@ -393,11 +429,21 @@ - /var/lib/ceph - /etc/ceph - roles: - - ceph-defaults - - ceph-handler - - ceph-docker-common - - ceph-rgw + - import_role: + name: ceph-defaults + private: false + + - import_role: + name: ceph-handler + private: false + + - import_role: + name: ceph-docker-common + private: false + + - import_role: + name: ceph-rgw + private: false - name: switching from non-containerized to containerized ceph rbd-mirror @@ -411,8 +457,8 @@ serial: 1 become: true - - pre_tasks: + tasks: + # pre-tasks for following import - - name: stop non-containerized ceph rbd mirror(s) service: name: "ceph-rbd-mirror@rbd-mirror.{{ ansible_hostname }}" @@ -436,11 +482,21 @@ - /var/lib/ceph - /etc/ceph - roles: - - ceph-defaults - - ceph-handler - - ceph-docker-common - - ceph-rbd-mirror + - import_role: + name: ceph-defaults + private: false + + - import_role: + name: ceph-handler + private: false + + - import_role: + name: ceph-docker-common + private: false + + - import_role: + name: ceph-rbd-mirror + private: false - name: switching from non-containerized to containerized ceph nfs @@ -454,8 +510,9 @@ 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 @@ -483,8 +540,18 @@ - /var/lib/ceph - /etc/ceph - roles: - - ceph-defaults - - ceph-handler - - ceph-docker-common - - ceph-nfs + - import_role: + name: ceph-defaults + private: false + + - import_role: + name: ceph-handler + private: false + + - import_role: + name: ceph-docker-common + private: false + + - import_role: + name: ceph-nfs + private: false diff --git a/infrastructure-playbooks/take-over-existing-cluster.yml b/infrastructure-playbooks/take-over-existing-cluster.yml index 7417047d9..7a68ee5c3 100644 --- a/infrastructure-playbooks/take-over-existing-cluster.yml +++ b/infrastructure-playbooks/take-over-existing-cluster.yml @@ -13,9 +13,13 @@ - hosts: mons become: True - roles: - - ceph-defaults - - ceph-fetch-keys + tasks: + - import_role: + name: ceph-defaults + private: false + - import_role: + name: ceph-fetch-keys + private: false - hosts: - mons @@ -29,14 +33,15 @@ - mgrs - iscsi-gw become: true + tasks: + - import_role: + name: ceph-defaults + private: false - roles: - - ceph-defaults - - post_tasks: + # post-tasks for preceding import - - name: get the name of the existing ceph cluster shell: | - basename $(grep --exclude '*.bak' -R fsid /etc/ceph/ | egrep -o '^[^.]*' | head -n 1) + basename $(grep --exclude '*.bak' -R fsid /etc/ceph/ | egrep -o '^[^.]*' | head -n 1) changed_when: false register: cluster_name @@ -45,7 +50,7 @@ path: "/etc/ceph/{{ cluster_name.stdout }}.conf" register: ceph_conf_stat - # Creates a backup of original ceph conf file in 'cluster_name-YYYYMMDDTHHMMSS.conf.bak' format + # Creates a backup of original ceph conf file in 'cluster_name-YYYYMMDDTHHMMSS.conf.bak' format - name: "make a backup of original {{ cluster_name.stdout }}.conf" copy: src: "/etc/ceph/{{ cluster_name.stdout }}.conf" @@ -65,4 +70,3 @@ mode: "{{ ceph_conf_stat.stat.mode }}" config_overrides: "{{ ceph_conf_overrides }}" config_type: ini - diff --git a/infrastructure-playbooks/untested-by-ci/replace-osd.yml b/infrastructure-playbooks/untested-by-ci/replace-osd.yml index 0666882cb..5761de83e 100644 --- a/infrastructure-playbooks/untested-by-ci/replace-osd.yml +++ b/infrastructure-playbooks/untested-by-ci/replace-osd.yml @@ -26,23 +26,19 @@ - debug: msg="gather facts on all Ceph hosts for following reference" - name: confirm whether user really meant to replace osd(s) - hosts: - localhost - become: true - vars_prompt: - name: ireallymeanit prompt: Are you sure you want to replace the osd(s)? default: 'no' private: no - vars: mon_group_name: mons osd_group_name: osds - - pre_tasks: + tasks: + # pre-tasks for following import - - 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.. @@ -59,11 +55,11 @@ -e osd_to_replace=0,1,2,3 argument." when: osd_to_replace is not defined - roles: - - ceph-defaults - - post_tasks: + - import_role: + name: ceph-defaults + private: false + # post-tasks for preceding import - - 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-docker.yml.sample b/site-docker.yml.sample index 34c626582..7d46c670c 100644 --- a/site-docker.yml.sample +++ b/site-docker.yml.sample @@ -21,7 +21,8 @@ vars: delegate_facts_host: True - pre_tasks: + tasks: + # pre-tasks for following import - - name: gather facts setup: when: @@ -49,19 +50,29 @@ tags: - always - roles: - - role: ceph-defaults + - import_role: + name: ceph-defaults + private: false tags: [with_pkg, fetch_container_image] - - role: ceph-validate - - role: ceph-infra - - role: ceph-handler - - role: ceph-docker-common + - import_role: + name: ceph-validate + private: false + - import_role: + name: ceph-infra + private: false + - import_role: + name: ceph-handler + private: false + - import_role: + name: ceph-docker-common + private: false tags: [with_pkg, fetch_container_image] when: - not (is_atomic | bool) - (not (inventory_hostname in groups.get('clients', [])) or (inventory_hostname == groups.get('clients', [''])|first)) - post_tasks: + + # post-tasks for upcoming import - - name: "pull {{ ceph_docker_image }} image" command: "docker pull {{ ceph_docker_registry}}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}" changed_when: false @@ -83,14 +94,24 @@ - hosts: mons become: True gather_facts: false - roles: - - role: ceph-defaults + tasks: + - import_role: + name: ceph-defaults + private: false tags: ['ceph_update_config'] - - role: ceph-handler - - role: ceph-docker-common - - role: ceph-config + - import_role: + name: ceph-handler + private: false + - import_role: + name: ceph-docker-common + private: false + - import_role: + name: ceph-config + private: false tags: ['ceph_update_config'] - - role: ceph-mon + - import_role: + name: ceph-mon + private: false serial: 1 # MUST be '1' WHEN DEPLOYING MONITORS ON DOCKER CONTAINERS - hosts: mons @@ -106,7 +127,8 @@ - hosts: mgrs become: True gather_facts: false - pre_tasks: + tasks: + # pre-tasks for following imports - - name: set ceph manager install 'In Progress' run_once: true set_stats: @@ -114,15 +136,26 @@ installer_phase_ceph_mgr: status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - roles: - - role: ceph-defaults + + - import_role: + name: ceph-defaults + private: false tags: ['ceph_update_config'] - - role: ceph-handler - - role: ceph-docker-common - - role: ceph-config + - import_role: + name: ceph-handler + private: false + - import_role: + name: ceph-docker-common + private: false + - import_role: + name: ceph-config + private: fals tags: ['ceph_update_config'] - - role: ceph-mgr - post_tasks: + - import_role: + name: ceph-mgr + private: false + + # post-tasks for upcoming imports - - name: set ceph manager install 'Complete' run_once: true set_stats: @@ -134,7 +167,8 @@ - hosts: osds become: True gather_facts: false - pre_tasks: + tasks: + # pre-tasks for upcoming imports - - name: set ceph osd install 'In Progress' run_once: true set_stats: @@ -142,15 +176,26 @@ installer_phase_ceph_osd: status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - roles: - - role: ceph-defaults + + - import_role: + name: ceph-defaults + private: false tags: ['ceph_update_config'] - - role: ceph-handler - - role: ceph-docker-common - - role: ceph-config + - import_role: + name: ceph-handler + private: false + - import_role: + name: ceph-docker-common + private: false + - import_role: + name: ceph-config + private: false tags: ['ceph_update_config'] - - role: ceph-osd - post_tasks: + - import_role: + name: ceph-osd + private: false + + # post-tasks for preceding imports - - name: set ceph osd install 'Complete' run_once: true set_stats: @@ -162,7 +207,8 @@ - hosts: mdss become: True gather_facts: false - pre_tasks: + tasks: + # pre-tasks for following imports - - name: set ceph mds install 'In Progress' run_once: true set_stats: @@ -170,15 +216,26 @@ installer_phase_ceph_mds: status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - roles: - - role: ceph-defaults + + - import_role: + name: ceph-defaults + private: false tags: ['ceph_update_config'] - - role: ceph-handler - - role: ceph-docker-common - - role: ceph-config + - import_role: + name: ceph-handler + private: false + - import_role: + name: ceph-docker-common + private: false + - import_role: + name: ceph-config + private: false tags: ['ceph_update_config'] - - ceph-mds - post_tasks: + - import_role: + name: ceph-mds + private: false + + # post-tasks for preceding imports - - name: set ceph mds install 'Complete' run_once: true set_stats: @@ -190,7 +247,8 @@ - hosts: rgws become: True gather_facts: false - pre_tasks: + tasks: + # pre-tasks for following imports - - name: set ceph rgw install 'In Progress' run_once: true set_stats: @@ -198,15 +256,26 @@ installer_phase_ceph_rgw: status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - roles: - - role: ceph-defaults + + - import_role: + name: ceph-defaults + private: false tags: ['ceph_update_config'] - - role: ceph-handler - - role: ceph-docker-common - - role: ceph-config + - import_role: + name: ceph-handler + private: false + - import_role: + name: ceph-docker-common + private: false + - import_role: + name: ceph-config + private: false tags: ['ceph_update_config'] - - role: ceph-rgw - post_tasks: + - import_role: + name: ceph-rgw + private: false + + # post-tasks for preceding imports - - name: set ceph rgw install 'Complete' run_once: true set_stats: @@ -218,7 +287,8 @@ - hosts: nfss become: True gather_facts: false - pre_tasks: + tasks: + # pre-tasks for following imports - - name: set ceph nfs install 'In Progress' run_once: true set_stats: @@ -226,15 +296,26 @@ installer_phase_ceph_nfs: status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - roles: - - role: ceph-defaults + + - import_role: + name: ceph-defaults + private: false tags: ['ceph_update_config'] - - role: ceph-handler - - role: ceph-docker-common - - role: ceph-config + - import_role: + name: ceph-handler + private: false + - import_role: + name: ceph-docker-common + private: false + - import_role: + name: ceph-config + private: false tags: ['ceph_update_config'] - - role: ceph-nfs - post_tasks: + - import_role: + name: ceph-nfs + private: false + + # post-tasks for following imports - - name: set ceph nfs install 'Complete' run_once: true set_stats: @@ -246,7 +327,8 @@ - hosts: rbdmirrors become: True gather_facts: false - pre_tasks: + tasks: + # pre-tasks for following imports - - name: set ceph rbd mirror install 'In Progress' run_once: true set_stats: @@ -254,15 +336,26 @@ installer_phase_ceph_rbdmirror: status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - roles: - - role: ceph-defaults + + - import_role: + name: ceph-defaults + private: false tags: ['ceph_update_config'] - - role: ceph-handler - - role: ceph-docker-common - - role: ceph-config + - import_role: + name: ceph-handler + private: false + - import_role: + name: ceph-docker-common + private: false + - import_role: + name: ceph-config + private: false tags: ['ceph_update_config'] - - role: ceph-rbd-mirror - post_tasks: + - import_role: + name: ceph-rbd-mirror + private: false + + # post-tasks for preceding imports - - name: set ceph rbd mirror install 'Complete' run_once: true set_stats: @@ -274,7 +367,8 @@ - hosts: clients become: True gather_facts: false - pre_tasks: + tasks: + # pre-tasks for following imports - - name: set ceph client install 'In Progress' run_once: true set_stats: @@ -282,17 +376,28 @@ installer_phase_ceph_client: status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - roles: - - role: ceph-defaults + + - import_role: + name: ceph-defaults + private: false tags: ['ceph_update_config'] - - role: ceph-handler - - role: ceph-docker-common + - import_role: + name: ceph-handler + private: false + - import_role: + name: ceph-docker-common + private: false when: - inventory_hostname == groups.get('clients', ['']) | first - - role: ceph-config + - import_role: + name: ceph-config + private: false tags: ['ceph_update_config'] - - role: ceph-client - post_tasks: + - import_role: + name: ceph-client + private: false + + # post-tasks for preceding imports - - name: set ceph client install 'Complete' run_once: true set_stats: @@ -306,7 +411,8 @@ - iscsi-gws # for backward compatibility only! gather_facts: false become: True - pre_tasks: + tasks: + # pre-tasks for following imports - - name: set ceph iscsi gateway install 'In Progress' run_once: true set_stats: @@ -314,13 +420,26 @@ installer_phase_ceph_iscsi_gw: status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - roles: - - { role: ceph-defaults, tags: ['ceph_update_config'] } - - role: ceph-handler - - ceph-docker-common - - { role: ceph-config, tags: ['ceph_update_config'] } - - ceph-iscsi-gw - post_tasks: + + - import_role: + name: ceph-defaults + private: false + tags: ['ceph_update_config'] + - import_role: + name: ceph-handler + private: false + - import_role: + name: ceph-docker-common + private: false + - import_role: + name: ceph-config + private: false + tags: ['ceph_update_config'] + - import_role: + name: ceph-iscsi-gw + private: false + + # post-tasks for preceding imports - - name: set ceph iscsi gw install 'Complete' run_once: true set_stats: diff --git a/site.yml.sample b/site.yml.sample index 7a1ca0405..db93692e6 100644 --- a/site.yml.sample +++ b/site.yml.sample @@ -24,7 +24,8 @@ vars: delegate_facts_host: True - pre_tasks: + tasks: + # pre-tasks for following imports - # 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 @@ -71,16 +72,21 @@ - ansible_distribution == 'Fedora' - ansible_distribution_major_version|int >= 23 - roles: - - ceph-defaults - - ceph-validate - - ceph-infra - + - import_role: + name: ceph-defaults + private: false + - import_role: + name: ceph-validate + private: false + - import_role: + name: ceph-infra + private: false - hosts: mons gather_facts: false become: True - pre_tasks: + tasks: + # pre-tasks for following imports - - name: set ceph monitor install 'In Progress' run_once: true set_stats: @@ -88,15 +94,26 @@ installer_phase_ceph_mon: status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - roles: - - role: ceph-defaults + + - import_role: + name: ceph-defaults + private: false tags: ['ceph_update_config'] - - role: ceph-handler - - role: ceph-common - - role: ceph-config + - import_role: + name: ceph-handler + private: false + - import_role: + name: ceph-common + private: false + - import_role: + name: ceph-config + private: false tags: ['ceph_update_config'] - - role: ceph-mon - post_tasks: + - import_role: + name: ceph-mon + private: false + + # post-tasks for preceding imports - - name: set ceph monitor install 'Complete' run_once: true set_stats: @@ -108,7 +125,8 @@ - hosts: mgrs gather_facts: false become: True - pre_tasks: + tasks: + # pre-tasks for following imports - - name: set ceph manager install 'In Progress' run_once: true set_stats: @@ -116,15 +134,26 @@ installer_phase_ceph_mgr: status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - roles: - - role: ceph-defaults + + - import_role: + name: ceph-defaults + private: false tags: ['ceph_update_config'] - - role: ceph-handler - - role: ceph-common - - role: ceph-config + - import_role: + name: ceph-handler + private: false + - import_role: + name: ceph-common + private: false + - import_role: + name: ceph-config + private: false tags: ['ceph_update_config'] - - role: ceph-mgr - post_tasks: + - import_role: + name: ceph-mgr + private: false + + # post-tasks for following imports - - name: set ceph manager install 'Complete' run_once: true set_stats: @@ -136,7 +165,8 @@ - hosts: agents gather_facts: false become: True - pre_tasks: + tasks: + # pre-tasks for following imports - - name: set ceph agent install 'In Progress' run_once: true set_stats: @@ -144,15 +174,26 @@ installer_phase_ceph_agent: status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - roles: - - role: ceph-defaults + + - import_role: + name: ceph-defaults + private: false tags: ['ceph_update_config'] - - role: ceph-handler - - role: ceph-common - - role: ceph-config + - import_role: + name: ceph-handler + private: false + - import_role: + name: ceph-common + private: false + - import_role: + name: ceph-config + private: false tags: ['ceph_update_config'] - - role: ceph-agent - post_tasks: + - import_role: + name: ceph-agent + private: false + + # post-tasks for following imports - - name: set ceph agent install 'Complete' run_once: true set_stats: @@ -164,7 +205,8 @@ - hosts: osds gather_facts: false become: True - pre_tasks: + tasks: + # pre-tasks for following imports - - name: set ceph osd install 'In Progress' run_once: true set_stats: @@ -172,15 +214,26 @@ installer_phase_ceph_osd: status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - roles: - - role: ceph-defaults + + - import_role: + name: ceph-defaults + private: false tags: ['ceph_update_config'] - - role: ceph-handler - - role: ceph-common - - role: ceph-config + - import_role: + name: ceph-handler + private: false + - import_role: + name: ceph-common + private: false + - import_role: + name: ceph-config + private: false tags: ['ceph_update_config'] - - role: ceph-osd - post_tasks: + - import_role: + name: ceph-osd + private: false + + # post-tasks for following imports - - name: set ceph osd install 'Complete' run_once: true set_stats: @@ -192,7 +245,8 @@ - hosts: mdss gather_facts: false become: True - pre_tasks: + tasks: + # pre-tasks for following imports - - name: set ceph mds install 'In Progress' run_once: true set_stats: @@ -200,15 +254,26 @@ installer_phase_ceph_mds: status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - roles: - - role: ceph-defaults + + - import_role: + name: ceph-defaults + private: false tags: ['ceph_update_config'] - - role: ceph-handler - - role: ceph-common - - role: ceph-config + - import_role: + name: ceph-handler + private: false + - import_role: + name: ceph-common + private: false + - import_role: + name: ceph-config + private: false tags: ['ceph_update_config'] - - role: ceph-mds - post_tasks: + - import_role: + name: ceph-mds + private: false + + # post-tasks for following imports - - name: set ceph mds install 'Complete' run_once: true set_stats: @@ -220,7 +285,8 @@ - hosts: rgws gather_facts: false become: True - pre_tasks: + tasks: + # pre-tasks for following imports - - name: set ceph rgw install 'In Progress' run_once: true set_stats: @@ -228,15 +294,26 @@ installer_phase_ceph_rgw: status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - roles: - - role: ceph-defaults + + - import_role: + name: ceph-defaults + private: false tags: ['ceph_update_config'] - - role: ceph-handler - - role: ceph-common - - role: ceph-config + - import_role: + name: ceph-handler + private: false + - import_role: + name: ceph-common + private: false + - import_role: + name: ceph-config + private: false tags: ['ceph_update_config'] - - role: ceph-rgw - post_tasks: + - import_role: + name: ceph-rgw + private: false + + # post-tasks for following imports - - name: set ceph rgw install 'Complete' run_once: true set_stats: @@ -248,7 +325,8 @@ - hosts: nfss gather_facts: false become: True - pre_tasks: + tasks: + # pre-tasks for following imports - - name: set ceph nfs install 'In Progress' run_once: true set_stats: @@ -256,15 +334,26 @@ installer_phase_ceph_nfs: status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - roles: - - role: ceph-defaults + + - import_role: + name: ceph-defaults + private: false tags: ['ceph_update_config'] - - role: ceph-handler - - role: ceph-common - - role: ceph-config + - import_role: + name: ceph-handler + private: false + - import_role: + name: ceph-common + private: false + - import_role: + name: ceph-config + private: false tags: ['ceph_update_config'] - - role: ceph-nfs - post_tasks: + - import_role: + name: ceph-nfs + private: false + + # post-tasks for following imports - - name: set ceph nfs install 'Complete' run_once: true set_stats: @@ -276,7 +365,8 @@ - hosts: rbdmirrors gather_facts: false become: True - pre_tasks: + tasks: + # pre-tasks for following imports - - name: set ceph rbd mirror install 'In Progress' run_once: true set_stats: @@ -284,15 +374,26 @@ installer_phase_ceph_rbdmirror: status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - roles: - - role: ceph-defaults + + - import_role: + name: ceph-defaults + private: false tags: ['ceph_update_config'] - - role: ceph-handler - - role: ceph-common - - role: ceph-config + - import_role: + name: ceph-handler + private: false + - import_role: + name: ceph-common + private: false + - import_role: + name: ceph-config + private: false tags: ['ceph_update_config'] - - role: ceph-rbd-mirror - post_tasks: + - import_role: + name: ceph-rbd-mirror + private: false + + # post-tasks for following imports - - name: set ceph rbd mirror install 'Complete' run_once: true set_stats: @@ -304,7 +405,8 @@ - hosts: clients gather_facts: false become: True - pre_tasks: + tasks: + # pre-tasks for following imports - - name: set ceph client install 'In Progress' run_once: true set_stats: @@ -312,15 +414,26 @@ installer_phase_ceph_client: status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - roles: - - role: ceph-defaults + + - import_role: + name: ceph-defaults + private: false tags: ['ceph_update_config'] - - role: ceph-handler - - role: ceph-common - - role: ceph-config + - import_role: + name: ceph-handler + private: false + - import_role: + name: ceph-common + private: false + - import_role: + name: ceph-config + private: false tags: ['ceph_update_config'] - - role: ceph-client - post_tasks: + - import_role: + name: ceph-client + private: false + + # post-tasks for following imports - - name: set ceph client install 'Complete' run_once: true set_stats: @@ -334,7 +447,8 @@ - iscsi-gws # for backward compatibility only! gather_facts: false become: True - pre_tasks: + tasks: + # pre-tasks for following imports - - name: set ceph iscsi gateway install 'In Progress' run_once: true set_stats: @@ -342,15 +456,28 @@ installer_phase_ceph_iscsi_gw: status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - roles: - - role: ceph-defaults + + - import_role: + name: ceph-defaults + private: false tags: ['ceph_update_config'] - - role: ceph-handler - - role: ceph-common - - role: ceph-config + - import_role: + name: ceph-handler + private: false + - import_role: + name: ceph-common + private: false + when: + - ceph_release_num[ceph_release] >= ceph_release_num.luminous + - import_role: + name: ceph-config + private: false tags: ['ceph_update_config'] - - role: ceph-iscsi-gw - post_tasks: + - import_role: + name: ceph-iscsi-gw + private: false + + # post-tasks for following imports - - name: set ceph iscsi gw install 'Complete' run_once: true set_stats: @@ -376,4 +503,4 @@ msg: "{{ ceph_status.stdout_lines }}" delegate_to: "{{ groups['mons'][0] }}" run_once: true - when: not ceph_status.failed \ No newline at end of file + when: not ceph_status.failed diff --git a/test.yml b/test.yml index ed6b5d5fd..4e2be2776 100644 --- a/test.yml +++ b/test.yml @@ -1,10 +1,22 @@ --- - hosts: localhost become: true - roles: - - ceph.ceph-common - - ceph-mon - - ceph-osd - - ceph-mds - - ceph-rgw - - ceph-fetch-keys + tasks: + - import_role: + name: ceph.ceph-common + private: false + - import_role: + name: ceph-mon + private: false + - import_role: + name: ceph-osd + private: false + - import_role: + name: ceph-mds + private: false + - import_role: + name: ceph-rgw + private: false + - import_role: + name: ceph-fetch-keys + private: false