docker2podman: manage dashboard nodes

The dashboard nodes (alertmanager, grafana, node-exporter, and prometheus)
were not manage during the docker to podman migration.

This adds the systemd container template of those services to a dedicated
file (systemd.yml) in order to include it in the docker2podman playbook.

This also adds the dashboard container images pull from docker to podman.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1829389

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit 252e78b4e4)
pull/5408/head
Dimitri Savineau 2020-04-16 12:17:12 -04:00 committed by Dimitri Savineau
parent 6f893e5ed9
commit a97e24fee9
9 changed files with 85 additions and 28 deletions

View File

@ -46,6 +46,7 @@
- "{{ mgr_group_name | default('mgrs') }}" - "{{ mgr_group_name | default('mgrs') }}"
- "{{ iscsi_gw_group_name | default('iscsigws') }}" - "{{ iscsi_gw_group_name | default('iscsigws') }}"
- "{{ rbdmirror_group_name | default('rbdmirrors') }}" - "{{ rbdmirror_group_name | default('rbdmirrors') }}"
- "{{ grafana_server_group_name|default('grafana-server') }}"
gather_facts: false gather_facts: false
become: true become: true
tasks: tasks:
@ -99,6 +100,30 @@
inventory_hostname in groups.get(iscsi_gw_group_name, []) or inventory_hostname in groups.get(iscsi_gw_group_name, []) or
inventory_hostname in groups.get(nfs_group_name, []) inventory_hostname in groups.get(nfs_group_name, [])
- name: "pulling alertmanager/grafana/prometheus images from docker daemon"
command: "{{ timeout_command }} {{ container_binary }} pull docker-daemon:{{ item }}"
changed_when: false
register: pull_image
until: pull_image.rc == 0
retries: "{{ docker_pull_retry }}"
delay: 10
loop:
- "{{ alertmanager_container_image }}"
- "{{ grafana_container_image }}"
- "{{ prometheus_container_image }}"
when:
- dashboard_enabled | bool
- inventory_hostname in groups.get(grafana_server_group_name, [])
- name: "pulling {{ node_exporter_container_image }} image from docker daemon"
command: "{{ timeout_command }} {{ container_binary }} pull docker-daemon:{{ node_exporter_container_image }}"
changed_when: false
register: pull_image
until: pull_image.rc == 0
retries: "{{ docker_pull_retry }}"
delay: 10
when: dashboard_enabled | bool
- import_role: - import_role:
name: ceph-mon name: ceph-mon
tasks_from: systemd.yml tasks_from: systemd.yml
@ -144,6 +169,28 @@
tasks_from: systemd.yml tasks_from: systemd.yml
when: inventory_hostname in groups.get(rgw_group_name, []) when: inventory_hostname in groups.get(rgw_group_name, [])
- name: dashboard configuration
when: dashboard_enabled | bool
block:
- import_role:
name: ceph-node-exporter
tasks_from: systemd.yml
- import_role:
name: ceph-facts
tasks_from: grafana.yml
when: inventory_hostname in groups.get(grafana_server_group_name, [])
- import_role:
name: ceph-grafana
tasks_from: systemd.yml
when: inventory_hostname in groups.get(grafana_server_group_name, [])
- import_role:
name: ceph-prometheus
tasks_from: systemd.yml
when: inventory_hostname in groups.get(grafana_server_group_name, [])
- name: reload systemd daemon - name: reload systemd daemon
systemd: systemd:
daemon_reload: yes daemon_reload: yes

View File

@ -10,13 +10,8 @@
- /etc/grafana - /etc/grafana
- /var/lib/grafana - /var/lib/grafana
- name: ship systemd service - name: include_tasks systemd.yml
template: include_tasks: systemd.yml
src: grafana-server.service.j2
dest: "/etc/systemd/system/grafana-server.service"
owner: root
group: root
mode: 0644
- name: start the grafana-server service - name: start the grafana-server service
systemd: systemd:

View File

@ -0,0 +1,8 @@
---
- name: ship systemd service
template:
src: grafana-server.service.j2
dest: "/etc/systemd/system/grafana-server.service"
owner: root
group: root
mode: 0644

View File

@ -1,11 +1,6 @@
--- ---
- name: ship systemd service - name: include_tasks systemd.yml
template: include_tasks: systemd.yml
src: node_exporter.service.j2
dest: "/etc/systemd/system/node_exporter.service"
owner: root
group: root
mode: 0644
- name: start the node_exporter service - name: start the node_exporter service
systemd: systemd:

View File

@ -0,0 +1,8 @@
---
- name: ship systemd service
template:
src: node_exporter.service.j2
dest: "/etc/systemd/system/node_exporter.service"
owner: root
group: root
mode: 0644

View File

@ -10,3 +10,4 @@
with_items: with_items:
- 'alertmanager' - 'alertmanager'
- 'prometheus' - 'prometheus'
when: not docker2podman | default(False) | bool

View File

@ -1,15 +1,6 @@
--- ---
- name: ship systemd services - name: include_tasks systemd.yml
template: include_tasks: systemd.yml
src: "{{ item }}.j2"
dest: "/etc/systemd/system/{{ item }}"
owner: root
group: root
mode: 0644
with_items:
- 'alertmanager.service'
- 'prometheus.service'
notify: service handler
- name: start prometheus services - name: start prometheus services
systemd: systemd:

View File

@ -0,0 +1,12 @@
---
- name: ship systemd services
template:
src: "{{ item }}.j2"
dest: "/etc/systemd/system/{{ item }}"
owner: root
group: root
mode: 0644
with_items:
- 'alertmanager.service'
- 'prometheus.service'
notify: service handler

View File

@ -10,5 +10,5 @@ mon0
[mgrs] [mgrs]
mon0 mon0
#[all:vars] [grafana-server]
#ansible_python_interpreter=/usr/bin/python3 mon0