2024-04-09 11:42:03 +00:00
|
|
|
---
|
|
|
|
- name: "Install - Ansible - Python Library"
|
|
|
|
pip:
|
|
|
|
name: ansible
|
|
|
|
state: latest
|
|
|
|
extra_args: --upgrade
|
|
|
|
virtualenv: /opt/ansible
|
|
|
|
virtualenv_command: "python3 -m venv"
|
|
|
|
tags:
|
|
|
|
- ansible
|
|
|
|
|
|
|
|
- name: "Install - Ansible - Create Symbolic Links"
|
|
|
|
ansible.builtin.file:
|
|
|
|
src: /opt/ansible/bin/{{ binary }}
|
|
|
|
dest: /usr/local/bin/{{ binary }}
|
|
|
|
state: link
|
|
|
|
vars:
|
|
|
|
binaries:
|
|
|
|
- ansible
|
|
|
|
- ansible-community
|
|
|
|
- ansible-config
|
|
|
|
- ansible-connection
|
|
|
|
- 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: "Install - Ansible - Dependencies / Python Library : hvac"
|
|
|
|
pip:
|
|
|
|
name: hvac
|
|
|
|
state: latest
|
|
|
|
extra_args: --upgrade
|
|
|
|
virtualenv: /opt/ansible
|
|
|
|
virtualenv_command: "python3 -m venv"
|
|
|
|
tags:
|
|
|
|
- ansible
|
|
|
|
|
|
|
|
- name: "Install - Ansible - Dependencies / Python Library : netaddr"
|
|
|
|
pip:
|
|
|
|
name: netaddr
|
|
|
|
state: latest
|
|
|
|
extra_args: --upgrade
|
|
|
|
virtualenv: /opt/ansible
|
|
|
|
virtualenv_command: "python3 -m venv"
|
|
|
|
tags:
|
|
|
|
- ansible
|
|
|
|
|
|
|
|
- name: "Install - Ansible - Dependencies / Python Library : jmespath"
|
|
|
|
pip:
|
|
|
|
name: jmespath
|
|
|
|
state: latest
|
|
|
|
extra_args: --upgrade
|
|
|
|
virtualenv: /opt/ansible
|
|
|
|
virtualenv_command: "python3 -m venv"
|
|
|
|
tags:
|
|
|
|
- ansible
|
|
|
|
|
|
|
|
- name: "Install - Ansible - Dependencies / Python Library : pexpect"
|
|
|
|
pip:
|
|
|
|
name: pexpect
|
|
|
|
state: latest
|
|
|
|
extra_args: --upgrade
|
|
|
|
virtualenv: /opt/ansible
|
|
|
|
virtualenv_command: "python3 -m venv"
|
|
|
|
tags:
|
|
|
|
- ansible
|
|
|
|
|
|
|
|
- name: "Install - Podman"
|
|
|
|
apt:
|
|
|
|
name: podman
|
|
|
|
state: latest
|
|
|
|
tags:
|
|
|
|
- podman
|
|
|
|
|
|
|
|
- name: "Install - Certbot - Python Library"
|
|
|
|
pip:
|
|
|
|
name: certbot
|
|
|
|
state: latest
|
|
|
|
extra_args: --upgrade
|
|
|
|
virtualenv: /opt/ansible
|
|
|
|
virtualenv_command: "python3 -m venv"
|
|
|
|
tags:
|
|
|
|
- certbot
|
|
|
|
|
|
|
|
- name: "Install - Certbot - Create Symbolic Links"
|
|
|
|
ansible.builtin.file:
|
|
|
|
src: /opt/ansible/bin/{{ binary }}
|
|
|
|
dest: /usr/local/bin/{{ binary }}
|
|
|
|
state: link
|
|
|
|
vars:
|
|
|
|
binaries:
|
|
|
|
- certbot
|
|
|
|
loop: "{{ binaries }}"
|
|
|
|
loop_control:
|
|
|
|
label: "{{ binary }}"
|
|
|
|
loop_var: "binary"
|
|
|
|
tags:
|
|
|
|
- certbot
|
|
|
|
|
2024-04-16 18:19:53 +00:00
|
|
|
# - name: "Install - Certbot - Create Certificates"
|
|
|
|
# command: "certbot 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/renewal-hooks/pre/acme-dns-auth.py --debug-challenges --preferred-chain='ISRG Root X1' --key-type rsa -d {{ cert.domains | join(' -d ') }}"
|
|
|
|
# register: task
|
|
|
|
# changed_when: task.stdout.find("Certificate not yet due for renewal; no action taken.") == -1
|
|
|
|
# vars:
|
|
|
|
# cert:
|
2024-04-18 13:00:47 +00:00
|
|
|
# name: mpp
|
|
|
|
# email: matias.martikainen@metropolia.fi
|
2024-04-16 18:19:53 +00:00
|
|
|
# domains:
|
2024-04-18 13:00:47 +00:00
|
|
|
# - "{{ ansible_facts.fqdn }}"
|
2024-04-16 18:19:53 +00:00
|
|
|
# tags:
|
|
|
|
# - certbot
|
2024-04-09 11:42:03 +00:00
|
|
|
|
|
|
|
- name: "Install - MariaDB - Dependencies / Python Library : pymysql"
|
|
|
|
pip:
|
|
|
|
name: pymysql
|
|
|
|
state: latest
|
|
|
|
extra_args: --upgrade
|
|
|
|
virtualenv: /opt/ansible
|
|
|
|
virtualenv_command: "python3 -m venv"
|
|
|
|
|
|
|
|
- name: "Install - MariaDB - Dependencies / Package : mariadb-client"
|
|
|
|
apt:
|
|
|
|
name: "mariadb-client"
|
|
|
|
state: latest
|
|
|
|
when:
|
|
|
|
- ansible_facts.distribution == "Debian" or ansible_facts.distribution == "Ubuntu" or ansible_facts.distribution == "Linux Mint"
|
|
|
|
|
|
|
|
- name: "Install - Schedule - Maintenance"
|
|
|
|
cron:
|
|
|
|
name: Maintenance
|
|
|
|
hour: "*/3"
|
|
|
|
minute: "0"
|
2024-04-09 11:50:38 +00:00
|
|
|
job: "/opt/ansible/bin/ansible-pull -U ssh://git@github.com/MatteZ02/mpp-ansible --accept-host-key --private-key ~/.ssh/id_rsa tasks.yml -t maintenance"
|
2024-04-09 11:42:03 +00:00
|
|
|
|
2024-04-16 18:19:53 +00:00
|
|
|
# - name: "Install - Schedule - Deployer"
|
|
|
|
# cron:
|
|
|
|
# name: Deployer
|
|
|
|
# minute: "*/5"
|
|
|
|
# job: "/opt/ansible/bin/ansible-pull -U ssh://git@github.com/MatteZ02/mpp-ansible --accept-host-key --private-key ~/.ssh/id_rsa tasks.yml -t deployer"
|