docker: Switch to docker compose plugin
This commit is contained in:
parent
fe97b0ae76
commit
ec682e500c
|
@ -1,6 +1,11 @@
|
||||||
---
|
---
|
||||||
# handlers file for server
|
# handlers file for server
|
||||||
|
|
||||||
|
- name: Update Apt Cache
|
||||||
|
become: true
|
||||||
|
ansible.builtin.apt:
|
||||||
|
update_cache: true
|
||||||
|
|
||||||
- name: Restart sshd
|
- name: Restart sshd
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
|
|
|
@ -24,9 +24,11 @@
|
||||||
diff: false
|
diff: false
|
||||||
- name: Docker - Add docker CE repo key
|
- name: Docker - Add docker CE repo key
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.apt_key:
|
ansible.builtin.get_url:
|
||||||
url: https://download.docker.com/linux/debian/gpg
|
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 ...
|
# IMPORTANT: raspbian needs deb [arch=armhf] https://download.docker.com/linux/raspbian ...
|
||||||
- name: Docker - Add docker CE repo (Debian)
|
- name: Docker - Add docker CE repo (Debian)
|
||||||
|
@ -35,38 +37,25 @@
|
||||||
ansible.builtin.apt_repository:
|
ansible.builtin.apt_repository:
|
||||||
repo: "deb [arch={{ dpkg_arch.stdout }}] https://download.docker.com/linux/debian {{ ansible_distribution_release }} stable"
|
repo: "deb [arch={{ dpkg_arch.stdout }}] https://download.docker.com/linux/debian {{ ansible_distribution_release }} stable"
|
||||||
state: present
|
state: present
|
||||||
|
notify: Update Apt Cache
|
||||||
- name: Docker - Add docker CE repo (Raspbian)
|
- name: Docker - Add docker CE repo (Raspbian)
|
||||||
when: ansible_facts['lsb']['id'] == "Raspbian"
|
when: ansible_facts['lsb']['id'] == "Raspbian"
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.apt_repository:
|
ansible.builtin.apt_repository:
|
||||||
repo: "deb [arch={{ dpkg_arch.stdout }}] https://download.docker.com/linux/raspbian {{ ansible_distribution_release }} stable"
|
repo: "deb [arch={{ dpkg_arch.stdout }}] https://download.docker.com/linux/raspbian {{ ansible_distribution_release }} stable"
|
||||||
state: present
|
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
|
- name: Docker - Install docker CE
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
name: docker-ce
|
name:
|
||||||
state: latest
|
- docker-ce
|
||||||
|
- docker-compose-plugin
|
||||||
install_recommends: false
|
install_recommends: false
|
||||||
update_cache: true
|
|
||||||
cache_valid_time: "3600"
|
|
||||||
diff: false
|
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
|
|
||||||
|
|
|
@ -14,9 +14,16 @@
|
||||||
state: present
|
state: present
|
||||||
- name: Telegraf - Add telegraf repo
|
- name: Telegraf - Add telegraf repo
|
||||||
become: true
|
become: true
|
||||||
|
when: ansible_distribution_release != 'bookworm'
|
||||||
ansible.builtin.apt_repository:
|
ansible.builtin.apt_repository:
|
||||||
repo: "deb https://repos.influxdata.com/debian {{ ansible_distribution_release }} stable"
|
repo: "deb https://repos.influxdata.com/debian {{ ansible_distribution_release }} stable"
|
||||||
state: present
|
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
|
- name: Telegraf - Install telegraf
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
|
|
Loading…
Reference in a new issue