docker: Switch to docker compose plugin

This commit is contained in:
Jannik Beyerstedt 2024-01-20 19:51:51 +01:00
parent fe97b0ae76
commit ec682e500c
3 changed files with 26 additions and 25 deletions

View file

@ -1,6 +1,11 @@
---
# handlers file for server
- name: Update Apt Cache
become: true
ansible.builtin.apt:
update_cache: true
- name: Restart sshd
become: true
ansible.builtin.service:

View file

@ -24,9 +24,11 @@
diff: false
- name: Docker - Add docker CE repo key
become: true
ansible.builtin.apt_key:
ansible.builtin.get_url:
url: https://download.docker.com/linux/debian/gpg
state: present
dest: /etc/apt/trusted.gpg.d/docker.asc
mode: 0644
notify: Update Apt Cache
# IMPORTANT: raspbian needs deb [arch=armhf] https://download.docker.com/linux/raspbian ...
- name: Docker - Add docker CE repo (Debian)
@ -35,38 +37,25 @@
ansible.builtin.apt_repository:
repo: "deb [arch={{ dpkg_arch.stdout }}] https://download.docker.com/linux/debian {{ ansible_distribution_release }} stable"
state: present
notify: Update Apt Cache
- name: Docker - Add docker CE repo (Raspbian)
when: ansible_facts['lsb']['id'] == "Raspbian"
become: true
ansible.builtin.apt_repository:
repo: "deb [arch={{ dpkg_arch.stdout }}] https://download.docker.com/linux/raspbian {{ ansible_distribution_release }} stable"
state: present
notify: Update Apt Cache
- name: Docker - Flush handlers
meta: flush_handlers
# Docker compose V1 (python package) doesn't receive updates since 2023-06 any more, so use the V2 instead
# The community.docker.docker_compose module won't work any more!
- name: Docker - Install docker CE
become: true
ansible.builtin.apt:
name: docker-ce
state: latest
name:
- docker-ce
- docker-compose-plugin
install_recommends: false
update_cache: true
cache_valid_time: "3600"
diff: false
# Just always use the python package, because the ansible module won't work otherwise
- name: Docker-compose - Install python package
block:
- name: Docker-compose - Install requirements
become: true
ansible.builtin.apt:
name: "{{ packages }}"
state: present
vars:
packages:
- python3-pip
- python3-setuptools
diff: false
- name: Docker-compose - Install using pip3
become: true
ansible.builtin.pip:
name: docker-compose
executable: pip3

View file

@ -14,9 +14,16 @@
state: present
- name: Telegraf - Add telegraf repo
become: true
when: ansible_distribution_release != 'bookworm'
ansible.builtin.apt_repository:
repo: "deb https://repos.influxdata.com/debian {{ ansible_distribution_release }} stable"
state: present
- name: Telegraf - Add telegraf repo
when: ansible_distribution_release == 'bookworm'
become: true
ansible.builtin.apt_repository:
repo: "deb https://repos.influxdata.com/debian bullseye stable"
state: present
- name: Telegraf - Install telegraf
become: true
ansible.builtin.apt: