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') }}"
- "{{ iscsi_gw_group_name | default('iscsigws') }}"
- "{{ rbdmirror_group_name | default('rbdmirrors') }}"
- "{{ grafana_server_group_name|default('grafana-server') }}"
gather_facts: false
become: true
tasks:
@ -99,6 +100,30 @@
inventory_hostname in groups.get(iscsi_gw_group_name, []) or
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:
name: ceph-mon
tasks_from: systemd.yml
@ -144,6 +169,28 @@
tasks_from: systemd.yml
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
systemd:
daemon_reload: yes

View File

@ -10,13 +10,8 @@
- /etc/grafana
- /var/lib/grafana
- name: ship systemd service
template:
src: grafana-server.service.j2
dest: "/etc/systemd/system/grafana-server.service"
owner: root
group: root
mode: 0644
- name: include_tasks systemd.yml
include_tasks: systemd.yml
- name: start the grafana-server service
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
template:
src: node_exporter.service.j2
dest: "/etc/systemd/system/node_exporter.service"
owner: root
group: root
mode: 0644
- name: include_tasks systemd.yml
include_tasks: systemd.yml
- name: start the node_exporter service
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:
- 'alertmanager'
- 'prometheus'
when: not docker2podman | default(False) | bool

View File

@ -1,15 +1,6 @@
---
- 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
- name: include_tasks systemd.yml
include_tasks: systemd.yml
- name: start prometheus services
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]
mon0
#[all:vars]
#ansible_python_interpreter=/usr/bin/python3
[grafana-server]
mon0