From: Sébastien Han Date: Thu, 28 Jan 2016 18:11:22 +0000 (+0100) Subject: use dnf when yum is not available X-Git-Tag: v1.0.0~54^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=17bc64e1ea3606e2e250d565ada113bd728a9a21;p=ceph-ansible.git use dnf when yum is not available fixes the `importError: No module named yum` see here: https://jenkins.ceph.com/job/ceph-ansible-pull-requests/45/console Signed-off-by: Sébastien Han --- diff --git a/roles/ceph-common/tasks/installs/install_on_redhat.yml b/roles/ceph-common/tasks/installs/install_on_redhat.yml index 4d6659330..0eacdb733 100644 --- a/roles/ceph-common/tasks/installs/install_on_redhat.yml +++ b/roles/ceph-common/tasks/installs/install_on_redhat.yml @@ -4,6 +4,14 @@ name: "{{ item }}" state: present with_items: redhat_package_dependencies + when: ansible_pkg_mgr == "yum" + +- name: install dependencies + dnf: + name: "{{ item }}" + state: present + with_items: redhat_package_dependencies + when: ansible_pkg_mgr == "dnf" - name: configure ceph yum repository include: redhat_ceph_repository.yml @@ -24,7 +32,20 @@ - ceph-mon when: ceph_stable_rh_storage and - mon_group_name in group_names + mon_group_name in group_names and + ansible_pkg_mgr == "yum" + +- name: install red hat storage ceph mon + dnf: + name: "{{ item }}" + state: latest + with_items: + - ceph + - ceph-mon + when: + ceph_stable_rh_storage and + mon_group_name in group_names and + ansible_pkg_mgr == "dnf" - name: install red hat storage ceph osd yum: @@ -35,7 +56,20 @@ - ceph-osd when: ceph_stable_rh_storage and - osd_group_name in group_names + osd_group_name in group_names and + ansible_pkg_mgr == "yum" + +- name: install red hat storage ceph osd + dnf: + name: "{{ item }}" + state: latest + with_items: + - ceph + - ceph-osd + when: + ceph_stable_rh_storage and + osd_group_name in group_names and + ansible_pkg_mgr == "dnf" - name: install Inktank Ceph Enterprise RBD Kernel modules yum: @@ -43,14 +77,35 @@ with_items: - "{{ ceph_stable_ice_temp_path }}/kmod-libceph-{{ ceph_stable_ice_kmod }}.rpm" - "{{ ceph_stable_ice_temp_path }}/kmod-rbd-{{ ceph_stable_ice_kmod }}.rpm" - when: ceph_stable_ice + when: + ceph_stable_ice and + ansible_pkg_mgr == "yum" + +- name: install Inktank Ceph Enterprise RBD Kernel modules + dnf: + name: "{{ item }}" + with_items: + - "{{ ceph_stable_ice_temp_path }}/kmod-libceph-{{ ceph_stable_ice_kmod }}.rpm" + - "{{ ceph_stable_ice_temp_path }}/kmod-rbd-{{ ceph_stable_ice_kmod }}.rpm" + when: + ceph_stable_ice and + ansible_pkg_mgr == "dnf" - name: install rados gateway yum: name: ceph-radosgw state: latest when: - rgw_group_name in group_names + rgw_group_name in group_names and + ansible_pkg_mgr == "yum" + +- name: install rados gateway + dnf: + name: ceph-radosgw + state: latest + when: + rgw_group_name in group_names and + ansible_pkg_mgr == "dnf" - name: configure rbd clients directories file: diff --git a/roles/ceph-common/tasks/installs/install_rgw_on_redhat.yml b/roles/ceph-common/tasks/installs/install_rgw_on_redhat.yml index 39ff7051e..3dac9ab89 100644 --- a/roles/ceph-common/tasks/installs/install_rgw_on_redhat.yml +++ b/roles/ceph-common/tasks/installs/install_rgw_on_redhat.yml @@ -22,6 +22,17 @@ - httpd - mod_fastcgi - mod_fcgid + when: ansible_pkg_mgr == "yum" + +- name: install apache and fastcgi + dnf: + name: "{{ item }}" + state: present + with_items: + - httpd + - mod_fastcgi + - mod_fcgid + when: ansible_pkg_mgr == "dnf" - name: install rados gateway vhost template: diff --git a/roles/ceph-common/tasks/installs/redhat_ceph_repository.yml b/roles/ceph-common/tasks/installs/redhat_ceph_repository.yml index 1654ceebe..f896aeb27 100644 --- a/roles/ceph-common/tasks/installs/redhat_ceph_repository.yml +++ b/roles/ceph-common/tasks/installs/redhat_ceph_repository.yml @@ -29,15 +29,34 @@ yum: name: http://ceph.com/rpm-{{ ceph_stable_release }}/{{ ceph_stable_redhat_distro }}/noarch/ceph-release-1-0.{{ ceph_stable_redhat_distro|replace('rhel', 'el') }}.noarch.rpm changed_when: false - when: ceph_stable + when: + ceph_stable and + ansible_pkg_mgr == "yum" + +- name: add ceph stable repository + dnf: + name: http://ceph.com/rpm-{{ ceph_stable_release }}/{{ ceph_stable_redhat_distro }}/noarch/ceph-release-1-0.{{ ceph_stable_redhat_distro|replace('rhel', 'el') }}.noarch.rpm + changed_when: false + when: + ceph_stable and + ansible_pkg_mgr == "dnf" - name: add ceph development repository yum: name: http://gitbuilder.ceph.com/ceph-rpm-{{ ceph_dev_redhat_distro }}-x86_64-basic/ref/{{ ceph_dev_branch }}/noarch/ceph-release-1-0.{{ ceph_stable_redhat_distro }}.noarch.rpm changed_when: false - when: ceph_dev + when: + ceph_dev and + ansible_pkg_mgr == "yum" + +- name: add ceph development repository + dnf: + name: http://gitbuilder.ceph.com/ceph-rpm-{{ ceph_dev_redhat_distro }}-x86_64-basic/ref/{{ ceph_dev_branch }}/noarch/ceph-release-1-0.{{ ceph_stable_redhat_distro }}.noarch.rpm + changed_when: false + when: + ceph_dev and + ansible_pkg_mgr == "dnf" -- name: add inktank ceph enterprise repository template: src: redhat_ice_repo.j2 dest: /etc/yum.repos.d/ice.repo diff --git a/roles/ceph-mds/tasks/docker/pre_requisite.yml b/roles/ceph-mds/tasks/docker/pre_requisite.yml index 36765e2ef..71a03bd05 100644 --- a/roles/ceph-mds/tasks/docker/pre_requisite.yml +++ b/roles/ceph-mds/tasks/docker/pre_requisite.yml @@ -17,7 +17,17 @@ yum: name: python-pip state: present - when: ansible_os_family == 'RedHat' + when: + ansible_os_family == 'RedHat' and + ansible_pkg_mgr == "yum" + +- name: install pip on redhat + dnf: + name: python-pip + state: present + when: + ansible_os_family == 'RedHat' and + ansible_pkg_mgr == "dnf" # NOTE (leseb): for version 1.1.0 because https://github.com/ansible/ansible-modules-core/issues/1227 - name: install docker-py diff --git a/roles/ceph-mon/tasks/docker/pre_requisite.yml b/roles/ceph-mon/tasks/docker/pre_requisite.yml index 211e64ee3..c4fb42d02 100644 --- a/roles/ceph-mon/tasks/docker/pre_requisite.yml +++ b/roles/ceph-mon/tasks/docker/pre_requisite.yml @@ -19,7 +19,17 @@ yum: name: python-pip state: present - when: ansible_os_family == 'RedHat' + when: + ansible_os_family == 'RedHat' and + ansible_pkg_mgr == "yum" + +- name: install pip on redhat + dnf: + name: python-pip + state: present + when: + ansible_os_family == 'RedHat' and + ansible_pkg_mgr == "dnf" # NOTE (leseb): for version 1.1.0 because https://github.com/ansible/ansible-modules-core/issues/1227 - name: install docker-py diff --git a/roles/ceph-osd/tasks/docker/pre_requisite.yml b/roles/ceph-osd/tasks/docker/pre_requisite.yml index 00b995087..6797f6954 100644 --- a/roles/ceph-osd/tasks/docker/pre_requisite.yml +++ b/roles/ceph-osd/tasks/docker/pre_requisite.yml @@ -17,7 +17,17 @@ yum: name: python-pip state: present - when: ansible_os_family == 'RedHat' + when: + ansible_os_family == 'RedHat' and + ansible_pkg_mgr == "yum" + +- name: install pip on redhat + dnf: + name: python-pip + state: present + when: + ansible_os_family == 'RedHat' and + ansible_pkg_mgr == "dnf" # NOTE (leseb): for version 1.1.0 because https://github.com/ansible/ansible-modules-core/issues/1227 - name: install docker-py diff --git a/roles/ceph-restapi/tasks/docker/pre_requisite.yml b/roles/ceph-restapi/tasks/docker/pre_requisite.yml index d300ba57a..dd8b011ba 100644 --- a/roles/ceph-restapi/tasks/docker/pre_requisite.yml +++ b/roles/ceph-restapi/tasks/docker/pre_requisite.yml @@ -9,7 +9,17 @@ yum: name: python-pip state: present - when: ansible_os_family == 'RedHat' + when: + ansible_os_family == 'RedHat' and + ansible_pkg_mgr == "yum" + +- name: install pip on redhat + dnf: + name: python-pip + state: present + when: + ansible_os_family == 'RedHat' and + ansible_pkg_mgr == "dnf" # NOTE (leseb): for version 1.1.0 because https://github.com/ansible/ansible-modules-core/issues/1227 - name: install docker-py diff --git a/roles/ceph-rgw/tasks/docker/pre_requisite.yml b/roles/ceph-rgw/tasks/docker/pre_requisite.yml index ce84f6d72..2b322050e 100644 --- a/roles/ceph-rgw/tasks/docker/pre_requisite.yml +++ b/roles/ceph-rgw/tasks/docker/pre_requisite.yml @@ -17,7 +17,17 @@ yum: name: python-pip state: present - when: ansible_os_family == 'RedHat' + when: + ansible_os_family == 'RedHat' and + ansible_pkg_mgr == "yum" + +- name: install pip on redhat + dnf: + name: python-pip + state: present + when: + ansible_os_family == 'RedHat' and + ansible_pkg_mgr == "dnf" # NOTE (leseb): for version 1.1.0 because https://github.com/ansible/ansible-modules-core/issues/1227 - name: install docker-py