feat: initial commit
This commit is contained in:
parent
6c9b9d0bb6
commit
dfaf9214c1
17 changed files with 304 additions and 93 deletions
14
tasks/cleanup.yaml
Normal file
14
tasks/cleanup.yaml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
|
||||
# cleanup
|
||||
- name: "docker - prune all"
|
||||
community.docker.docker_prune:
|
||||
containers: true
|
||||
images: true
|
||||
networks: true
|
||||
volumes: true
|
||||
builder_cache: true
|
||||
|
||||
- name: "docker - force prune"
|
||||
ansible.builtin.command: "docker system prune --all --force --volumes"
|
||||
changed_when: false
|
||||
9
tasks/main.yaml
Normal file
9
tasks/main.yaml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
|
||||
# install traefik
|
||||
- name: "install traefik"
|
||||
ansible.builtin.import_tasks: "traefik.yaml"
|
||||
|
||||
# cleanup docker
|
||||
- name: "cleanup docker"
|
||||
ansible.builtin.import_tasks: "cleanup.yaml"
|
||||
82
tasks/traefik.yaml
Normal file
82
tasks/traefik.yaml
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
---
|
||||
|
||||
# create directory
|
||||
- name: "create - directory - /mnt/traefik"
|
||||
ansible.builtin.file:
|
||||
path: "/mnt/traefik"
|
||||
state: "directory"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0775"
|
||||
|
||||
# traefik config
|
||||
- name: "traefik config"
|
||||
ansible.builtin.template:
|
||||
src: "templates/traefik/config.yml.j2"
|
||||
dest: "/mnt/traefik/traefik.yml"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0640"
|
||||
notify: "restart traefik"
|
||||
|
||||
# transip apikey
|
||||
- name: "traefik - transip api"
|
||||
ansible.builtin.file:
|
||||
dest: "/mnt/traefik/transip.key"
|
||||
state: "touch"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0600"
|
||||
changed_when: false
|
||||
|
||||
# touch acme.json
|
||||
- name: "treafik - acme.json"
|
||||
ansible.builtin.file:
|
||||
dest: "/mnt/traefik/acme.json"
|
||||
state: "touch"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0600"
|
||||
changed_when: false
|
||||
|
||||
# run traefik
|
||||
- name: "run traefik"
|
||||
community.docker.docker_container:
|
||||
|
||||
# container_default_behavior
|
||||
auto_remove: "no"
|
||||
container_default_behavior: "no_defaults"
|
||||
detach: "yes"
|
||||
init: "no"
|
||||
interactive: "no"
|
||||
log_driver: "json-file"
|
||||
log_options:
|
||||
max-size: "5m"
|
||||
max-file: "3"
|
||||
memory: "0"
|
||||
paused: "no"
|
||||
privileged: "no"
|
||||
pull: "always"
|
||||
read_only: "no"
|
||||
state: "started"
|
||||
tty: "no"
|
||||
|
||||
# traefik
|
||||
name: "traefik"
|
||||
image: "docker.io/traefik:v3.5"
|
||||
image_name_mismatch: "recreate"
|
||||
restart_policy: "unless-stopped"
|
||||
network_mode: "host"
|
||||
volumes:
|
||||
- "/mnt/traefik/traefik.yml:/traefik.yml:ro"
|
||||
- "/mnt/traefik/acme.json:/acme.json"
|
||||
- "/mnt/traefik/transip.key:/transip.key:ro"
|
||||
|
||||
env:
|
||||
|
||||
# transip api
|
||||
TRANSIP_ACCOUNT_NAME: "{{ transip_user }}"
|
||||
TRANSIP_PRIVATE_KEY_PATH: "/transip.key"
|
||||
|
||||
# global
|
||||
TZ: "{{ timezone }}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue