diff --git a/infrastructure-playbooks/add-osd.yml b/infrastructure-playbooks/add-osd.yml index fa5a2f460..393e6e6f7 100644 --- a/infrastructure-playbooks/add-osd.yml +++ b/infrastructure-playbooks/add-osd.yml @@ -45,6 +45,9 @@ - import_role: name: ceph-defaults + - import_role: + name: ceph-facts + - import_role: name: ceph-validate @@ -68,6 +71,9 @@ - import_role: name: ceph-defaults + - import_role: + name: ceph-facts + - import_role: name: ceph-handler diff --git a/infrastructure-playbooks/purge-docker-cluster.yml b/infrastructure-playbooks/purge-docker-cluster.yml index ccc69ebf7..6b0969056 100644 --- a/infrastructure-playbooks/purge-docker-cluster.yml +++ b/infrastructure-playbooks/purge-docker-cluster.yml @@ -321,6 +321,10 @@ name: ceph-defaults private: false + - import_role: + name: ceph-facts + private: false + - name: get all the running osds shell: | systemctl list-units | grep 'loaded[[:space:]]\+active' | grep -oE "ceph-osd@([0-9]{1,2}|[a-z]+).service" @@ -588,6 +592,10 @@ name: ceph-defaults private: false + - import_role: + name: ceph-facts + private: false + - name: show container list on all the nodes (should be empty) command: > {{ container_binary }} ps --filter='name=ceph' -a -q diff --git a/infrastructure-playbooks/rolling_update.yml b/infrastructure-playbooks/rolling_update.yml index ffda4d7e9..5547a8b81 100644 --- a/infrastructure-playbooks/rolling_update.yml +++ b/infrastructure-playbooks/rolling_update.yml @@ -120,6 +120,8 @@ - import_role: name: ceph-defaults + - import_role: + name: ceph-facts - import_role: name: ceph-handler - import_role: @@ -250,6 +252,8 @@ tasks: - import_role: name: ceph-defaults + - import_role: + name: ceph-facts - name: non container - get current fsid command: "ceph --cluster {{ cluster }} fsid" @@ -330,6 +334,8 @@ - import_role: name: ceph-defaults + - import_role: + name: ceph-facts - import_role: name: ceph-handler - import_role: @@ -395,6 +401,8 @@ - import_role: name: ceph-defaults + - import_role: + name: ceph-facts - import_role: name: ceph-handler - import_role: @@ -487,6 +495,8 @@ tasks: - import_role: name: ceph-defaults + - import_role: + name: ceph-facts - name: set_fact docker_exec_cmd_osd set_fact: @@ -538,6 +548,8 @@ - import_role: name: ceph-defaults + - import_role: + name: ceph-facts - import_role: name: ceph-handler - import_role: @@ -587,6 +599,8 @@ - import_role: name: ceph-defaults + - import_role: + name: ceph-facts - import_role: name: ceph-handler - import_role: @@ -644,6 +658,8 @@ - import_role: name: ceph-defaults + - import_role: + name: ceph-facts - import_role: name: ceph-handler - import_role: @@ -697,6 +713,8 @@ - import_role: name: ceph-defaults + - import_role: + name: ceph-facts - import_role: name: ceph-handler - import_role: @@ -753,6 +771,8 @@ - import_role: name: ceph-defaults + - import_role: + name: ceph-facts - import_role: name: ceph-handler - import_role: @@ -785,6 +805,8 @@ tasks: - import_role: name: ceph-defaults + - import_role: + name: ceph-facts - import_role: name: ceph-handler - import_role: diff --git a/infrastructure-playbooks/shrink-mon.yml b/infrastructure-playbooks/shrink-mon.yml index 84d8d2270..88634525e 100644 --- a/infrastructure-playbooks/shrink-mon.yml +++ b/infrastructure-playbooks/shrink-mon.yml @@ -70,6 +70,9 @@ - import_role: name: ceph-defaults + - import_role: + name: ceph-facts + # post_tasks for preceding import - name: pick a monitor different than the one we want to remove set_fact: diff --git a/infrastructure-playbooks/shrink-osd.yml b/infrastructure-playbooks/shrink-osd.yml index 40b0c0d66..b791a8830 100644 --- a/infrastructure-playbooks/shrink-osd.yml +++ b/infrastructure-playbooks/shrink-osd.yml @@ -59,6 +59,9 @@ - import_role: name: ceph-defaults + - import_role: + name: ceph-facts + post_tasks: - name: set_fact docker_exec_cmd build docker exec command (containerized) set_fact: 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 e702d8c35..8f931ddb7 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 @@ -114,10 +114,16 @@ tasks: - import_role: name: ceph-defaults + + - import_role: + name: ceph-facts + - import_role: name: ceph-handler + - import_role: name: ceph-container-common + - import_role: name: ceph-mon @@ -176,6 +182,9 @@ - import_role: name: ceph-defaults + - import_role: + name: ceph-facts + - import_role: name: ceph-handler @@ -292,6 +301,9 @@ - import_role: name: ceph-defaults + - import_role: + name: ceph-facts + - import_role: name: ceph-handler @@ -363,6 +375,9 @@ - import_role: name: ceph-defaults + - import_role: + name: ceph-facts + - import_role: name: ceph-handler @@ -413,6 +428,9 @@ - import_role: name: ceph-defaults + - import_role: + name: ceph-facts + - import_role: name: ceph-handler @@ -462,6 +480,9 @@ - import_role: name: ceph-defaults + - import_role: + name: ceph-facts + - import_role: name: ceph-handler @@ -516,6 +537,9 @@ - import_role: name: ceph-defaults + - import_role: + name: ceph-facts + - import_role: name: ceph-handler diff --git a/roles/ceph-defaults/tasks/main.yml b/roles/ceph-defaults/tasks/main.yml index 37b7149d2..73b314ff7 100644 --- a/roles/ceph-defaults/tasks/main.yml +++ b/roles/ceph-defaults/tasks/main.yml @@ -1,3 +1 @@ ---- -- name: include facts.yml - include_tasks: facts.yml +--- \ No newline at end of file diff --git a/roles/ceph-facts/README.md b/roles/ceph-facts/README.md new file mode 100644 index 000000000..592982dac --- /dev/null +++ b/roles/ceph-facts/README.md @@ -0,0 +1,3 @@ +# Ansible role: ceph-facts + +Documentation is available at http://docs.ceph.com/ceph-ansible/. diff --git a/roles/ceph-facts/defaults/main.yml b/roles/ceph-facts/defaults/main.yml new file mode 100644 index 000000000..73b314ff7 --- /dev/null +++ b/roles/ceph-facts/defaults/main.yml @@ -0,0 +1 @@ +--- \ No newline at end of file diff --git a/roles/ceph-facts/meta/main.yml b/roles/ceph-facts/meta/main.yml new file mode 100644 index 000000000..b834c5308 --- /dev/null +++ b/roles/ceph-facts/meta/main.yml @@ -0,0 +1,17 @@ +--- +galaxy_info: + company: Red Hat + author: Guillaume Abrioux + description: Set some facts for ceph to be deployed + license: Apache + min_ansible_version: 2.7 + platforms: + - name: Ubuntu + versions: + - xenial + - name: EL + versions: + - 7 + galaxy_tags: + - system +dependencies: [] diff --git a/roles/ceph-defaults/tasks/facts.yml b/roles/ceph-facts/tasks/facts.yml similarity index 100% rename from roles/ceph-defaults/tasks/facts.yml rename to roles/ceph-facts/tasks/facts.yml diff --git a/roles/ceph-facts/tasks/main.yml b/roles/ceph-facts/tasks/main.yml new file mode 100644 index 000000000..37b7149d2 --- /dev/null +++ b/roles/ceph-facts/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: include facts.yml + include_tasks: facts.yml diff --git a/roles/ceph-defaults/tasks/set_monitor_address.yml b/roles/ceph-facts/tasks/set_monitor_address.yml similarity index 100% rename from roles/ceph-defaults/tasks/set_monitor_address.yml rename to roles/ceph-facts/tasks/set_monitor_address.yml diff --git a/roles/ceph-defaults/tasks/set_radosgw_address.yml b/roles/ceph-facts/tasks/set_radosgw_address.yml similarity index 100% rename from roles/ceph-defaults/tasks/set_radosgw_address.yml rename to roles/ceph-facts/tasks/set_radosgw_address.yml diff --git a/site-container.yml.sample b/site-container.yml.sample index 3c4425ebf..1a9a321b3 100644 --- a/site-container.yml.sample +++ b/site-container.yml.sample @@ -106,6 +106,9 @@ - import_role: name: ceph-defaults tags: ['ceph_update_config'] + - import_role: + name: ceph-facts + tags: ['ceph_update_config'] - import_role: name: ceph-handler - import_role: @@ -144,6 +147,9 @@ - import_role: name: ceph-defaults tags: ['ceph_update_config'] + - import_role: + name: ceph-facts + tags: ['ceph_update_config'] - import_role: name: ceph-handler - import_role: @@ -181,6 +187,9 @@ - import_role: name: ceph-defaults tags: ['ceph_update_config'] + - import_role: + name: ceph-facts + tags: ['ceph_update_config'] - import_role: name: ceph-handler - import_role: @@ -217,6 +226,9 @@ - import_role: name: ceph-defaults tags: ['ceph_update_config'] + - import_role: + name: ceph-facts + tags: ['ceph_update_config'] - import_role: name: ceph-handler - import_role: @@ -253,6 +265,9 @@ - import_role: name: ceph-defaults tags: ['ceph_update_config'] + - import_role: + name: ceph-facts + tags: ['ceph_update_config'] - import_role: name: ceph-handler - import_role: @@ -289,6 +304,9 @@ - import_role: name: ceph-defaults tags: ['ceph_update_config'] + - import_role: + name: ceph-facts + tags: ['ceph_update_config'] - import_role: name: ceph-handler - import_role: @@ -325,6 +343,9 @@ - import_role: name: ceph-defaults tags: ['ceph_update_config'] + - import_role: + name: ceph-facts + tags: ['ceph_update_config'] - import_role: name: ceph-handler - import_role: @@ -361,6 +382,9 @@ - import_role: name: ceph-defaults tags: ['ceph_update_config'] + - import_role: + name: ceph-facts + tags: ['ceph_update_config'] - import_role: name: ceph-handler - import_role: @@ -401,6 +425,9 @@ - import_role: name: ceph-defaults tags: ['ceph_update_config'] + - import_role: + name: ceph-facts + tags: ['ceph_update_config'] - import_role: name: ceph-handler - import_role: @@ -425,6 +452,8 @@ gather_facts: false become: True tasks: + - import_role: + name: ceph-defaults - name: check if podman binary is present stat: path: /usr/bin/podman @@ -432,16 +461,15 @@ - name: get ceph status from the first monitor command: > - {{ 'podman' if podman_binary.stat.exists and ansible_distribution == 'Fedora' else 'docker' }} exec ceph-mon-{{ hostvars[groups['mons'][0]]['ansible_hostname'] }} ceph --cluster {{ cluster | default ('ceph') }} -s + {{ 'podman' if podman_binary.stat.exists and ansible_distribution == 'Fedora' else 'docker' }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }} ceph --cluster {{ cluster }} -s register: ceph_status changed_when: false - delegate_to: "{{ groups['mons'][0] }}" + delegate_to: "{{ groups[mon_group_name][0] }}" run_once: true - ignore_errors: true # we skip the error if mon_group_name is different than 'mons' - - name: "show ceph status for cluster {{ cluster | default ('ceph') }}" + - name: "show ceph status for cluster {{ cluster }}" debug: msg: "{{ ceph_status.stdout_lines }}" - delegate_to: "{{ groups['mons'][0] }}" + delegate_to: "{{ groups[mon_group_name][0] }}" run_once: true when: not ceph_status.failed diff --git a/site.yml.sample b/site.yml.sample index b963f2df2..f594633d7 100644 --- a/site.yml.sample +++ b/site.yml.sample @@ -96,6 +96,9 @@ - import_role: name: ceph-defaults tags: ['ceph_update_config'] + - import_role: + name: ceph-facts + tags: ['ceph_update_config'] - import_role: name: ceph-handler - import_role: @@ -134,6 +137,9 @@ - import_role: name: ceph-defaults tags: ['ceph_update_config'] + - import_role: + name: ceph-facts + tags: ['ceph_update_config'] - import_role: name: ceph-handler - import_role: @@ -170,6 +176,9 @@ - import_role: name: ceph-defaults tags: ['ceph_update_config'] + - import_role: + name: ceph-facts + tags: ['ceph_update_config'] - import_role: name: ceph-handler - import_role: @@ -206,6 +215,9 @@ - import_role: name: ceph-defaults tags: ['ceph_update_config'] + - import_role: + name: ceph-facts + tags: ['ceph_update_config'] - import_role: name: ceph-handler - import_role: @@ -242,6 +254,9 @@ - import_role: name: ceph-defaults tags: ['ceph_update_config'] + - import_role: + name: ceph-facts + tags: ['ceph_update_config'] - import_role: name: ceph-handler - import_role: @@ -278,6 +293,9 @@ - import_role: name: ceph-defaults tags: ['ceph_update_config'] + - import_role: + name: ceph-facts + tags: ['ceph_update_config'] - import_role: name: ceph-handler - import_role: @@ -314,6 +332,9 @@ - import_role: name: ceph-defaults tags: ['ceph_update_config'] + - import_role: + name: ceph-facts + tags: ['ceph_update_config'] - import_role: name: ceph-handler - import_role: @@ -350,6 +371,9 @@ - import_role: name: ceph-defaults tags: ['ceph_update_config'] + - import_role: + name: ceph-facts + tags: ['ceph_update_config'] - import_role: name: ceph-handler - import_role: @@ -386,6 +410,9 @@ - import_role: name: ceph-defaults tags: ['ceph_update_config'] + - import_role: + name: ceph-facts + tags: ['ceph_update_config'] - import_role: name: ceph-handler - import_role: @@ -424,6 +451,9 @@ - import_role: name: ceph-defaults tags: ['ceph_update_config'] + - import_role: + name: ceph-facts + tags: ['ceph_update_config'] - import_role: name: ceph-handler - import_role: @@ -449,17 +479,18 @@ gather_facts: false become: True tasks: + - import_role: + name: ceph-defaults - name: get ceph status from the first monitor - command: ceph --cluster {{ cluster | default ('ceph') }} -s + command: ceph --cluster {{ cluster }} -s register: ceph_status changed_when: false - delegate_to: "{{ groups['mons'][0] }}" + delegate_to: "{{ groups[mon_group_name][0] }}" run_once: true - ignore_errors: true # we skip the error if mon_group_name is different than 'mons' - - name: "show ceph status for cluster {{ cluster | default ('ceph') }}" + - name: "show ceph status for cluster {{ cluster }}" debug: msg: "{{ ceph_status.stdout_lines }}" - delegate_to: "{{ groups['mons'][0] }}" + delegate_to: "{{ groups[mon_group_name][0] }}" run_once: true when: not ceph_status.failed