56 lines
1.7 KiB
YAML
56 lines
1.7 KiB
YAML
---
|
|
- 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
|
|
register: systemd_reload
|
|
|
|
- name: Reload the systemd unit
|
|
ansible.builtin.systemd:
|
|
daemon_reload: true
|
|
when: systemd_reload is changed
|
|
|
|
- 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
|