From e05824260d55df6494502b4f5f631cf0908d5ac8 Mon Sep 17 00:00:00 2001 From: markdhooper Date: Fri, 3 Dec 2021 16:42:50 -0400 Subject: [PATCH 01/27] updated generate-osd-vars.yml to use new -d argument for dedicated_devices --- generate-osd-vars.yml | 49 ++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/generate-osd-vars.yml b/generate-osd-vars.yml index 77255f5613..b223b28e74 100644 --- a/generate-osd-vars.yml +++ b/generate-osd-vars.yml @@ -1,34 +1,39 @@ --- - hosts: osds tasks: - - name: execute generate-osd-vars script - command: /usr/bin/bash /opt/45drives/tools/generate-osd-vars.sh - register: output - - - debug: - msg: "{{ output.stdout }}" - - local_action: file path=/usr/share/ceph-ansible/host_vars/ state=directory - when: not output.failed - - name: Check that inventory file exists + - name: Check that host inventory file exists local_action: stat path=/usr/share/ceph-ansible/host_vars/{{ inventory_hostname }}.yml register: stat_result - when: not output.failed - name: Create inventory file if it does not exist local_action: file path=/usr/share/ceph-ansible/host_vars/{{ inventory_hostname }}.yml state=touch - when: not output.failed and not stat_result.stat.exists + when: not stat_result.stat.exists + + - name: execute generate-osd-vars script with dedicated devices omitted + command: /usr/bin/bash /opt/45drives/tools/generate-osd-vars.sh -d "{% for ded_dev in hostvars[inventory_hostname].dedicated_devices -%}{{ ded_dev }}{% if not loop.last %},{% endif %}{%- endfor %}" + register: osd_vars_dedicated_devices + when: (dedicated_device_db|bool) and hostvars[inventory_hostname].dedicated_devices is defined and (hostvars[inventory_hostname].dedicated_devices|length>0) + + - debug: + msg: "{{ osd_vars_dedicated_devices.stdout }}" + when: osd_vars_dedicated_devices.stdout is defined + + - name: execute generate-osd-vars script + command: /usr/bin/bash /opt/45drives/tools/generate-osd-vars.sh + register: osd_vars_default + when: not dedicated_device_db|bool + + - debug: + msg: "{{ osd_vars_default.stdout }}" + when: osd_vars_default.stdout is defined + + - name: Put generate-osd-vars default output to host inventory files + local_action: blockinfile insertbefore=BOF dest=/usr/share/ceph-ansible/host_vars/{{ inventory_hostname }}.yml block={{ osd_vars_default.stdout }} marker="# {mark} ********** generate-osd-vars.sh output **********" + when: osd_vars_default.stdout is defined and not osd_vars_default.failed - - name: Append osd-vars output to host inventory files - local_action: blockinfile insertbefore=BOF dest=/usr/share/ceph-ansible/host_vars/{{ inventory_hostname }}.yml block={{ output.stdout }} marker="# {mark} ********** generate-osd-vars.sh output **********" - when: not output.failed + - name: Put generate-osd-vars output with dedicated_devices omitted to host inventory files + local_action: blockinfile insertbefore=BOF dest=/usr/share/ceph-ansible/host_vars/{{ inventory_hostname }}.yml block={{ osd_vars_dedicated_devices.stdout }} marker="# {mark} ********** generate-osd-vars.sh output **********" + when: osd_vars_dedicated_devices.stdout is defined and not osd_vars_dedicated_devices.failed -# - name: Check for existance of host inventory files for cockpit-ceph-deploy -# local_action: stat path=/usr/share/cockpit/ceph-deploy/ceph-ansible-files/{{ inventory_hostname }}.yml -# register: stat_cockpit_ceph_deploy_inventory -# when: not output.failed -# -# - name: Add in cockpit-ceph-deploy defined variables to host inventory files -# local_action: blockinfile insertafter=EOF dest=/usr/share/ceph-ansible/host_vars/{{ inventory_hostname }}.yml block={{ lookup('file','/usr/share/cockpit/ceph-deploy/ceph-ansible-files/{{ inventory_hostname }}.yml') }} marker="# {mark} ********** cockpit-ceph-deploy make_hosts output **********" -# when: not output.failed and stat_cockpit_ceph_deploy_inventory.stat.exists From 3e587058ba7c56a4d497df53623f9b21cca1f5e9 Mon Sep 17 00:00:00 2001 From: bkelly16 Date: Sun, 5 Dec 2021 15:12:17 -0400 Subject: [PATCH 02/27] added rocky offline repo tasks --- .../ceph-prerun/tasks/offline/repo_setup.yml | 6 +- .../tasks/offline/repo_setup_redhat.yml | 27 ++++++-- .../tasks/offline/repo_setup_ubuntu.yml | 64 ------------------- roles/ceph-prerun/vars/main.yml | 2 + 4 files changed, 30 insertions(+), 69 deletions(-) diff --git a/roles/ceph-prerun/tasks/offline/repo_setup.yml b/roles/ceph-prerun/tasks/offline/repo_setup.yml index 26ce6adc24..a6ab2a242b 100644 --- a/roles/ceph-prerun/tasks/offline/repo_setup.yml +++ b/roles/ceph-prerun/tasks/offline/repo_setup.yml @@ -2,7 +2,7 @@ ## Fail if repo-server IP is not set in group_vars - name: fail if offline_repo_server_ip fact is not set fail: - msg: "offline_repo_server_ip varible must be set in group_vars/all.yml when using offline repos" + msg: "offline_repo_server_ip varible must be set in group_vars/all.yml when offline_install is true" when: offline_repo_server_ip == "" - name: setup offline repos on redhat @@ -12,3 +12,7 @@ - name: setup offline repos on ubuntu include_tasks: offline/repo_setup_ubuntu.yml when: ansible_distribution == 'Ubuntu' + +- name: import container images + include_tasks: offline/import_container_images.yml + when: import_container_images | bool diff --git a/roles/ceph-prerun/tasks/offline/repo_setup_redhat.yml b/roles/ceph-prerun/tasks/offline/repo_setup_redhat.yml index fb23892398..7af05a0aaa 100644 --- a/roles/ceph-prerun/tasks/offline/repo_setup_redhat.yml +++ b/roles/ceph-prerun/tasks/offline/repo_setup_redhat.yml @@ -1,10 +1,29 @@ --- - name: disable active repos + block: + - name: get active repos + command: "/usr/bin/dnf repolist" + register: active_repos + + - name: show em to me + debug: + msg: "{{ active_repos }}" - name: place offline repo file on each node + template: + src: "Rocky-Offline.repo.j2" + dest: "/etc/yum.repos.d/Rocky-Offline.repo.j2" + owner: root + group: root + mode: 0644 -- name: install container packages on each node +- name: place GPG keys on each node + get_url: + url: http://{{ offline_repo_server_ip }}/keys/RPM-GPG-KEY-{{ item }} + dest: /etc/pki/rpm-gpg/RPM-GPG-KEY-{{ item }} + loop: + - 45drives + - ceph + - EPEL-8 + - zfsonlinux -- name: import node_exporter on each node - -- name: import metric container images on metrics node diff --git a/roles/ceph-prerun/tasks/offline/repo_setup_ubuntu.yml b/roles/ceph-prerun/tasks/offline/repo_setup_ubuntu.yml index aa4d9df993..0e46cc179f 100644 --- a/roles/ceph-prerun/tasks/offline/repo_setup_ubuntu.yml +++ b/roles/ceph-prerun/tasks/offline/repo_setup_ubuntu.yml @@ -49,67 +49,3 @@ - name: update apt cache apt: update_cache: yes - -- name: install container packages on each node - block: - - name: check if it is Atomic host - stat: path=/run/ostree-booted - register: stat_ostree - check_mode: no - - - name: set_fact is_atomic - set_fact: - is_atomic: '{{ stat_ostree.stat.exists }}' - tags: always - - import_role: - name: ceph-container-engine - -- name: Inspect node_exporter local image - docker_image_info: - name: - - prom/node-exporter:v0.17.0 - register: node_exporter_result - -- name: Pull down and import node_exporter image if not present already - block: - - name: Pull down node_exporter image - get_url: - url: http://{{ offline_repo_server_ip }}/images/node-exporter-v0.17.0.tar - dest: /tmp/node-exporter-v0.17.0.tar - - - name: Import node_exporter if not present already - shell: "/usr/bin/docker load -i /tmp/node-exporter-v0.17.0.tar" - - - name: remove node-exporter image tar - file: - path: /tmp/node-exporter-v0.17.0.tar - state: absent - when: node_exporter_result.images | length == 0 - -- name: Inspect metrics node for local docker images - docker_image_info: - name: - - localhost/grafana-offline:5.4.2 - - prom/alertmanager:v0.16.2 - - prom/prometheus:v2.7.2 - register: metric_images_result - -- name: Pull down and import metric stack images if not present already - block: - - name: Pull down node_exporter image - get_url: - url: http://{{ offline_repo_server_ip }}/images/{{ item }} - dest: /tmp/{{ item }} - loop: "{{ metric_docker_images|flatten(levels=1) }}" - - - name: Import node_exporter if not present already - shell: "/usr/bin/docker load -i /tmp/{{ item }}" - loop: "{{ metric_docker_images|flatten(levels=1) }}" - - - name: remove node-exporter image tar - file: - path: /tmp/{{ item }} - state: absent - loop: "{{ metric_docker_images|flatten(levels=1) }}" - delegate_to: "{{ groups[grafana_server_group_name][0] }}" - when: metric_images_result.images | length != 3 diff --git a/roles/ceph-prerun/vars/main.yml b/roles/ceph-prerun/vars/main.yml index 2558465270..1a59e547d0 100644 --- a/roles/ceph-prerun/vars/main.yml +++ b/roles/ceph-prerun/vars/main.yml @@ -1,4 +1,6 @@ --- +import_container_images: true + ubuntu_install_pkgs: - "45drives-tools" - "python3-docker" From a2c6acd86300eebf04ad61e7ee99b6a0feb15e4e Mon Sep 17 00:00:00 2001 From: bkelly16 Date: Sun, 5 Dec 2021 15:13:45 -0400 Subject: [PATCH 03/27] update --- .../tasks/offline/import_container_images.yml | 64 +++++++++++++ .../templates/Rocky-Offline.repo.j2 | 95 +++++++++++++++++++ 2 files changed, 159 insertions(+) create mode 100644 roles/ceph-prerun/tasks/offline/import_container_images.yml create mode 100644 roles/ceph-prerun/templates/Rocky-Offline.repo.j2 diff --git a/roles/ceph-prerun/tasks/offline/import_container_images.yml b/roles/ceph-prerun/tasks/offline/import_container_images.yml new file mode 100644 index 0000000000..b0a9e8a8f3 --- /dev/null +++ b/roles/ceph-prerun/tasks/offline/import_container_images.yml @@ -0,0 +1,64 @@ +--- +- name: install container packages on each node + block: + - name: check if it is Atomic host + stat: path=/run/ostree-booted + register: stat_ostree + check_mode: no + + - name: set_fact is_atomic + set_fact: + is_atomic: '{{ stat_ostree.stat.exists }}' + tags: always + - import_role: + name: ceph-container-engine + +- name: Inspect node_exporter local image + docker_image_info: + name: + - prom/node-exporter:v0.17.0 + register: node_exporter_result + +- name: Pull down and import node_exporter image if not present already + block: + - name: Pull down node_exporter image + get_url: + url: http://{{ offline_repo_server_ip }}/images/node-exporter-v0.17.0.tar + dest: /tmp/node-exporter-v0.17.0.tar + + - name: Import node_exporter if not present already + shell: "/usr/bin/docker load -i /tmp/node-exporter-v0.17.0.tar" + + - name: remove node-exporter image tar + file: + path: /tmp/node-exporter-v0.17.0.tar + state: absent + when: node_exporter_result.images | length == 0 + +- name: Inspect metrics node for local docker images + docker_image_info: + name: + - localhost/grafana-offline:5.4.2 + - prom/alertmanager:v0.16.2 + - prom/prometheus:v2.7.2 + register: metric_images_result + +- name: Pull down and import metric stack images if not present already + block: + - name: Pull down node_exporter image + get_url: + url: http://{{ offline_repo_server_ip }}/images/{{ item }} + dest: /tmp/{{ item }} + loop: "{{ metric_docker_images|flatten(levels=1) }}" + + - name: Import node_exporter if not present already + shell: "/usr/bin/docker load -i /tmp/{{ item }}" + loop: "{{ metric_docker_images|flatten(levels=1) }}" + + - name: remove node-exporter image tar + file: + path: /tmp/{{ item }} + state: absent + loop: "{{ metric_docker_images|flatten(levels=1) }}" + delegate_to: "{{ groups[grafana_server_group_name][0] }}" + when: metric_images_result.images | length != 3 diff --git a/roles/ceph-prerun/templates/Rocky-Offline.repo.j2 b/roles/ceph-prerun/templates/Rocky-Offline.repo.j2 new file mode 100644 index 0000000000..1166aac8ca --- /dev/null +++ b/roles/ceph-prerun/templates/Rocky-Offline.repo.j2 @@ -0,0 +1,95 @@ +### 45DRIVES +[45drives-stable-local] +enabled = 1 +priority = 1 +gpgcheck = 1 +repo_gpgcheck = 1 +baseurl = http://{{ offline_repo_server_ip }}/packages/45drives_stable +gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-45drives +name = 45Drives EL8 Stable + +### CEPH +[ceph-iscsi-local] +name=ceph-iscsi noarch packages +baseurl=http://{{ offline_repo_server_ip }}/packages/ceph-iscsi +enabled=1 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ceph +type=rpm-md + +[ceph-stable-local] +baseurl = http://{{ offline_repo_server_ip }}/packages/ceph_stable +gpgcheck = 1 +gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ceph +name = Ceph Stable $basearch repo +priority = 2 + +[ceph-stable-noarch-local] +baseurl = http://{{ offline_repo_server_ip }}/packages/ceph_stable_noarch +gpgcheck = 1 +gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ceph +name = Ceph Stable noarch repo +priority = 2 + +### EPEL +[epel-local] +name=Extra Packages for Enterprise Linux $releasever - $basearch +baseurl=http://{{ offline_repo_server_ip }}/packages/epel +enabled=1 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8 +exclude=epel-release* + +[epel-modular-local] +name=Extra Packages for Enterprise Linux Modular $releasever - $basearch +baseurl=http://{{ offline_repo_server_ip }}/packages/epel-modular +enabled=1 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8 + +### ROCKY OFFICIAL +[appstream-local] +name=Rocky Linux $releasever - AppStream +baseurl=http://{{ offline_repo_server_ip }}/packages/appstream +gpgcheck=1 +enabled=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial + +[baseos-local] +name=Rocky Linux $releasever - BaseOS +baseurl=http://{{ offline_repo_server_ip }}/packages/baseos +gpgcheck=1 +enabled=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial + +[extras-local] +name=Rocky Linux $releasever - Extras +baseurl=http://{{ offline_repo_server_ip }}/packages/extras +gpgcheck=1 +enabled=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial +exclude=epel-release* + +### HIGH AVAILABILITY +[ha-local] +name=Rocky Linux $releasever - HighAvailability +baseurl=http://{{ offline_repo_server_ip }}/packages/ha +gpgcheck=1 +enabled=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial + +### POWER TOOLS +[powertools-local] +name=Rocky Linux $releasever - PowerTools +baseurl=http://{{ offline_repo_server_ip }}/packages/powertools +gpgcheck=1 +enabled=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial + +### ZFS +[zfs-local] +name=ZFS on Linux for EL8 - dkms +baseurl=http://{{ offline_repo_server_ip }}/packages/zfs +enabled=1 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-zfsonlinux From 32163bf1ee4cb001c0f0ee5be59cf34be657a454 Mon Sep 17 00:00:00 2001 From: bkelly16 Date: Mon, 6 Dec 2021 10:47:17 -0400 Subject: [PATCH 04/27] update --- roles/ceph-prerun/tasks/offline/repo_setup_redhat.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/ceph-prerun/tasks/offline/repo_setup_redhat.yml b/roles/ceph-prerun/tasks/offline/repo_setup_redhat.yml index 7af05a0aaa..2276127f47 100644 --- a/roles/ceph-prerun/tasks/offline/repo_setup_redhat.yml +++ b/roles/ceph-prerun/tasks/offline/repo_setup_redhat.yml @@ -2,12 +2,12 @@ - name: disable active repos block: - name: get active repos - command: "/usr/bin/dnf repolist" + shell: "dnf repolist --enabled | awk 'NR>1{print $1}'" register: active_repos - - name: show em to me - debug: - msg: "{{ active_repos }}" + - name: disable active repos + command: "dnf config-manager --set-disabled {{ item }}" + loop: "{{ active_repos.stdout_lines }}" - name: place offline repo file on each node template: From ca182d9ab2eacae4aa788f96f96be4bfeb3fe9d3 Mon Sep 17 00:00:00 2001 From: bkelly16 Date: Mon, 6 Dec 2021 11:23:39 -0400 Subject: [PATCH 05/27] cleanup tmeplate repo file --- roles/ceph-prerun/templates/Rocky-Offline.repo.j2 | 7 ------- 1 file changed, 7 deletions(-) diff --git a/roles/ceph-prerun/templates/Rocky-Offline.repo.j2 b/roles/ceph-prerun/templates/Rocky-Offline.repo.j2 index 1166aac8ca..84e43863b2 100644 --- a/roles/ceph-prerun/templates/Rocky-Offline.repo.j2 +++ b/roles/ceph-prerun/templates/Rocky-Offline.repo.j2 @@ -1,4 +1,3 @@ -### 45DRIVES [45drives-stable-local] enabled = 1 priority = 1 @@ -8,7 +7,6 @@ baseurl = http://{{ offline_repo_server_ip }}/packages/45drives_stable gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-45drives name = 45Drives EL8 Stable -### CEPH [ceph-iscsi-local] name=ceph-iscsi noarch packages baseurl=http://{{ offline_repo_server_ip }}/packages/ceph-iscsi @@ -31,7 +29,6 @@ gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ceph name = Ceph Stable noarch repo priority = 2 -### EPEL [epel-local] name=Extra Packages for Enterprise Linux $releasever - $basearch baseurl=http://{{ offline_repo_server_ip }}/packages/epel @@ -47,7 +44,6 @@ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8 -### ROCKY OFFICIAL [appstream-local] name=Rocky Linux $releasever - AppStream baseurl=http://{{ offline_repo_server_ip }}/packages/appstream @@ -70,7 +66,6 @@ enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial exclude=epel-release* -### HIGH AVAILABILITY [ha-local] name=Rocky Linux $releasever - HighAvailability baseurl=http://{{ offline_repo_server_ip }}/packages/ha @@ -78,7 +73,6 @@ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial -### POWER TOOLS [powertools-local] name=Rocky Linux $releasever - PowerTools baseurl=http://{{ offline_repo_server_ip }}/packages/powertools @@ -86,7 +80,6 @@ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial -### ZFS [zfs-local] name=ZFS on Linux for EL8 - dkms baseurl=http://{{ offline_repo_server_ip }}/packages/zfs From edee90ed81fc1a1a3582f43b23190bd2e4993a82 Mon Sep 17 00:00:00 2001 From: bkelly16 Date: Mon, 6 Dec 2021 11:25:12 -0400 Subject: [PATCH 06/27] fixed wrong path name for .repo file --- roles/ceph-prerun/tasks/offline/repo_setup_redhat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/ceph-prerun/tasks/offline/repo_setup_redhat.yml b/roles/ceph-prerun/tasks/offline/repo_setup_redhat.yml index 2276127f47..98b23b657e 100644 --- a/roles/ceph-prerun/tasks/offline/repo_setup_redhat.yml +++ b/roles/ceph-prerun/tasks/offline/repo_setup_redhat.yml @@ -12,7 +12,7 @@ - name: place offline repo file on each node template: src: "Rocky-Offline.repo.j2" - dest: "/etc/yum.repos.d/Rocky-Offline.repo.j2" + dest: "/etc/yum.repos.d/Rocky-Offline.repo" owner: root group: root mode: 0644 From a7c6b17a495c6073929a29225055153bebc85b98 Mon Sep 17 00:00:00 2001 From: bkelly16 Date: Mon, 6 Dec 2021 11:56:07 -0400 Subject: [PATCH 07/27] added separate container image import for docker and podman --- .../tasks/offline/import_container_images.yml | 53 +++---------------- .../import_container_images_docker.yml | 52 ++++++++++++++++++ .../import_container_images_podman.yml | 52 ++++++++++++++++++ roles/ceph-prerun/vars/main.yml | 2 +- 4 files changed, 111 insertions(+), 48 deletions(-) create mode 100644 roles/ceph-prerun/tasks/offline/import_container_images_docker.yml create mode 100644 roles/ceph-prerun/tasks/offline/import_container_images_podman.yml diff --git a/roles/ceph-prerun/tasks/offline/import_container_images.yml b/roles/ceph-prerun/tasks/offline/import_container_images.yml index b0a9e8a8f3..73ba55126e 100644 --- a/roles/ceph-prerun/tasks/offline/import_container_images.yml +++ b/roles/ceph-prerun/tasks/offline/import_container_images.yml @@ -13,52 +13,11 @@ - import_role: name: ceph-container-engine -- name: Inspect node_exporter local image - docker_image_info: - name: - - prom/node-exporter:v0.17.0 - register: node_exporter_result +- name: import container images w. podman + include_tasks: offline/import_container_images_podman.yml + when: "{{ container_service_name }}" == "podman" -- name: Pull down and import node_exporter image if not present already - block: - - name: Pull down node_exporter image - get_url: - url: http://{{ offline_repo_server_ip }}/images/node-exporter-v0.17.0.tar - dest: /tmp/node-exporter-v0.17.0.tar - - - name: Import node_exporter if not present already - shell: "/usr/bin/docker load -i /tmp/node-exporter-v0.17.0.tar" - - - name: remove node-exporter image tar - file: - path: /tmp/node-exporter-v0.17.0.tar - state: absent - when: node_exporter_result.images | length == 0 - -- name: Inspect metrics node for local docker images - docker_image_info: - name: - - localhost/grafana-offline:5.4.2 - - prom/alertmanager:v0.16.2 - - prom/prometheus:v2.7.2 - register: metric_images_result - -- name: Pull down and import metric stack images if not present already - block: - - name: Pull down node_exporter image - get_url: - url: http://{{ offline_repo_server_ip }}/images/{{ item }} - dest: /tmp/{{ item }} - loop: "{{ metric_docker_images|flatten(levels=1) }}" - - - name: Import node_exporter if not present already - shell: "/usr/bin/docker load -i /tmp/{{ item }}" - loop: "{{ metric_docker_images|flatten(levels=1) }}" +- name: import container images w. docker + include_tasks: offline/import_container_images_podman.yml + when: "{{ container_service_name }}" == "docker" - - name: remove node-exporter image tar - file: - path: /tmp/{{ item }} - state: absent - loop: "{{ metric_docker_images|flatten(levels=1) }}" - delegate_to: "{{ groups[grafana_server_group_name][0] }}" - when: metric_images_result.images | length != 3 diff --git a/roles/ceph-prerun/tasks/offline/import_container_images_docker.yml b/roles/ceph-prerun/tasks/offline/import_container_images_docker.yml new file mode 100644 index 0000000000..5b31f6e78c --- /dev/null +++ b/roles/ceph-prerun/tasks/offline/import_container_images_docker.yml @@ -0,0 +1,52 @@ +--- +- name: Inspect node_exporter local image + docker_image_info: + name: + - prom/node-exporter:v0.17.0 + register: node_exporter_result + +- name: Pull down and import node_exporter image if not present already + block: + - name: Pull down node_exporter image + get_url: + url: http://{{ offline_repo_server_ip }}/images/node-exporter-v0.17.0.tar + dest: /tmp/node-exporter-v0.17.0.tar + + - name: Import node_exporter if not present already + docker_image_load: + path: /tmp/node-exporter-v0.17.0.tar + + - name: remove node-exporter image tar + file: + path: /tmp/node-exporter-v0.17.0.tar + state: absent + when: node_exporter_result.images | length == 0 + +- name: Inspect metrics node for local docker images + docker_image_info: + name: + - localhost/grafana-offline:5.4.2 + - prom/alertmanager:v0.16.2 + - prom/prometheus:v2.7.2 + register: metric_images_result + +- name: Pull down and import metric stack images if not present already + block: + - name: Pull down node_exporter image + get_url: + url: http://{{ offline_repo_server_ip }}/images/{{ item }} + dest: /tmp/{{ item }} + loop: "{{ metric_container_images|flatten(levels=1) }}" + + - name: Import node_exporter if not present already + docker_image_load: + path: /tmp/{{ item }} + loop: "{{ metric_container_images|flatten(levels=1) }}" + + - name: remove node-exporter image tar + file: + path: /tmp/{{ item }} + state: absent + loop: "{{ metric_container_images|flatten(levels=1) }}" + delegate_to: "{{ groups[grafana_server_group_name][0] }}" + when: metric_images_result.images | length != 3 diff --git a/roles/ceph-prerun/tasks/offline/import_container_images_podman.yml b/roles/ceph-prerun/tasks/offline/import_container_images_podman.yml new file mode 100644 index 0000000000..55b8f491cd --- /dev/null +++ b/roles/ceph-prerun/tasks/offline/import_container_images_podman.yml @@ -0,0 +1,52 @@ +--- +- name: Inspect node_exporter local image + podman_image_info: + name: + - prom/node-exporter:v0.17.0 + register: node_exporter_result + +- name: Pull down and import node_exporter image if not present already + block: + - name: Pull down node_exporter image + get_url: + url: http://{{ offline_repo_server_ip }}/images/node-exporter-v0.17.0.tar + dest: /tmp/node-exporter-v0.17.0.tar + + - name: Import node_exporter if not present already + podman_load: + - input: /tmp/node-exporter-v0.17.0.tar + + - name: remove node-exporter image tar + file: + path: /tmp/node-exporter-v0.17.0.tar + state: absent + when: node_exporter_result.images | length == 0 + +- name: Inspect metrics node for local docker images + podman_image_info: + name: + - localhost/grafana-offline:5.4.2 + - prom/alertmanager:v0.16.2 + - prom/prometheus:v2.7.2 + register: metric_images_result + +- name: Pull down and import metric stack images if not present already + block: + - name: Pull down node_exporter image + get_url: + url: http://{{ offline_repo_server_ip }}/images/{{ item }} + dest: /tmp/{{ item }} + loop: "{{ metric_docker_images|flatten(levels=1) }}" + + - name: Import node_exporter if not present already + podman_load: + - input: /tmp/{{ item }} + loop: "{{ metric_docker_images|flatten(levels=1) }}" + + - name: remove node-exporter image tar + file: + path: /tmp/{{ item }} + state: absent + loop: "{{ metric_docker_images|flatten(levels=1) }}" + delegate_to: "{{ groups[grafana_server_group_name][0] }}" + when: metric_images_result.images | length != 3 diff --git a/roles/ceph-prerun/vars/main.yml b/roles/ceph-prerun/vars/main.yml index 1a59e547d0..26c7e0f23c 100644 --- a/roles/ceph-prerun/vars/main.yml +++ b/roles/ceph-prerun/vars/main.yml @@ -31,7 +31,7 @@ rocky_cleanup_pkgs: - "cockpit-zfs-manager" - "cockpit-machines" -metric_docker_images: +metric_container_images: - "alertmanager-v0.16.2.tar" - "grafana-v5.4.2.tar" - "prometheus-v2.7.2.tar" From 05bdd081d36dbc6c6c7a92e380acf4c4177e0989 Mon Sep 17 00:00:00 2001 From: bkelly16 Date: Mon, 6 Dec 2021 12:04:02 -0400 Subject: [PATCH 08/27] use container varibles for prerun --- roles/ceph-prerun/tasks/offline/import_container_images.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/roles/ceph-prerun/tasks/offline/import_container_images.yml b/roles/ceph-prerun/tasks/offline/import_container_images.yml index 73ba55126e..7b249eea77 100644 --- a/roles/ceph-prerun/tasks/offline/import_container_images.yml +++ b/roles/ceph-prerun/tasks/offline/import_container_images.yml @@ -13,6 +13,12 @@ - import_role: name: ceph-container-engine +- name: include specific variables + include_vars: "../../ceph-container-engine/vars/{{ item }}" + with_first_found: + - "{{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_major_version'] }}.yml" + - "{{ ansible_facts['os_family'] }}.yml" + - name: import container images w. podman include_tasks: offline/import_container_images_podman.yml when: "{{ container_service_name }}" == "podman" From a58764c9e145da88a6af426ca3bd8d08636adfd7 Mon Sep 17 00:00:00 2001 From: bkelly16 Date: Mon, 6 Dec 2021 12:05:41 -0400 Subject: [PATCH 09/27] update --- .../ceph-prerun/tasks/offline/import_container_images.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/roles/ceph-prerun/tasks/offline/import_container_images.yml b/roles/ceph-prerun/tasks/offline/import_container_images.yml index 7b249eea77..a3028b5097 100644 --- a/roles/ceph-prerun/tasks/offline/import_container_images.yml +++ b/roles/ceph-prerun/tasks/offline/import_container_images.yml @@ -19,11 +19,7 @@ - "{{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_major_version'] }}.yml" - "{{ ansible_facts['os_family'] }}.yml" -- name: import container images w. podman - include_tasks: offline/import_container_images_podman.yml - when: "{{ container_service_name }}" == "podman" +- name: import container images + include_tasks: offline/import_container_images_{{ container_service_name }}.yml -- name: import container images w. docker - include_tasks: offline/import_container_images_podman.yml - when: "{{ container_service_name }}" == "docker" From c67fe162598458500f39f589e863d0c88fb255a2 Mon Sep 17 00:00:00 2001 From: bkelly16 Date: Mon, 6 Dec 2021 12:08:07 -0400 Subject: [PATCH 10/27] update --- roles/ceph-prerun/tasks/offline/import_container_images.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/ceph-prerun/tasks/offline/import_container_images.yml b/roles/ceph-prerun/tasks/offline/import_container_images.yml index a3028b5097..6f43f3f536 100644 --- a/roles/ceph-prerun/tasks/offline/import_container_images.yml +++ b/roles/ceph-prerun/tasks/offline/import_container_images.yml @@ -14,7 +14,7 @@ name: ceph-container-engine - name: include specific variables - include_vars: "../../ceph-container-engine/vars/{{ item }}" + include_vars: "../../../ceph-container-engine/vars/{{ item }}" with_first_found: - "{{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_major_version'] }}.yml" - "{{ ansible_facts['os_family'] }}.yml" From 9977c4a474ed9bb1aa940a349ec194a84a613dda Mon Sep 17 00:00:00 2001 From: bkelly16 Date: Mon, 6 Dec 2021 17:08:07 -0400 Subject: [PATCH 11/27] import container vars --- .../ceph-prerun/tasks/offline/import_container_images.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/roles/ceph-prerun/tasks/offline/import_container_images.yml b/roles/ceph-prerun/tasks/offline/import_container_images.yml index 6f43f3f536..f7dcb7f6a0 100644 --- a/roles/ceph-prerun/tasks/offline/import_container_images.yml +++ b/roles/ceph-prerun/tasks/offline/import_container_images.yml @@ -14,12 +14,7 @@ name: ceph-container-engine - name: include specific variables - include_vars: "../../../ceph-container-engine/vars/{{ item }}" - with_first_found: - - "{{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_major_version'] }}.yml" - - "{{ ansible_facts['os_family'] }}.yml" + include_vars: "../../../ceph-container-engine/vars/{{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_major_version'] }}.yml" - name: import container images include_tasks: offline/import_container_images_{{ container_service_name }}.yml - - From f70c814750b74555bbe6dc0d104cb5af110818f6 Mon Sep 17 00:00:00 2001 From: bkelly16 Date: Mon, 6 Dec 2021 19:14:53 -0400 Subject: [PATCH 12/27] remove task opening firewalld for offline repo server --- roles/ceph-infra/tasks/configure_firewall.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/roles/ceph-infra/tasks/configure_firewall.yml b/roles/ceph-infra/tasks/configure_firewall.yml index 5f45bfd6d8..c7972518dc 100644 --- a/roles/ceph-infra/tasks/configure_firewall.yml +++ b/roles/ceph-infra/tasks/configure_firewall.yml @@ -322,16 +322,6 @@ - rgwloadbalancer_group_name is defined - rgwloadbalancer_group_name in group_names - - name: open http port for offline reposerver - firewalld: - port: "80/tcp" - zone: "{{ ceph_mon_firewall_zone }}" - permanent: true - immediate: true - state: enabled - when: - - offline_install | bool - - name: add rich rule for keepalived vrrp firewalld: rich_rule: 'rule protocol value="vrrp" accept' From 3e8dae89a09ce2b7bd14c52d63a63e3f785cc698 Mon Sep 17 00:00:00 2001 From: bkelly16 Date: Mon, 6 Dec 2021 19:16:20 -0400 Subject: [PATCH 13/27] use shell task to import container images --- .../offline/import_container_images_podman.yml | 14 ++++++-------- roles/ceph-prerun/vars/main.yml | 8 ++++---- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/roles/ceph-prerun/tasks/offline/import_container_images_podman.yml b/roles/ceph-prerun/tasks/offline/import_container_images_podman.yml index 55b8f491cd..23caf51edb 100644 --- a/roles/ceph-prerun/tasks/offline/import_container_images_podman.yml +++ b/roles/ceph-prerun/tasks/offline/import_container_images_podman.yml @@ -13,8 +13,7 @@ dest: /tmp/node-exporter-v0.17.0.tar - name: Import node_exporter if not present already - podman_load: - - input: /tmp/node-exporter-v0.17.0.tar + shell: "/usr/bin/podman load -i /tmp/node-exporter-v0.17.0.tar" - name: remove node-exporter image tar file: @@ -22,7 +21,7 @@ state: absent when: node_exporter_result.images | length == 0 -- name: Inspect metrics node for local docker images +- name: Inspect metrics node for local container images podman_image_info: name: - localhost/grafana-offline:5.4.2 @@ -36,17 +35,16 @@ get_url: url: http://{{ offline_repo_server_ip }}/images/{{ item }} dest: /tmp/{{ item }} - loop: "{{ metric_docker_images|flatten(levels=1) }}" + loop: "{{ metric_container_images|flatten(levels=1) }}" - name: Import node_exporter if not present already - podman_load: - - input: /tmp/{{ item }} - loop: "{{ metric_docker_images|flatten(levels=1) }}" + shell: "/usr/bin/podman load -i /tmp/{{ item }}" + loop: "{{ metric_container_images|flatten(levels=1) }}" - name: remove node-exporter image tar file: path: /tmp/{{ item }} state: absent - loop: "{{ metric_docker_images|flatten(levels=1) }}" + loop: "{{ metric_container_images|flatten(levels=1) }}" delegate_to: "{{ groups[grafana_server_group_name][0] }}" when: metric_images_result.images | length != 3 diff --git a/roles/ceph-prerun/vars/main.yml b/roles/ceph-prerun/vars/main.yml index 26c7e0f23c..fee5ea037e 100644 --- a/roles/ceph-prerun/vars/main.yml +++ b/roles/ceph-prerun/vars/main.yml @@ -1,5 +1,9 @@ --- import_container_images: true +metric_container_images: + - "alertmanager-v0.16.2.tar" + - "grafana-v5.4.2.tar" + - "prometheus-v2.7.2.tar" ubuntu_install_pkgs: - "45drives-tools" @@ -31,9 +35,5 @@ rocky_cleanup_pkgs: - "cockpit-zfs-manager" - "cockpit-machines" -metric_container_images: - - "alertmanager-v0.16.2.tar" - - "grafana-v5.4.2.tar" - - "prometheus-v2.7.2.tar" From 6557c423808b2f063fae8a14f947409028d8cfe1 Mon Sep 17 00:00:00 2001 From: bkelly16 Date: Tue, 7 Dec 2021 10:56:42 -0400 Subject: [PATCH 14/27] default to first ipv4 address if ansible_default_ipv4 undefined --- roles/ceph-smb/templates/etc/ctdb/nodes.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/ceph-smb/templates/etc/ctdb/nodes.j2 b/roles/ceph-smb/templates/etc/ctdb/nodes.j2 index 8faa54352d..dd533c46e5 100644 --- a/roles/ceph-smb/templates/etc/ctdb/nodes.j2 +++ b/roles/ceph-smb/templates/etc/ctdb/nodes.j2 @@ -1,3 +1,3 @@ {% for host in groups['smbs'] %} -{{ hostvars[host]['ansible_default_ipv4']['address']}} +{{ hostvars[host]['ansible_default_ipv4']['address']|default(hostvars[host]['ansible_all_ipv4_addresses'][0])}} {% endfor %} From 8f75c363834382bdae00576493d8f65b3f84d9b7 Mon Sep 17 00:00:00 2001 From: bkelly16 Date: Tue, 7 Dec 2021 12:43:22 -0400 Subject: [PATCH 15/27] do not configure nfs-ganesha repos when offline_install is true --- roles/ceph-nfs/tasks/pre_requisite_non_container_debian.yml | 1 + roles/ceph-nfs/tasks/pre_requisite_non_container_red_hat.yml | 1 + roles/ceph-nfs/tasks/pre_requisite_non_container_ubuntu.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/roles/ceph-nfs/tasks/pre_requisite_non_container_debian.yml b/roles/ceph-nfs/tasks/pre_requisite_non_container_debian.yml index 403971aa23..04ebaac678 100644 --- a/roles/ceph-nfs/tasks/pre_requisite_non_container_debian.yml +++ b/roles/ceph-nfs/tasks/pre_requisite_non_container_debian.yml @@ -41,6 +41,7 @@ owner: root group: root backup: yes + when: not offline_install - name: debain based systems - install required packages block: diff --git a/roles/ceph-nfs/tasks/pre_requisite_non_container_red_hat.yml b/roles/ceph-nfs/tasks/pre_requisite_non_container_red_hat.yml index 1829e6d51b..4944578551 100644 --- a/roles/ceph-nfs/tasks/pre_requisite_non_container_red_hat.yml +++ b/roles/ceph-nfs/tasks/pre_requisite_non_container_red_hat.yml @@ -37,6 +37,7 @@ when: - nfs_ganesha_dev | bool - ceph_repository == 'dev' + when: not offline_install - name: red hat based systems - install nfs packages block: diff --git a/roles/ceph-nfs/tasks/pre_requisite_non_container_ubuntu.yml b/roles/ceph-nfs/tasks/pre_requisite_non_container_ubuntu.yml index ef65622c84..4224e90640 100644 --- a/roles/ceph-nfs/tasks/pre_requisite_non_container_ubuntu.yml +++ b/roles/ceph-nfs/tasks/pre_requisite_non_container_ubuntu.yml @@ -34,6 +34,7 @@ delay: 2 until: update_libntirpc_apt_cache is success when: add_libntirpc_apt_repo is changed + when: not offline_install - name: ubuntu systems - install nfs packages From 34caac6b695155c55de352f5a18ca846ce2a38f2 Mon Sep 17 00:00:00 2001 From: bkelly16 Date: Tue, 7 Dec 2021 14:22:10 -0400 Subject: [PATCH 16/27] added missing nfs_ganesha entry to rocky offline repo template --- roles/ceph-prerun/templates/Rocky-Offline.repo.j2 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/roles/ceph-prerun/templates/Rocky-Offline.repo.j2 b/roles/ceph-prerun/templates/Rocky-Offline.repo.j2 index 84e43863b2..003f8066a3 100644 --- a/roles/ceph-prerun/templates/Rocky-Offline.repo.j2 +++ b/roles/ceph-prerun/templates/Rocky-Offline.repo.j2 @@ -15,6 +15,18 @@ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ceph type=rpm-md +[nfs_ganesha_stable] +baseurl=http://{{ offline_repo_server_ip }}/nfs-ganesha/rpm-V3.3-stable/octopus/el$releasever/$basearch +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ceph +name=nfs-ganesha stable repo + +[nfs_ganesha_stable_noarch] +baseurl=http://{{ offline_repo_server_ip }}/nfs-ganesha/rpm-V3.3-stable/octopus/el$releasever/noarch +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ceph +name=nfs-ganesha stable noarch repo + [ceph-stable-local] baseurl = http://{{ offline_repo_server_ip }}/packages/ceph_stable gpgcheck = 1 From 1bfb6c614dc7d249a90143d7cc2ccc0c63469cde Mon Sep 17 00:00:00 2001 From: bkelly16 Date: Tue, 7 Dec 2021 14:38:39 -0400 Subject: [PATCH 17/27] fixed broekn path nfs offline repos --- roles/ceph-prerun/templates/Rocky-Offline.repo.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/ceph-prerun/templates/Rocky-Offline.repo.j2 b/roles/ceph-prerun/templates/Rocky-Offline.repo.j2 index 003f8066a3..43f0af0fca 100644 --- a/roles/ceph-prerun/templates/Rocky-Offline.repo.j2 +++ b/roles/ceph-prerun/templates/Rocky-Offline.repo.j2 @@ -16,13 +16,13 @@ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ceph type=rpm-md [nfs_ganesha_stable] -baseurl=http://{{ offline_repo_server_ip }}/nfs-ganesha/rpm-V3.3-stable/octopus/el$releasever/$basearch +baseurl=http://{{ offline_repo_server_ip }}/packages/nfs_ganesha_stable/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ceph name=nfs-ganesha stable repo [nfs_ganesha_stable_noarch] -baseurl=http://{{ offline_repo_server_ip }}/nfs-ganesha/rpm-V3.3-stable/octopus/el$releasever/noarch +baseurl=http://{{ offline_repo_server_ip }}/packages/nfs_ganesha_noarch gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ceph name=nfs-ganesha stable noarch repo From 56efc7a3a8d6202b93e97d5e268b4c1cdced2fc3 Mon Sep 17 00:00:00 2001 From: bkelly16 Date: Tue, 7 Dec 2021 14:59:05 -0400 Subject: [PATCH 18/27] fixed incorrect path on nfs_ganesha offline repo --- roles/ceph-prerun/templates/Rocky-Offline.repo.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/ceph-prerun/templates/Rocky-Offline.repo.j2 b/roles/ceph-prerun/templates/Rocky-Offline.repo.j2 index 43f0af0fca..47c825996b 100644 --- a/roles/ceph-prerun/templates/Rocky-Offline.repo.j2 +++ b/roles/ceph-prerun/templates/Rocky-Offline.repo.j2 @@ -22,7 +22,7 @@ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ceph name=nfs-ganesha stable repo [nfs_ganesha_stable_noarch] -baseurl=http://{{ offline_repo_server_ip }}/packages/nfs_ganesha_noarch +baseurl=http://{{ offline_repo_server_ip }}/packages/nfs_ganesha_stable_noarch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ceph name=nfs-ganesha stable noarch repo From 13168a8591c38c48937d0f690caa6557dd9dea70 Mon Sep 17 00:00:00 2001 From: bkelly16 Date: Tue, 7 Dec 2021 15:04:52 -0400 Subject: [PATCH 19/27] dont try to enable ha repo when offline_install is true --- roles/ceph-nfs/tasks/pre_requisite_non_container_red_hat.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/ceph-nfs/tasks/pre_requisite_non_container_red_hat.yml b/roles/ceph-nfs/tasks/pre_requisite_non_container_red_hat.yml index 4944578551..a8431bda13 100644 --- a/roles/ceph-nfs/tasks/pre_requisite_non_container_red_hat.yml +++ b/roles/ceph-nfs/tasks/pre_requisite_non_container_red_hat.yml @@ -64,6 +64,7 @@ when: - ansible_os_family == 'RedHat' - ansible_distribution_major_version == '8' + - not offline_install - name: install pacemaker package: From dc903511889977a67acaa8387937e28437fdca2d Mon Sep 17 00:00:00 2001 From: bkelly16 Date: Tue, 7 Dec 2021 15:11:34 -0400 Subject: [PATCH 20/27] dont configure iscsi repo when offline_repo is true --- roles/ceph-iscsi-gw/tasks/non-container/prerequisites.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/roles/ceph-iscsi-gw/tasks/non-container/prerequisites.yml b/roles/ceph-iscsi-gw/tasks/non-container/prerequisites.yml index 52cc0f7586..c36c4d60b7 100644 --- a/roles/ceph-iscsi-gw/tasks/non-container/prerequisites.yml +++ b/roles/ceph-iscsi-gw/tasks/non-container/prerequisites.yml @@ -86,7 +86,9 @@ url: "https://download.ceph.com/ceph-iscsi/{{ '3' if use_new_ceph_iscsi | bool else '2' }}/rpm/el{{ ansible_facts['distribution_major_version'] }}/ceph-iscsi.repo" dest: /etc/yum.repos.d/ceph-iscsi.repo force: true - when: ceph_repository == 'community' + when: + - ceph_repository == 'community' + - not offline_install - name: install ceph iscsi package package: From 4bc2ce74a47eee975e2e8c61a6b91431c33d4041 Mon Sep 17 00:00:00 2001 From: bkelly16 Date: Wed, 8 Dec 2021 13:24:51 -0400 Subject: [PATCH 21/27] use shell module to load container images rather than docker_image_load --- .../tasks/offline/import_container_images_docker.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/roles/ceph-prerun/tasks/offline/import_container_images_docker.yml b/roles/ceph-prerun/tasks/offline/import_container_images_docker.yml index 5b31f6e78c..a3731ea985 100644 --- a/roles/ceph-prerun/tasks/offline/import_container_images_docker.yml +++ b/roles/ceph-prerun/tasks/offline/import_container_images_docker.yml @@ -13,8 +13,7 @@ dest: /tmp/node-exporter-v0.17.0.tar - name: Import node_exporter if not present already - docker_image_load: - path: /tmp/node-exporter-v0.17.0.tar + shell: "/usr/bin/docker load -i /tmp/node-exporter-v0.17.0.tar" - name: remove node-exporter image tar file: @@ -32,18 +31,17 @@ - name: Pull down and import metric stack images if not present already block: - - name: Pull down node_exporter image + - name: Pull down {{ item }} image get_url: url: http://{{ offline_repo_server_ip }}/images/{{ item }} dest: /tmp/{{ item }} loop: "{{ metric_container_images|flatten(levels=1) }}" - - name: Import node_exporter if not present already - docker_image_load: - path: /tmp/{{ item }} + - name: Import {{ item }} if not present already + shell: "/usr/bin/docker load -i /tmp/node-exporter-v0.17.0.tar" loop: "{{ metric_container_images|flatten(levels=1) }}" - - name: remove node-exporter image tar + - name: remove {{ item }} image tar file: path: /tmp/{{ item }} state: absent From b9cb114c0e94ad5adf2eb46d13a3aa6a5a35eb10 Mon Sep 17 00:00:00 2001 From: bkelly16 Date: Wed, 8 Dec 2021 13:27:50 -0400 Subject: [PATCH 22/27] fixed incorrect varible name --- .../tasks/offline/import_container_images_docker.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/ceph-prerun/tasks/offline/import_container_images_docker.yml b/roles/ceph-prerun/tasks/offline/import_container_images_docker.yml index a3731ea985..64c9ffde9e 100644 --- a/roles/ceph-prerun/tasks/offline/import_container_images_docker.yml +++ b/roles/ceph-prerun/tasks/offline/import_container_images_docker.yml @@ -31,17 +31,17 @@ - name: Pull down and import metric stack images if not present already block: - - name: Pull down {{ item }} image + - name: Pull down metric stack images get_url: url: http://{{ offline_repo_server_ip }}/images/{{ item }} dest: /tmp/{{ item }} loop: "{{ metric_container_images|flatten(levels=1) }}" - - name: Import {{ item }} if not present already - shell: "/usr/bin/docker load -i /tmp/node-exporter-v0.17.0.tar" + - name: Import images if not present already + shell: "/usr/bin/docker load -i /tmp/{{ item }}" loop: "{{ metric_container_images|flatten(levels=1) }}" - - name: remove {{ item }} image tar + - name: remove container image tar file: path: /tmp/{{ item }} state: absent From 3456ad65c884026c6c85a32a8aeb10cf6f74ef97 Mon Sep 17 00:00:00 2001 From: bkelly16 Date: Thu, 9 Dec 2021 13:22:49 -0400 Subject: [PATCH 23/27] rework container import process for offline_install --- .../pre_requisite_non_container_ubuntu.yml | 2 +- .../import_container_images_docker.yml | 44 ++++-------------- .../import_container_images_podman.yml | 45 ++++--------------- roles/ceph-prerun/vars/main.yml | 8 ++++ 4 files changed, 25 insertions(+), 74 deletions(-) diff --git a/roles/ceph-nfs/tasks/pre_requisite_non_container_ubuntu.yml b/roles/ceph-nfs/tasks/pre_requisite_non_container_ubuntu.yml index 4224e90640..91268f6142 100644 --- a/roles/ceph-nfs/tasks/pre_requisite_non_container_ubuntu.yml +++ b/roles/ceph-nfs/tasks/pre_requisite_non_container_ubuntu.yml @@ -1,5 +1,6 @@ --- - name: ubuntu systems - repo handling + when: not offline_install block: - name: stable repos specific tasks block: @@ -34,7 +35,6 @@ delay: 2 until: update_libntirpc_apt_cache is success when: add_libntirpc_apt_repo is changed - when: not offline_install - name: ubuntu systems - install nfs packages diff --git a/roles/ceph-prerun/tasks/offline/import_container_images_docker.yml b/roles/ceph-prerun/tasks/offline/import_container_images_docker.yml index 64c9ffde9e..777856fa92 100644 --- a/roles/ceph-prerun/tasks/offline/import_container_images_docker.yml +++ b/roles/ceph-prerun/tasks/offline/import_container_images_docker.yml @@ -1,50 +1,22 @@ --- - name: Inspect node_exporter local image docker_image_info: - name: - - prom/node-exporter:v0.17.0 + name: "{{ node_exporter_container_image }}" register: node_exporter_result - name: Pull down and import node_exporter image if not present already - block: - - name: Pull down node_exporter image - get_url: - url: http://{{ offline_repo_server_ip }}/images/node-exporter-v0.17.0.tar - dest: /tmp/node-exporter-v0.17.0.tar - - - name: Import node_exporter if not present already - shell: "/usr/bin/docker load -i /tmp/node-exporter-v0.17.0.tar" - - - name: remove node-exporter image tar - file: - path: /tmp/node-exporter-v0.17.0.tar - state: absent + include_tasks: image_import.yml + loop: "{{ node_exporter_container_image_archive }}" when: node_exporter_result.images | length == 0 - name: Inspect metrics node for local docker images docker_image_info: - name: - - localhost/grafana-offline:5.4.2 - - prom/alertmanager:v0.16.2 - - prom/prometheus:v2.7.2 + name: "{{ metric_container_images }}" register: metric_images_result -- name: Pull down and import metric stack images if not present already - block: - - name: Pull down metric stack images - get_url: - url: http://{{ offline_repo_server_ip }}/images/{{ item }} - dest: /tmp/{{ item }} - loop: "{{ metric_container_images|flatten(levels=1) }}" - - - name: Import images if not present already - shell: "/usr/bin/docker load -i /tmp/{{ item }}" - loop: "{{ metric_container_images|flatten(levels=1) }}" - - - name: remove container image tar - file: - path: /tmp/{{ item }} - state: absent - loop: "{{ metric_container_images|flatten(levels=1) }}" +- name: Pull down and import node_exporter image if not present already + include_tasks: image_import.yml + loop: "{{ metric_container_images_archive|flatten(levels=1) }}" delegate_to: "{{ groups[grafana_server_group_name][0] }}" when: metric_images_result.images | length != 3 + diff --git a/roles/ceph-prerun/tasks/offline/import_container_images_podman.yml b/roles/ceph-prerun/tasks/offline/import_container_images_podman.yml index 23caf51edb..3649b27e49 100644 --- a/roles/ceph-prerun/tasks/offline/import_container_images_podman.yml +++ b/roles/ceph-prerun/tasks/offline/import_container_images_podman.yml @@ -1,50 +1,21 @@ --- - name: Inspect node_exporter local image podman_image_info: - name: - - prom/node-exporter:v0.17.0 + name: "{{ node_exporter_container_image }}" register: node_exporter_result - name: Pull down and import node_exporter image if not present already - block: - - name: Pull down node_exporter image - get_url: - url: http://{{ offline_repo_server_ip }}/images/node-exporter-v0.17.0.tar - dest: /tmp/node-exporter-v0.17.0.tar - - - name: Import node_exporter if not present already - shell: "/usr/bin/podman load -i /tmp/node-exporter-v0.17.0.tar" - - - name: remove node-exporter image tar - file: - path: /tmp/node-exporter-v0.17.0.tar - state: absent + include_tasks: image_import.yml + loop: "{{ node_exporter_container_image_archive }}" when: node_exporter_result.images | length == 0 -- name: Inspect metrics node for local container images +- name: Inspect metrics node for local docker images podman_image_info: - name: - - localhost/grafana-offline:5.4.2 - - prom/alertmanager:v0.16.2 - - prom/prometheus:v2.7.2 + name: "{{ metric_container_images }}" register: metric_images_result -- name: Pull down and import metric stack images if not present already - block: - - name: Pull down node_exporter image - get_url: - url: http://{{ offline_repo_server_ip }}/images/{{ item }} - dest: /tmp/{{ item }} - loop: "{{ metric_container_images|flatten(levels=1) }}" - - - name: Import node_exporter if not present already - shell: "/usr/bin/podman load -i /tmp/{{ item }}" - loop: "{{ metric_container_images|flatten(levels=1) }}" - - - name: remove node-exporter image tar - file: - path: /tmp/{{ item }} - state: absent - loop: "{{ metric_container_images|flatten(levels=1) }}" +- name: Pull down and import node_exporter image if not present already + include_tasks: image_import.yml + loop: "{{ metric_container_images_archive|flatten(levels=1) }}" delegate_to: "{{ groups[grafana_server_group_name][0] }}" when: metric_images_result.images | length != 3 diff --git a/roles/ceph-prerun/vars/main.yml b/roles/ceph-prerun/vars/main.yml index fee5ea037e..8c7dacbb39 100644 --- a/roles/ceph-prerun/vars/main.yml +++ b/roles/ceph-prerun/vars/main.yml @@ -1,9 +1,17 @@ --- +## OFFLINE MODE ONLY import_container_images: true metric_container_images: + - "localhost/grafana-offline:5.4.2" + - "prom/alertmanager:v0.16.2" + - "prom/prometheus:v2.7.2" +metric_container_images_archive: - "alertmanager-v0.16.2.tar" - "grafana-v5.4.2.tar" - "prometheus-v2.7.2.tar" +node_exporter_container_image: "prom/node-exporter:v0.17.0" +node_exporter_container_image_archive: "node-exporter-v0.17.0.tar" +### ubuntu_install_pkgs: - "45drives-tools" From 35a97552dfa33c25edca6dd1d105321d257f9046 Mon Sep 17 00:00:00 2001 From: bkelly16 Date: Thu, 9 Dec 2021 13:23:27 -0400 Subject: [PATCH 24/27] added import_image tasks --- roles/ceph-prerun/tasks/offline/image_import.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 roles/ceph-prerun/tasks/offline/image_import.yml diff --git a/roles/ceph-prerun/tasks/offline/image_import.yml b/roles/ceph-prerun/tasks/offline/image_import.yml new file mode 100644 index 0000000000..1c444e4427 --- /dev/null +++ b/roles/ceph-prerun/tasks/offline/image_import.yml @@ -0,0 +1,14 @@ +- name: Pull down and import {{ item }} image + block: + - name: Pull down node_exporter image + get_url: + url: http://{{ offline_repo_server_ip }}/images/{{ item }} + dest: /tmp/{{ item }} + + - name: Import {{ item }} + shell: "/usr/bin/{{ container_service_name }} load -i /tmp/{{ item }}" + + - name: remove {{ item }} image tar + file: + path: /tmp/{{ item }} + state: absent \ No newline at end of file From 8e3847ce32794ce84776f9cd852fc388f8ba4e50 Mon Sep 17 00:00:00 2001 From: bkelly16 Date: Thu, 9 Dec 2021 14:40:57 -0400 Subject: [PATCH 25/27] set grafana_image fact when using offline install --- roles/ceph-prerun/tasks/main.yml | 6 +++++- .../tasks/offline/import_container_images_docker.yml | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/roles/ceph-prerun/tasks/main.yml b/roles/ceph-prerun/tasks/main.yml index 3f683884dc..9960cf00ba 100644 --- a/roles/ceph-prerun/tasks/main.yml +++ b/roles/ceph-prerun/tasks/main.yml @@ -18,7 +18,11 @@ - name: setup offline repositories include_tasks: offline/repo_setup.yml - when: offline_install + when: offline_install + +- name: set grafana image fact when offline_install + set_fact: grafana_container_image="localhost/grafana-offline:5.4.2" + when: offline_install - name: include_tasks cleanup/cleanup_on_ubuntu.yml include_tasks: cleanup/cleanup_on_ubuntu.yml diff --git a/roles/ceph-prerun/tasks/offline/import_container_images_docker.yml b/roles/ceph-prerun/tasks/offline/import_container_images_docker.yml index 777856fa92..aa4c33ea5d 100644 --- a/roles/ceph-prerun/tasks/offline/import_container_images_docker.yml +++ b/roles/ceph-prerun/tasks/offline/import_container_images_docker.yml @@ -19,4 +19,3 @@ loop: "{{ metric_container_images_archive|flatten(levels=1) }}" delegate_to: "{{ groups[grafana_server_group_name][0] }}" when: metric_images_result.images | length != 3 - From 9311e84f98e19e8f23fa46251f70d749466ad6a7 Mon Sep 17 00:00:00 2001 From: bkelly16 Date: Sat, 11 Dec 2021 14:00:37 -0400 Subject: [PATCH 26/27] undo change to container process import --- .../tasks/offline/image_import.yml | 14 ------- .../import_container_images_docker.yml | 37 ++++++++++++++++--- .../import_container_images_podman.yml | 37 ++++++++++++++++--- 3 files changed, 62 insertions(+), 26 deletions(-) delete mode 100644 roles/ceph-prerun/tasks/offline/image_import.yml diff --git a/roles/ceph-prerun/tasks/offline/image_import.yml b/roles/ceph-prerun/tasks/offline/image_import.yml deleted file mode 100644 index 1c444e4427..0000000000 --- a/roles/ceph-prerun/tasks/offline/image_import.yml +++ /dev/null @@ -1,14 +0,0 @@ -- name: Pull down and import {{ item }} image - block: - - name: Pull down node_exporter image - get_url: - url: http://{{ offline_repo_server_ip }}/images/{{ item }} - dest: /tmp/{{ item }} - - - name: Import {{ item }} - shell: "/usr/bin/{{ container_service_name }} load -i /tmp/{{ item }}" - - - name: remove {{ item }} image tar - file: - path: /tmp/{{ item }} - state: absent \ No newline at end of file diff --git a/roles/ceph-prerun/tasks/offline/import_container_images_docker.yml b/roles/ceph-prerun/tasks/offline/import_container_images_docker.yml index aa4c33ea5d..b81674c248 100644 --- a/roles/ceph-prerun/tasks/offline/import_container_images_docker.yml +++ b/roles/ceph-prerun/tasks/offline/import_container_images_docker.yml @@ -5,17 +5,42 @@ register: node_exporter_result - name: Pull down and import node_exporter image if not present already - include_tasks: image_import.yml - loop: "{{ node_exporter_container_image_archive }}" + block: + - name: Pull down node_exporter image + get_url: + url: http://{{ offline_repo_server_ip }}/images/{{ node_exporter_container_image_archive }} + dest: /tmp/"{{ node_exporter_container_image_archive }}" + + - name: Import node_exporter if not present already + shell: "/usr/bin/docker load -i /tmp/{{ node_exporter_container_image_archive }}" + + - name: remove node-exporter image tar + file: + path: /tmp/{{ node_exporter_container_image_archive }} + state: absent when: node_exporter_result.images | length == 0 -- name: Inspect metrics node for local docker images +- name: Inspect metrics node for local container images docker_image_info: name: "{{ metric_container_images }}" register: metric_images_result -- name: Pull down and import node_exporter image if not present already - include_tasks: image_import.yml - loop: "{{ metric_container_images_archive|flatten(levels=1) }}" +- name: Pull down and import metric stack images if not present already + block: + - name: Pull down metrics images + get_url: + url: http://{{ offline_repo_server_ip }}/images/{{ item }} + dest: /tmp/{{ item }} + loop: "{{ metric_container_images_archive|flatten(levels=1) }}" + + - name: Import metric images if not present already + shell: "/usr/bin/docker load -i /tmp/{{ item }}" + loop: "{{ metric_container_images_archive|flatten(levels=1) }}" + + - name: remove metric images image tar + file: + path: /tmp/{{ item }} + state: absent + loop: "{{ metric_container_images_archive|flatten(levels=1) }}" delegate_to: "{{ groups[grafana_server_group_name][0] }}" when: metric_images_result.images | length != 3 diff --git a/roles/ceph-prerun/tasks/offline/import_container_images_podman.yml b/roles/ceph-prerun/tasks/offline/import_container_images_podman.yml index 3649b27e49..f7e9acef84 100644 --- a/roles/ceph-prerun/tasks/offline/import_container_images_podman.yml +++ b/roles/ceph-prerun/tasks/offline/import_container_images_podman.yml @@ -5,17 +5,42 @@ register: node_exporter_result - name: Pull down and import node_exporter image if not present already - include_tasks: image_import.yml - loop: "{{ node_exporter_container_image_archive }}" + block: + - name: Pull down node_exporter image + get_url: + url: http://{{ offline_repo_server_ip }}/images/{{ node_exporter_container_image_archive }} + dest: /tmp/"{{ node_exporter_container_image_archive }}" + + - name: Import node_exporter if not present already + shell: "/usr/bin/podman load -i /tmp/{{ node_exporter_container_image_archive }}" + + - name: remove node-exporter image tar + file: + path: /tmp/{{ node_exporter_container_image_archive }} + state: absent when: node_exporter_result.images | length == 0 -- name: Inspect metrics node for local docker images +- name: Inspect metrics node for local container images podman_image_info: name: "{{ metric_container_images }}" register: metric_images_result -- name: Pull down and import node_exporter image if not present already - include_tasks: image_import.yml - loop: "{{ metric_container_images_archive|flatten(levels=1) }}" +- name: Pull down and import metric stack images if not present already + block: + - name: Pull down node_exporter image + get_url: + url: http://{{ offline_repo_server_ip }}/images/{{ item }} + dest: /tmp/{{ item }} + loop: "{{ metric_container_images_archive|flatten(levels=1) }}" + + - name: Import node_exporter if not present already + shell: "/usr/bin/podman load -i /tmp/{{ item }}" + loop: "{{ metric_container_images_archive|flatten(levels=1) }}" + + - name: remove node-exporter image tar + file: + path: /tmp/{{ item }} + state: absent + loop: "{{ metric_container_images_archive|flatten(levels=1) }}" delegate_to: "{{ groups[grafana_server_group_name][0] }}" when: metric_images_result.images | length != 3 From b074cf763337a8694e1f9fe9fd520d2d5b125de9 Mon Sep 17 00:00:00 2001 From: bkelly16 Date: Sat, 11 Dec 2021 14:06:37 -0400 Subject: [PATCH 27/27] fixed syntax --- .../tasks/offline/import_container_images_docker.yml | 2 +- .../tasks/offline/import_container_images_podman.yml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/roles/ceph-prerun/tasks/offline/import_container_images_docker.yml b/roles/ceph-prerun/tasks/offline/import_container_images_docker.yml index b81674c248..f2d153482e 100644 --- a/roles/ceph-prerun/tasks/offline/import_container_images_docker.yml +++ b/roles/ceph-prerun/tasks/offline/import_container_images_docker.yml @@ -9,7 +9,7 @@ - name: Pull down node_exporter image get_url: url: http://{{ offline_repo_server_ip }}/images/{{ node_exporter_container_image_archive }} - dest: /tmp/"{{ node_exporter_container_image_archive }}" + dest: /tmp/{{ node_exporter_container_image_archive }} - name: Import node_exporter if not present already shell: "/usr/bin/docker load -i /tmp/{{ node_exporter_container_image_archive }}" diff --git a/roles/ceph-prerun/tasks/offline/import_container_images_podman.yml b/roles/ceph-prerun/tasks/offline/import_container_images_podman.yml index f7e9acef84..9572c1d87a 100644 --- a/roles/ceph-prerun/tasks/offline/import_container_images_podman.yml +++ b/roles/ceph-prerun/tasks/offline/import_container_images_podman.yml @@ -9,7 +9,7 @@ - name: Pull down node_exporter image get_url: url: http://{{ offline_repo_server_ip }}/images/{{ node_exporter_container_image_archive }} - dest: /tmp/"{{ node_exporter_container_image_archive }}" + dest: /tmp/{{ node_exporter_container_image_archive }} - name: Import node_exporter if not present already shell: "/usr/bin/podman load -i /tmp/{{ node_exporter_container_image_archive }}" @@ -27,17 +27,17 @@ - name: Pull down and import metric stack images if not present already block: - - name: Pull down node_exporter image + - name: Pull down metrics images get_url: url: http://{{ offline_repo_server_ip }}/images/{{ item }} dest: /tmp/{{ item }} loop: "{{ metric_container_images_archive|flatten(levels=1) }}" - - name: Import node_exporter if not present already + - name: Import metric images if not present already shell: "/usr/bin/podman load -i /tmp/{{ item }}" loop: "{{ metric_container_images_archive|flatten(levels=1) }}" - - name: remove node-exporter image tar + - name: remove metric images image tar file: path: /tmp/{{ item }} state: absent