From e79bda9a054d6a3ffc69c52711ea9a8bb2bfb514 Mon Sep 17 00:00:00 2001 From: Seena Fallah Date: Thu, 5 Aug 2021 20:16:04 +0430 Subject: [PATCH] ceph-common: export repository configuration to a single task Signed-off-by: Seena Fallah --- .../tasks/configure_repository.yml | 31 +++++++++++++++++++ .../tasks/installs/install_on_debian.yml | 12 ------- .../tasks/installs/install_on_redhat.yml | 12 ------- .../tasks/installs/install_on_suse.yml | 7 ----- roles/ceph-common/tasks/main.yml | 16 +++++++--- 5 files changed, 42 insertions(+), 36 deletions(-) create mode 100644 roles/ceph-common/tasks/configure_repository.yml delete mode 100644 roles/ceph-common/tasks/installs/install_on_redhat.yml delete mode 100644 roles/ceph-common/tasks/installs/install_on_suse.yml diff --git a/roles/ceph-common/tasks/configure_repository.yml b/roles/ceph-common/tasks/configure_repository.yml new file mode 100644 index 0000000000..0f7d7b2bde --- /dev/null +++ b/roles/ceph-common/tasks/configure_repository.yml @@ -0,0 +1,31 @@ +--- +- name: config repository for Red Hat based OS + when: ansible_facts['os_family'] == 'RedHat' + block: + - name: include installs/configure_redhat_repository_installation.yml + include_tasks: installs/configure_redhat_repository_installation.yml + when: ceph_origin == 'repository' + + - name: include installs/configure_redhat_local_installation.yml + include_tasks: installs/configure_redhat_local_installation.yml + when: ceph_origin == 'local' + +- name: config repository for Debian based OS + when: ansible_facts['os_family'] == 'Debian' + block: + - name: include installs/configure_debian_repository_installation.yml + include_tasks: installs/configure_debian_repository_installation.yml + when: ceph_origin == 'repository' + + - name: update apt cache if cache_valid_time has expired + apt: + update_cache: yes + cache_valid_time: 3600 + register: result + until: result is succeeded + +- name: include installs/configure_suse_repository_installation.yml + include_tasks: installs/configure_suse_repository_installation.yml + when: + - ansible_facts['os_family'] == 'Suse' + - ceph_origin == 'repository' diff --git a/roles/ceph-common/tasks/installs/install_on_debian.yml b/roles/ceph-common/tasks/installs/install_on_debian.yml index 78143a61ac..b10d04fafa 100644 --- a/roles/ceph-common/tasks/installs/install_on_debian.yml +++ b/roles/ceph-common/tasks/installs/install_on_debian.yml @@ -1,15 +1,3 @@ ---- -- name: include configure_debian_repository_installation.yml - include_tasks: configure_debian_repository_installation.yml - when: ceph_origin == 'repository' - -- name: update apt cache if cache_valid_time has expired - apt: - update_cache: yes - cache_valid_time: 3600 - register: result - until: result is succeeded - - name: install dependencies apt: name: "{{ debian_package_dependencies }}" diff --git a/roles/ceph-common/tasks/installs/install_on_redhat.yml b/roles/ceph-common/tasks/installs/install_on_redhat.yml deleted file mode 100644 index 93e261484b..0000000000 --- a/roles/ceph-common/tasks/installs/install_on_redhat.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -- name: include configure_redhat_repository_installation.yml - include_tasks: configure_redhat_repository_installation.yml - when: ceph_origin == 'repository' - -- name: include configure_redhat_local_installation.yml - include_tasks: configure_redhat_local_installation.yml - when: ceph_origin == 'local' - -- name: include install_redhat_packages.yml - include_tasks: install_redhat_packages.yml - when: (ceph_origin == 'repository' or ceph_origin == 'distro') diff --git a/roles/ceph-common/tasks/installs/install_on_suse.yml b/roles/ceph-common/tasks/installs/install_on_suse.yml deleted file mode 100644 index 442400b8fa..0000000000 --- a/roles/ceph-common/tasks/installs/install_on_suse.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- name: include configure_suse_repository_installation.yml - include_tasks: configure_suse_repository_installation.yml - when: ceph_origin == 'repository' - -- name: include install_suse_packages.yml - include_tasks: install_suse_packages.yml diff --git a/roles/ceph-common/tasks/main.yml b/roles/ceph-common/tasks/main.yml index 648eee117d..a3fa31e332 100644 --- a/roles/ceph-common/tasks/main.yml +++ b/roles/ceph-common/tasks/main.yml @@ -1,11 +1,17 @@ --- -- name: include_tasks installs/install_on_redhat.yml - include_tasks: installs/install_on_redhat.yml - when: ansible_facts['os_family'] == 'RedHat' +- name: include configure_repository.yml + include_tasks: configure_repository.yml + tags: package-configure + +- name: include installs/install_redhat_packages.yml + include_tasks: installs/install_redhat_packages.yml + when: + - ansible_facts['os_family'] == 'RedHat' + - (ceph_origin == 'repository' or ceph_origin == 'distro') tags: package-install -- name: include_tasks installs/install_on_suse.yml - include_tasks: installs/install_on_suse.yml +- name: include installs/install_suse_packages.yml + include_tasks: installs/install_suse_packages.yml when: ansible_facts['os_family'] == 'Suse' tags: package-install