cadvisor moved into the 'docker' role.

This commit is contained in:
Andrea Dell'Amico 2023-05-29 13:39:12 +02:00
parent e220e26551
commit 8f6aeb7268
Signed by: adellam
GPG Key ID: 147ABE6CEB9E20FF
6 changed files with 0 additions and 125 deletions

View File

@ -2,7 +2,6 @@ Role Name
=========
A role that configures a docker swarm cluster, adding Portainer CE and HAPROXY
cAdvisor is also installed, as standalone package and not as container. The standalone package does not require a local Prometheus instance
Role Variables
--------------

View File

@ -16,14 +16,6 @@ docker_swarm_api_networks_acl:
- '127.0.0.1/8'
docker_swarm_api_haproxy_mode: http
# cAdvisor
docker_swarm_cluster_cadvisor_install: true
docker_swarm_cluster_cadvisor_deb_pkg: true
docker_swarm_cluster_cadvisor_docker_endpoint: "unix:///var/run/docker.sock"
docker_swarm_cluster_cadvisor_port: 4194
docker_swarm_cluster_cadvisor_github_url: "https://github.com/google/cadvisor/releases/download/v0.47.0/cadvisor-v0.47.0-linux-amd64"
docker_swarm_cluster_cadvisor_binary_path: /usr/local/bin/cadvisor
# Portainer
docker_swarm_cluster_portainer_install: true
docker_swarm_portainer_hostname: 'portainer-swarm.example.com'

View File

@ -1,49 +0,0 @@
---
- name: Manage the installation of cAdvisor deb package
when: docker_swarm_cluster_cadvisor_deb_pkg
tags: ['cadvisor', 'docker_cadvisor', 'docker_swarm', 'docker']
block:
- name: Install the cadvisor package
ansible.builtin.apt:
pkg: cadvisor
state: present
cache_valid_time: 1800
- name: Manage the installation of cAdvisor Linux binary from GitHub
when: not docker_swarm_cluster_cadvisor_deb_pkg
tags: ['cadvisor', 'docker_cadvisor', 'docker_swarm', 'docker']
block:
- name: Download the cAdvisor executable from GitHub
ansible.builtin.get_url:
url: "{{ docker_swarm_cluster_cadvisor_github_url }}"
dest: "{{ docker_swarm_cluster_cadvisor_binary_path }}"
owner: root
group: root
mode: 0755
- name: Install the cAdvisor systemd unit
ansible.builtin.template:
src: cadvisor.systemd.j2
dest: /lib/systemd/system/cadvisor.service
owner: root
group: root
mode: 0644
notify: Restart cadvisor
- name: Manage the cAdvisor service
tags: ['cadvisor', 'docker_cadvisor', 'docker_swarm', 'docker']
block:
- name: Install the cadvisor default
ansible.builtin.template:
src: cadvisor.default.j2
dest: /etc/default/cadvisor
mode: 0600
owner: root
group: root
notify: Restart cadvisor
- name: Ensure that the cAdvisor service is up and running
ansible.builtin.service:
name: cadvisor
state: started
enabled: true

View File

@ -5,6 +5,3 @@
- name: Import the portainer tasks
ansible.builtin.import_tasks: portainer.yml
when: docker_swarm_cluster_portainer_install
- name: Import the cAdvisor tasks
ansible.builtin.import_tasks: cadvisor.yml
when: docker_swarm_cluster_cadvisor_install

View File

@ -1,44 +0,0 @@
# config options for cadvisor(1)
#
# Docker endpoint to connect to
# Default: unix:///var/run/docker.sock
CADVISOR_DOCKER_ENDPOINT="{{ docker_swarm_cluster_cadvisor_docker_endpoint }}"
# Port to listen on
# Default: 8080
# kubernetes expects it on port 4194
CADVISOR_PORT="{{ docker_swarm_cluster_cadvisor_port }}"
# Storage driver
# Default: none/blank
#
# Available Options:
# - [none]
# - bigquery
# - influxdb
CADVISOR_STORAGE_DRIVER=""
# Storage driver host
# Default: localhost:8086"
CADVISOR_STORAGE_DRIVER_HOST="localhost:8086"
# Storage driver password
# Default: root
CADVISOR_STORAGE_DRIVER_PASSWORD="root"
# Storage driver secure connection
# Default: false
CADVISOR_STORAGE_DRIVER_SECURE="false"
# Storage driver user
# Default: root
CADVISOR_STORAGE_DRIVER_USER="root"
# Log to stderr ("true" logs to journal on systemd
# and to "/var/log/cadvisor.log" on SysV)
# Default: false
CADVISOR_LOG_TO_STDERR="true"
# Other options:
#DAEMON_ARGS=""

View File

@ -1,20 +0,0 @@
[Unit]
Description=cAdvisor
Documentation=man:cadvisor
Documentation=https://github.com/google/cadvisor
[Service]
EnvironmentFile=/etc/default/cadvisor
ExecStart={{ docker_swarm_cluster_cadvisor_binary_path }} \
--docker=${CADVISOR_DOCKER_ENDPOINT} \
--port=${CADVISOR_PORT} \
--storage_driver=${CADVISOR_STORAGE_DRIVER} \
--storage_driver_host=${CADVISOR_STORAGE_DRIVER_HOST} \
--storage_driver_password=${CADVISOR_STORAGE_DRIVER_PASSWORD} \
--storage_driver_secure=${CADVISOR_STORAGE_DRIVER_SECURE} \
--storage_driver_user=${CADVISOR_STORAGE_DRIVER_USER} \
--logtostderr=${CADVISOR_LOG_TO_STDERR} \
${DAEMON_ARGS}
[Install]
WantedBy=multi-user.target