70 lines
2 KiB
YAML
70 lines
2 KiB
YAML
---
|
|
# Server/Borgbackup: Install and Setup Borgbackup Backup Crobjob - Default Debian Version
|
|
# Variables:
|
|
# - none
|
|
|
|
# Detect some more host facts
|
|
- name: docker - Detect architecture
|
|
ansible.builtin.shell: dpkg --print-architecture
|
|
register: dpkg_arch
|
|
|
|
# Install docker CE
|
|
- name: docker - Install docker CE APT dependencies
|
|
become: yes
|
|
ansible.builtin.apt:
|
|
name: "{{ packages }}"
|
|
state: present
|
|
vars:
|
|
packages:
|
|
- apt-transport-https
|
|
- ca-certificates
|
|
- curl
|
|
- gnupg2
|
|
- software-properties-common
|
|
- name: docker - Add docker CE repo key
|
|
become: yes
|
|
ansible.builtin.apt_key:
|
|
url: https://download.docker.com/linux/debian/gpg
|
|
state: present
|
|
|
|
# IMPORTANT: raspbian needs deb [arch=armhf] https://download.docker.com/linux/raspbian ...
|
|
- name: docker - Add docker CE repo (Debian)
|
|
become: yes
|
|
ansible.builtin.apt_repository:
|
|
repo: "deb [arch={{ dpkg_arch.stdout }}] https://download.docker.com/linux/debian {{ ansible_distribution_release }} stable"
|
|
state: present
|
|
when: ansible_facts['lsb']['id'] != "Raspbian"
|
|
- name: docker - Add docker CE repo (Raspbian)
|
|
become: yes
|
|
ansible.builtin.apt_repository:
|
|
repo: "deb [arch={{ dpkg_arch.stdout }}] https://download.docker.com/linux/raspbian {{ ansible_distribution_release }} stable"
|
|
state: present
|
|
when: ansible_facts['lsb']['id'] == "Raspbian"
|
|
|
|
- name: docker - Install docker CE
|
|
become: yes
|
|
ansible.builtin.apt:
|
|
name: docker-ce
|
|
state: latest
|
|
install_recommends: no
|
|
update_cache: yes
|
|
cache_valid_time: "3600"
|
|
|
|
# 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: yes
|
|
ansible.builtin.apt:
|
|
name: "{{ packages }}"
|
|
state: present
|
|
vars:
|
|
packages:
|
|
- python3-pip
|
|
- python3-setuptools
|
|
- name: docker-compose - Install using pip3
|
|
become: yes
|
|
ansible.builtin.pip:
|
|
name: docker-compose
|
|
executable: pip3
|