From d100b4e5964971e5e471b7d159e477b60147f688 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Han?= Date: Thu, 14 Sep 2017 16:48:53 -0600 Subject: [PATCH] name includes and set_fact for clarity MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When Ansible is not run with verbose options it's difficult to see which include and/or set_fact does what. So adding a name for each clarifies. Signed-off-by: Sébastien Han --- roles/ceph-agent/tasks/main.yml | 6 +- roles/ceph-client/tasks/main.yml | 7 ++- roles/ceph-client/tasks/pre_requisite.yml | 2 +- .../tasks/checks/check_ntp_debian.yml | 3 +- .../tasks/checks/check_ntp_redhat.yml | 3 +- .../ceph-common/tasks/checks/check_system.yml | 12 ++-- .../tasks/configure_cluster_name.yml | 6 +- .../tasks/create_rbd_client_dir.yml | 3 +- roles/ceph-common/tasks/facts_mon_fsid.yml | 6 +- ...nfigure_debian_repository_installation.yml | 10 +-- ...nfigure_redhat_repository_installation.yml | 8 +-- .../installs/debian_enterprise_repository.yml | 3 +- .../install_debian_enterprise_packages.yml | 28 ++++++--- .../tasks/installs/install_on_debian.yml | 6 +- .../tasks/installs/install_on_redhat.yml | 6 +- .../installs/install_redhat_packages.yml | 12 ++-- .../prerequisite_rhcs_cdn_install.yml | 9 ++- .../prerequisite_rhcs_cdn_install_debian.yml | 9 ++- .../prerequisite_rhcs_iso_install.yml | 3 +- .../installs/redhat_enterprise_repository.yml | 6 +- roles/ceph-common/tasks/main.yml | 57 +++++++++++------ roles/ceph-common/tasks/misc/ntp_atomic.yml | 6 +- roles/ceph-common/tasks/misc/ntp_debian.yml | 6 +- roles/ceph-common/tasks/misc/ntp_redhat.yml | 6 +- .../ceph-common/tasks/misc/system_tuning.yml | 10 ++- roles/ceph-common/tasks/release-rhcs.yml | 24 ++++--- roles/ceph-config/tasks/main.yml | 18 ++++-- roles/ceph-defaults/handlers/main.yml | 3 +- roles/ceph-defaults/tasks/facts.yml | 61 +++++++++++------- roles/ceph-defaults/tasks/main.yml | 7 ++- roles/ceph-docker-common/tasks/checks.yml | 6 +- .../tasks/checks/check_ntp_debian.yml | 3 +- .../tasks/checks/check_ntp_redhat.yml | 3 +- .../tasks/fetch_configs.yml | 6 +- .../ceph-docker-common/tasks/fetch_image.yml | 15 +++-- roles/ceph-docker-common/tasks/main.yml | 62 ++++++++++++------- .../tasks/misc/ntp_atomic.yml | 3 +- .../tasks/misc/ntp_debian.yml | 6 +- .../tasks/misc/ntp_redhat.yml | 6 +- .../tasks/pre_requisites/prerequisites.yml | 30 ++++++--- roles/ceph-docker-common/tasks/release.yml | 24 ++++--- .../tasks/stat_ceph_files.yml | 12 ++-- roles/ceph-fetch-keys/tasks/main.yml | 2 +- roles/ceph-iscsi-gw/tasks/deploy_ssl_keys.yml | 5 +- roles/ceph-iscsi-gw/tasks/main.yml | 10 ++- roles/ceph-mds/tasks/docker/copy_configs.yml | 2 +- roles/ceph-mds/tasks/docker/main.yml | 13 ++-- roles/ceph-mds/tasks/main.yml | 6 +- roles/ceph-mgr/tasks/docker/copy_configs.yml | 2 +- roles/ceph-mgr/tasks/docker/main.yml | 7 ++- roles/ceph-mgr/tasks/main.yml | 6 +- roles/ceph-mon/tasks/ceph_keys.yml | 36 +++++++---- roles/ceph-mon/tasks/crush_rules.yml | 2 +- roles/ceph-mon/tasks/deploy_monitors.yml | 6 +- roles/ceph-mon/tasks/docker/copy_configs.yml | 23 ++++--- roles/ceph-mon/tasks/docker/main.yml | 15 +++-- roles/ceph-mon/tasks/main.yml | 24 ++++--- .../tasks/set_osd_pool_default_pg_num.yml | 9 ++- roles/ceph-nfs/tasks/docker/main.yml | 12 ++-- roles/ceph-nfs/tasks/main.yml | 6 +- roles/ceph-nfs/tasks/pre_requisite.yml | 10 +-- roles/ceph-osd/tasks/activate_osds.yml | 2 +- .../tasks/ceph_disk_cli_options_facts.yml | 33 ++++++---- roles/ceph-osd/tasks/check_devices.yml | 3 +- roles/ceph-osd/tasks/check_mandatory_vars.yml | 3 +- roles/ceph-osd/tasks/copy_configs.yml | 3 +- roles/ceph-osd/tasks/docker/main.yml | 8 ++- .../tasks/docker/start_docker_osd.yml | 3 +- roles/ceph-osd/tasks/main.yml | 41 +++++++----- roles/ceph-osd/tasks/osd_fragment.yml | 2 +- roles/ceph-osd/tasks/pre_requisite.yml | 8 ++- roles/ceph-osd/tasks/start_osds.yml | 3 - .../tasks/docker/copy_configs.yml | 13 ++-- roles/ceph-rbd-mirror/tasks/docker/main.yml | 7 ++- roles/ceph-rbd-mirror/tasks/main.yml | 21 ++++--- .../tasks/start_rbd_mirror.yml | 9 ++- .../tasks/docker/copy_configs.yml | 8 ++- roles/ceph-restapi/tasks/docker/main.yml | 7 ++- roles/ceph-restapi/tasks/main.yml | 18 ++++-- roles/ceph-restapi/tasks/pre_requisite.yml | 9 ++- roles/ceph-restapi/tasks/start_restapi.yml | 3 +- roles/ceph-rgw/tasks/docker/copy_configs.yml | 6 +- .../tasks/docker/copy_rgw_configs.yml | 5 +- roles/ceph-rgw/tasks/docker/main.yml | 10 ++- roles/ceph-rgw/tasks/main.yml | 31 ++++++---- roles/ceph-rgw/tasks/multisite/destroy.yml | 4 +- roles/ceph-rgw/tasks/multisite/main.yml | 8 ++- roles/ceph-rgw/tasks/multisite/master.yml | 17 +++-- roles/ceph-rgw/tasks/multisite/secondary.yml | 9 ++- roles/ceph-rgw/tasks/openstack-keystone.yml | 6 +- roles/ceph-rgw/tasks/rgw_pool_pgs.yml | 3 +- 91 files changed, 667 insertions(+), 354 deletions(-) diff --git a/roles/ceph-agent/tasks/main.yml b/roles/ceph-agent/tasks/main.yml index 091baf71d..9f7159766 100644 --- a/roles/ceph-agent/tasks/main.yml +++ b/roles/ceph-agent/tasks/main.yml @@ -1,4 +1,6 @@ --- -- include: pre_requisite.yml +- name: include pre_requisite.yml + include: pre_requisite.yml -- include: start_agent.yml +- name: include start_agent.yml + include: start_agent.yml diff --git a/roles/ceph-client/tasks/main.yml b/roles/ceph-client/tasks/main.yml index 36ec8a765..72ca8a195 100644 --- a/roles/ceph-client/tasks/main.yml +++ b/roles/ceph-client/tasks/main.yml @@ -1,6 +1,9 @@ --- -- include: pre_requisite.yml -- include: create_users_keys.yml +- name: include pre_requisite.yml + include: pre_requisite.yml + +- name: include create_users_keys.yml + include: create_users_keys.yml when: - user_config - global_in_ceph_conf_overrides diff --git a/roles/ceph-client/tasks/pre_requisite.yml b/roles/ceph-client/tasks/pre_requisite.yml index f9f9df913..94c0d2735 100644 --- a/roles/ceph-client/tasks/pre_requisite.yml +++ b/roles/ceph-client/tasks/pre_requisite.yml @@ -22,6 +22,6 @@ - cephx - copy_admin_key -- name: check if global key exists in ceph_conf_overrides +- name: set_fact global_in_ceph_conf_overrides set_fact: global_in_ceph_conf_overrides: "{{ 'global' in ceph_conf_overrides }}" diff --git a/roles/ceph-common/tasks/checks/check_ntp_debian.yml b/roles/ceph-common/tasks/checks/check_ntp_debian.yml index 7da8f5bee..c666958ca 100644 --- a/roles/ceph-common/tasks/checks/check_ntp_debian.yml +++ b/roles/ceph-common/tasks/checks/check_ntp_debian.yml @@ -5,7 +5,8 @@ ignore_errors: true always_run: true changed_when: false - when: ansible_os_family == 'Debian' + when: + - ansible_os_family == 'Debian' - name: install ntp on debian package: diff --git a/roles/ceph-common/tasks/checks/check_ntp_redhat.yml b/roles/ceph-common/tasks/checks/check_ntp_redhat.yml index 0e4772f54..2a957b455 100644 --- a/roles/ceph-common/tasks/checks/check_ntp_redhat.yml +++ b/roles/ceph-common/tasks/checks/check_ntp_redhat.yml @@ -5,7 +5,8 @@ ignore_errors: true always_run: true changed_when: false - when: ansible_os_family == 'RedHat' + when: + - ansible_os_family == 'RedHat' - name: install ntp on redhat package: diff --git a/roles/ceph-common/tasks/checks/check_system.yml b/roles/ceph-common/tasks/checks/check_system.yml index 9d909a6fd..b9b7c9918 100644 --- a/roles/ceph-common/tasks/checks/check_system.yml +++ b/roles/ceph-common/tasks/checks/check_system.yml @@ -2,17 +2,20 @@ - name: fail on unsupported system fail: msg: "System not supported {{ ansible_system }}" - when: "'{{ ansible_system }}' not in ['Linux']" + when: + - ansible_system not in ['Linux'] - name: fail on unsupported architecture fail: msg: "Architecture not supported {{ ansible_architecture }}" - when: "'{{ ansible_architecture }}' not in ['x86_64', 'ppc64le', 'armv7l']" + when: + - ansible_architecture not in ['x86_64', 'ppc64le', 'armv7l'] - name: fail on unsupported distribution fail: msg: "Distribution not supported {{ ansible_os_family }}" - when: "'{{ ansible_os_family }}' not in ['Debian', 'RedHat', 'ClearLinux']" + when: + - ansible_os_family not in ['Debian', 'RedHat', 'ClearLinux'] - name: fail on unsupported distribution for red hat ceph storage fail: @@ -65,7 +68,8 @@ - name: fail if systemd is not present fail: msg: "Systemd must be present" - when: ansible_service_mgr != 'systemd' + when: + - ansible_service_mgr != 'systemd' - name: fail on unsupported distribution for iscsi gateways fail: diff --git a/roles/ceph-common/tasks/configure_cluster_name.yml b/roles/ceph-common/tasks/configure_cluster_name.yml index bd37af886..373a87eff 100644 --- a/roles/ceph-common/tasks/configure_cluster_name.yml +++ b/roles/ceph-common/tasks/configure_cluster_name.yml @@ -5,7 +5,8 @@ insertafter: EOF create: yes line: "CLUSTER={{ cluster }}" - when: ansible_os_family == "RedHat" + when: + - ansible_os_family == "RedHat" # NOTE(leseb): we are performing the following check # to ensure any Jewel installation will not fail. @@ -22,7 +23,8 @@ path: /etc/default/ceph register: etc_default_ceph always_run: true - when: ansible_os_family == "Debian" + when: + - ansible_os_family == "Debian" - name: configure cluster name lineinfile: diff --git a/roles/ceph-common/tasks/create_rbd_client_dir.yml b/roles/ceph-common/tasks/create_rbd_client_dir.yml index f893bbcfc..c55909d76 100644 --- a/roles/ceph-common/tasks/create_rbd_client_dir.yml +++ b/roles/ceph-common/tasks/create_rbd_client_dir.yml @@ -9,4 +9,5 @@ with_items: - "{{ rbd_client_admin_socket_path }}" - "{{ rbd_client_log_path }}" - when: rbd_client_directories + when: + - rbd_client_directories diff --git a/roles/ceph-common/tasks/facts_mon_fsid.yml b/roles/ceph-common/tasks/facts_mon_fsid.yml index cafe13ae3..683ff0cf6 100644 --- a/roles/ceph-common/tasks/facts_mon_fsid.yml +++ b/roles/ceph-common/tasks/facts_mon_fsid.yml @@ -27,7 +27,8 @@ - name: fail if initial mon keyring found doesn't work fail: msg: "Initial mon keyring found doesn't work." - when: test_initial_monitor_keyring.rc != 0 + when: + - test_initial_monitor_keyring.rc != 0 - name: write initial mon keyring in {{ fetch_directory }}/monitor_keyring.conf if it doesn't exist local_action: shell echo {{ monitor_keyring.stdout }} | tee {{ fetch_directory }}/monitor_keyring.conf @@ -37,4 +38,5 @@ - name: put initial mon keyring in mon kv store command: ceph --cluster {{ cluster }} config-key put initial_mon_keyring {{ monitor_keyring.stdout }} - when: test_initial_monitor_keyring.rc == 0 + when: + - test_initial_monitor_keyring.rc == 0 diff --git a/roles/ceph-common/tasks/installs/configure_debian_repository_installation.yml b/roles/ceph-common/tasks/installs/configure_debian_repository_installation.yml index b404141ca..466f26283 100644 --- a/roles/ceph-common/tasks/installs/configure_debian_repository_installation.yml +++ b/roles/ceph-common/tasks/installs/configure_debian_repository_installation.yml @@ -1,25 +1,25 @@ --- -- name: configure debian community repository +- name: include debian_community_repository.yml include: debian_community_repository.yml when: - ceph_repository == 'community' -- name: configure debian rhcs repository +- name: include debian_rhcs_repository.yml include: debian_rhcs_repository.yml when: - ceph_repository == 'rhcs' -- name: configure debian dev repository +- name: include debian_dev_repository.yml include: debian_dev_repository.yml when: - ceph_repository == 'dev' -- name: configure debian custom repository +- name: include debian_custom_repository.yml include: debian_custom_repository.yml when: - ceph_repository == 'custom' -- name: configure debian cloud archive repository +- name: include debian_uca_repository.yml include: debian_uca_repository.yml when: - ceph_repository == 'uca' diff --git a/roles/ceph-common/tasks/installs/configure_redhat_repository_installation.yml b/roles/ceph-common/tasks/installs/configure_redhat_repository_installation.yml index 8674062be..d63094c7e 100644 --- a/roles/ceph-common/tasks/installs/configure_redhat_repository_installation.yml +++ b/roles/ceph-common/tasks/installs/configure_redhat_repository_installation.yml @@ -1,20 +1,20 @@ --- -- name: configure redhat community repository +- name: include redhat_community_repository.yml include: redhat_community_repository.yml when: - ceph_repository == 'community' -- name: configure redhat rhcs repository +- name: include redhat_rhcs_repository.yml include: redhat_rhcs_repository.yml when: - ceph_repository == 'rhcs' -- name: configure redhat dev repository +- name: include redhat_dev_repository.yml include: redhat_dev_repository.yml when: - ceph_repository == 'dev' -- name: configure redhat custom repository +- name: include redhat_custom_repository.yml include: redhat_custom_repository.yml when: - ceph_repository == 'custom' diff --git a/roles/ceph-common/tasks/installs/debian_enterprise_repository.yml b/roles/ceph-common/tasks/installs/debian_enterprise_repository.yml index 853b4a8a3..9dcb0ba7a 100644 --- a/roles/ceph-common/tasks/installs/debian_enterprise_repository.yml +++ b/roles/ceph-common/tasks/installs/debian_enterprise_repository.yml @@ -1,4 +1,5 @@ --- -- include: prerequisite_rhcs_cdn_install_debian.yml +- name: include prerequisite_rhcs_cdn_install_debian.yml + include: prerequisite_rhcs_cdn_install_debian.yml when: - ceph_repository_type == 'cdn' diff --git a/roles/ceph-common/tasks/installs/install_debian_enterprise_packages.yml b/roles/ceph-common/tasks/installs/install_debian_enterprise_packages.yml index 5dd37863c..02a07102b 100644 --- a/roles/ceph-common/tasks/installs/install_debian_enterprise_packages.yml +++ b/roles/ceph-common/tasks/installs/install_debian_enterprise_packages.yml @@ -3,55 +3,63 @@ apt: name: ceph-mon state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" - when: mon_group_name in group_names + when: + - mon_group_name in group_names - name: install red hat storage ceph osd for debian apt: name: ceph-osd state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" - when: osd_group_name in group_names + when: + - osd_group_name in group_names - name: install ceph-test for debian apt: name: ceph-test state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" - when: ceph_test + when: + - ceph_test - name: install red hat storage radosgw for debian apt: name: radosgw state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" - when: rgw_group_name in group_names + when: + - rgw_group_name in group_names - name: install red hat storage ceph mds for debian apt: pkg: ceph-mds state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" - when: mds_group_name in group_names + when: + - mds_group_name in group_names - name: install red hat storage ceph-fuse client for debian apt: pkg: ceph-fuse state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" - when: client_group_name in group_names + when: + - client_group_name in group_names - name: install red hat storage ceph-common for debian apt: pkg: ceph-common state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" - when: client_group_name in group_names + when: + - client_group_name in group_names - name: install red hat storage nfs gateway for debian apt: name: nfs-ganesha state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" - when: nfs_group_name in group_names + when: + - nfs_group_name in group_names - name: install red hat storage nfs file gateway apt: name: nfs-ganesha-ceph state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" - when: + when: - nfs_group_name in group_names - nfs_file_gw @@ -59,7 +67,7 @@ apt: name: nfs-ganesha-rgw state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" - when: + when: - nfs_group_name in group_names - nfs_obj_gw diff --git a/roles/ceph-common/tasks/installs/install_on_debian.yml b/roles/ceph-common/tasks/installs/install_on_debian.yml index ca621b538..d96ad26b5 100644 --- a/roles/ceph-common/tasks/installs/install_on_debian.yml +++ b/roles/ceph-common/tasks/installs/install_on_debian.yml @@ -1,5 +1,5 @@ --- -- name: configure debian repository installation +- name: include configure_debian_repository_installation.yml include: configure_debian_repository_installation.yml when: - ceph_origin == 'repository' @@ -16,13 +16,13 @@ apt: update_cache: yes -- name: install ceph debian packages +- name: include install_debian_packages.yml include: install_debian_packages.yml when: - (ceph_origin == 'repository' or ceph_origin == 'distro') - ceph_repository != 'rhcs' -- name: install ceph rhcs debian packages +- name: include install_debian_rhcs_packages.yml include: install_debian_rhcs_packages.yml when: - (ceph_origin == 'repository' or ceph_origin == 'distro') diff --git a/roles/ceph-common/tasks/installs/install_on_redhat.yml b/roles/ceph-common/tasks/installs/install_on_redhat.yml index 30cb48337..3ddb88ef0 100644 --- a/roles/ceph-common/tasks/installs/install_on_redhat.yml +++ b/roles/ceph-common/tasks/installs/install_on_redhat.yml @@ -1,15 +1,15 @@ --- -- name: configure redhat repository installation +- name: include configure_redhat_repository_installation.yml include: configure_redhat_repository_installation.yml when: - ceph_origin == 'repository' -- name: configure redhat local installation +- name: include configure_redhat_local_installation.yml include: configure_redhat_local_installation.yml when: - ceph_origin == 'local' -- name: install redhat packages +- name: include install_redhat_packages.yml include: install_redhat_packages.yml when: - (ceph_origin == 'repository' or ceph_origin == 'distro') diff --git a/roles/ceph-common/tasks/installs/install_redhat_packages.yml b/roles/ceph-common/tasks/installs/install_redhat_packages.yml index 9d7c6c0c6..e76e011fd 100644 --- a/roles/ceph-common/tasks/installs/install_redhat_packages.yml +++ b/roles/ceph-common/tasks/installs/install_redhat_packages.yml @@ -4,14 +4,16 @@ name: "{{ item }}" state: present with_items: "{{ redhat_package_dependencies }}" - when: ansible_distribution == "RedHat" + when: + - ansible_distribution == 'RedHat' - name: install centos dependencies package: name: "{{ item }}" state: present with_items: "{{ centos_package_dependencies }}" - when: ansible_distribution == "CentOS" + when: + - ansible_distribution == 'CentOS' - name: install redhat ceph-common package: @@ -58,13 +60,15 @@ package: name: ceph-test state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" - when: ceph_test + when: + - ceph_test - name: install redhat ceph-radosgw package package: name: ceph-radosgw state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" - when: rgw_group_name in group_names + when: + - rgw_group_name in group_names - name: install redhat nfs-ganesha-ceph package package: diff --git a/roles/ceph-common/tasks/installs/prerequisite_rhcs_cdn_install.yml b/roles/ceph-common/tasks/installs/prerequisite_rhcs_cdn_install.yml index e1af07597..5a8932137 100644 --- a/roles/ceph-common/tasks/installs/prerequisite_rhcs_cdn_install.yml +++ b/roles/ceph-common/tasks/installs/prerequisite_rhcs_cdn_install.yml @@ -5,7 +5,8 @@ failed_when: false register: rhcs_mon_repo always_run: true - when: mon_group_name in group_names + when: + - mon_group_name in group_names - name: enable red hat storage monitor repository command: subscription-manager repos --enable rhel-7-server-rhceph-{{ ceph_rhcs_version }}-mon-rpms @@ -20,7 +21,8 @@ failed_when: false register: rhcs_osd_repo always_run: true - when: osd_group_name in group_names + when: + - osd_group_name in group_names - name: enable red hat storage osd repository command: subscription-manager repos --enable rhel-7-server-rhceph-{{ ceph_rhcs_version }}-osd-rpms @@ -35,7 +37,8 @@ failed_when: false register: rhcs_rgw_mds_repo always_run: true - when: (rgw_group_name in group_names or mds_group_name in group_names) + when: + - (rgw_group_name in group_names or mds_group_name in group_names) - name: enable red hat storage rados gateway / mds repository command: subscription-manager repos --enable rhel-7-server-rhceph-{{ ceph_rhcs_version }}-tools-rpms diff --git a/roles/ceph-common/tasks/installs/prerequisite_rhcs_cdn_install_debian.yml b/roles/ceph-common/tasks/installs/prerequisite_rhcs_cdn_install_debian.yml index 4df13beff..25aa6e004 100644 --- a/roles/ceph-common/tasks/installs/prerequisite_rhcs_cdn_install_debian.yml +++ b/roles/ceph-common/tasks/installs/prerequisite_rhcs_cdn_install_debian.yml @@ -9,21 +9,24 @@ repo: "deb {{ ceph_rhcs_cdn_debian_repo }}/2-updates/MON {{ ceph_stable_distro_source | default(ansible_lsb.codename) }} main" state: present changed_when: false - when: mon_group_name in group_names + when: + - mon_group_name in group_names - name: enable red hat storage osd repository for debian systems apt_repository: repo: "deb {{ ceph_rhcs_cdn_debian_repo }}/2-updates/OSD {{ ceph_stable_distro_source | default(ansible_lsb.codename) }} main" state: present changed_when: false - when: osd_group_name in group_names + when: + - osd_group_name in group_names - name: enable red hat storage rados gateway / mds repository for debian systems apt_repository: repo: "deb {{ ceph_rhcs_cdn_debian_repo }}/2-updates/Tools {{ ceph_stable_distro_source | default(ansible_lsb.codename) }} main" state: present changed_when: false - when: (rgw_group_name in group_names or mds_group_name in group_names) + when: + - (rgw_group_name in group_names or mds_group_name in group_names) - name: enable red hat storage agent repository for debian systems apt_repository: diff --git a/roles/ceph-common/tasks/installs/prerequisite_rhcs_iso_install.yml b/roles/ceph-common/tasks/installs/prerequisite_rhcs_iso_install.yml index 302abc519..b8a20394e 100644 --- a/roles/ceph-common/tasks/installs/prerequisite_rhcs_iso_install.yml +++ b/roles/ceph-common/tasks/installs/prerequisite_rhcs_iso_install.yml @@ -12,7 +12,8 @@ path: "{{ ceph_rhcs_iso_path | dirname }}" state: directory recurse: yes - when: "'{{ ceph_rhcs_iso_path | dirname }}' != '/'" + when: + - ceph_rhcs_iso_path | dirname != '/' - name: fetch the red hat storage iso from the ansible server copy: diff --git a/roles/ceph-common/tasks/installs/redhat_enterprise_repository.yml b/roles/ceph-common/tasks/installs/redhat_enterprise_repository.yml index 40e07d828..3fdac2b05 100644 --- a/roles/ceph-common/tasks/installs/redhat_enterprise_repository.yml +++ b/roles/ceph-common/tasks/installs/redhat_enterprise_repository.yml @@ -1,8 +1,10 @@ --- -- include: prerequisite_rhcs_iso_install.yml +- name: include prerequisite_rhcs_iso_install.yml + include: prerequisite_rhcs_iso_install.yml when: - ceph_repository_type == 'iso' -- include: prerequisite_rhcs_cdn_install.yml +- name: include prerequisite_rhcs_cdn_install.yml + include: prerequisite_rhcs_cdn_install.yml when: - ceph_repository_type == 'cdn' diff --git a/roles/ceph-common/tasks/main.yml b/roles/ceph-common/tasks/main.yml index 59cdb6274..765853047 100644 --- a/roles/ceph-common/tasks/main.yml +++ b/roles/ceph-common/tasks/main.yml @@ -1,18 +1,26 @@ --- -- include: ./checks/check_system.yml -- include: ./checks/check_mandatory_vars.yml +- name: include checks/check_system.yml + include: checks/check_system.yml -- include: ./checks/check_firewall.yml - when: check_firewall +- name: include checks/check_mandatory_vars.yml + include: checks/check_mandatory_vars.yml + +- name: include checks/check_firewall.yml + include: checks/check_firewall.yml + when: + - check_firewall # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False -- include: ./misc/system_tuning.yml - when: osd_group_name in group_names +- name: include misc/system_tuning.yml + include: misc/system_tuning.yml + when: + - osd_group_name in group_names # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False -- include: ./installs/install_on_redhat.yml +- name: include installs/install_on_redhat.yml + include: installs/install_on_redhat.yml when: - ansible_os_family == 'RedHat' tags: @@ -20,7 +28,8 @@ # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False -- include: ./installs/install_on_debian.yml +- name: include installs/install_on_debian.yml + include: installs/install_on_debian.yml when: - ansible_os_family == 'Debian' tags: @@ -28,21 +37,25 @@ # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False -- include: ./installs/install_on_clear.yml - when: ansible_os_family == 'ClearLinux' +- name: include installs/install_on_clear.yml + include: installs/install_on_clear.yml + when: + - ansible_os_family == 'ClearLinux' tags: - package-install # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False -- include: ./misc/ntp_redhat.yml +- name: include misc/ntp_redhat.yml + include: misc/ntp_redhat.yml when: - ansible_os_family == 'RedHat' - ntp_service_enabled # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False -- include: ./misc/ntp_debian.yml +- name: include misc/ntp_debian.yml + include: misc/ntp_debian.yml when: - ansible_os_family == 'Debian' - ntp_service_enabled @@ -55,17 +68,20 @@ always_run: yes register: ceph_version -- set_fact: +- name: set_fact ceph_version + set_fact: ceph_version: "{{ ceph_version.stdout.split(' ')[2] }}" # override ceph_stable_release for ceph_dev and rhcs installations since ceph_stable_release is not mandatory -- include: ./release-rhcs.yml +- name: include release-rhcs.yml + include: release-rhcs.yml when: - ceph_repository in ['rhcs', 'dev'] tags: - always -- include: facts_mon_fsid.yml +- name: include facts_mon_fsid.yml + include: facts_mon_fsid.yml run_once: true when: - cephx @@ -73,6 +89,11 @@ - ceph_current_fsid.rc == 0 - mon_group_name in group_names -- include: create_ceph_initial_dirs.yml -- include: create_rbd_client_dir.yml -- include: configure_cluster_name.yml +- name: include create_ceph_initial_dirs.yml + include: create_ceph_initial_dirs.yml + +- name: include create_rbd_client_dir.yml + include: create_rbd_client_dir.yml + +- name: include configure_cluster_name.yml + include: configure_cluster_name.yml diff --git a/roles/ceph-common/tasks/misc/ntp_atomic.yml b/roles/ceph-common/tasks/misc/ntp_atomic.yml index 11dfc988e..4da8abe84 100644 --- a/roles/ceph-common/tasks/misc/ntp_atomic.yml +++ b/roles/ceph-common/tasks/misc/ntp_atomic.yml @@ -1,6 +1,8 @@ --- -- include: ../checks/check_ntp_atomic.yml - when: is_atomic +- name: include ../checks/check_ntp_atomic.yml + include: ../checks/check_ntp_atomic.yml + when: + - is_atomic - name: start the ntp service service: diff --git a/roles/ceph-common/tasks/misc/ntp_debian.yml b/roles/ceph-common/tasks/misc/ntp_debian.yml index 62db3469c..7eab2e410 100644 --- a/roles/ceph-common/tasks/misc/ntp_debian.yml +++ b/roles/ceph-common/tasks/misc/ntp_debian.yml @@ -1,6 +1,8 @@ --- -- include: ../checks/check_ntp_debian.yml - when: ansible_os_family == 'Debian' +- name: include ../checks/check_ntp_debian.yml + include: ../checks/check_ntp_debian.yml + when: + - ansible_os_family == 'Debian' - name: start the ntp service service: diff --git a/roles/ceph-common/tasks/misc/ntp_redhat.yml b/roles/ceph-common/tasks/misc/ntp_redhat.yml index b64b9d8cd..332841b9c 100644 --- a/roles/ceph-common/tasks/misc/ntp_redhat.yml +++ b/roles/ceph-common/tasks/misc/ntp_redhat.yml @@ -1,6 +1,8 @@ --- -- include: ../checks/check_ntp_redhat.yml - when: ansible_os_family == 'RedHat' +- name: include ../checks/check_ntp_redhat.yml + include: ../checks/check_ntp_redhat.yml + when: + - ansible_os_family == 'RedHat' - name: start the ntp service service: diff --git a/roles/ceph-common/tasks/misc/system_tuning.yml b/roles/ceph-common/tasks/misc/system_tuning.yml index 9ae92732e..0aeced9ff 100644 --- a/roles/ceph-common/tasks/misc/system_tuning.yml +++ b/roles/ceph-common/tasks/misc/system_tuning.yml @@ -3,6 +3,8 @@ command: updatedb -e /var/lib/ceph changed_when: false failed_when: false + when: + - osd_objectstore == 'filestore' - name: create tmpfiles.d directory file: @@ -12,7 +14,8 @@ group: "root" mode: "0755" register: "tmpfiles_d" - when: disable_transparent_hugepage + when: + - disable_transparent_hugepage - name: disable transparent hugepage template: @@ -23,7 +26,8 @@ mode: "0644" force: "yes" validate: "systemd-tmpfiles --create %s" - when: disable_transparent_hugepage + when: + - disable_transparent_hugepage - name: get default vm.min_free_kbytes command: sysctl -b vm.min_free_kbytes @@ -32,7 +36,7 @@ always_run: yes register: default_vm_min_free_kbytes -- name: define vm.min_free_kbytes +- name: set_fact vm_min_free_kbytes set_fact: vm_min_free_kbytes: "{{ 4194303 if ansible_memtotal_mb >= 49152 else default_vm_min_free_kbytes.stdout }}" diff --git a/roles/ceph-common/tasks/release-rhcs.yml b/roles/ceph-common/tasks/release-rhcs.yml index b6054e393..304c6d30c 100644 --- a/roles/ceph-common/tasks/release-rhcs.yml +++ b/roles/ceph-common/tasks/release-rhcs.yml @@ -1,16 +1,24 @@ --- -- set_fact: +- name: set_fact ceph_release jewel + set_fact: ceph_release: jewel - when: ceph_version.split('.')[0] | version_compare('10', '==') + when: + - ceph_version.split('.')[0] | version_compare('10', '==') -- set_fact: +- name: set_fact ceph_release kraken + set_fact: ceph_release: kraken - when: ceph_version.split('.')[0] | version_compare('11', '==') + when: + - ceph_version.split('.')[0] | version_compare('11', '==') -- set_fact: +- name: set_fact ceph_release luminous + set_fact: ceph_release: luminous - when: ceph_version.split('.')[0] | version_compare('12', '==') + when: + - ceph_version.split('.')[0] | version_compare('12', '==') -- set_fact: +- name: set_fact ceph_release mimic + set_fact: ceph_release: mimic - when: ceph_version.split('.')[0] | version_compare('13', '==') + when: + - ceph_version.split('.')[0] | version_compare('13', '==') diff --git a/roles/ceph-config/tasks/main.yml b/roles/ceph-config/tasks/main.yml index e4ec2b4e4..3ecf5d9e7 100644 --- a/roles/ceph-config/tasks/main.yml +++ b/roles/ceph-config/tasks/main.yml @@ -52,7 +52,8 @@ - restart ceph mdss - restart ceph rgws - restart ceph nfss - when: not containerized_deployment|bool + when: + - not containerized_deployment|bool # ceph-docker-common # only create fetch directory when: @@ -78,7 +79,8 @@ creates="{{ fetch_directory }}/ceph_cluster_uuid.conf" register: cluster_uuid become: false - when: generate_fsid + when: + - generate_fsid - name: read cluster uuid if it already exists local_action: command cat {{ fetch_directory }}/ceph_cluster_uuid.conf @@ -87,7 +89,8 @@ register: cluster_uuid always_run: true become: false - when: generate_fsid + when: + - generate_fsid - name: ensure /etc/ceph exists file: @@ -96,7 +99,8 @@ owner: 'ceph' group: 'ceph' mode: 0755 - when: groups.get(mon_group_name, []) | length == 0 + when: + - groups.get(mon_group_name, []) | length == 0 - name: "generate {{ cluster }}.conf configuration file" action: config_template @@ -117,5 +121,7 @@ - name: set fsid fact when generate_fsid = true set_fact: fsid: "{{ cluster_uuid.stdout }}" - when: generate_fsid - when: containerized_deployment|bool + when: + - generate_fsid + when: + - containerized_deployment|bool diff --git a/roles/ceph-defaults/handlers/main.yml b/roles/ceph-defaults/handlers/main.yml index 91a533b65..4389952d2 100644 --- a/roles/ceph-defaults/handlers/main.yml +++ b/roles/ceph-defaults/handlers/main.yml @@ -2,7 +2,8 @@ - name: update apt cache apt: update-cache: yes - when: ansible_os_family == 'Debian' + when: + - ansible_os_family == 'Debian' - block: - name: copy mon restart script diff --git a/roles/ceph-defaults/tasks/facts.yml b/roles/ceph-defaults/tasks/facts.yml index 78e961bdf..8dcad149b 100644 --- a/roles/ceph-defaults/tasks/facts.yml +++ b/roles/ceph-defaults/tasks/facts.yml @@ -1,11 +1,15 @@ --- -- set_fact: +- name: set_fact monitor_name ansible_hostname + set_fact: monitor_name: "{{ ansible_hostname }}" - when: not mon_use_fqdn + when: + - not mon_use_fqdn -- set_fact: +- name: set_fact monitor_name ansible_fqdn + set_fact: monitor_name: "{{ ansible_fqdn }}" - when: mon_use_fqdn + when: + - mon_use_fqdn # this task shouldn't run in a rolling_update situation # because it blindly picks a mon, which may be down because @@ -30,7 +34,8 @@ # set this as a default when performing a rolling_update # so the rest of the tasks here will succeed -- set_fact: +- name: set_fact ceph_current_fsid rc 1 + set_fact: ceph_current_fsid: rc: 1 when: @@ -41,15 +46,18 @@ changed_when: false become: false run_once: true - when: cephx or generate_fsid + when: + - (cephx or generate_fsid) -- set_fact: +- name: set_fact fsid ceph_current_fsid.stdout + set_fact: fsid: "{{ ceph_current_fsid.stdout }}" when: - ceph_current_fsid.rc == 0 # Set ceph_release to ceph_stable by default -- set_fact: +- name: set_fact ceph_release ceph_stable_release + set_fact: ceph_release: "{{ ceph_stable_release }}" - name: generate cluster fsid @@ -65,7 +73,8 @@ local_action: shell echo {{ fsid }} | tee {{ fetch_directory }}/ceph_cluster_uuid.conf creates="{{ fetch_directory }}/ceph_cluster_uuid.conf" become: false - when: ceph_current_fsid.rc == 0 + when: + - ceph_current_fsid.rc == 0 - name: read cluster fsid if it already exists local_action: command cat {{ fetch_directory }}/ceph_cluster_uuid.conf @@ -74,39 +83,49 @@ register: cluster_uuid become: false always_run: true - when: generate_fsid + when: + - generate_fsid -- name: set fsid fact when generate_fsid = true +- name: set_fact fsid set_fact: fsid: "{{ cluster_uuid.stdout }}" - when: generate_fsid + when: + - generate_fsid -- name: set docker_exec_cmd fact +- name: set_fact docker_exec_cmd set_fact: docker_exec_cmd: "docker exec ceph-mon-{{ ansible_hostname }}" - when: containerized_deployment + when: + - containerized_deployment -- set_fact: +- name: set_fact mds_name ansible_hostname + set_fact: mds_name: "{{ ansible_hostname }}" - when: not mds_use_fqdn + when: + - not mds_use_fqdn -- set_fact: +- name: set_fact mds_name ansible_fqdn + set_fact: mds_name: "{{ ansible_fqdn }}" - when: mds_use_fqdn + when: + - mds_use_fqdn -- set_fact: +- name: set_fact rbd_client_directory_owner ceph + set_fact: rbd_client_directory_owner: ceph when: - rbd_client_directory_owner is not defined or not rbd_client_directory_owner -- set_fact: +- name: set_fact rbd_client_directory_group rbd_client_directory_group + set_fact: rbd_client_directory_group: ceph when: - rbd_client_directory_group is not defined or not rbd_client_directory_group -- set_fact: +- name: set_fact rbd_client_directory_mode 0770 + set_fact: rbd_client_directory_mode: "0770" when: - rbd_client_directory_mode is not defined diff --git a/roles/ceph-defaults/tasks/main.yml b/roles/ceph-defaults/tasks/main.yml index 25887efa7..2efe05941 100644 --- a/roles/ceph-defaults/tasks/main.yml +++ b/roles/ceph-defaults/tasks/main.yml @@ -1,3 +1,6 @@ --- -- include: facts.yml -- include: check_socket.yml +- name: include facts.yml + include: facts.yml + +- name: include check_socket.yml + include: check_socket.yml diff --git a/roles/ceph-docker-common/tasks/checks.yml b/roles/ceph-docker-common/tasks/checks.yml index 941b96c51..bd37f414d 100644 --- a/roles/ceph-docker-common/tasks/checks.yml +++ b/roles/ceph-docker-common/tasks/checks.yml @@ -1,5 +1,6 @@ --- -- include: stat_ceph_files.yml +- name: include stat_ceph_files.yml + include: stat_ceph_files.yml - name: fail if we find existing cluster files fail: @@ -7,4 +8,5 @@ with_together: - "{{ ceph_config_keys }}" - "{{ statconfig.results }}" - when: item.1.stat.exists == true + when: + - item.1.stat.exists == true diff --git a/roles/ceph-docker-common/tasks/checks/check_ntp_debian.yml b/roles/ceph-docker-common/tasks/checks/check_ntp_debian.yml index 7da8f5bee..c666958ca 100644 --- a/roles/ceph-docker-common/tasks/checks/check_ntp_debian.yml +++ b/roles/ceph-docker-common/tasks/checks/check_ntp_debian.yml @@ -5,7 +5,8 @@ ignore_errors: true always_run: true changed_when: false - when: ansible_os_family == 'Debian' + when: + - ansible_os_family == 'Debian' - name: install ntp on debian package: diff --git a/roles/ceph-docker-common/tasks/checks/check_ntp_redhat.yml b/roles/ceph-docker-common/tasks/checks/check_ntp_redhat.yml index 0e4772f54..2a957b455 100644 --- a/roles/ceph-docker-common/tasks/checks/check_ntp_redhat.yml +++ b/roles/ceph-docker-common/tasks/checks/check_ntp_redhat.yml @@ -5,7 +5,8 @@ ignore_errors: true always_run: true changed_when: false - when: ansible_os_family == 'RedHat' + when: + - ansible_os_family == 'RedHat' - name: install ntp on redhat package: diff --git a/roles/ceph-docker-common/tasks/fetch_configs.yml b/roles/ceph-docker-common/tasks/fetch_configs.yml index c1c756c96..cd186a5c7 100644 --- a/roles/ceph-docker-common/tasks/fetch_configs.yml +++ b/roles/ceph-docker-common/tasks/fetch_configs.yml @@ -1,5 +1,6 @@ --- -- include: stat_ceph_files.yml +- name: include stat_ceph_files.yml + include: stat_ceph_files.yml - name: try to fetch ceph config and keys copy: @@ -12,4 +13,5 @@ with_together: - "{{ ceph_config_keys }}" - "{{ statconfig.results | default([]) }}" - when: item.1.stat.exists == true + when: + - item.1.stat.exists == true diff --git a/roles/ceph-docker-common/tasks/fetch_image.yml b/roles/ceph-docker-common/tasks/fetch_image.yml index 57c76ed85..69ba821fd 100644 --- a/roles/ceph-docker-common/tasks/fetch_image.yml +++ b/roles/ceph-docker-common/tasks/fetch_image.yml @@ -3,24 +3,29 @@ - name: "pull {{ ceph_docker_image }} image" command: "docker pull {{ ceph_docker_registry}}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}" changed_when: false - when: ceph_docker_dev_image is undefined or not ceph_docker_dev_image + when: + - (ceph_docker_dev_image is undefined or not ceph_docker_dev_image) # Dev case - export local dev image and send it across - name: export local ceph dev image local_action: command docker save -o "/tmp/{{ ceph_docker_username }}-{{ ceph_docker_imagename }}-{{ ceph_docker_image_tag }}.tar" "{{ ceph_docker_username }}/{{ ceph_docker_imagename }}:{{ ceph_docker_image_tag }}" - when: ceph_docker_dev_image is defined and ceph_docker_dev_image + when: + - (ceph_docker_dev_image is defined and ceph_docker_dev_image) run_once: true - name: copy ceph dev image file copy: src: "/tmp/{{ ceph_docker_username }}-{{ ceph_docker_imagename }}-{{ ceph_docker_image_tag }}.tar" dest: "/tmp/{{ ceph_docker_username }}-{{ ceph_docker_imagename }}-{{ ceph_docker_image_tag }}.tar" - when: ceph_docker_dev_image is defined and ceph_docker_dev_image + when: + - (ceph_docker_dev_image is defined and ceph_docker_dev_image) - name: load ceph dev image command: "docker load -i /tmp/{{ ceph_docker_username }}-{{ ceph_docker_imagename }}-{{ ceph_docker_image_tag }}.tar" - when: ceph_docker_dev_image is defined and ceph_docker_dev_image + when: + - (ceph_docker_dev_image is defined and ceph_docker_dev_image) - name: remove tmp ceph dev image file command: "rm /tmp/{{ ceph_docker_username }}-{{ ceph_docker_imagename }}-{{ ceph_docker_image_tag }}.tar" - when: ceph_docker_dev_image is defined and ceph_docker_dev_image + when: + - (ceph_docker_dev_image is defined and ceph_docker_dev_image) diff --git a/roles/ceph-docker-common/tasks/main.yml b/roles/ceph-docker-common/tasks/main.yml index 24f76b2a7..f70c8e752 100644 --- a/roles/ceph-docker-common/tasks/main.yml +++ b/roles/ceph-docker-common/tasks/main.yml @@ -1,26 +1,34 @@ --- -- include: system_checks.yml +- name: include system_checks.yml + include: system_checks.yml - name: check if it is atomic host - stat: path=/run/ostree-booted + stat: + path: /run/ostree-booted register: stat_ostree always_run: true -- name: set fact for using atomic host +- name: set_fact is_atomic set_fact: is_atomic: '{{ stat_ostree.stat.exists }}' -- include: ./pre_requisites/prerequisites.yml - when: not is_atomic +- name: include pre_requisites/prerequisites.yml + include: pre_requisites/prerequisites.yml + when: + - not is_atomic # NOTE(guits): would be nice to refact this block with L39-45 in roles/ceph-common/tasks/facts.yml -- set_fact: +- name: set_fact monitor_name ansible_hostname + set_fact: monitor_name: "{{ ansible_hostname }}" - when: not mon_use_fqdn + when: + - not mon_use_fqdn -- set_fact: +- name: set_fact monitor_name ansible_fqdn + set_fact: monitor_name: "{{ ansible_fqdn }}" - when: mon_use_fqdn + when: + - mon_use_fqdn - name: get docker version command: docker --version @@ -28,7 +36,8 @@ always_run: yes register: docker_version -- set_fact: +- name: set_fact docker_version docker_version.stdout.split + set_fact: docker_version: "{{ docker_version.stdout.split(' ')[2] }}" - name: check if a cluster is already running @@ -44,7 +53,8 @@ # a cluster is not already running, # AND # we are not playing rolling-update.yml playbook. -- include: checks.yml +- name: include checks.yml + include: checks.yml when: - (not containerized_deployment_with_kv and ((inventory_hostname in groups.get(mon_group_name, [])) or @@ -53,24 +63,28 @@ - ceph_health.rc != 0 - not "{{ rolling_update | default(false) }}" -- include: ./misc/ntp_atomic.yml +- name: include misc/ntp_atomic.yml + include: misc/ntp_atomic.yml when: - is_atomic - ansible_os_family == 'RedHat' - ntp_service_enabled -- include: ./misc/ntp_redhat.yml +- name: include misc/ntp_redhat.yml + include: misc/ntp_redhat.yml when: - not is_atomic - ansible_os_family == 'RedHat' - ntp_service_enabled -- include: ./misc/ntp_debian.yml +- name: include misc/ntp_debian.yml + include: misc/ntp_debian.yml when: - ansible_os_family == 'Debian' - ntp_service_enabled -- include: fetch_image.yml +- name: include fetch_image.yml + include: fetch_image.yml - name: get ceph version command: docker run --entrypoint /usr/bin/ceph {{ ceph_docker_registry}}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} --version @@ -78,16 +92,22 @@ always_run: yes register: ceph_version -- set_fact: +- name: set_fact ceph_version ceph_version.stdout.split + set_fact: ceph_version: "{{ ceph_version.stdout.split(' ')[2] }}" -- include: release.yml +- name: include release.yml + include: release.yml # NOTE (jimcurtis): dirs_permissions.yml must precede fetch_configs.yml # # because it creates the directories needed by the latter. -- include: dirs_permissions.yml +- name: include dirs_permissions.yml + include: dirs_permissions.yml -- include: create_configs.yml +- name: include create_configs.yml + include: create_configs.yml -- include: selinux.yml - when: ansible_os_family == 'RedHat' +- name: include selinux.yml + include: selinux.yml + when: + - ansible_os_family == 'RedHat' diff --git a/roles/ceph-docker-common/tasks/misc/ntp_atomic.yml b/roles/ceph-docker-common/tasks/misc/ntp_atomic.yml index 11dfc988e..b8a753450 100644 --- a/roles/ceph-docker-common/tasks/misc/ntp_atomic.yml +++ b/roles/ceph-docker-common/tasks/misc/ntp_atomic.yml @@ -1,5 +1,6 @@ --- -- include: ../checks/check_ntp_atomic.yml +- name: include ../checks/check_ntp_atomic.yml + include: ../checks/check_ntp_atomic.yml when: is_atomic - name: start the ntp service diff --git a/roles/ceph-docker-common/tasks/misc/ntp_debian.yml b/roles/ceph-docker-common/tasks/misc/ntp_debian.yml index 62db3469c..7eab2e410 100644 --- a/roles/ceph-docker-common/tasks/misc/ntp_debian.yml +++ b/roles/ceph-docker-common/tasks/misc/ntp_debian.yml @@ -1,6 +1,8 @@ --- -- include: ../checks/check_ntp_debian.yml - when: ansible_os_family == 'Debian' +- name: include ../checks/check_ntp_debian.yml + include: ../checks/check_ntp_debian.yml + when: + - ansible_os_family == 'Debian' - name: start the ntp service service: diff --git a/roles/ceph-docker-common/tasks/misc/ntp_redhat.yml b/roles/ceph-docker-common/tasks/misc/ntp_redhat.yml index b64b9d8cd..332841b9c 100644 --- a/roles/ceph-docker-common/tasks/misc/ntp_redhat.yml +++ b/roles/ceph-docker-common/tasks/misc/ntp_redhat.yml @@ -1,6 +1,8 @@ --- -- include: ../checks/check_ntp_redhat.yml - when: ansible_os_family == 'RedHat' +- name: include ../checks/check_ntp_redhat.yml + include: ../checks/check_ntp_redhat.yml + when: + - ansible_os_family == 'RedHat' - name: start the ntp service service: diff --git a/roles/ceph-docker-common/tasks/pre_requisites/prerequisites.yml b/roles/ceph-docker-common/tasks/pre_requisites/prerequisites.yml index 4296d5565..02dd814d6 100644 --- a/roles/ceph-docker-common/tasks/pre_requisites/prerequisites.yml +++ b/roles/ceph-docker-common/tasks/pre_requisites/prerequisites.yml @@ -1,8 +1,11 @@ --- -- include: remove_ceph_udev_rules.yml +- name: include remove_ceph_udev_rules.yml + include: remove_ceph_udev_rules.yml -- include: debian_prerequisites.yml - when: ansible_distribution == 'Debian' +- name: include debian_prerequisites.yml + include: debian_prerequisites.yml + when: + - ansible_distribution == 'Debian' tags: with_pkg @@ -11,7 +14,8 @@ name: docker.io state: present update_cache: yes - when: ansible_distribution == 'Ubuntu' + when: + - ansible_distribution == 'Ubuntu' tags: with_pkg @@ -32,7 +36,8 @@ name: python-six state: present update_cache: yes - when: ansible_distribution != 'Debian' + when: + - ansible_distribution != 'Debian' tags: with_pkg @@ -40,7 +45,8 @@ package: name: python-docker-py state: present - when: ansible_os_family == 'RedHat' + when: + - ansible_os_family == 'RedHat' tags: with_pkg @@ -48,7 +54,8 @@ package: name: python-docker state: present - when: ansible_distribution == 'Ubuntu' + when: + - ansible_distribution == 'Ubuntu' tags: with_pkg @@ -56,13 +63,15 @@ package: name: docker state: present - when: ansible_os_family == 'RedHat' + when: + - ansible_os_family == 'RedHat' tags: with_pkg - name: pause after docker install before starting (on openstack vms) pause: seconds=5 - when: ceph_docker_on_openstack + when: + - ceph_docker_on_openstack tags: with_pkg @@ -78,6 +87,7 @@ package: name: ntp state: present - when: ntp_service_enabled + when: + - ntp_service_enabled tags: with_pkg diff --git a/roles/ceph-docker-common/tasks/release.yml b/roles/ceph-docker-common/tasks/release.yml index b6054e393..304c6d30c 100644 --- a/roles/ceph-docker-common/tasks/release.yml +++ b/roles/ceph-docker-common/tasks/release.yml @@ -1,16 +1,24 @@ --- -- set_fact: +- name: set_fact ceph_release jewel + set_fact: ceph_release: jewel - when: ceph_version.split('.')[0] | version_compare('10', '==') + when: + - ceph_version.split('.')[0] | version_compare('10', '==') -- set_fact: +- name: set_fact ceph_release kraken + set_fact: ceph_release: kraken - when: ceph_version.split('.')[0] | version_compare('11', '==') + when: + - ceph_version.split('.')[0] | version_compare('11', '==') -- set_fact: +- name: set_fact ceph_release luminous + set_fact: ceph_release: luminous - when: ceph_version.split('.')[0] | version_compare('12', '==') + when: + - ceph_version.split('.')[0] | version_compare('12', '==') -- set_fact: +- name: set_fact ceph_release mimic + set_fact: ceph_release: mimic - when: ceph_version.split('.')[0] | version_compare('13', '==') + when: + - ceph_version.split('.')[0] | version_compare('13', '==') diff --git a/roles/ceph-docker-common/tasks/stat_ceph_files.yml b/roles/ceph-docker-common/tasks/stat_ceph_files.yml index 01573183c..a94056491 100644 --- a/roles/ceph-docker-common/tasks/stat_ceph_files.yml +++ b/roles/ceph-docker-common/tasks/stat_ceph_files.yml @@ -1,5 +1,5 @@ --- -- name: set config and keys paths +- name: set_fact ceph_config_keys set_fact: ceph_config_keys: - "{{ ceph_conf_key_directory }}/{{ cluster }}.client.admin.keyring" @@ -9,30 +9,30 @@ - /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring - /var/lib/ceph/bootstrap-mds/{{ cluster }}.keyring -- name: register rbd bootstrap key +- name: set_fact bootstrap_rbd_keyring set_fact: bootstrap_rbd_keyring: - "/var/lib/ceph/bootstrap-rbd/{{ cluster }}.keyring" when: ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous -- name: merge rbd bootstrap key to config and keys paths +- name: set_fact ceph_config_keys ceph_config_keys + bootstrap_rbd_keyring set_fact: ceph_config_keys: "{{ ceph_config_keys + bootstrap_rbd_keyring }}" when: ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous -- name: add mgr keys to config and keys paths +- 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: convert mgr keys to an array +- 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: merge mgr keys to config and keys paths +- 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 diff --git a/roles/ceph-fetch-keys/tasks/main.yml b/roles/ceph-fetch-keys/tasks/main.yml index ecce0028f..917c42b2c 100644 --- a/roles/ceph-fetch-keys/tasks/main.yml +++ b/roles/ceph-fetch-keys/tasks/main.yml @@ -14,7 +14,7 @@ with_items: - "{{ ceph_keys.stdout_lines }}" -- name: register rbd bootstrap key +- name: set_fact bootstrap_rbd_keyring set_fact: bootstrap_rbd_keyring: "/var/lib/ceph/bootstrap-rbd/{{ cluster }}.keyring" when: ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous diff --git a/roles/ceph-iscsi-gw/tasks/deploy_ssl_keys.yml b/roles/ceph-iscsi-gw/tasks/deploy_ssl_keys.yml index 0665f0a7f..f3d4989a7 100644 --- a/roles/ceph-iscsi-gw/tasks/deploy_ssl_keys.yml +++ b/roles/ceph-iscsi-gw/tasks/deploy_ssl_keys.yml @@ -1,5 +1,5 @@ --- -- name: set crt path(s) +- name: set_fact crt_files set_fact: crt_files: - "/etc/ceph/iscsi-gateway.crt" @@ -28,7 +28,8 @@ - "{{ crt_files_exist.results }}" when: item.1.stat.exists == true -- include: generate_crt.yml +- name: include generate_crt.yml + include: generate_crt.yml with_together: - "{{ crt_files }}" - "{{ crt_files_exist.results }}" diff --git a/roles/ceph-iscsi-gw/tasks/main.yml b/roles/ceph-iscsi-gw/tasks/main.yml index 87102c523..ade5fe2c7 100644 --- a/roles/ceph-iscsi-gw/tasks/main.yml +++ b/roles/ceph-iscsi-gw/tasks/main.yml @@ -1,8 +1,12 @@ --- -- include: prerequisites.yml +- name: include prerequisites.yml + include: prerequisites.yml # deploy_ssl_keys used the ansible controller to create self-signed crt/key/pub files # and transfers them to /etc/ceph directory on each controller. SSL certs are used by # the API for https support. -- include: deploy_ssl_keys.yml -- include: configure_iscsi.yml +- name: include deploy_ssl_keys.yml + include: deploy_ssl_keys.yml + +- name: configure_iscsi.yml + include: configure_iscsi.yml diff --git a/roles/ceph-mds/tasks/docker/copy_configs.yml b/roles/ceph-mds/tasks/docker/copy_configs.yml index 074f8781b..62c6ec3bc 100644 --- a/roles/ceph-mds/tasks/docker/copy_configs.yml +++ b/roles/ceph-mds/tasks/docker/copy_configs.yml @@ -1,5 +1,5 @@ --- -- name: set config and keys paths +- name: set_fact ceph_config_keys set_fact: ceph_config_keys: - /etc/ceph/{{ cluster }}.conf diff --git a/roles/ceph-mds/tasks/docker/main.yml b/roles/ceph-mds/tasks/docker/main.yml index 4a45f03d4..969388fcf 100644 --- a/roles/ceph-mds/tasks/docker/main.yml +++ b/roles/ceph-mds/tasks/docker/main.yml @@ -1,8 +1,13 @@ --- -- name: set docker_exec_cmd fact +- name: set_fact docker_exec_cmd set_fact: docker_exec_cmd: "docker exec ceph-mds-{{ ansible_hostname }}" -- include: copy_configs.yml -- include: start_docker_mds.yml -- include: enable_multimds.yml +- name: include copy_configs.yml + include: copy_configs.yml + +- name: include start_docker_mds.yml + include: start_docker_mds.yml + +- name: include enable_multimds.yml + include: enable_multimds.yml diff --git a/roles/ceph-mds/tasks/main.yml b/roles/ceph-mds/tasks/main.yml index 1c0b8c615..5df5e2163 100644 --- a/roles/ceph-mds/tasks/main.yml +++ b/roles/ceph-mds/tasks/main.yml @@ -1,6 +1,8 @@ --- -- include: pre_requisite.yml +- name: include pre_requisite.yml + include: pre_requisite.yml when: not containerized_deployment -- include: ./docker/main.yml +- name: docker/main.yml + include: docker/main.yml when: containerized_deployment diff --git a/roles/ceph-mgr/tasks/docker/copy_configs.yml b/roles/ceph-mgr/tasks/docker/copy_configs.yml index 0d3822c03..8ce8b64a0 100644 --- a/roles/ceph-mgr/tasks/docker/copy_configs.yml +++ b/roles/ceph-mgr/tasks/docker/copy_configs.yml @@ -1,5 +1,5 @@ --- -- name: set config and keys paths +- name: set_fact ceph_config_keys set_fact: ceph_config_keys: - /etc/ceph/{{ cluster }}.conf diff --git a/roles/ceph-mgr/tasks/docker/main.yml b/roles/ceph-mgr/tasks/docker/main.yml index 81590ce01..b350bcd87 100644 --- a/roles/ceph-mgr/tasks/docker/main.yml +++ b/roles/ceph-mgr/tasks/docker/main.yml @@ -15,5 +15,8 @@ group: "root" mode: "0755" -- include: copy_configs.yml -- include: start_docker_mgr.yml +- name: include copy_configs.yml + include: copy_configs.yml + +- name: include start_docker_mgr.yml + include: start_docker_mgr.yml diff --git a/roles/ceph-mgr/tasks/main.yml b/roles/ceph-mgr/tasks/main.yml index 1c0b8c615..f2b42763c 100644 --- a/roles/ceph-mgr/tasks/main.yml +++ b/roles/ceph-mgr/tasks/main.yml @@ -1,6 +1,8 @@ --- -- include: pre_requisite.yml +- name: include pre_requisite.yml + include: pre_requisite.yml when: not containerized_deployment -- include: ./docker/main.yml +- name: include docker/main.yml + include: docker/main.yml when: containerized_deployment diff --git a/roles/ceph-mon/tasks/ceph_keys.yml b/roles/ceph-mon/tasks/ceph_keys.yml index 4677e950c..f8e779b2f 100644 --- a/roles/ceph-mon/tasks/ceph_keys.yml +++ b/roles/ceph-mon/tasks/ceph_keys.yml @@ -54,9 +54,11 @@ - ceph_release_num.{{ ceph_release }} > ceph_release_num.jewel with_items: "{{ groups.get(mgr_group_name, []) }}" -- include: set_osd_pool_default_pg_num.yml +- name: include set_osd_pool_default_pg_num.yml + include: set_osd_pool_default_pg_num.yml -- include: crush_rules.yml +- name: crush_rules.yml + include: crush_rules.yml when: - crush_rule_config @@ -67,16 +69,19 @@ failed_when: false register: rbd_pool_exist -- include: rbd_pool.yml +- name: include rbd_pool.yml + include: rbd_pool.yml when: rbd_pool_exist.rc == 0 -- include: rbd_pool_pgs.yml +- name: include rbd_pool_pgs.yml + include: rbd_pool_pgs.yml when: - rbd_pool_exist.rc == 0 - global_in_ceph_conf_overrides - ceph_conf_overrides.global.osd_pool_default_pg_num is defined -- include: rbd_pool_size.yml +- name: include rbd_pool_size.yml + include: rbd_pool_size.yml when: - rbd_pool_exist.rc == 0 - global_in_ceph_conf_overrides @@ -92,17 +97,19 @@ - ceph_conf_overrides.global.osd_pool_default_pg_num is defined - rbd_pool_exist.rc != 0 -- include: openstack_config.yml +- name: include openstack_config.yml + include: openstack_config.yml when: - openstack_config - - "{{ inventory_hostname == groups[mon_group_name] | last }}" + - inventory_hostname == groups[mon_group_name] | last - name: find ceph keys shell: ls -1 /etc/ceph/*.keyring changed_when: false register: ceph_keys always_run: true - when: cephx + when: + - cephx - name: set keys permissions file: @@ -112,12 +119,14 @@ mode: "0600" with_items: - "{{ ceph_keys.get('stdout_lines') | default([]) }}" - when: cephx + when: + - cephx -- name: register rbd bootstrap key +- name: set_fact bootstrap_rbd_keyring set_fact: bootstrap_rbd_keyring: "/var/lib/ceph/bootstrap-rbd/{{ cluster }}.keyring" - when: ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous + when: + - ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous - name: copy keys to the ansible server fetch: @@ -132,7 +141,7 @@ - "{{ bootstrap_rbd_keyring | default([]) }}" when: - cephx - - "{{ inventory_hostname == groups[mon_group_name] | last }}" + - inventory_hostname == groups[mon_group_name] | last - name: drop in a motd script to report status when logging in copy: @@ -141,4 +150,5 @@ owner: root group: root mode: 0755 - when: ansible_distribution_release == 'precise' + when: + - ansible_distribution_release == 'precise' diff --git a/roles/ceph-mon/tasks/crush_rules.yml b/roles/ceph-mon/tasks/crush_rules.yml index 2c5d3c5a7..4bb783132 100644 --- a/roles/ceph-mon/tasks/crush_rules.yml +++ b/roles/ceph-mon/tasks/crush_rules.yml @@ -21,7 +21,7 @@ with_items: "{{ crush_rules }}" when: item.default -- name: set crush rule info as fact +- name: set_fact info_ceph_default_crush_rule_yaml set_fact: info_ceph_default_crush_rule_yaml: "{{ info_ceph_default_crush_rule.results[0].stdout|from_json() }}" when: info_ceph_default_crush_rule.results|length > 0 diff --git a/roles/ceph-mon/tasks/deploy_monitors.yml b/roles/ceph-mon/tasks/deploy_monitors.yml index df170065b..c4706e37e 100644 --- a/roles/ceph-mon/tasks/deploy_monitors.yml +++ b/roles/ceph-mon/tasks/deploy_monitors.yml @@ -38,14 +38,16 @@ mode: "0755" recurse: true -- set_fact: +- name: set_fact ceph_authtool_cap >= ceph_release_num.luminous + set_fact: ceph_authtool_cap: "--cap mon 'allow *' --cap osd 'allow *' --cap mds 'allow' --cap mgr 'allow *'" when: - ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous - cephx - admin_secret != 'admin_secret' -- set_fact: +- name: set_fact ceph_authtool_cap < ceph_release_num.luminous + set_fact: ceph_authtool_cap: "--cap mon 'allow *' --cap osd 'allow *' --cap mds 'allow'" when: - ceph_release_num.{{ ceph_release }} < ceph_release_num.luminous diff --git a/roles/ceph-mon/tasks/docker/copy_configs.yml b/roles/ceph-mon/tasks/docker/copy_configs.yml index 4121743c4..123dc36d9 100644 --- a/roles/ceph-mon/tasks/docker/copy_configs.yml +++ b/roles/ceph-mon/tasks/docker/copy_configs.yml @@ -1,5 +1,5 @@ --- -- name: set config and keys paths +- name: set_fact ceph_config_keys set_fact: ceph_config_keys: - /etc/ceph/{{ cluster }}.conf @@ -10,22 +10,25 @@ - /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring - /var/lib/ceph/bootstrap-mds/{{ cluster }}.keyring -- name: add mgr keys to config and keys paths +- name: set_fact tmp_ceph_mgr_keys add mgr keys to config and keys paths set_fact: tmp_ceph_mgr_keys: /etc/ceph/{{ 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 }}" + when: + - groups.get(mgr_group_name, []) | length > 0 -- name: convert mgr keys to an array +- 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 }}" + when: + - groups.get(mgr_group_name, []) | length > 0 -- name: merge mgr keys to config and keys paths +- 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 }}" + when: + - groups.get(mgr_group_name, []) | length > 0 - name: stat for ceph config and keys local_action: stat path={{ fetch_directory }}/{{ fsid }}/{{ item }} @@ -47,7 +50,8 @@ with_together: - "{{ ceph_config_keys }}" - "{{ statconfig.results }}" - when: item.1.stat.exists == true + when: + - item.1.stat.exists == true - name: set selinux permissions shell: | @@ -56,4 +60,5 @@ - "{{ ceph_conf_key_directory }}" - /var/lib/ceph changed_when: false - when: sestatus.stdout != 'Disabled' + when: + - sestatus.stdout != 'Disabled' diff --git a/roles/ceph-mon/tasks/docker/main.yml b/roles/ceph-mon/tasks/docker/main.yml index 6702cb09d..3f740516c 100644 --- a/roles/ceph-mon/tasks/docker/main.yml +++ b/roles/ceph-mon/tasks/docker/main.yml @@ -1,8 +1,10 @@ --- -- include: copy_configs.yml +- name: include copy_configs.yml + include: copy_configs.yml when: not containerized_deployment_with_kv -- include: start_docker_monitor.yml +- name: include start_docker_monitor.yml + include: start_docker_monitor.yml - name: wait for monitor socket to exist command: docker exec ceph-mon-{{ ansible_hostname }} stat /var/run/ceph/{{ cluster }}-mon.{{ monitor_name }}.asok @@ -71,7 +73,8 @@ - hostvars[groups[mon_group_name][0]]['monitor_address_block'] is defined - hostvars[groups[mon_group_name][0]]['monitor_address_block'] | length > 0 -- include: ./fetch_configs.yml +- name: include fetch_configs.yml + include: fetch_configs.yml when: not containerized_deployment_with_kv - name: create ceph rest api keyring when mon is containerized @@ -86,10 +89,12 @@ - "{{ inventory_hostname == groups[mon_group_name] | last }}" - not containerized_deployment_with_kv -- include: "{{ lookup('env', 'ANSIBLE_ROLES_PATH') | default (playbook_dir + '/roles', true) }}/ceph-mon/tasks/set_osd_pool_default_pg_num.yml" +- name: include ceph-mon/tasks/set_osd_pool_default_pg_num.yml + include: "{{ lookup('env', 'ANSIBLE_ROLES_PATH') | default (playbook_dir + '/roles', true) }}/ceph-mon/tasks/set_osd_pool_default_pg_num.yml" # create openstack pools only when all mons are up. -- include: "{{ lookup('env', 'ANSIBLE_ROLES_PATH') | default (playbook_dir + '/roles', true) }}/ceph-mon/tasks/openstack_config.yml" +- name: include ceph-mon/tasks/set_osd_pool_default_pg_num.yml + include: "{{ lookup('env', 'ANSIBLE_ROLES_PATH') | default (playbook_dir + '/roles', true) }}/ceph-mon/tasks/openstack_config.yml" when: - openstack_config - "{{ inventory_hostname == groups[mon_group_name] | last }}" diff --git a/roles/ceph-mon/tasks/main.yml b/roles/ceph-mon/tasks/main.yml index 4f0fed6b0..1817f06b7 100644 --- a/roles/ceph-mon/tasks/main.yml +++ b/roles/ceph-mon/tasks/main.yml @@ -1,31 +1,39 @@ --- -- include: check_mandatory_vars.yml +- name: include check_mandatory_vars.yml + include: check_mandatory_vars.yml -- include: deploy_monitors.yml +- name: include deploy_monitors.yml + include: deploy_monitors.yml when: not containerized_deployment -- include: start_monitor.yml +- name: include start_monitor.yml + include: start_monitor.yml when: not containerized_deployment -- include: ceph_keys.yml +- name: include ceph_keys.yml + include: ceph_keys.yml when: not containerized_deployment # this avoids the bug mentioned here: https://github.com/ansible/ansible/issues/18206 static: no -- include: create_mds_filesystems.yml +- name: include create_mds_filesystems.yml + include: create_mds_filesystems.yml when: - not containerized_deployment - groups[mds_group_name] is defined - "{{ groups[mds_group_name]|length > 0 }}" - "{{ inventory_hostname == groups[mon_group_name] | last }}" -- include: secure_cluster.yml +- name: include secure_cluster.yml + include: secure_cluster.yml when: - secure_cluster - not containerized_deployment -- include: ./docker/main.yml +- name: include docker/main.yml + include: docker/main.yml when: containerized_deployment -- include: calamari.yml +- name: include calamari.yml + include: calamari.yml when: calamari diff --git a/roles/ceph-mon/tasks/set_osd_pool_default_pg_num.yml b/roles/ceph-mon/tasks/set_osd_pool_default_pg_num.yml index e873410ab..e0dd25249 100644 --- a/roles/ceph-mon/tasks/set_osd_pool_default_pg_num.yml +++ b/roles/ceph-mon/tasks/set_osd_pool_default_pg_num.yml @@ -20,18 +20,21 @@ register: default_pool_default_pg_num when: pool_default_pg_num is not defined or not global_in_ceph_conf_overrides -- set_fact: +- name: set_fact osd_pool_default_pg_num pool_default_pg_num + set_fact: osd_pool_default_pg_num: "{{ pool_default_pg_num }}" when: pool_default_pg_num is defined -- set_fact: +- name: set_fact osd_pool_default_pg_num default_pool_default_pg_num.stdout + set_fact: osd_pool_default_pg_num: "{{ default_pool_default_pg_num.stdout }}" when: - pool_default_pg_num is not defined - default_pool_default_pg_num.rc == 0 - (osd_pool_default_pg_num_in_overrides is not defined or not osd_pool_default_pg_num_in_overrides) -- set_fact: +- name: set_fact osd_pool_default_pg_num ceph_conf_overrides.global.osd_pool_default_pg_num + set_fact: osd_pool_default_pg_num: "{{ ceph_conf_overrides.global.osd_pool_default_pg_num }}" when: - global_in_ceph_conf_overrides diff --git a/roles/ceph-nfs/tasks/docker/main.yml b/roles/ceph-nfs/tasks/docker/main.yml index 4bc05c95a..dbf56263b 100644 --- a/roles/ceph-nfs/tasks/docker/main.yml +++ b/roles/ceph-nfs/tasks/docker/main.yml @@ -1,9 +1,11 @@ --- -# Copy Ceph configs to host -- include: copy_configs.yml -# Copy Ganesha Ceph configs to host -- include: copy_ganesha_configs.yml +- name: include copy_configs.yml + include: copy_configs.yml + +- name: copy_ganesha_configs.yml + include: copy_ganesha_configs.yml when: not containerized_deployment_with_kv -- include: start_docker_nfs.yml +- name: start_docker_nfs.yml + include: start_docker_nfs.yml diff --git a/roles/ceph-nfs/tasks/main.yml b/roles/ceph-nfs/tasks/main.yml index 1c0b8c615..f2b42763c 100644 --- a/roles/ceph-nfs/tasks/main.yml +++ b/roles/ceph-nfs/tasks/main.yml @@ -1,6 +1,8 @@ --- -- include: pre_requisite.yml +- name: include pre_requisite.yml + include: pre_requisite.yml when: not containerized_deployment -- include: ./docker/main.yml +- name: include docker/main.yml + include: docker/main.yml when: containerized_deployment diff --git a/roles/ceph-nfs/tasks/pre_requisite.yml b/roles/ceph-nfs/tasks/pre_requisite.yml index 665345097..3d002f07d 100644 --- a/roles/ceph-nfs/tasks/pre_requisite.yml +++ b/roles/ceph-nfs/tasks/pre_requisite.yml @@ -44,15 +44,17 @@ owner: "ceph" group: "ceph" mode: "0600" - when: cephx + when: + - cephx - name: create rgw nfs user command: radosgw-admin --cluster {{ cluster }} user create --uid={{ ceph_nfs_rgw_user }} --display-name="RGW NFS User" register: rgwuser delegate_to: "{{ groups[mon_group_name][0] }}" - when: nfs_obj_gw + when: + - nfs_obj_gw -- name: set access key +- name: set_fact ceph_nfs_rgw_access_key set_fact: ceph_nfs_rgw_access_key: "{{ (rgwuser.stdout | from_json)['keys'][0]['access_key'] }}" delegate_to: "{{ groups[mon_group_name][0] }}" @@ -60,7 +62,7 @@ - nfs_obj_gw - ceph_nfs_rgw_access_key is not defined -- name: set secret key +- name: set_fact ceph_nfs_rgw_secret_key set_fact: ceph_nfs_rgw_secret_key: "{{(rgwuser.stdout | from_json)['keys'][0]['secret_key']}}" delegate_to: "{{ groups[mon_group_name][0] }}" diff --git a/roles/ceph-osd/tasks/activate_osds.yml b/roles/ceph-osd/tasks/activate_osds.yml index 381048a2c..2fd449ed1 100644 --- a/roles/ceph-osd/tasks/activate_osds.yml +++ b/roles/ceph-osd/tasks/activate_osds.yml @@ -25,7 +25,7 @@ # NOTE (leseb): we must do this because of # https://github.com/ansible/ansible/issues/4297 -- name: combine ispartition results +- name: set_fact combined_activate_osd_disk_results set_fact: combined_activate_osd_disk_results: "{{ activate_osd_disk if osd_scenario != 'collocated' else activate_osd_disk_dmcrypt }}" diff --git a/roles/ceph-osd/tasks/ceph_disk_cli_options_facts.yml b/roles/ceph-osd/tasks/ceph_disk_cli_options_facts.yml index 2906095e3..cb93c72bd 100644 --- a/roles/ceph-osd/tasks/ceph_disk_cli_options_facts.yml +++ b/roles/ceph-osd/tasks/ceph_disk_cli_options_facts.yml @@ -1,5 +1,6 @@ --- -- set_fact: +- name: set_fact ceph_disk_cli_options '--cluster {{ cluster }} --bluestore' + set_fact: ceph_disk_cli_options: "--cluster {{ cluster }} --bluestore" when: - osd_objectstore == 'bluestore' @@ -7,7 +8,8 @@ - ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous - not containerized_deployment -- set_fact: +- name: set_fact ceph_disk_cli_options 'ceph_disk_cli_options' + set_fact: ceph_disk_cli_options: "--cluster {{ cluster }} --filestore" when: - osd_objectstore == 'filestore' @@ -15,7 +17,8 @@ - ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous - not containerized_deployment -- set_fact: +- name: set_fact ceph_disk_cli_options '--cluster {{ cluster }}' + set_fact: ceph_disk_cli_options: "--cluster {{ cluster }}" when: - osd_objectstore == 'filestore' @@ -23,7 +26,8 @@ - ceph_release_num.{{ ceph_release }} < ceph_release_num.luminous - not containerized_deployment -- set_fact: +- name: set_fact ceph_disk_cli_options '--cluster {{ cluster }} --bluestore --dmcrypt' + set_fact: ceph_disk_cli_options: "--cluster {{ cluster }} --bluestore --dmcrypt" when: - osd_objectstore == 'bluestore' @@ -31,7 +35,8 @@ - ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous - not containerized_deployment -- set_fact: +- name: set_fact ceph_disk_cli_options '--cluster {{ cluster }} --filestore --dmcrypt' + set_fact: ceph_disk_cli_options: "--cluster {{ cluster }} --filestore --dmcrypt" when: - osd_objectstore == 'filestore' @@ -39,7 +44,8 @@ - ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous - not containerized_deployment -- set_fact: +- name: set_fact ceph_disk_cli_options '--cluster {{ cluster }} --dmcrypt' + set_fact: ceph_disk_cli_options: "--cluster {{ cluster }} --dmcrypt" when: - osd_objectstore == 'filestore' @@ -47,33 +53,38 @@ - ceph_release_num.{{ ceph_release }} < ceph_release_num.luminous - not containerized_deployment -- set_fact: +- name: set_fact docker_env_args '-e KV_TYPE={{ kv_type }} -e KV_IP={{ kv_endpoint }} -e KV_PORT={{ kv_port }}' + set_fact: docker_env_args: -e KV_TYPE={{ kv_type }} -e KV_IP={{ kv_endpoint }} -e KV_PORT={{ kv_port }} when: - containerized_deployment_with_kv -- set_fact: +- name: set_fact docker_env_args '-e OSD_BLUESTORE=0 -e OSD_FILESTORE=1 -e OSD_DMCRYPT=0' + set_fact: docker_env_args: -e OSD_BLUESTORE=0 -e OSD_FILESTORE=1 -e OSD_DMCRYPT=0 when: - containerized_deployment - osd_objectstore == 'filestore' - not dmcrypt -- set_fact: +- name: set_fact docker_env_args '-e OSD_BLUESTORE=0 -e OSD_FILESTORE=1 -e OSD_DMCRYPT=1' + set_fact: docker_env_args: -e OSD_BLUESTORE=0 -e OSD_FILESTORE=1 -e OSD_DMCRYPT=1 when: - containerized_deployment - osd_objectstore == 'filestore' - dmcrypt -- set_fact: +- name: set_fact docker_env_args '-e OSD_BLUESTORE=1 -e OSD_FILESTORE=0 -e OSD_DMCRYPT=0' + set_fact: docker_env_args: -e OSD_BLUESTORE=1 -e OSD_FILESTORE=0 -e OSD_DMCRYPT=0 when: - containerized_deployment - osd_objectstore == 'bluestore' - not dmcrypt -- set_fact: +- name: set_fact docker_env_args '-e OSD_BLUESTORE=1 -e OSD_FILESTORE=0 -e OSD_DMCRYPT=1' + set_fact: docker_env_args: -e OSD_BLUESTORE=1 -e OSD_FILESTORE=0 -e OSD_DMCRYPT=1 when: - containerized_deployment diff --git a/roles/ceph-osd/tasks/check_devices.yml b/roles/ceph-osd/tasks/check_devices.yml index ea2455fce..c03222fa4 100644 --- a/roles/ceph-osd/tasks/check_devices.yml +++ b/roles/ceph-osd/tasks/check_devices.yml @@ -10,7 +10,8 @@ # allow 2-digit partition numbers so fast SSDs can be shared by > 9 disks # for SSD journals. -- include: ./check_devices_static.yml +- name: include check_devices_static.yml + include: check_devices_static.yml # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False diff --git a/roles/ceph-osd/tasks/check_mandatory_vars.yml b/roles/ceph-osd/tasks/check_mandatory_vars.yml index 800a9fca2..5b0c0de63 100644 --- a/roles/ceph-osd/tasks/check_mandatory_vars.yml +++ b/roles/ceph-osd/tasks/check_mandatory_vars.yml @@ -2,7 +2,8 @@ - name: make sure public_network configured fail: msg: "public_network must be configured. Ceph public network" - when: public_network == '0.0.0.0/0' + when: + - public_network == '0.0.0.0/0' - name: make sure cluster_network configured fail: diff --git a/roles/ceph-osd/tasks/copy_configs.yml b/roles/ceph-osd/tasks/copy_configs.yml index 29d365b8a..2501f5bbf 100644 --- a/roles/ceph-osd/tasks/copy_configs.yml +++ b/roles/ceph-osd/tasks/copy_configs.yml @@ -36,4 +36,5 @@ - "{{ ceph_conf_key_directory }}" - /var/lib/ceph changed_when: false - when: sestatus.stdout != 'Disabled' + when: + - sestatus.stdout != 'Disabled' diff --git a/roles/ceph-osd/tasks/docker/main.yml b/roles/ceph-osd/tasks/docker/main.yml index db0fad568..e86b36a18 100644 --- a/roles/ceph-osd/tasks/docker/main.yml +++ b/roles/ceph-osd/tasks/docker/main.yml @@ -1,2 +1,8 @@ --- -- include: start_docker_osd.yml +- name: include osd_fragment.yml + include: osd_fragment.yml + when: + - crush_location + +- name: include start_docker_osd.yml + include: start_docker_osd.yml diff --git a/roles/ceph-osd/tasks/docker/start_docker_osd.yml b/roles/ceph-osd/tasks/docker/start_docker_osd.yml index 27039092c..bab4e7ce9 100644 --- a/roles/ceph-osd/tasks/docker/start_docker_osd.yml +++ b/roles/ceph-osd/tasks/docker/start_docker_osd.yml @@ -7,7 +7,8 @@ src: /dev/vdb fstype: ext3 state: unmounted - when: ceph_docker_on_openstack + when: + - ceph_docker_on_openstack - name: generate ceph osd docker run script become: true diff --git a/roles/ceph-osd/tasks/main.yml b/roles/ceph-osd/tasks/main.yml index 3c275e435..3a9e807fe 100644 --- a/roles/ceph-osd/tasks/main.yml +++ b/roles/ceph-osd/tasks/main.yml @@ -1,14 +1,18 @@ --- -- include: check_mandatory_vars.yml +- name: include check_mandatory_vars.yml + include: check_mandatory_vars.yml -- include: pre_requisite.yml - when: not containerized_deployment +- name: include pre_requisite.yml + include: pre_requisite.yml + when: + - not containerized_deployment # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False -- include: ceph_disk_cli_options_facts.yml +- name: include ceph_disk_cli_options_facts.yml + include: ceph_disk_cli_options_facts.yml -- name: generate device list when osd_auto_discovery +- name: set_fact devices generate device list when osd_auto_discovery set_fact: devices: "{{ devices | default([]) + [ item.key | regex_replace('^', '/dev/') ] }}" with_dict: "{{ ansible_devices }}" @@ -19,47 +23,54 @@ - item.value.holders|count == 0 - osd_auto_discovery -- include: check_devices.yml +- name: include check_devices.yml + include: check_devices.yml -- include: copy_configs.yml +- name: include copy_configs.yml + include: copy_configs.yml when: - containerized_deployment - not containerized_deployment_with_kv -- include: ./scenarios/collocated.yml +- name: include scenarios/collocated.yml + include: scenarios/collocated.yml when: - osd_scenario == 'collocated' # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False -- include: ./scenarios/non-collocated.yml +- name: include scenarios/non-collocated.yml + include: scenarios/non-collocated.yml when: - osd_scenario == 'non-collocated' # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False -- name: create lvm osds with ceph-volume - include: ./scenarios/lvm.yml +- name: include scenarios/lvm.yml + include: scenarios/lvm.yml when: - osd_scenario == 'lvm' - not containerized_deployment # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False -- include: ./activate_osds.yml +- name: include activate_osds.yml + include: activate_osds.yml when: - not containerized_deployment # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False -- name: ensure osd daemons are started +- name: include start_osds.yml include: start_osds.yml when: - not containerized_deployment # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False -- include: ./docker/main.yml - when: containerized_deployment +- name: include docker/main.yml + include: docker/main.yml + when: + - containerized_deployment # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False diff --git a/roles/ceph-osd/tasks/osd_fragment.yml b/roles/ceph-osd/tasks/osd_fragment.yml index 324ad1b4e..f7e71d6cc 100644 --- a/roles/ceph-osd/tasks/osd_fragment.yml +++ b/roles/ceph-osd/tasks/osd_fragment.yml @@ -17,7 +17,7 @@ # NOTE (leseb): we must do this because of # https://github.com/ansible/ansible/issues/4297 -- name: combine osd_path results +- name: set_fact combined_osd_id set_fact: combined_osd_id: "{{ osd_id_non_dir_scenario }}" diff --git a/roles/ceph-osd/tasks/pre_requisite.yml b/roles/ceph-osd/tasks/pre_requisite.yml index 59b419243..39afc7911 100644 --- a/roles/ceph-osd/tasks/pre_requisite.yml +++ b/roles/ceph-osd/tasks/pre_requisite.yml @@ -5,13 +5,15 @@ section: extras option: enabled value: 1 - when: ansible_distribution == 'CentOS' + when: + - ansible_distribution == 'CentOS' - name: install rependencies package: name: parted state: present - when: ansible_os_family != 'ClearLinux' + when: + - ansible_os_family != 'ClearLinux' - name: create bootstrap-osd and osd directories file: @@ -26,7 +28,7 @@ - /var/lib/ceph/bootstrap-osd/ - /var/lib/ceph/osd/ -- name: copy ceph admin key when using dmcrypt +- name: set_fact copy_admin_key set_fact: copy_admin_key: true when: diff --git a/roles/ceph-osd/tasks/start_osds.yml b/roles/ceph-osd/tasks/start_osds.yml index f2b78a2b6..da140bd07 100644 --- a/roles/ceph-osd/tasks/start_osds.yml +++ b/roles/ceph-osd/tasks/start_osds.yml @@ -1,7 +1,4 @@ --- -- include: osd_fragment.yml - when: crush_location - - name: get osd id shell: | ls /var/lib/ceph/osd/ | sed 's/.*-//' diff --git a/roles/ceph-rbd-mirror/tasks/docker/copy_configs.yml b/roles/ceph-rbd-mirror/tasks/docker/copy_configs.yml index 2d81ce195..3f50d879e 100644 --- a/roles/ceph-rbd-mirror/tasks/docker/copy_configs.yml +++ b/roles/ceph-rbd-mirror/tasks/docker/copy_configs.yml @@ -1,10 +1,11 @@ --- -- name: register rbd bootstrap key +- name: set_fact bootstrap_rbd_keyring set_fact: bootstrap_rbd_keyring: "/var/lib/ceph/bootstrap-rbd/{{ cluster }}.keyring" - when: ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous + when: + - ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous -- name: set config and keys paths +- name: set_fact ceph_config_keys set_fact: ceph_config_keys: - /etc/ceph/{{ cluster }}.conf @@ -31,7 +32,8 @@ with_together: - "{{ ceph_config_keys }}" - "{{ statconfig.results }}" - when: item.1.stat.exists == true + when: + - item.1.stat.exists == true - name: set selinux permissions shell: | @@ -40,4 +42,5 @@ - "{{ ceph_conf_key_directory }}" - /var/lib/ceph changed_when: false - when: sestatus.stdout != 'Disabled' + when: + - sestatus.stdout != 'Disabled' diff --git a/roles/ceph-rbd-mirror/tasks/docker/main.yml b/roles/ceph-rbd-mirror/tasks/docker/main.yml index fa221177e..65ff32080 100644 --- a/roles/ceph-rbd-mirror/tasks/docker/main.yml +++ b/roles/ceph-rbd-mirror/tasks/docker/main.yml @@ -1,3 +1,6 @@ --- -- include: copy_configs.yml -- include: start_docker_rbd_mirror.yml +- name: include copy_configs.yml + include: copy_configs.yml + +- name: include start_docker_rbd_mirror.yml + include: start_docker_rbd_mirror.yml diff --git a/roles/ceph-rbd-mirror/tasks/main.yml b/roles/ceph-rbd-mirror/tasks/main.yml index cdad90bfb..c2e753f75 100644 --- a/roles/ceph-rbd-mirror/tasks/main.yml +++ b/roles/ceph-rbd-mirror/tasks/main.yml @@ -1,14 +1,21 @@ --- -- include: pre_requisite.yml - when: not containerized_deployment +- name: include pre_requisite.yml + include: pre_requisite.yml + when: + - not containerized_deployment -- include: start_rbd_mirror.yml - when: not containerized_deployment +- name: include start_rbd_mirror.yml + include: start_rbd_mirror.yml + when: + - not containerized_deployment -- include: configure_mirroring.yml +- name: include configure_mirroring.yml + include: configure_mirroring.yml when: - ceph_rbd_mirror_configure - not containerized_deployment -- include: ./docker/main.yml - when: containerized_deployment +- name: include docker/main.yml + include: docker/main.yml + when: + - containerized_deployment diff --git a/roles/ceph-rbd-mirror/tasks/start_rbd_mirror.yml b/roles/ceph-rbd-mirror/tasks/start_rbd_mirror.yml index a6fdbdb9d..62a804372 100644 --- a/roles/ceph-rbd-mirror/tasks/start_rbd_mirror.yml +++ b/roles/ceph-rbd-mirror/tasks/start_rbd_mirror.yml @@ -23,7 +23,8 @@ state: started enabled: yes changed_when: false - when: ceph_release_num.{{ ceph_release }} < ceph_release_num.luminous + when: + - ceph_release_num.{{ ceph_release }} < ceph_release_num.luminous - name: stop and remove the generic rbd-mirror service instance service: @@ -31,7 +32,8 @@ state: stopped enabled: no changed_when: false - when: ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous + when: + - ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous - name: start and add the rbd-mirror service instance service: @@ -39,4 +41,5 @@ state: started enabled: yes changed_when: false - when: ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous + when: + - ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous diff --git a/roles/ceph-restapi/tasks/docker/copy_configs.yml b/roles/ceph-restapi/tasks/docker/copy_configs.yml index 8af83002c..2ecb548bb 100644 --- a/roles/ceph-restapi/tasks/docker/copy_configs.yml +++ b/roles/ceph-restapi/tasks/docker/copy_configs.yml @@ -1,5 +1,5 @@ --- -- name: set config and keys paths +- name: set_fact ceph_config_keys set_fact: ceph_config_keys: - /etc/ceph/{{ cluster }}.conf @@ -25,7 +25,8 @@ with_together: - "{{ ceph_config_keys }}" - "{{ statconfig.results }}" - when: item.1.stat.exists == true + when: + - item.1.stat.exists == true - name: set selinux permissions shell: | @@ -34,4 +35,5 @@ - "{{ ceph_conf_key_directory }}" - /var/lib/ceph changed_when: false - when: sestatus.stdout != 'Disabled' + when: + - sestatus.stdout != 'Disabled' diff --git a/roles/ceph-restapi/tasks/docker/main.yml b/roles/ceph-restapi/tasks/docker/main.yml index a571bbcc6..0e992d15d 100644 --- a/roles/ceph-restapi/tasks/docker/main.yml +++ b/roles/ceph-restapi/tasks/docker/main.yml @@ -1,3 +1,6 @@ --- -- include: copy_configs.yml -- include: start_docker_restapi.yml +- name: include copy_configs.yml + include: copy_configs.yml + +- name: include start_docker_restapi.yml + include: start_docker_restapi.yml diff --git a/roles/ceph-restapi/tasks/main.yml b/roles/ceph-restapi/tasks/main.yml index e62323e7b..1507a193e 100644 --- a/roles/ceph-restapi/tasks/main.yml +++ b/roles/ceph-restapi/tasks/main.yml @@ -1,9 +1,15 @@ --- -- include: pre_requisite.yml - when: not containerized_deployment +- name: include pre_requisite.yml + include: pre_requisite.yml + when: + - not containerized_deployment -- include: start_restapi.yml - when: not containerized_deployment +- name: include start_restapi.yml + include: start_restapi.yml + when: + - not containerized_deployment -- include: ./docker/main.yml - when: containerized_deployment +- name: include docker/main.yml + include: docker/main.yml + when: + - containerized_deployment diff --git a/roles/ceph-restapi/tasks/pre_requisite.yml b/roles/ceph-restapi/tasks/pre_requisite.yml index efdcb3cb8..18e9fc78c 100644 --- a/roles/ceph-restapi/tasks/pre_requisite.yml +++ b/roles/ceph-restapi/tasks/pre_requisite.yml @@ -14,7 +14,8 @@ owner: "ceph" group: "ceph" mode: "0600" - when: cephx + when: + - cephx - name: activate ceph rest api with upstart file: @@ -27,7 +28,8 @@ - done - upstart changed_when: false - when: ansible_distribution == "Ubuntu" + when: + - ansible_distribution == 'Ubuntu' - name: activate ceph rest api with sysvinit file: @@ -39,7 +41,8 @@ with_items: - done - sysvinit - when: ansible_distribution != "Ubuntu" + when: + - ansible_distribution != 'Ubuntu' # NOTE (leseb): will uncomment this when this https://github.com/ceph/ceph/pull/4144 lands #- name: start and add that the Ceph REST API service to the init sequence (Ubuntu) diff --git a/roles/ceph-restapi/tasks/start_restapi.yml b/roles/ceph-restapi/tasks/start_restapi.yml index 68fd25bd8..1c4f23665 100644 --- a/roles/ceph-restapi/tasks/start_restapi.yml +++ b/roles/ceph-restapi/tasks/start_restapi.yml @@ -9,4 +9,5 @@ - name: start ceph rest api shell: "nohup ceph-rest-api --conf /etc/ceph/{{ cluster }}.conf &" changed_when: false - when: restapi_status.rc != 0 + when: + - restapi_status.rc != 0 diff --git a/roles/ceph-rgw/tasks/docker/copy_configs.yml b/roles/ceph-rgw/tasks/docker/copy_configs.yml index ef01f913d..312cadfdb 100644 --- a/roles/ceph-rgw/tasks/docker/copy_configs.yml +++ b/roles/ceph-rgw/tasks/docker/copy_configs.yml @@ -25,7 +25,8 @@ with_together: - "{{ ceph_config_keys }}" - "{{ statconfig.results }}" - when: item.1.stat.exists == true + when: + - item.1.stat.exists == true - name: set selinux permissions shell: | @@ -34,4 +35,5 @@ - "{{ ceph_conf_key_directory }}" - /var/lib/ceph changed_when: false - when: sestatus.stdout != 'Disabled' + when: + - sestatus.stdout != 'Disabled' diff --git a/roles/ceph-rgw/tasks/docker/copy_rgw_configs.yml b/roles/ceph-rgw/tasks/docker/copy_rgw_configs.yml index f2124a1e0..cda9f789c 100644 --- a/roles/ceph-rgw/tasks/docker/copy_rgw_configs.yml +++ b/roles/ceph-rgw/tasks/docker/copy_rgw_configs.yml @@ -1,9 +1,10 @@ --- -- name: set config and keys paths +- name: set_fact rgw_config_keys set_fact: rgw_config_keys: - "/var/lib/ceph/radosgw/{{ ansible_hostname }}/keyring" - when: nfs_obj_gw + when: + - nfs_obj_gw - name: wait for rgw keyring wait_for: diff --git a/roles/ceph-rgw/tasks/docker/main.yml b/roles/ceph-rgw/tasks/docker/main.yml index 7012c42a8..80bcb0109 100644 --- a/roles/ceph-rgw/tasks/docker/main.yml +++ b/roles/ceph-rgw/tasks/docker/main.yml @@ -1,5 +1,9 @@ --- -- include: copy_configs.yml -- include: start_docker_rgw.yml +- name: include copy_configs.yml + include: copy_configs.yml -- include: copy_rgw_configs.yml +- name: include start_docker_rgw.yml + include: start_docker_rgw.yml + +- name: include copy_rgw_configs.yml + include: copy_rgw_configs.yml diff --git a/roles/ceph-rgw/tasks/main.yml b/roles/ceph-rgw/tasks/main.yml index 52fb1dd3c..549fcc1c6 100644 --- a/roles/ceph-rgw/tasks/main.yml +++ b/roles/ceph-rgw/tasks/main.yml @@ -1,35 +1,44 @@ --- -- include: pre_requisite.yml - when: not containerized_deployment +- name: include pre_requisite.yml + include: pre_requisite.yml + when: + - not containerized_deployment # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False -- include: openstack-keystone.yml +- name: include openstack-keystone.yml + include: openstack-keystone.yml when: - radosgw_keystone|bool - radosgw_keystone_ssl|bool # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False -- include: start_radosgw.yml - when: not containerized_deployment +- name: include start_radosgw.yml + include: start_radosgw.yml + when: + - not containerized_deployment # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False -- include: rgw_pool_pgs.yml - when: create_pools is defined +- name: include rgw_pool_pgs.yml + include: rgw_pool_pgs.yml + when: + - create_pools is defined static: False -- name: include rgw multisite playbooks +- name: include multisite/main.yml include: multisite/main.yml when: - rgw_zone is defined - rgw_multisite - - ( ceph_release_num.{{ ceph_release }} >= ceph_release_num.jewel ) + - ceph_release_num.{{ ceph_release }} >= ceph_release_num.jewel # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False -- include: ./docker/main.yml - when: containerized_deployment +- name: include docker/main.yml + include: docker/main.yml + when: + - containerized_deployment # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False diff --git a/roles/ceph-rgw/tasks/multisite/destroy.yml b/roles/ceph-rgw/tasks/multisite/destroy.yml index de3c63715..acef129c6 100644 --- a/roles/ceph-rgw/tasks/multisite/destroy.yml +++ b/roles/ceph-rgw/tasks/multisite/destroy.yml @@ -24,6 +24,8 @@ dest: "/etc/ceph/{{ cluster }}.conf" regexp: "rgw_zone = {{ rgw_zonegroup }}-{{ rgw_zone }}" state: absent - when: "rgw_zone is defined and rgw_zonegroup is defined" + when: + - rgw_zone is defined + - rgw_zonegroup is defined notify: - restart rgw diff --git a/roles/ceph-rgw/tasks/multisite/main.yml b/roles/ceph-rgw/tasks/multisite/main.yml index 2f7114a3d..6485e7338 100644 --- a/roles/ceph-rgw/tasks/multisite/main.yml +++ b/roles/ceph-rgw/tasks/multisite/main.yml @@ -5,13 +5,17 @@ # Include the tasks depending on the zone type - name: include master multisite tasks include: master.yml - when: "rgw_zonemaster is defined and rgw_zonemaster" + when: + - rgw_zonemaster is defined + - rgw_zonemaster # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False - name: include secondary multisite tasks include: secondary.yml - when: "rgw_zonesecondary is defined and rgw_zonesecondary" + when: + - rgw_zonesecondary is defined + - rgw_zonesecondary # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False diff --git a/roles/ceph-rgw/tasks/multisite/master.yml b/roles/ceph-rgw/tasks/multisite/master.yml index ff818465b..5b5c78e67 100644 --- a/roles/ceph-rgw/tasks/multisite/master.yml +++ b/roles/ceph-rgw/tasks/multisite/master.yml @@ -2,27 +2,34 @@ - name: create the realm command: radosgw-admin realm create --rgw-realm={{ rgw_realm }} --default run_once: true - when: ("No such file or directory" in realmcheck.stderr) and rgw_zonemaster + when: + - 'No such file or directory' in realmcheck.stderr + - rgw_zonemaster notify: - update period -- name: create the zonegroup +- name: create the zonegroup command: radosgw-admin zonegroup create --rgw-zonegroup={{ rgw_zonegroup }} --endpoints=http://{{ ansible_fqdn }}:{{ radosgw_civetweb_port }} --master --default run_once: true - when: ("No such file or directory" in zonegroupcheck.stderr) and rgw_zonemaster + when: + - 'No such file or directory' in zonegroupcheck.stderr + - rgw_zonemaster notify: - update period - name: create the zone command: radosgw-admin zone create --rgw-zonegroup={{ rgw_zonegroup }} --rgw-zone={{ rgw_zone }} --endpoints=http://{{ ansible_fqdn }}:{{ radosgw_civetweb_port }} --access-key={{ system_access_key }} --secret={{ system_secret_key }} --default --master run_once: true - when: ("No such file or directory" in zonecheck.stderr) and rgw_zonemaster + when: + - 'No such file or directory' in zonecheck.stderr + - rgw_zonemaster notify: - update period - name: create the zone user command: radosgw-admin user create --uid=zone.user --display-name="Zone User" --access-key={{ system_access_key }} --secret={{ system_secret_key }} --system run_once: true - when: "'could not fetch user info: no user info saved' in usercheck.stderr" + when: + - 'could not fetch user info: no user info saved' in usercheck.stderr notify: - update period diff --git a/roles/ceph-rgw/tasks/multisite/secondary.yml b/roles/ceph-rgw/tasks/multisite/secondary.yml index 7623e832c..d844e143e 100644 --- a/roles/ceph-rgw/tasks/multisite/secondary.yml +++ b/roles/ceph-rgw/tasks/multisite/secondary.yml @@ -2,14 +2,16 @@ - name: fetch the realm command: radosgw-admin realm pull --url={{ rgw_pull_proto }}://{{ rgw_pullhost }}:{{ rgw_pull_port }} --access-key={{ system_access_key }} --secret={{ system_secret_key }} run_once: true - when: ("No such file or directory" in realmcheck.stderr) + when: + - 'No such file or directory' in realmcheck.stderr notify: - update period - name: fetch the period command: radosgw-admin period pull --url={{ rgw_pull_proto }}://{{ rgw_pullhost }}:{{ rgw_pull_port }} --access-key={{ system_access_key }} --secret={{ system_secret_key }} run_once: true - when: ("No such file or directory" in realmcheck.stderr) + when: + - 'No such file or directory' in realmcheck.stderr notify: - update period @@ -28,6 +30,7 @@ - name: create the zone command: radosgw-admin zone create --rgw-zonegroup={{ rgw_zonegroup }} --rgw-zone={{ rgw_zone }} --endpoints=http://{{ ansible_hostname }}:{{ radosgw_civetweb_port }} --access-key={{ system_access_key }} --secret={{ system_secret_key }} --default run_once: true - when: ("No such file or directory" in zonecheck.stderr) + when: + - 'No such file or directory' in zonecheck.stderr notify: - update period diff --git a/roles/ceph-rgw/tasks/openstack-keystone.yml b/roles/ceph-rgw/tasks/openstack-keystone.yml index ece05e842..ab0653ec3 100644 --- a/roles/ceph-rgw/tasks/openstack-keystone.yml +++ b/roles/ceph-rgw/tasks/openstack-keystone.yml @@ -3,13 +3,15 @@ package: name: nss-tools state: present - when: ansible_pkg_mgr == "yum" or ansible_pkg_mgr == "dnf" + when: + - ansible_pkg_mgr == 'yum' or ansible_pkg_mgr == 'dnf' - name: install libnss3-tools on debian package: name: libnss3-tools state: present - when: ansible_pkg_mgr == 'apt' + when: + - ansible_pkg_mgr == 'apt' - name: create nss directory for keystone certificates file: diff --git a/roles/ceph-rgw/tasks/rgw_pool_pgs.yml b/roles/ceph-rgw/tasks/rgw_pool_pgs.yml index 1e848b5c0..4e6d38817 100644 --- a/roles/ceph-rgw/tasks/rgw_pool_pgs.yml +++ b/roles/ceph-rgw/tasks/rgw_pool_pgs.yml @@ -3,5 +3,6 @@ command: ceph --connect-timeout 5 --cluster {{ cluster }} osd pool create {{ item.key }} {{ item.value.pg_num }} changed_when: false failed_when: false - when: create_pools is defined with_dict: "{{ create_pools }}" + when: + - create_pools is defined -- 2.39.5