mirror of
https://github.com/MatteZ02/infra.git
synced 2026-09-15 08:36:52 +00:00
Ansible: Update
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
---
|
||||
- name: "Deployer - Certbot - Renew Certificates"
|
||||
containers.podman.podman_container:
|
||||
name: certbot
|
||||
image: "docker.io/certbot/certbot:latest"
|
||||
state: started
|
||||
network: host
|
||||
volumes:
|
||||
- "{{ ansible_facts.user_dir }}/data/certbot:/etc/letsencrypt"
|
||||
command: "renew"
|
||||
detach: false
|
||||
register: task
|
||||
changed_when:
|
||||
- task.stdout.find("No renewals were attempted.") == -1
|
||||
tags:
|
||||
- certbot
|
||||
- tls
|
||||
|
||||
- name: "Deployer - Certbot - Copy Certificates"
|
||||
ansible.builtin.copy:
|
||||
src: "~/data/certbot/live/{{ cert }}/"
|
||||
dest: "~/data/certificates/{{ cert }}/"
|
||||
follow: true
|
||||
loop: "{{ certs }}"
|
||||
loop_control:
|
||||
label: "{{ cert }}"
|
||||
loop_var: "cert"
|
||||
vars:
|
||||
certs:
|
||||
- arcadiamc
|
||||
register: task
|
||||
tags:
|
||||
- certbot
|
||||
- tls
|
||||
|
||||
# - name: "Deployer - Minecraft - Build Image"
|
||||
# containers.podman.podman_image:
|
||||
# name: arcadiamc/openjdk
|
||||
# tag: latest
|
||||
# path: "{{ ansible_facts.user_dir }}/data/minecraft"
|
||||
# build:
|
||||
# file: Dockerfile
|
||||
# format: docker
|
||||
# cache: off
|
||||
# force: on
|
||||
# tags:
|
||||
# - minecraft
|
||||
|
||||
# - name: "Deployer - Minecraft - Create Container"
|
||||
# containers.podman.podman_container:
|
||||
# name: minecraft
|
||||
# image: "arcadiamc/openjdk:latest"
|
||||
# state: started
|
||||
# recreate: on
|
||||
# network: host
|
||||
# volumes:
|
||||
# - "{{ ansible_facts.user_dir }}/data/minecraft:/usr/src/app"
|
||||
# workdir: /usr/src/app
|
||||
# command: "java -Xms1G -Xmx8G -jar paper-1.21.4-232.jar"
|
||||
# restart_policy: unless-stopped
|
||||
# tags:
|
||||
# - minecraft
|
||||
|
||||
# - name: "Deployer - SSH - Build Image"
|
||||
# containers.podman.podman_image:
|
||||
# name: matte/ssh
|
||||
# tag: latest
|
||||
# path: "{{ ansible_facts.user_dir }}/data/ssh"
|
||||
# build:
|
||||
# file: Dockerfile
|
||||
# format: docker
|
||||
# cache: off
|
||||
# force: on
|
||||
# tags:
|
||||
# - ssh
|
||||
|
||||
# - name: "Deployer - SSH - Create Container"
|
||||
# containers.podman.podman_container:
|
||||
# name: ssh
|
||||
# image: "matte/ssh:latest"
|
||||
# state: started
|
||||
# recreate: on
|
||||
# network: host
|
||||
# volumes:
|
||||
# - "{{ ansible_facts.user_dir }}/data:/root/data"
|
||||
# - "{{ ansible_facts.user_dir }}/data/ssh/keys:/etc/ssh/keys"
|
||||
# restart_policy: unless-stopped
|
||||
# tags:
|
||||
# - ssh
|
||||
@@ -0,0 +1,130 @@
|
||||
---
|
||||
- name: "Installer - Ansible - Python Library"
|
||||
ansible.builtin.pip:
|
||||
name: ansible
|
||||
state: latest
|
||||
extra_args: --upgrade
|
||||
virtualenv: ~/.venv/ansible
|
||||
virtualenv_command: "python3 -m venv"
|
||||
tags:
|
||||
- ansible
|
||||
|
||||
- name: "Installer : Ansible : Create Folder"
|
||||
ansible.builtin.file:
|
||||
path: ~/bin
|
||||
state: directory
|
||||
tags:
|
||||
- ansible
|
||||
|
||||
- name: "Installer : Ansible : Create Symbolic Links"
|
||||
ansible.builtin.file:
|
||||
src: ~/.venv/ansible/bin/{{ binary }}
|
||||
dest: ~/bin/{{ binary }}
|
||||
state: link
|
||||
vars:
|
||||
binaries:
|
||||
- ansible
|
||||
- ansible-community
|
||||
- ansible-config
|
||||
- ansible-console
|
||||
- ansible-doc
|
||||
- ansible-galaxy
|
||||
- ansible-inventory
|
||||
- ansible-playbook
|
||||
- ansible-pull
|
||||
- ansible-test
|
||||
- ansible-vault
|
||||
loop: "{{ binaries }}"
|
||||
loop_control:
|
||||
label: "{{ binary }}"
|
||||
loop_var: "binary"
|
||||
tags:
|
||||
- ansible
|
||||
|
||||
- name: "Installer - Ansible - Dependencies / Python Libraries"
|
||||
ansible.builtin.pip:
|
||||
name: "{{ library }}"
|
||||
state: latest
|
||||
extra_args: --upgrade
|
||||
virtualenv: ~/.venv/ansible
|
||||
virtualenv_command: "python3 -m venv"
|
||||
vars:
|
||||
libraries:
|
||||
- cryptography
|
||||
- dnspython
|
||||
- hvac
|
||||
- jmespath
|
||||
- netaddr
|
||||
- pexpect
|
||||
loop: "{{ libraries }}"
|
||||
loop_control:
|
||||
label: "{{ library }}"
|
||||
loop_var: "library"
|
||||
|
||||
- name: "Installer : Certbot : Auth Hook - Create Folder"
|
||||
ansible.builtin.file:
|
||||
path: ~/data/certbot/auth-hooks
|
||||
state: directory
|
||||
tags:
|
||||
- certbot
|
||||
|
||||
- name: "Installer : Certbot : Auth Hook - Copy File"
|
||||
ansible.builtin.copy:
|
||||
src: "./templates/certbot/auth-hooks/acme-dns.py"
|
||||
dest: "~/data/certbot/auth-hooks/acme-dns.py"
|
||||
mode: '700'
|
||||
force: true
|
||||
tags:
|
||||
- certbot
|
||||
|
||||
- name: "Installer : Certbot : Create Certificates"
|
||||
containers.podman.podman_container:
|
||||
name: certbot
|
||||
image: "docker.io/certbot/certbot:latest"
|
||||
state: started
|
||||
network: host
|
||||
volumes:
|
||||
- "{{ ansible_facts.user_dir }}/data/certbot:/etc/letsencrypt"
|
||||
command: "certonly --cert-name {{ cert.name }} --manual --preferred-challenges dns-01 --email {{ cert.email }} --server https://acme-v02.api.letsencrypt.org/directory --agree-tos -n --manual-auth-hook /etc/letsencrypt/auth-hooks/acme-dns.py --debug-challenges --key-type rsa -d {{ cert.domains | join(' -d ') }}"
|
||||
detach: false
|
||||
register: task
|
||||
changed_when:
|
||||
- task.stdout.find("Certificate not yet due for renewal; no action taken.") == -1
|
||||
loop: "{{ certs }}"
|
||||
loop_control:
|
||||
label: "{{ cert.name }}"
|
||||
loop_var: "cert"
|
||||
vars:
|
||||
certs:
|
||||
- name: arcadiamc
|
||||
email: mattez02.contact@gmail.com
|
||||
domains:
|
||||
- arcadiamc.wgi.fi
|
||||
tags:
|
||||
- certbot
|
||||
|
||||
- name: "Installer : Schedule : Maintenance"
|
||||
ansible.builtin.cron:
|
||||
name: "Matte - Infra - Maintenance"
|
||||
hour: "*/3"
|
||||
minute: "0"
|
||||
job: "~/.venv/ansible/bin/ansible-pull -U ssh://git@github.com/MatteZ02/infra -d ~/.ansible/pull/matte/infra --accept-host-key --private-key ~/.ssh/keys/matte/infra --vault-password-file ~/.ansible/vault/matte.yml tasks.yml -t maintenance"
|
||||
tags:
|
||||
- cron
|
||||
|
||||
- name: "Installer : Schedule : Deployer"
|
||||
ansible.builtin.cron:
|
||||
name: "Matte - Infra - Deployer"
|
||||
minute: "*/5"
|
||||
job: "~/.venv/ansible/bin/ansible-pull -U ssh://git@github.com/MatteZ02/infra -d ~/.ansible/pull/matte/infra --accept-host-key --private-key ~/.ssh/keys/matte/infra --vault-password-file ~/.ansible/vault/matte.yml tasks.yml -t deployer"
|
||||
tags:
|
||||
- cron
|
||||
|
||||
- name: "Installer : Schedule : Backup"
|
||||
ansible.builtin.cron:
|
||||
name: "Matte - Infra - Backup"
|
||||
hour: "3"
|
||||
minute: "30"
|
||||
job: "~/.venv/ansible/bin/ansible-pull -U ssh://git@github.com/MatteZ02/infra -d ~/.ansible/pull/matte/infra --accept-host-key --private-key ~/.ssh/keys/matte/infra --vault-password-file ~/.ansible/vault/matte.yml tasks.yml -t backup"
|
||||
tags:
|
||||
- cron
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
- name: "Installer - Ansible - Dependencies / Python Libraries"
|
||||
ansible.builtin.pip:
|
||||
name: "{{ library }}"
|
||||
state: latest
|
||||
extra_args: --upgrade
|
||||
virtualenv: ~/.venv/ansible
|
||||
virtualenv_command: "python3 -m venv"
|
||||
vars:
|
||||
libraries:
|
||||
- cryptography
|
||||
- dnspython
|
||||
- hvac
|
||||
- jmespath
|
||||
- netaddr
|
||||
- pexpect
|
||||
loop: "{{ libraries }}"
|
||||
loop_control:
|
||||
label: "{{ library }}"
|
||||
loop_var: "library"
|
||||
|
||||
- name: "Maintenance : Ansible : Update"
|
||||
ansible.builtin.pip:
|
||||
name: ansible
|
||||
state: latest
|
||||
extra_args: --upgrade
|
||||
virtualenv: ~/.venv/ansible
|
||||
virtualenv_command: "python3 -m venv"
|
||||
|
||||
- name: "Maintenance : Podman : Prune"
|
||||
containers.podman.podman_prune:
|
||||
container: yes
|
||||
image: yes
|
||||
image_filters:
|
||||
dangling_only: no
|
||||
volume: yes
|
||||
Reference in New Issue
Block a user