-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ceph-exporter: add installation role
Signed-off-by: Seena Fallah <[email protected]>
- Loading branch information
Showing
19 changed files
with
307 additions
and
4 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
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,30 @@ | ||
--- | ||
# Variables here are applicable to all host groups NOT roles | ||
|
||
# This sample file generated by generate_group_vars_sample.sh | ||
|
||
# Dummy variable to avoid error because ansible does not recognize the | ||
# file as a good configuration file when no variable in it. | ||
dummy: | ||
|
||
########### | ||
# GENERAL # | ||
########### | ||
|
||
#ceph_exporter_addr: "0.0.0.0" | ||
#ceph_exporter_port: 9926 | ||
#ceph_exporter_stats_period: 5 # seconds | ||
|
||
########## | ||
# DOCKER # | ||
########## | ||
|
||
# If you want to add parameters, you should retain the existing ones and include the new ones. | ||
#ceph_exporter_container_params: | ||
# args: | ||
# - -f | ||
# - --sock-dir=/var/run/ceph | ||
# - --addrs={{ ceph_exporter_addr }} | ||
# - --port={{ ceph_exporter_port }} | ||
# - --stats-period={{ ceph_exporter_stats_period }} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
########### | ||
# GENERAL # | ||
########### | ||
|
||
ceph_exporter_addr: "0.0.0.0" | ||
ceph_exporter_port: 9926 | ||
ceph_exporter_stats_period: 5 # seconds | ||
|
||
########## | ||
# DOCKER # | ||
########## | ||
|
||
# If you want to add parameters, you should retain the existing ones and include the new ones. | ||
ceph_exporter_container_params: | ||
args: | ||
- -f | ||
- --sock-dir=/var/run/ceph | ||
- --addrs={{ ceph_exporter_addr }} | ||
- --port={{ ceph_exporter_port }} | ||
- --stats-period={{ ceph_exporter_stats_period }} |
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,14 @@ | ||
--- | ||
galaxy_info: | ||
company: Red Hat | ||
author: Guillaume Abrioux | ||
description: Deploy ceph-exporter | ||
license: Apache | ||
min_ansible_version: '2.7' | ||
platforms: | ||
- name: EL | ||
versions: | ||
- 'all' | ||
galaxy_tags: | ||
- system | ||
dependencies: [] |
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,12 @@ | ||
--- | ||
- name: Include_tasks systemd.yml | ||
ansible.builtin.include_tasks: systemd.yml | ||
when: containerized_deployment | bool | ||
|
||
- name: Start the ceph-exporter service | ||
ansible.builtin.systemd: | ||
name: "{{ 'ceph-exporter@' + ansible_facts['hostname'] if containerized_deployment | bool else 'ceph-exporter.service' }}" | ||
state: started | ||
enabled: true | ||
masked: false | ||
daemon_reload: true |
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,9 @@ | ||
--- | ||
- name: Generate systemd unit file for ceph-exporter container | ||
ansible.builtin.template: | ||
src: "{{ role_path }}/templates/ceph-exporter.service.j2" | ||
dest: /etc/systemd/system/[email protected] | ||
owner: "root" | ||
group: "root" | ||
mode: "0644" | ||
notify: Restart ceph exporter |
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,50 @@ | ||
[Unit] | ||
Description=Ceph exporter | ||
{% if container_binary == 'docker' %} | ||
After=docker.service network-online.target local-fs.target time-sync.target | ||
Requires=docker.service | ||
{% else %} | ||
After=network-online.target local-fs.target time-sync.target | ||
{% endif %} | ||
Wants=network-online.target local-fs.target time-sync.target | ||
|
||
[Service] | ||
{% if container_binary == 'podman' %} | ||
ExecStartPre=-/usr/bin/rm -f /%t/%n-pid /%t/%n-cid | ||
ExecStartPre=-/usr/bin/{{ container_binary }} rm --storage ceph-exporter-%i | ||
{% endif %} | ||
ExecStartPre=-/usr/bin/{{ container_binary }} rm -f ceph-exporter-%i | ||
ExecStart=/usr/bin/{{ container_binary }} run --rm --name ceph-exporter-%i \ | ||
{% if container_binary == 'podman' %} | ||
-d --log-driver journald --conmon-pidfile /%t/%n-pid --cidfile /%t/%n-cid \ | ||
{% endif %} | ||
--pids-limit={{ 0 if container_binary == 'podman' else -1 }} \ | ||
--security-opt label=disable \ | ||
--net=host \ | ||
{% for v in ceph_common_container_params['volumes'] + ceph_exporter_container_params['volumes'] | default([]) %} | ||
-v {{ v }} \ | ||
{% endfor %} | ||
{% for k, v in (ceph_common_container_params['envs'] | combine(ceph_exporter_container_params['envs'] | default({}))).items() %} | ||
-e {{ k }}={{ v }} \ | ||
{% endfor %} | ||
--entrypoint=/usr/bin/ceph-exporter {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} | ||
{{ (ceph_common_container_params['args'] + ceph_exporter_container_params['args'] | default([])) | join(' ') }} | ||
{% if container_binary == 'podman' %} | ||
ExecStop=-/usr/bin/sh -c "/usr/bin/{{ container_binary }} rm -f `cat /%t/%n-cid`" | ||
{% else %} | ||
ExecStop=-/usr/bin/{{ container_binary }} stop ceph-exporter-%i | ||
{% endif %} | ||
StartLimitInterval=10min | ||
StartLimitBurst=30 | ||
{% if container_binary == 'podman' %} | ||
Type=forking | ||
PIDFile=/%t/%n-pid | ||
{% endif %} | ||
KillMode=none | ||
Restart=always | ||
RestartSec=10s | ||
TimeoutStartSec=120 | ||
TimeoutStopSec=10 | ||
|
||
[Install] | ||
WantedBy=ceph.target |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
- name: Set _exporter_handler_called before restart | ||
ansible.builtin.set_fact: | ||
_exporter_handler_called: true | ||
|
||
- name: Restart the ceph-exporter service # noqa: ignore-errors | ||
ansible.builtin.systemd: | ||
name: ceph-exporter@{{ ansible_facts['hostname'] }} | ||
state: restarted | ||
enabled: true | ||
masked: false | ||
daemon_reload: true | ||
ignore_errors: true | ||
when: hostvars[inventory_hostname]['_exporter_handler_called'] | default(False) | bool | ||
|
||
- name: Set _exporter_handler_called after restart | ||
ansible.builtin.set_fact: | ||
_exporter_handler_called: false |
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
Oops, something went wrong.