forked from ceph/ceph-ansible
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev-45d-octopus' into master-45d-octopus
- Loading branch information
Showing
16 changed files
with
294 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
roles/ceph-prerun/tasks/offline/import_container_images.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
- 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: include specific variables | ||
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 |
46 changes: 46 additions & 0 deletions
46
roles/ceph-prerun/tasks/offline/import_container_images_docker.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
- name: Inspect node_exporter local image | ||
docker_image_info: | ||
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_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 container images | ||
docker_image_info: | ||
name: "{{ metric_container_images }}" | ||
register: metric_images_result | ||
|
||
- 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 |
46 changes: 46 additions & 0 deletions
46
roles/ceph-prerun/tasks/offline/import_container_images_podman.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
- name: Inspect node_exporter local image | ||
podman_image_info: | ||
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_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 container images | ||
podman_image_info: | ||
name: "{{ metric_container_images }}" | ||
register: metric_images_result | ||
|
||
- 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/podman 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,29 @@ | ||
--- | ||
- name: disable active repos | ||
block: | ||
- name: get active repos | ||
shell: "dnf repolist --enabled | awk 'NR>1{print $1}'" | ||
register: 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: | ||
src: "Rocky-Offline.repo.j2" | ||
dest: "/etc/yum.repos.d/Rocky-Offline.repo" | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.