From 7559a2deffe515726a95dca6c9ccb6ca1140b6f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Wed, 2 Aug 2017 15:13:06 +0200 Subject: [PATCH] common: automate setting up online repositories for ceph deployments on debian nodes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commits automates the process of setting up online repositories for Red Hat Ceph Storage on Debian nodes. The manual steps are currently described here: https://access.redhat.com/documentation/en-us/red_hat_ceph_storage/2/html/installation_guide_for_ubuntu/prerequisites#online_repositories If you are an RHCS customer and run a Debian based system you can now access package through the Red Hat CDN. For this set: ceph_rhcs and ceph_rhcs_cdn_install to true. Then set your customer credentials in ceph_rhcs_cdn_debian_repo. Replace customername:customerpasswd with your details. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1434175 Signed-off-by: Sébastien Han --- group_vars/all.yml.sample | 1 + .../tasks/checks/check_mandatory_vars.yml | 11 ++++++ .../installs/install_rh_storage_on_debian.yml | 36 ------------------- roles/ceph-common/tasks/main.yml | 22 ++++++++---- .../prerequisite_rhcs_cdn_install_debian.yml | 32 +++++++++++++++++ .../prerequisite_rhcs_iso_install.yml | 19 ++++++++++ roles/ceph-defaults/defaults/main.yml | 1 + 7 files changed, 80 insertions(+), 42 deletions(-) create mode 100644 roles/ceph-common/tasks/pre_requisites/prerequisite_rhcs_cdn_install_debian.yml diff --git a/group_vars/all.yml.sample b/group_vars/all.yml.sample index de54eca35..39b55edcc 100644 --- a/group_vars/all.yml.sample +++ b/group_vars/all.yml.sample @@ -159,6 +159,7 @@ dummy: # version. The previous version was 1.3. The current version is 2. #ceph_rhcs_version: "{{ ceph_stable_rh_storage_version | default(2) }}" #ceph_rhcs_cdn_install: "{{ ceph_stable_rh_storage_cdn_install | default(false) }}" # assumes all the nodes can connect to cdn.redhat.com +#ceph_rhcs_cdn_debian_repo: https://customername:customerpasswd@rhcs.download.redhat.com #ceph_rhcs_iso_install: "{{ ceph_stable_rh_storage_iso_install | default(false) }}" # usually used when nodes don't have access to cdn.redhat.com #ceph_rhcs_iso_path: "{{ ceph_stable_rh_storage_iso_path | default('') }}" #ceph_rhcs_mount_path: "{{ ceph_stable_rh_storage_mount_path | default('/tmp/rh-storage-mount') }}" diff --git a/roles/ceph-common/tasks/checks/check_mandatory_vars.yml b/roles/ceph-common/tasks/checks/check_mandatory_vars.yml index b4ef088f9..91c34e137 100644 --- a/roles/ceph-common/tasks/checks/check_mandatory_vars.yml +++ b/roles/ceph-common/tasks/checks/check_mandatory_vars.yml @@ -51,6 +51,17 @@ tags: - package-install +- name: verify that ceph_rhcs_cdn_debian_repo url is valid for red hat storage + fail: + msg: "ceph_rhcs_cdn_debian_repo url is invalid, please set your customername:customerpasswd" + when: + - ceph_rhcs + - ceph_rhcs_cdn_install + - ansible_os_family == 'Debian' + - ceph_rhcs_cdn_debian_repo == 'https://customername:customerpasswd@rhcs.download.redhat.com' + 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/install_rh_storage_on_debian.yml b/roles/ceph-common/tasks/installs/install_rh_storage_on_debian.yml index d90190e4b..1ec33a4f4 100644 --- a/roles/ceph-common/tasks/installs/install_rh_storage_on_debian.yml +++ b/roles/ceph-common/tasks/installs/install_rh_storage_on_debian.yml @@ -1,40 +1,4 @@ --- -# NOTE: this assumes that the ISO will always have a MON directory. Current -# ISOs have MON, OSD, Tools, and Agent. If ISOs change the layout or provide -# certain repos depending on the type of node this task will require a more -# intelligent way to determine the location of the key. -- name: install the red hat ceph storage repository key - apt_key: - file: "{{ ceph_rhcs_repository_path }}/MON/release.asc" - state: present - when: ceph_rhcs_iso_install - -- name: add red hat ceph storage repositories - apt_repository: - repo: "deb file://{{ ceph_rhcs_repository_path }}/{{ item }}/ {{ ansible_lsb.codename }} main" - state: present - changed_when: false - with_items: - - "MON" - - "OSD" - - "Tools" - - "Agent" - when: ceph_rhcs_iso_install - -- name: set apt pinning for red hat ceph storage - template: - src: "{{ role_path }}/templates/rhcs.pref.j2" - dest: /etc/apt/preferences.d/rhcs.pref - owner: root - group: root - mode: 0644 - -- name: add red hat storage apt-key - apt_key: - data: "{{ lookup('file', role_path+'/files/cephstablerhcs.asc') }}" - state: present - when: not ceph_rhcs_iso_install - - name: install dependencies apt: pkg: "{{ item }}" diff --git a/roles/ceph-common/tasks/main.yml b/roles/ceph-common/tasks/main.yml index 9c65a27bf..3cd402723 100644 --- a/roles/ceph-common/tasks/main.yml +++ b/roles/ceph-common/tasks/main.yml @@ -31,6 +31,16 @@ # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False +- include: ./pre_requisites/prerequisite_rhcs_cdn_install_debian.yml + when: + - ceph_rhcs + - ceph_rhcs_cdn_install + - ansible_os_family == "Debian" + tags: + - package-install + # 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 when: - ansible_os_family == 'RedHat' @@ -40,19 +50,19 @@ # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False -- include: ./installs/install_rh_storage_on_redhat.yml +- include: ./installs/install_on_debian.yml when: - - ansible_distribution == "RedHat" - - ceph_rhcs + - ansible_os_family == 'Debian' + - not ceph_rhcs tags: - package-install # 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 +- include: ./installs/install_rh_storage_on_redhat.yml when: - - ansible_os_family == 'Debian' - - not ceph_rhcs + - ceph_rhcs + - ansible_distribution == "RedHat" tags: - package-install # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) diff --git a/roles/ceph-common/tasks/pre_requisites/prerequisite_rhcs_cdn_install_debian.yml b/roles/ceph-common/tasks/pre_requisites/prerequisite_rhcs_cdn_install_debian.yml new file mode 100644 index 000000000..4df13beff --- /dev/null +++ b/roles/ceph-common/tasks/pre_requisites/prerequisite_rhcs_cdn_install_debian.yml @@ -0,0 +1,32 @@ +--- +- name: install red hat storage repository key for debian systems + apt_key: + data: "{{ lookup('file', role_path+'/files/cephstablerhcs.asc') }}" + state: present + +- name: enable red hat storage monitor repository for debian systems + apt_repository: + 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 + +- 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 + +- 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) + +- name: enable red hat storage agent repository for debian systems + apt_repository: + repo: "deb {{ ceph_rhcs_cdn_debian_repo }}/2-updates/Agent {{ ceph_stable_distro_source | default(ansible_lsb.codename) }} main" + state: present + changed_when: false diff --git a/roles/ceph-common/tasks/pre_requisites/prerequisite_rhcs_iso_install.yml b/roles/ceph-common/tasks/pre_requisites/prerequisite_rhcs_iso_install.yml index e589fec34..51ada8e58 100644 --- a/roles/ceph-common/tasks/pre_requisites/prerequisite_rhcs_iso_install.yml +++ b/roles/ceph-common/tasks/pre_requisites/prerequisite_rhcs_iso_install.yml @@ -41,3 +41,22 @@ src: "{{ ceph_rhcs_iso_path }}" fstype: iso9660 state: unmounted + +- name: install the red hat ceph storage repository key + apt_key: + file: "{{ ceph_rhcs_repository_path }}/MON/release.asc" + state: present + when: ceph_rhcs_iso_install + +- name: add red hat ceph storage repositories + apt_repository: + repo: "deb file://{{ ceph_rhcs_repository_path }}/{{ item }}/ {{ ansible_lsb.codename }} main" + state: present + changed_when: false + with_items: + - "MON" + - "OSD" + - "Tools" + - "Agent" + when: ceph_rhcs_iso_install + diff --git a/roles/ceph-defaults/defaults/main.yml b/roles/ceph-defaults/defaults/main.yml index 3a41ed5fb..2fbea9222 100644 --- a/roles/ceph-defaults/defaults/main.yml +++ b/roles/ceph-defaults/defaults/main.yml @@ -151,6 +151,7 @@ ceph_rhcs: "{{ ceph_stable_rh_storage | default(false) }}" # version. The previous version was 1.3. The current version is 2. ceph_rhcs_version: "{{ ceph_stable_rh_storage_version | default(2) }}" ceph_rhcs_cdn_install: "{{ ceph_stable_rh_storage_cdn_install | default(false) }}" # assumes all the nodes can connect to cdn.redhat.com +ceph_rhcs_cdn_debian_repo: https://customername:customerpasswd@rhcs.download.redhat.com ceph_rhcs_iso_install: "{{ ceph_stable_rh_storage_iso_install | default(false) }}" # usually used when nodes don't have access to cdn.redhat.com ceph_rhcs_iso_path: "{{ ceph_stable_rh_storage_iso_path | default('') }}" ceph_rhcs_mount_path: "{{ ceph_stable_rh_storage_mount_path | default('/tmp/rh-storage-mount') }}"