From cfac79bec4e2d5e9a22f27b64e5a58398bb8900f Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Han?= Date: Mon, 26 Nov 2018 10:56:14 +0100 Subject: [PATCH] container-common: remove old check MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This removes a bit of unnecessary code, the check was always wrong because of the condition 'not ceph_current_status.get('rc', 1) == 0' It will never match since `Not` is used for bool and we are checking for an rc. Also, even though the check would work, this will be a major blocker for a complete meltdown. If the whole platform is shutdown then nothing will be up but files will be present, so this check is definitely wrong. Signed-off-by: Sébastien Han --- roles/ceph-container-common/tasks/checks.yml | 14 ------- roles/ceph-container-common/tasks/main.yml | 9 ----- .../tasks/stat_ceph_files.yml | 39 ------------------- 3 files changed, 62 deletions(-) delete mode 100644 roles/ceph-container-common/tasks/checks.yml delete mode 100644 roles/ceph-container-common/tasks/stat_ceph_files.yml diff --git a/roles/ceph-container-common/tasks/checks.yml b/roles/ceph-container-common/tasks/checks.yml deleted file mode 100644 index b0b978e01..000000000 --- a/roles/ceph-container-common/tasks/checks.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -- name: include stat_ceph_files.yml - include_tasks: stat_ceph_files.yml - -- name: fail if we find existing cluster files - fail: - msg: "looks like no cluster is running but ceph files are present, please remove them" - with_together: - - "{{ ceph_config_keys }}" - - "{{ statconfig.results }}" - when: - - inventory_hostname == groups.get(mon_group_name) - - item.1.stat.exists - - not ceph_current_status.get('rc', 1) == 0 diff --git a/roles/ceph-container-common/tasks/main.yml b/roles/ceph-container-common/tasks/main.yml index e2e688294..01ebd2ccf 100644 --- a/roles/ceph-container-common/tasks/main.yml +++ b/roles/ceph-container-common/tasks/main.yml @@ -18,15 +18,6 @@ when: - container_binary == 'docker' -- name: include checks.yml - include_tasks: checks.yml - when: - - (inventory_hostname in groups.get(mon_group_name, []) or - inventory_hostname in groups.get(nfs_group_name, []) or - inventory_hostname in groups.get(osd_group_name, [])) - - not ceph_current_status.get('rc', 1) == 0 - - not rolling_update | default(false) - - name: include fetch_image.yml include_tasks: fetch_image.yml tags: diff --git a/roles/ceph-container-common/tasks/stat_ceph_files.yml b/roles/ceph-container-common/tasks/stat_ceph_files.yml deleted file mode 100644 index aa732cc12..000000000 --- a/roles/ceph-container-common/tasks/stat_ceph_files.yml +++ /dev/null @@ -1,39 +0,0 @@ ---- -- name: set_fact ceph_config_keys - set_fact: - ceph_config_keys: - - "{{ ceph_conf_key_directory }}/{{ cluster }}.client.admin.keyring" - - "{{ ceph_conf_key_directory }}/monmap-{{ cluster }}" - - "{{ ceph_conf_key_directory }}/{{ cluster }}.mon.keyring" - - /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 - -- name: set_fact tmp_ceph_mgr_keys add mgr keys to config and keys paths - set_fact: - tmp_ceph_mgr_keys: "{{ ceph_conf_key_directory }}/{{ cluster }}.mgr.{{ hostvars[item]['ansible_hostname'] }}.keyring" - with_items: "{{ groups.get(mgr_group_name, []) }}" - register: tmp_ceph_mgr_keys_result - when: groups.get(mgr_group_name, []) | length > 0 - -- name: set_fact ceph_mgr_keys convert mgr keys to an array - set_fact: - ceph_mgr_keys: "{{ tmp_ceph_mgr_keys_result.results | map(attribute='ansible_facts.tmp_ceph_mgr_keys') | list }}" - when: groups.get(mgr_group_name, []) | length > 0 - -- name: set_fact ceph_config_keys merge mgr keys to config and keys paths - set_fact: - ceph_config_keys: "{{ ceph_config_keys + ceph_mgr_keys }}" - when: groups.get(mgr_group_name, []) | length > 0 - -- name: stat for ceph config and keys - stat: - path: "{{ fetch_directory }}/{{ fsid }}/{{ item }}" - delegate_to: localhost - with_items: "{{ ceph_config_keys }}" - changed_when: false - become: false - failed_when: false - register: statconfig - check_mode: no \ No newline at end of file -- 2.47.3