From feaf5ff9c6acf02f5b9f14e506bcee5839e8744d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Thu, 5 Oct 2017 18:33:17 +0200 Subject: [PATCH] common: iso install on Debian is supported by rhcs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also adds support for RCSH installation on Debian. Signed-off-by: Sébastien Han --- .../tasks/checks/check_mandatory_vars.yml | 11 ---- .../tasks/installs/debian_dev_repository.yml | 4 +- .../tasks/installs/debian_rhcs_repository.yml | 5 ++ .../prerequisite_rhcs_iso_install.yml | 16 +++--- .../prerequisite_rhcs_iso_install_debian.yml | 57 +++++++++++++++++++ 5 files changed, 72 insertions(+), 21 deletions(-) create mode 100644 roles/ceph-common/tasks/installs/prerequisite_rhcs_iso_install_debian.yml diff --git a/roles/ceph-common/tasks/checks/check_mandatory_vars.yml b/roles/ceph-common/tasks/checks/check_mandatory_vars.yml index fc5143c67..8186d008d 100644 --- a/roles/ceph-common/tasks/checks/check_mandatory_vars.yml +++ b/roles/ceph-common/tasks/checks/check_mandatory_vars.yml @@ -64,17 +64,6 @@ tags: - package-install -- name: verify that ceph_rhcs_cdn_debian_repo url is valid for red hat storage - fail: - msg: "iso installation is not supported by the Ceph Debian rhcs version" - when: - - ceph_origin == 'repository' - - ceph_repository == 'rhcs' - - ceph_repository_type == 'iso' - - ansible_os_family == 'Debian' - tags: - - package-install - - name: make sure monitor_interface or monitor_address is defined fail: msg: "you must set monitor_interface or monitor_address" diff --git a/roles/ceph-common/tasks/installs/debian_dev_repository.yml b/roles/ceph-common/tasks/installs/debian_dev_repository.yml index b19501e3a..c975540f7 100644 --- a/roles/ceph-common/tasks/installs/debian_dev_repository.yml +++ b/roles/ceph-common/tasks/installs/debian_dev_repository.yml @@ -16,7 +16,7 @@ url: https://shaman.ceph.com/api/repos/nfs-ganesha/next/latest/{{ ansible_distribution | lower }}/{{ ansible_distribution_release }}/flavors/{{ nfs_ganesha_flavor }}/repo return_content: yes register: nfs_ganesha_apt_repo - when: + when: - nfs_group_name in group_names - nfs_ganesha_dev @@ -27,7 +27,7 @@ owner: root group: root backup: yes - when: + when: - nfs_group_name in group_names - nfs_ganesha_dev diff --git a/roles/ceph-common/tasks/installs/debian_rhcs_repository.yml b/roles/ceph-common/tasks/installs/debian_rhcs_repository.yml index 9dcb0ba7a..5bf4418b2 100644 --- a/roles/ceph-common/tasks/installs/debian_rhcs_repository.yml +++ b/roles/ceph-common/tasks/installs/debian_rhcs_repository.yml @@ -1,4 +1,9 @@ --- +- name: include prerequisite_rhcs_iso_install_debian.yml + include: prerequisite_rhcs_iso_install_debian.yml + when: + - ceph_repository_type == 'iso' + - name: include prerequisite_rhcs_cdn_install_debian.yml include: prerequisite_rhcs_cdn_install_debian.yml when: 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 b8a20394e..d95bc66f5 100644 --- a/roles/ceph-common/tasks/installs/prerequisite_rhcs_iso_install.yml +++ b/roles/ceph-common/tasks/installs/prerequisite_rhcs_iso_install.yml @@ -1,5 +1,5 @@ --- -- name: create red hat storage package directories +- name: create red hat storage package directories for redhat systems file: path: "{{ item }}" state: directory @@ -7,7 +7,7 @@ - "{{ ceph_rhcs_mount_path }}" - "{{ ceph_rhcs_repository_path }}" -- name: ensure destination iso directory exists +- name: ensure destination iso directory exists for redhat systems file: path: "{{ ceph_rhcs_iso_path | dirname }}" state: directory @@ -15,14 +15,14 @@ when: - ceph_rhcs_iso_path | dirname != '/' -- name: fetch the red hat storage iso from the ansible server +- name: fetch the red hat storage iso from the ansible server for redhat systems copy: src: "{{ ceph_rhcs_iso_path }}" dest: "{{ ceph_rhcs_iso_path }}" # assumption: ceph_rhcs_mount_path does not specify directory -- name: mount red hat storage iso file +- name: mount red hat storage iso file for redhat systems mount: name: "{{ ceph_rhcs_mount_path }}" src: "{{ ceph_rhcs_iso_path }}" @@ -31,24 +31,24 @@ passno: 2 state: mounted -- name: copy red hat storage iso content +- name: copy red hat storage iso content for redhat systems shell: cp -r {{ ceph_rhcs_mount_path }}/* {{ ceph_rhcs_repository_path }} args: creates: "{{ ceph_rhcs_repository_path }}/README" -- name: unmount red hat storage iso file +- name: unmount red hat storage iso file for redhat systems mount: name: "{{ ceph_rhcs_mount_path }}" src: "{{ ceph_rhcs_iso_path }}" fstype: iso9660 state: unmounted -- name: install red hat storage repository key +- name: install red hat storage repository key for redhat systems rpm_key: key: "{{ ceph_rhcs_repository_path }}/RPM-GPG-KEY-redhat-release" state: present -- name: add red hat storage repository +- name: add red hat storage repository for redhat systems template: src: "{{ role_path }}/templates/redhat_storage_repo.j2" dest: /etc/yum.repos.d/rh_storage.repo diff --git a/roles/ceph-common/tasks/installs/prerequisite_rhcs_iso_install_debian.yml b/roles/ceph-common/tasks/installs/prerequisite_rhcs_iso_install_debian.yml new file mode 100644 index 000000000..1d35ab281 --- /dev/null +++ b/roles/ceph-common/tasks/installs/prerequisite_rhcs_iso_install_debian.yml @@ -0,0 +1,57 @@ +--- +- name: create red hat storage package directories for debian systems + file: + path: "{{ item }}" + state: directory + with_items: + - "{{ ceph_rhcs_mount_path }}" + - "{{ ceph_rhcs_repository_path }}" + +- name: ensure destination iso directory exists for debian systems + file: + path: "{{ ceph_rhcs_iso_path | dirname }}" + state: directory + recurse: yes + when: + - ceph_rhcs_iso_path | dirname != '/' + +- name: fetch the red hat storage iso from the ansible server for debian systems + copy: + src: "{{ ceph_rhcs_iso_path }}" + dest: "{{ ceph_rhcs_iso_path }}" + +# assumption: ceph_rhcs_mount_path does not specify directory + +- name: mount red hat storage iso file for debian systems + mount: + name: "{{ ceph_rhcs_mount_path }}" + src: "{{ ceph_rhcs_iso_path }}" + fstype: iso9660 + opts: ro,loop,noauto + passno: 2 + state: mounted + +- name: copy red hat storage iso content for debian systems + shell: cp -r {{ ceph_rhcs_mount_path }}/* {{ ceph_rhcs_repository_path }} + args: + creates: "{{ ceph_rhcs_repository_path }}/README" + +- name: unmount red hat storage iso file + mount: + name: "{{ ceph_rhcs_mount_path }}" + src: "{{ ceph_rhcs_iso_path }}" + fstype: iso9660 + state: unmounted + +- name: install red hat storage repository key for debian systems + apt_key: + file: "{{ ceph_rhcs_repository_path }}/RPM-GPG-KEY-redhat-release" + state: present + +- name: add red hat storage repository for debian systems + template: + src: "{{ role_path }}/templates/redhat_storage_repo.j2" + dest: /etc/apt/sources.list.d/rh_storage.list + owner: root + group: root + mode: 0644