This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,4 +1,5 @@
|
|||||||
*
|
*
|
||||||
|
!*.yaml
|
||||||
!docker-compose.yml
|
!docker-compose.yml
|
||||||
!authelia/*.yml
|
!authelia/*.yml
|
||||||
!.gitea/
|
!.gitea/
|
||||||
|
|||||||
86
traefik.yaml
Normal file
86
traefik.yaml
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
- hosts: takahe
|
||||||
|
gather_facts: yes
|
||||||
|
become: yes
|
||||||
|
vars:
|
||||||
|
ansible_ssh_common_args: '-o StrictHostKeyChecking=no'
|
||||||
|
ansible_sudo_pass: "{{ ANSIBLE_SUDO_PASS }}"
|
||||||
|
container_dir: /srv/docker
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Install Docker CE ## From: https://gist.github.com/rbq/886587980894e98b23d0eee2a1d84933, https://docs.docker.com/engine/install/
|
||||||
|
block:
|
||||||
|
- name: Set Docker repo architecture
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
docker_arch: "{{ 'amd64' if ansible_architecture == 'x86_64' else 'ansible_architecture' }}"
|
||||||
|
|
||||||
|
- name: Install prerequisites for Docker repository
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name:
|
||||||
|
- ca-certificates
|
||||||
|
- curl
|
||||||
|
- gnupg2
|
||||||
|
- lsb-release
|
||||||
|
state: latest
|
||||||
|
|
||||||
|
- name: Add Docker's APT key
|
||||||
|
ansible.builtin.apt_key:
|
||||||
|
url: https://download.docker.com/linux/{{ ansible_distribution|lower }}/gpg
|
||||||
|
# ^ ex: Ubuntu -> ubuntu
|
||||||
|
state: present
|
||||||
|
|
||||||
|
|
||||||
|
- name: Add Docker's APT repo
|
||||||
|
ansible.builtin.apt_repository:
|
||||||
|
repo: "deb [arch={{ docker_arck }}] https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable"
|
||||||
|
state: present
|
||||||
|
update_cache: yes
|
||||||
|
|
||||||
|
- name: Install docker and dependencies
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name:
|
||||||
|
- docker-ce
|
||||||
|
- docker-ce-cli
|
||||||
|
- containerd.io
|
||||||
|
- docker-buildx-plugin
|
||||||
|
- docker-compose-plugin
|
||||||
|
state: latest
|
||||||
|
|
||||||
|
- name: Start and enable Docker daemon
|
||||||
|
become: yes
|
||||||
|
ansible.builtin.service:
|
||||||
|
name: docker
|
||||||
|
state: started
|
||||||
|
enabled: yes
|
||||||
|
|
||||||
|
- name: Start and enable Containerd daemon
|
||||||
|
become: yes
|
||||||
|
ansible.builtin.service:
|
||||||
|
name: containerd
|
||||||
|
state: started
|
||||||
|
enabled: yes
|
||||||
|
|
||||||
|
- name: Make sure Container directory exists
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: {{ container_dir }}
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: Set up containers
|
||||||
|
block:
|
||||||
|
- ansible.builtin.git:
|
||||||
|
repo: https://git.pukeko.xyz/shmick/docker.git
|
||||||
|
dest: {{ container_dir }}/{{ item }}
|
||||||
|
version: {{ item }}-cv
|
||||||
|
|
||||||
|
- ansible.builtin.template:
|
||||||
|
src: {{ container_dir }}/{{ item }}/docker-compose.yml.j2
|
||||||
|
dest: {{ container_dir }}/{{ item }}/docker-compose.yml
|
||||||
|
|
||||||
|
- community.docker.docker_compose:
|
||||||
|
project_src: {{ container_dir }}/{{ item }}
|
||||||
|
tags: compose
|
||||||
|
|
||||||
|
with_items:
|
||||||
|
- ddclient
|
||||||
|
- prometheus
|
||||||
|
- traefik
|
||||||
|
|
||||||
Reference in New Issue
Block a user