Updated Ansible tasks to FQCN format
This commit is contained in:
parent
81d2ea447a
commit
6e4f083e01
@ -1,46 +1,46 @@
|
|||||||
- name: Install the Uncomplicated Firewall
|
- name: Install the Uncomplicated Firewall
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: ufw
|
name: ufw
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Install Fail2ban
|
- name: Install Fail2ban
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: fail2ban
|
name: fail2ban
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Deny incoming traffic by default
|
- name: Deny incoming traffic by default
|
||||||
ufw:
|
community.general.ufw:
|
||||||
default: deny
|
default: deny
|
||||||
direction: incoming
|
direction: incoming
|
||||||
|
|
||||||
- name: Allow outgoing traffic by default
|
- name: Allow outgoing traffic by default
|
||||||
ufw:
|
community.general.ufw:
|
||||||
default: allow
|
default: allow
|
||||||
direction: outgoing
|
direction: outgoing
|
||||||
|
|
||||||
- name: Allow OpenSSH with rate limiting
|
- name: Allow OpenSSH with rate limiting
|
||||||
ufw:
|
community.general.ufw:
|
||||||
name: ssh
|
name: ssh
|
||||||
rule: limit
|
rule: limit
|
||||||
|
|
||||||
- name: Remove Fail2ban defaults-debian.conf
|
- name: Remove Fail2ban defaults-debian.conf
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: /etc/fail2ban/jail.d/defaults-debian.conf
|
path: /etc/fail2ban/jail.d/defaults-debian.conf
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Install OpenSSH's Fail2ban jail
|
- name: Install OpenSSH's Fail2ban jail
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: fail2ban-ssh.conf.j2
|
src: fail2ban-ssh.conf.j2
|
||||||
dest: /etc/fail2ban/jail.d/sshd.conf
|
dest: /etc/fail2ban/jail.d/sshd.conf
|
||||||
notify: restart_fail2ban
|
notify: restart_fail2ban
|
||||||
|
|
||||||
- name: Install Fail2ban IP allow list
|
- name: Install Fail2ban IP allow list
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: fail2ban-allowlist.conf.j2
|
src: fail2ban-allowlist.conf.j2
|
||||||
dest: /etc/fail2ban/jail.d/allowlist.conf
|
dest: /etc/fail2ban/jail.d/allowlist.conf
|
||||||
when: fail2ban_ignoreip is defined
|
when: fail2ban_ignoreip is defined
|
||||||
notify: restart_fail2ban
|
notify: restart_fail2ban
|
||||||
|
|
||||||
- name: Enable firewall
|
- name: Enable firewall
|
||||||
ufw:
|
community.general.ufw:
|
||||||
state: enabled
|
state: enabled
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
- name: Install msmtp
|
- name: Install msmtp
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
state: present
|
state: present
|
||||||
loop:
|
loop:
|
||||||
@ -8,12 +8,12 @@
|
|||||||
- mailutils
|
- mailutils
|
||||||
|
|
||||||
- name: Install msmtp configuration
|
- name: Install msmtp configuration
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: msmtprc.j2
|
src: msmtprc.j2
|
||||||
dest: /root/.msmtprc
|
dest: /root/.msmtprc
|
||||||
mode: 0700
|
mode: 0700
|
||||||
|
|
||||||
- name: Install /etc/aliases
|
- name: Install /etc/aliases
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
dest: /etc/aliases
|
dest: /etc/aliases
|
||||||
content: "root: {{ mail.rootalias }}"
|
content: "root: {{ mail.rootalias }}"
|
||||||
|
@ -1,24 +1,24 @@
|
|||||||
- import_tasks: ansible.yml
|
- ansible.builtin.import_tasks: ansible.yml
|
||||||
tags: ansible
|
tags: ansible
|
||||||
|
|
||||||
- import_tasks: system.yml
|
- ansible.builtin.import_tasks: system.yml
|
||||||
tags: system
|
tags: system
|
||||||
|
|
||||||
- import_tasks: firewall.yml
|
- ansible.builtin.import_tasks: firewall.yml
|
||||||
tags: firewall
|
tags: firewall
|
||||||
|
|
||||||
- import_tasks: network.yml
|
- ansible.builtin.import_tasks: network.yml
|
||||||
tags: network
|
tags: network
|
||||||
when: manage_network
|
when: manage_network
|
||||||
|
|
||||||
- import_tasks: mail.yml
|
- ansible.builtin.import_tasks: mail.yml
|
||||||
tags: mail
|
tags: mail
|
||||||
when: mail is defined
|
when: mail is defined
|
||||||
|
|
||||||
- import_tasks: ddclient.yml
|
- ansible.builtin.import_tasks: ddclient.yml
|
||||||
tags: ddclient
|
tags: ddclient
|
||||||
when: ddclient is defined
|
when: ddclient is defined
|
||||||
|
|
||||||
- import_tasks: wireguard.yml
|
- ansible.builtin.import_tasks: wireguard.yml
|
||||||
tags: wireguard
|
tags: wireguard
|
||||||
when: wireguard is defined
|
when: wireguard is defined
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
- name: Install network interfaces file
|
- name: Install network interfaces file
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
src: network-interfaces.cfg
|
src: network-interfaces.cfg
|
||||||
dest: /etc/network/interfaces
|
dest: /etc/network/interfaces
|
||||||
owner: root
|
owner: root
|
||||||
@ -7,7 +7,7 @@
|
|||||||
mode: '0644'
|
mode: '0644'
|
||||||
|
|
||||||
- name: Install network interfaces
|
- name: Install network interfaces
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: "interface.j2"
|
src: "interface.j2"
|
||||||
dest: "/etc/network/interfaces.d/{{ item.name }}"
|
dest: "/etc/network/interfaces.d/{{ item.name }}"
|
||||||
loop: "{{ interfaces }}"
|
loop: "{{ interfaces }}"
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
- name: Install useful software
|
- name: Install useful software
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: "{{ packages }}"
|
name: "{{ packages }}"
|
||||||
state: present
|
state: present
|
||||||
update_cache: true
|
update_cache: true
|
||||||
|
|
||||||
- name: Manage root authorized_keys
|
- name: Manage root authorized_keys
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: authorized_keys.j2
|
src: authorized_keys.j2
|
||||||
dest: /root/.ssh/authorized_keys
|
dest: /root/.ssh/authorized_keys
|
||||||
when: authorized_keys is defined
|
when: authorized_keys is defined
|
||||||
|
|
||||||
- name: Manage filesystem mounts
|
- name: Manage filesystem mounts
|
||||||
mount:
|
ansible.posix.mount:
|
||||||
path: "{{ item.path }}"
|
path: "{{ item.path }}"
|
||||||
src: "UUID={{ item.uuid }}"
|
src: "UUID={{ item.uuid }}"
|
||||||
fstype: "{{ item.fstype }}"
|
fstype: "{{ item.fstype }}"
|
||||||
|
@ -1,35 +1,35 @@
|
|||||||
- name: Install WireGuard
|
- name: Install WireGuard
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: wireguard
|
name: wireguard
|
||||||
state: present
|
state: present
|
||||||
update_cache: true
|
update_cache: true
|
||||||
|
|
||||||
- name: Generate WireGuard keys
|
- name: Generate WireGuard keys
|
||||||
shell: wg genkey | tee privatekey | wg pubkey > publickey
|
ansible.builtin.shell: wg genkey | tee privatekey | wg pubkey > publickey
|
||||||
args:
|
args:
|
||||||
chdir: /etc/wireguard/
|
chdir: /etc/wireguard/
|
||||||
creates: /etc/wireguard/privatekey
|
creates: /etc/wireguard/privatekey
|
||||||
|
|
||||||
- name: Grab WireGuard private key for configuration
|
- name: Grab WireGuard private key for configuration
|
||||||
slurp:
|
ansible.builtin.slurp:
|
||||||
src: /etc/wireguard/privatekey
|
src: /etc/wireguard/privatekey
|
||||||
register: wgkey
|
register: wgkey
|
||||||
|
|
||||||
- name: Install WireGuard configuration
|
- name: Install WireGuard configuration
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: wireguard.j2
|
src: wireguard.j2
|
||||||
dest: /etc/wireguard/wg0.conf
|
dest: /etc/wireguard/wg0.conf
|
||||||
notify:
|
notify:
|
||||||
- restart_wireguard
|
- restart_wireguard
|
||||||
|
|
||||||
- name: Start WireGuard interface
|
- name: Start WireGuard interface
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: wg-quick@wg0
|
name: wg-quick@wg0
|
||||||
state: started
|
state: started
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
- name: Add WireGuard firewall rule
|
- name: Add WireGuard firewall rule
|
||||||
ufw:
|
community.general.ufw:
|
||||||
rule: allow
|
rule: allow
|
||||||
port: "{{ wireguard.listenport }}"
|
port: "{{ wireguard.listenport }}"
|
||||||
proto: tcp
|
proto: tcp
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
- name: Stop Bitwarden for rebuild
|
- name: Stop Bitwarden for rebuild
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: "{{ bitwarden_name }}"
|
name: "{{ bitwarden_name }}"
|
||||||
state: stopped
|
state: stopped
|
||||||
listen: rebuild_bitwarden
|
listen: rebuild_bitwarden
|
||||||
|
|
||||||
- name: Rebuild Bitwarden
|
- name: Rebuild Bitwarden
|
||||||
shell: "{{ bitwarden_root }}/bitwarden.sh rebuild"
|
ansible.builtin.shell: "{{ bitwarden_root }}/bitwarden.sh rebuild"
|
||||||
listen: rebuild_bitwarden
|
listen: rebuild_bitwarden
|
||||||
|
|
||||||
- name: Start Bitwarden after rebuild
|
- name: Start Bitwarden after rebuild
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: "{{ bitwarden_name }}"
|
name: "{{ bitwarden_name }}"
|
||||||
state: started
|
state: started
|
||||||
enabled: true
|
enabled: true
|
||||||
|
@ -1,40 +1,40 @@
|
|||||||
- name: Install expect
|
- name: Install expect
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: expect
|
name: expect
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Create Bitwarden directory
|
- name: Create Bitwarden directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ bitwarden_root }}"
|
path: "{{ bitwarden_root }}"
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- name: Download Bitwarden script
|
- name: Download Bitwarden script
|
||||||
get_url:
|
ansible.builtin.get_url:
|
||||||
url: "https://raw.githubusercontent.com/\
|
url: "https://raw.githubusercontent.com/\
|
||||||
bitwarden/self-host/master/bitwarden.sh"
|
bitwarden/self-host/master/bitwarden.sh"
|
||||||
dest: "{{ bitwarden_root }}"
|
dest: "{{ bitwarden_root }}"
|
||||||
mode: u+x
|
mode: u+x
|
||||||
|
|
||||||
- name: Install Bitwarden script wrapper
|
- name: Install Bitwarden script wrapper
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: bw_wrapper.j2
|
src: bw_wrapper.j2
|
||||||
dest: "{{ bitwarden_root }}/bw_wrapper"
|
dest: "{{ bitwarden_root }}/bw_wrapper"
|
||||||
mode: u+x
|
mode: u+x
|
||||||
|
|
||||||
- name: Run Bitwarden installation script
|
- name: Run Bitwarden installation script
|
||||||
shell: "{{ bitwarden_root }}/bw_wrapper"
|
ansible.builtin.shell: "{{ bitwarden_root }}/bw_wrapper"
|
||||||
args:
|
args:
|
||||||
creates: "{{ bitwarden_root }}/bwdata/config.yml"
|
creates: "{{ bitwarden_root }}/bwdata/config.yml"
|
||||||
|
|
||||||
- name: Install docker-compose override
|
- name: Install docker-compose override
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: compose.override.yml.j2
|
src: compose.override.yml.j2
|
||||||
dest: "{{ bitwarden_root }}/bwdata/docker/docker-compose.override.yml"
|
dest: "{{ bitwarden_root }}/bwdata/docker/docker-compose.override.yml"
|
||||||
when: traefik_version is defined
|
when: traefik_version is defined
|
||||||
notify: rebuild_bitwarden
|
notify: rebuild_bitwarden
|
||||||
|
|
||||||
- name: Disable bitwarden-nginx HTTP on 80
|
- name: Disable bitwarden-nginx HTTP on 80
|
||||||
replace:
|
ansible.builtin.replace:
|
||||||
path: "{{ bitwarden_root }}/bwdata/config.yml"
|
path: "{{ bitwarden_root }}/bwdata/config.yml"
|
||||||
regexp: "^http_port: 80$"
|
regexp: "^http_port: 80$"
|
||||||
replace: "http_port: 127.0.0.1:8080"
|
replace: "http_port: 127.0.0.1:8080"
|
||||||
@ -42,7 +42,7 @@
|
|||||||
notify: rebuild_bitwarden
|
notify: rebuild_bitwarden
|
||||||
|
|
||||||
- name: Disable bitwarden-nginx HTTPS on 443
|
- name: Disable bitwarden-nginx HTTPS on 443
|
||||||
replace:
|
ansible.builtin.replace:
|
||||||
path: "{{ bitwarden_root }}/bwdata/config.yml"
|
path: "{{ bitwarden_root }}/bwdata/config.yml"
|
||||||
regexp: "^https_port: 443$"
|
regexp: "^https_port: 443$"
|
||||||
replace: "https_port: 127.0.0.1:8443"
|
replace: "https_port: 127.0.0.1:8443"
|
||||||
@ -50,7 +50,7 @@
|
|||||||
notify: rebuild_bitwarden
|
notify: rebuild_bitwarden
|
||||||
|
|
||||||
- name: Disable Bitwarden managed Lets Encrypt
|
- name: Disable Bitwarden managed Lets Encrypt
|
||||||
replace:
|
ansible.builtin.replace:
|
||||||
path: "{{ bitwarden_root }}/bwdata/config.yml"
|
path: "{{ bitwarden_root }}/bwdata/config.yml"
|
||||||
regexp: "^ssl_managed_lets_encrypt: true$"
|
regexp: "^ssl_managed_lets_encrypt: true$"
|
||||||
replace: "ssl_managed_lets_encrypt: false"
|
replace: "ssl_managed_lets_encrypt: false"
|
||||||
@ -58,7 +58,7 @@
|
|||||||
notify: rebuild_bitwarden
|
notify: rebuild_bitwarden
|
||||||
|
|
||||||
- name: Disable Bitwarden managed SSL
|
- name: Disable Bitwarden managed SSL
|
||||||
replace:
|
ansible.builtin.replace:
|
||||||
path: "{{ bitwarden_root }}/bwdata/config.yml"
|
path: "{{ bitwarden_root }}/bwdata/config.yml"
|
||||||
regexp: "^ssl: true$"
|
regexp: "^ssl: true$"
|
||||||
replace: "ssl: false"
|
replace: "ssl: false"
|
||||||
@ -66,39 +66,39 @@
|
|||||||
notify: rebuild_bitwarden
|
notify: rebuild_bitwarden
|
||||||
|
|
||||||
- name: Define reverse proxy servers
|
- name: Define reverse proxy servers
|
||||||
lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
path: "{{ bitwarden_root }}/bwdata/config.yml"
|
path: "{{ bitwarden_root }}/bwdata/config.yml"
|
||||||
line: "- {{ bitwarden_realips }}"
|
line: "- {{ bitwarden_realips }}"
|
||||||
insertafter: "^real_ips"
|
insertafter: "^real_ips"
|
||||||
notify: rebuild_bitwarden
|
notify: rebuild_bitwarden
|
||||||
|
|
||||||
- name: Install Bitwarden systemd service
|
- name: Install Bitwarden systemd service
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: bitwarden.service.j2
|
src: bitwarden.service.j2
|
||||||
dest: "/etc/systemd/system/{{ bitwarden_name }}.service"
|
dest: "/etc/systemd/system/{{ bitwarden_name }}.service"
|
||||||
register: bitwarden_systemd
|
register: bitwarden_systemd
|
||||||
notify: rebuild_bitwarden
|
notify: rebuild_bitwarden
|
||||||
|
|
||||||
- name: Create Bitwarden's initial logging directory
|
- name: Create Bitwarden's initial logging directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ bitwarden_logs_identity }}"
|
path: "{{ bitwarden_logs_identity }}"
|
||||||
state: directory
|
state: directory
|
||||||
register: bitwarden_logs
|
register: bitwarden_logs
|
||||||
|
|
||||||
- name: Create Bitwarden's initial log file
|
- name: Create Bitwarden's initial log file
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ bitwarden_logs_identity }}/{{ bitwarden_logs_identity_date }}.txt"
|
path: "{{ bitwarden_logs_identity }}/{{ bitwarden_logs_identity_date }}.txt"
|
||||||
state: touch
|
state: touch
|
||||||
when: bitwarden_logs.changed
|
when: bitwarden_logs.changed
|
||||||
|
|
||||||
- name: Install Bitwarden's Fail2ban jail
|
- name: Install Bitwarden's Fail2ban jail
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: fail2ban-jail.conf.j2
|
src: fail2ban-jail.conf.j2
|
||||||
dest: /etc/fail2ban/jail.d/bitwarden.conf
|
dest: /etc/fail2ban/jail.d/bitwarden.conf
|
||||||
notify: restart_fail2ban
|
notify: restart_fail2ban
|
||||||
|
|
||||||
- name: Reload systemd manager configuration
|
- name: Reload systemd manager configuration
|
||||||
systemd:
|
ansible.builtin.systemd:
|
||||||
daemon_reload: true
|
daemon_reload: true
|
||||||
when: bitwarden_systemd.changed
|
when: bitwarden_systemd.changed
|
||||||
notify: rebuild_bitwarden
|
notify: rebuild_bitwarden
|
||||||
|
@ -1,27 +1,27 @@
|
|||||||
- name: Install Docker
|
- name: Install Docker
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: ['docker.io', 'docker-compose']
|
name: ['docker.io', 'docker-compose']
|
||||||
state: present
|
state: present
|
||||||
update_cache: true
|
update_cache: true
|
||||||
|
|
||||||
- name: Create docker-compose root
|
- name: Create docker-compose root
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ docker_compose_root }}"
|
path: "{{ docker_compose_root }}"
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- name: Install docker-compose systemd service
|
- name: Install docker-compose systemd service
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: docker-compose.service.j2
|
src: docker-compose.service.j2
|
||||||
dest: "/etc/systemd/system/{{ docker_compose_service }}@.service"
|
dest: "/etc/systemd/system/{{ docker_compose_service }}@.service"
|
||||||
register: compose_systemd
|
register: compose_systemd
|
||||||
|
|
||||||
- name: Reload systemd manager configuration
|
- name: Reload systemd manager configuration
|
||||||
systemd:
|
ansible.builtin.systemd:
|
||||||
daemon_reload: true
|
daemon_reload: true
|
||||||
when: compose_systemd.changed
|
when: compose_systemd.changed
|
||||||
|
|
||||||
- name: Add users to docker group
|
- name: Add users to docker group
|
||||||
user:
|
ansible.builtin.user:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
groups: docker
|
groups: docker
|
||||||
append: true
|
append: true
|
||||||
@ -29,7 +29,7 @@
|
|||||||
when: docker_users is defined
|
when: docker_users is defined
|
||||||
|
|
||||||
- name: Start Docker and enable on boot
|
- name: Start Docker and enable on boot
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: docker
|
name: docker
|
||||||
state: started
|
state: started
|
||||||
enabled: true
|
enabled: true
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
- name: Restart Gitea
|
- name: Restart Gitea
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: "{{ docker_compose_service }}@{{ gitea_name }}"
|
name: "{{ docker_compose_service }}@{{ gitea_name }}"
|
||||||
state: restarted
|
state: restarted
|
||||||
listen: restart_gitea
|
listen: restart_gitea
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
- name: Create Gitea directory
|
- name: Create Gitea directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ gitea_root }}"
|
path: "{{ gitea_root }}"
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- name: Create Gitea database
|
- name: Create Gitea database
|
||||||
mysql_db:
|
community.mysql.mysql_db:
|
||||||
name: "{{ gitea_dbname }}"
|
name: "{{ gitea_dbname }}"
|
||||||
state: present
|
state: present
|
||||||
login_unix_socket: /var/run/mysqld/mysqld.sock
|
login_unix_socket: /var/run/mysqld/mysqld.sock
|
||||||
|
|
||||||
- name: Create Gitea database user
|
- name: Create Gitea database user
|
||||||
mysql_user:
|
community.mysql.mysql_user:
|
||||||
name: "{{ gitea_dbuser }}"
|
name: "{{ gitea_dbuser }}"
|
||||||
password: "{{ gitea_dbpass }}"
|
password: "{{ gitea_dbpass }}"
|
||||||
host: '%'
|
host: '%'
|
||||||
@ -19,93 +19,93 @@
|
|||||||
login_unix_socket: /var/run/mysqld/mysqld.sock
|
login_unix_socket: /var/run/mysqld/mysqld.sock
|
||||||
|
|
||||||
- name: Create git user
|
- name: Create git user
|
||||||
user:
|
ansible.builtin.user:
|
||||||
name: git
|
name: git
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Git user uid
|
- name: Git user uid
|
||||||
getent:
|
ansible.builtin.getent:
|
||||||
database: passwd
|
database: passwd
|
||||||
key: git
|
key: git
|
||||||
|
|
||||||
- name: Git user gid
|
- name: Git user gid
|
||||||
getent:
|
ansible.builtin.getent:
|
||||||
database: group
|
database: group
|
||||||
key: git
|
key: git
|
||||||
|
|
||||||
- name: Create git's .ssh directory
|
- name: Create git's .ssh directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: /home/git/.ssh
|
path: /home/git/.ssh
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- name: Generate git's SSH keys
|
- name: Generate git's SSH keys
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: /home/git/.ssh/id_rsa
|
path: /home/git/.ssh/id_rsa
|
||||||
|
|
||||||
- name: Find git's public SSH key
|
- name: Find git's public SSH key
|
||||||
slurp:
|
ansible.builtin.slurp:
|
||||||
src: /home/git/.ssh/id_rsa.pub
|
src: /home/git/.ssh/id_rsa.pub
|
||||||
register: git_rsapub
|
register: git_rsapub
|
||||||
|
|
||||||
- name: Get stats on git's authorized_keys file
|
- name: Get stats on git's authorized_keys file
|
||||||
stat:
|
ansible.builtin.stat:
|
||||||
path: /home/git/.ssh/authorized_keys
|
path: /home/git/.ssh/authorized_keys
|
||||||
register: git_authkeys
|
register: git_authkeys
|
||||||
|
|
||||||
- name: Create git's authorized_keys file
|
- name: Create git's authorized_keys file
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: /home/git/.ssh/authorized_keys
|
path: /home/git/.ssh/authorized_keys
|
||||||
state: touch
|
state: touch
|
||||||
when: not git_authkeys.stat.exists
|
when: not git_authkeys.stat.exists
|
||||||
|
|
||||||
- name: Add git's public SSH key to authorized_keys
|
- name: Add git's public SSH key to authorized_keys
|
||||||
lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
path: /home/git/.ssh/authorized_keys
|
path: /home/git/.ssh/authorized_keys
|
||||||
regex: "^ssh-rsa"
|
regex: "^ssh-rsa"
|
||||||
line: "{{ git_rsapub['content'] | b64decode }}"
|
line: "{{ git_rsapub['content'] | b64decode }}"
|
||||||
|
|
||||||
- name: Create Gitea host script for SSH
|
- name: Create Gitea host script for SSH
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: gitea.sh.j2
|
src: gitea.sh.j2
|
||||||
dest: /usr/local/bin/gitea
|
dest: /usr/local/bin/gitea
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
|
||||||
- name: Install Gitea's docker-compose file
|
- name: Install Gitea's docker-compose file
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: docker-compose.yml.j2
|
src: docker-compose.yml.j2
|
||||||
dest: "{{ gitea_root }}/docker-compose.yml"
|
dest: "{{ gitea_root }}/docker-compose.yml"
|
||||||
notify: restart_gitea
|
notify: restart_gitea
|
||||||
|
|
||||||
- name: Install Gitea's docker-compose variables
|
- name: Install Gitea's docker-compose variables
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: compose-env.j2
|
src: compose-env.j2
|
||||||
dest: "{{ gitea_root }}/.env"
|
dest: "{{ gitea_root }}/.env"
|
||||||
notify: restart_gitea
|
notify: restart_gitea
|
||||||
|
|
||||||
- name: Create Gitea's logging directory
|
- name: Create Gitea's logging directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
name: /var/log/gitea
|
name: /var/log/gitea
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- name: Create Gitea's initial log file
|
- name: Create Gitea's initial log file
|
||||||
file:
|
ansible.builtin.file:
|
||||||
name: /var/log/gitea/gitea.log
|
name: /var/log/gitea/gitea.log
|
||||||
state: touch
|
state: touch
|
||||||
|
|
||||||
- name: Install Gitea's Fail2ban filter
|
- name: Install Gitea's Fail2ban filter
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: fail2ban-filter.conf.j2
|
src: fail2ban-filter.conf.j2
|
||||||
dest: /etc/fail2ban/filter.d/gitea.conf
|
dest: /etc/fail2ban/filter.d/gitea.conf
|
||||||
notify: restart_fail2ban
|
notify: restart_fail2ban
|
||||||
|
|
||||||
- name: Install Gitea's Fail2ban jail
|
- name: Install Gitea's Fail2ban jail
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: fail2ban-jail.conf.j2
|
src: fail2ban-jail.conf.j2
|
||||||
dest: /etc/fail2ban/jail.d/gitea.conf
|
dest: /etc/fail2ban/jail.d/gitea.conf
|
||||||
notify: restart_fail2ban
|
notify: restart_fail2ban
|
||||||
|
|
||||||
- name: Start and enable Gitea service
|
- name: Start and enable Gitea service
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: "{{ docker_compose_service }}@{{ gitea_name }}"
|
name: "{{ docker_compose_service }}@{{ gitea_name }}"
|
||||||
state: started
|
state: started
|
||||||
enabled: true
|
enabled: true
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
- name: Restart Jellyfin
|
- name: Restart Jellyfin
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: "{{ docker_compose_service }}@{{ jellyfin_name }}"
|
name: "{{ docker_compose_service }}@{{ jellyfin_name }}"
|
||||||
state: restarted
|
state: restarted
|
||||||
listen: restart_jellyfin
|
listen: restart_jellyfin
|
||||||
|
@ -4,34 +4,34 @@
|
|||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- name: Create jellyfin user
|
- name: Create jellyfin user
|
||||||
user:
|
ansible.builtin.user:
|
||||||
name: jellyfin
|
name: jellyfin
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: jellyfin user uid
|
- name: jellyfin user uid
|
||||||
getent:
|
ansible.builtin.getent:
|
||||||
database: passwd
|
database: passwd
|
||||||
key: jellyfin
|
key: jellyfin
|
||||||
|
|
||||||
- name: jellyfin user gid
|
- name: jellyfin user gid
|
||||||
getent:
|
ansible.builtin.getent:
|
||||||
database: group
|
database: group
|
||||||
key: jellyfin
|
key: jellyfin
|
||||||
|
|
||||||
- name: Install Jellyfin's docker-compose file
|
- name: Install Jellyfin's docker-compose file
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: docker-compose.yml.j2
|
src: docker-compose.yml.j2
|
||||||
dest: "{{ jellyfin_root }}/docker-compose.yml"
|
dest: "{{ jellyfin_root }}/docker-compose.yml"
|
||||||
notify: restart_jellyfin
|
notify: restart_jellyfin
|
||||||
|
|
||||||
- name: Install Jellyfin's docker-compose variables
|
- name: Install Jellyfin's docker-compose variables
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: compose-env.j2
|
src: compose-env.j2
|
||||||
dest: "{{ jellyfin_root }}/.env"
|
dest: "{{ jellyfin_root }}/.env"
|
||||||
notify: restart_jellyfin
|
notify: restart_jellyfin
|
||||||
|
|
||||||
- name: Start and enable Jellyfin service
|
- name: Start and enable Jellyfin service
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: "{{ docker_compose_service }}@{{ jellyfin_name }}"
|
name: "{{ docker_compose_service }}@{{ jellyfin_name }}"
|
||||||
state: started
|
state: started
|
||||||
enabled: true
|
enabled: true
|
||||||
|
@ -1,31 +1,31 @@
|
|||||||
- name: Create Jenkins user
|
- name: Create Jenkins user
|
||||||
user:
|
ansible.builtin.user:
|
||||||
name: "{{ jenkins_user }}"
|
name: "{{ jenkins_user }}"
|
||||||
state: present
|
state: present
|
||||||
shell: /bin/bash
|
ansible.builtin.shell: /bin/bash
|
||||||
skeleton: /etc/skel
|
skeleton: /etc/skel
|
||||||
generate_ssh_key: true
|
generate_ssh_key: true
|
||||||
|
|
||||||
- name: Set Jenkins authorized key
|
- name: Set Jenkins authorized key
|
||||||
authorized_key:
|
ansible.posix.authorized_key:
|
||||||
user: jenkins
|
user: jenkins
|
||||||
state: present
|
state: present
|
||||||
exclusive: true
|
exclusive: true
|
||||||
key: "{{ jenkins_sshkey }}"
|
key: "{{ jenkins_sshkey }}"
|
||||||
|
|
||||||
- name: Give Jenkins user passwordless sudo
|
- name: Give Jenkins user passwordless sudo
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: jenkins_sudoers.j2
|
src: jenkins_sudoers.j2
|
||||||
dest: /etc/sudoers.d/{{ jenkins_user }}
|
dest: /etc/sudoers.d/{{ jenkins_user }}
|
||||||
validate: "visudo -cf %s"
|
validate: "visudo -cf %s"
|
||||||
mode: 0440
|
mode: 0440
|
||||||
|
|
||||||
- name: Install Ansible
|
- name: Install Ansible
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: ansible
|
name: ansible
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Install Java
|
- name: Install Java
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: default-jre
|
name: default-jre
|
||||||
state: present
|
state: present
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
- import_tasks: agent.yml
|
- ansible.builtin.import_tasks: agent.yml
|
||||||
when: jenkins_sshkey is defined
|
when: jenkins_sshkey is defined
|
||||||
|
|
||||||
- import_tasks: server.yml
|
- ansible.builtin.import_tasks: server.yml
|
||||||
when: jenkins_domain is defined
|
when: jenkins_domain is defined
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
- name: Create Jenkin's directory
|
- name: Create Jenkin's directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ jenkins_root }}"
|
path: "{{ jenkins_root }}"
|
||||||
state: directory
|
state: directory
|
||||||
owner: "1000"
|
owner: "1000"
|
||||||
group: "1000"
|
group: "1000"
|
||||||
|
|
||||||
- name: Start Jenkins Container
|
- name: Start Jenkins Container
|
||||||
docker_container:
|
community.general.docker_container:
|
||||||
name: "{{ jenkins_name }}"
|
name: "{{ jenkins_name }}"
|
||||||
image: jenkins/jenkins:{{ jenkins_version }}
|
image: jenkins/jenkins:{{ jenkins_version }}
|
||||||
state: started
|
state: started
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
- name: Install QEMU/KVM
|
- name: Install QEMU/KVM
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: qemu-kvm
|
name: qemu-kvm
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Install Libvirt
|
- name: Install Libvirt
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: ["libvirt-clients", "libvirt-daemon-system"]
|
name: ["libvirt-clients", "libvirt-daemon-system"]
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Add users to libvirt group
|
- name: Add users to libvirt group
|
||||||
user:
|
ansible.builtin.user:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
groups: libvirt
|
groups: libvirt
|
||||||
append: yes
|
append: yes
|
||||||
@ -17,12 +17,12 @@
|
|||||||
when: libvirt_users is defined
|
when: libvirt_users is defined
|
||||||
|
|
||||||
- name: Check for NODOWNLOAD file
|
- name: Check for NODOWNLOAD file
|
||||||
stat:
|
ansible.builtin.stat:
|
||||||
path: /var/lib/libvirt/images/NODOWNLOAD
|
path: /var/lib/libvirt/images/NODOWNLOAD
|
||||||
register: NODOWNLOAD
|
register: NODOWNLOAD
|
||||||
|
|
||||||
- name: Download GNU/Linux ISOs
|
- name: Download GNU/Linux ISOs
|
||||||
get_url:
|
ansible.builtin.get_url:
|
||||||
url: "{{ item.url }}"
|
url: "{{ item.url }}"
|
||||||
dest: /var/lib/libvirt/images
|
dest: /var/lib/libvirt/images
|
||||||
checksum: "{{ item.hash }}"
|
checksum: "{{ item.hash }}"
|
||||||
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
# Prevent downloaded ISOs from being rehashed every run
|
# Prevent downloaded ISOs from being rehashed every run
|
||||||
- name: Create NODOWNLOAD file
|
- name: Create NODOWNLOAD file
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: /var/lib/libvirt/images/NODOWNLOAD
|
path: /var/lib/libvirt/images/NODOWNLOAD
|
||||||
state: touch
|
state: touch
|
||||||
when: download_isos.changed
|
when: download_isos.changed
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
- name: Install MariaDB
|
- name: Install MariaDB
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: mariadb-server
|
name: mariadb-server
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Change the bind-address to allow Docker
|
- name: Change the bind-address to allow Docker
|
||||||
lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
path: /etc/mysql/mariadb.conf.d/50-server.cnf
|
path: /etc/mysql/mariadb.conf.d/50-server.cnf
|
||||||
regex: "^bind-address"
|
regex: "^bind-address"
|
||||||
line: "bind-address = 0.0.0.0"
|
line: "bind-address = 0.0.0.0"
|
||||||
register: mariadb_conf
|
register: mariadb_conf
|
||||||
|
|
||||||
- name: Restart MariaDB
|
- name: Restart MariaDB
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: mariadb
|
name: mariadb
|
||||||
state: restarted
|
state: restarted
|
||||||
when: mariadb_conf.changed
|
when: mariadb_conf.changed
|
||||||
|
|
||||||
- name: Allow database connections
|
- name: Allow database connections
|
||||||
ufw:
|
community.general.ufw:
|
||||||
rule: allow
|
rule: allow
|
||||||
port: "3306"
|
port: "3306"
|
||||||
proto: tcp
|
proto: tcp
|
||||||
|
@ -1,28 +1,28 @@
|
|||||||
- name: Install GPG
|
- name: Install GPG
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: gpg
|
name: gpg
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Add AdoptOpenJDK's signing key
|
- name: Add AdoptOpenJDK's signing key
|
||||||
apt_key:
|
ansible.builtin.apt_key:
|
||||||
id: 8ED17AF5D7E675EB3EE3BCE98AC3B29174885C03
|
id: 8ED17AF5D7E675EB3EE3BCE98AC3B29174885C03
|
||||||
url: https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public
|
url: https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public
|
||||||
|
|
||||||
- name: Install AdoptOpenJDK repository
|
- name: Install AdoptOpenJDK repository
|
||||||
apt_repository:
|
ansible.builtin.apt_repository:
|
||||||
repo: deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ buster main
|
repo: deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ buster main
|
||||||
mode: 0644
|
mode: 0644
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Install Java
|
- name: Install Java
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: "adoptopenjdk-{{ item.java.version }}-hotspot"
|
name: "adoptopenjdk-{{ item.java.version }}-hotspot"
|
||||||
state: present
|
state: present
|
||||||
when: item.java.version is defined
|
when: item.java.version is defined
|
||||||
loop: "{{ minecraft }}"
|
loop: "{{ minecraft }}"
|
||||||
|
|
||||||
- name: "Install default Java, version {{ minecraft_java }}"
|
- name: "Install default Java, version {{ minecraft_java }}"
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: "{{ minecraft_java_pkg }}"
|
name: "{{ minecraft_java_pkg }}"
|
||||||
state: present
|
state: present
|
||||||
when: item.java.version is not defined
|
when: item.java.version is not defined
|
||||||
@ -30,7 +30,7 @@
|
|||||||
register: minecraft_java_default
|
register: minecraft_java_default
|
||||||
|
|
||||||
- name: "Activate default Java, version {{ minecraft_java }}"
|
- name: "Activate default Java, version {{ minecraft_java }}"
|
||||||
alternatives:
|
community.general.alternatives:
|
||||||
name: java
|
name: java
|
||||||
path: "/usr/lib/jvm/{{ minecraft_java_pkg }}-amd64/bin/java"
|
path: "/usr/lib/jvm/{{ minecraft_java_pkg }}-amd64/bin/java"
|
||||||
when: minecraft_java_default.changed
|
when: minecraft_java_default.changed
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
- import_tasks: system.yml
|
- ansible.builtin.import_tasks: system.yml
|
||||||
when: minecraft_eula
|
when: minecraft_eula
|
||||||
|
|
||||||
- import_tasks: java.yml
|
- ansible.builtin.import_tasks: java.yml
|
||||||
when: minecraft_eula
|
when: minecraft_eula
|
||||||
|
|
||||||
- import_tasks: vanilla.yml
|
- ansible.builtin.import_tasks: vanilla.yml
|
||||||
when: minecraft_eula
|
when: minecraft_eula
|
||||||
|
|
||||||
- import_tasks: modpacks.yml
|
- ansible.builtin.import_tasks: modpacks.yml
|
||||||
when: minecraft_eula
|
when: minecraft_eula
|
||||||
|
|
||||||
- import_tasks: service.yml
|
- ansible.builtin.import_tasks: service.yml
|
||||||
when: minecraft_eula
|
when: minecraft_eula
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
- name: Download Minecraft modpack installer
|
- name: Download Minecraft modpack installer
|
||||||
get_url:
|
ansible.builtin.get_url:
|
||||||
url: "{{ minecraft_modpack_url }}"
|
url: "{{ minecraft_modpack_url }}"
|
||||||
dest: "{{ minecraft_home }}/{{ item.name }}/serverinstall_{{ item.modpack | replace ('/', '_') }}"
|
dest: "{{ minecraft_home }}/{{ item.name }}/serverinstall_{{ item.modpack | replace ('/', '_') }}"
|
||||||
owner: "{{ minecraft_user }}"
|
owner: "{{ minecraft_user }}"
|
||||||
@ -9,7 +9,7 @@
|
|||||||
when: item.modpack is defined and item.sha1 is not defined
|
when: item.modpack is defined and item.sha1 is not defined
|
||||||
|
|
||||||
- name: Run Minecraft modpack installer
|
- name: Run Minecraft modpack installer
|
||||||
command: "sudo -u {{ minecraft_user }} ./serverinstall_{{ item.modpack | replace ('/', '_') }} --auto"
|
ansible.builtin.command: "sudo -u {{ minecraft_user }} ./serverinstall_{{ item.modpack | replace ('/', '_') }} --auto"
|
||||||
args:
|
args:
|
||||||
creates: "{{ minecraft_home }}/{{ item.name }}/mods"
|
creates: "{{ minecraft_home }}/{{ item.name }}/mods"
|
||||||
chdir: "{{ minecraft_home }}/{{ item.name }}"
|
chdir: "{{ minecraft_home }}/{{ item.name }}"
|
||||||
@ -17,7 +17,7 @@
|
|||||||
when: item.modpack is defined and item.sha1 is not defined
|
when: item.modpack is defined and item.sha1 is not defined
|
||||||
|
|
||||||
- name: Find Minecraft Forge
|
- name: Find Minecraft Forge
|
||||||
find:
|
ansible.builtin.find:
|
||||||
paths: "{{ minecraft_home }}/{{ item.name }}"
|
paths: "{{ minecraft_home }}/{{ item.name }}"
|
||||||
patterns: "forge*.jar"
|
patterns: "forge*.jar"
|
||||||
register: minecraft_forge
|
register: minecraft_forge
|
||||||
@ -25,7 +25,7 @@
|
|||||||
when: item.modpack is defined and item.sha1 is not defined
|
when: item.modpack is defined and item.sha1 is not defined
|
||||||
|
|
||||||
- name: Link to Minecraft Forge
|
- name: Link to Minecraft Forge
|
||||||
file:
|
ansible.builtin.file:
|
||||||
src: "{{ item.files[0].path }}"
|
src: "{{ item.files[0].path }}"
|
||||||
dest: "{{ minecraft_home }}/{{ item.item.name }}/minecraft_server.jar"
|
dest: "{{ minecraft_home }}/{{ item.item.name }}/minecraft_server.jar"
|
||||||
owner: "{{ minecraft_user }}"
|
owner: "{{ minecraft_user }}"
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
- name: Deploy Minecraft systemd service
|
- name: Deploy Minecraft systemd service
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: minecraft.service.j2
|
src: minecraft.service.j2
|
||||||
dest: "/etc/systemd/system/minecraft@.service"
|
dest: "/etc/systemd/system/minecraft@.service"
|
||||||
register: minecraft_systemd
|
register: minecraft_systemd
|
||||||
|
|
||||||
- name: Deploy service environmental variables
|
- name: Deploy service environmental variables
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: environment.conf.j2
|
src: environment.conf.j2
|
||||||
dest: "{{ minecraft_home }}/{{ item.name }}/environment.conf"
|
dest: "{{ minecraft_home }}/{{ item.name }}/environment.conf"
|
||||||
owner: "{{ minecraft_user }}"
|
owner: "{{ minecraft_user }}"
|
||||||
@ -13,25 +13,25 @@
|
|||||||
loop: "{{ minecraft }}"
|
loop: "{{ minecraft }}"
|
||||||
|
|
||||||
- name: Reload systemd manager configuration
|
- name: Reload systemd manager configuration
|
||||||
systemd:
|
ansible.builtin.systemd:
|
||||||
daemon_reload: true
|
daemon_reload: true
|
||||||
when: minecraft_systemd.changed
|
when: minecraft_systemd.changed
|
||||||
|
|
||||||
- name: Disable non-default service instances
|
- name: Disable non-default service instances
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: "minecraft@{{ item.name }}"
|
name: "minecraft@{{ item.name }}"
|
||||||
enabled: false
|
enabled: false
|
||||||
loop: "{{ minecraft }}"
|
loop: "{{ minecraft }}"
|
||||||
when: item.name != minecraft_onboot
|
when: item.name != minecraft_onboot
|
||||||
|
|
||||||
- name: Enable default service instance
|
- name: Enable default service instance
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: "minecraft@{{ minecraft_onboot }}"
|
name: "minecraft@{{ minecraft_onboot }}"
|
||||||
enabled: true
|
enabled: true
|
||||||
when: minecraft_eula and minecraft_onboot is defined
|
when: minecraft_eula and minecraft_onboot is defined
|
||||||
|
|
||||||
- name: Run default service instance
|
- name: Run default service instance
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: "minecraft@{{ minecraft_onboot }}"
|
name: "minecraft@{{ minecraft_onboot }}"
|
||||||
state: started
|
state: started
|
||||||
when: minecraft_eula and minecraft_onboot is defined and minecraft_onboot_run
|
when: minecraft_eula and minecraft_onboot is defined and minecraft_onboot_run
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
- name: Install Screen
|
- name: Install Screen
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: screen
|
name: screen
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Create Minecraft user
|
- name: Create Minecraft user
|
||||||
user:
|
ansible.builtin.user:
|
||||||
name: "{{ minecraft_user }}"
|
name: "{{ minecraft_user }}"
|
||||||
state: present
|
state: present
|
||||||
shell: /bin/bash
|
ansible.builtin.shell: /bin/bash
|
||||||
|
|
||||||
- name: Create Minecraft directory
|
- name: Create Minecraft directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ minecraft_home }}/{{ item.name }}"
|
path: "{{ minecraft_home }}/{{ item.name }}"
|
||||||
state: directory
|
state: directory
|
||||||
owner: "{{ minecraft_user }}"
|
owner: "{{ minecraft_user }}"
|
||||||
@ -18,7 +18,7 @@
|
|||||||
loop: "{{ minecraft }}"
|
loop: "{{ minecraft }}"
|
||||||
|
|
||||||
- name: Answer to Mojang's EULA
|
- name: Answer to Mojang's EULA
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: eula.txt.j2
|
src: eula.txt.j2
|
||||||
dest: "{{ minecraft_home }}/{{ item.name }}/eula.txt"
|
dest: "{{ minecraft_home }}/{{ item.name }}/eula.txt"
|
||||||
owner: "{{ minecraft_user }}"
|
owner: "{{ minecraft_user }}"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
- name: Download Minecraft
|
- name: Download Minecraft
|
||||||
get_url:
|
ansible.builtin.get_url:
|
||||||
url: "{{ minecraft_url }}"
|
url: "{{ minecraft_url }}"
|
||||||
dest: "{{ minecraft_home }}/{{ item.name }}/minecraft_server.jar"
|
dest: "{{ minecraft_home }}/{{ item.name }}/minecraft_server.jar"
|
||||||
checksum: "sha1:{{ item.sha1 }}"
|
checksum: "sha1:{{ item.sha1 }}"
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
- name: Create Nextcloud network
|
- name: Create Nextcloud network
|
||||||
docker_network:
|
community.general.docker_network:
|
||||||
name: "{{ nextcloud_container }}"
|
name: "{{ nextcloud_container }}"
|
||||||
|
|
||||||
- name: Start Nextcloud's database container
|
- name: Start Nextcloud's database container
|
||||||
docker_container:
|
community.general.docker_container:
|
||||||
name: "{{ nextcloud_dbcontainer }}"
|
name: "{{ nextcloud_dbcontainer }}"
|
||||||
image: mariadb:{{ nextcloud_dbversion }}
|
image: mariadb:{{ nextcloud_dbversion }}
|
||||||
state: started
|
state: started
|
||||||
@ -19,7 +19,7 @@
|
|||||||
MYSQL_PASSWORD: "{{ nextcloud_dbpass }}"
|
MYSQL_PASSWORD: "{{ nextcloud_dbpass }}"
|
||||||
|
|
||||||
- name: Start Nextcloud container
|
- name: Start Nextcloud container
|
||||||
docker_container:
|
community.general.docker_container:
|
||||||
name: "{{ nextcloud_container }}"
|
name: "{{ nextcloud_container }}"
|
||||||
image: nextcloud:{{ nextcloud_version }}
|
image: nextcloud:{{ nextcloud_version }}
|
||||||
state: started
|
state: started
|
||||||
@ -41,34 +41,34 @@
|
|||||||
traefik.enable: "true"
|
traefik.enable: "true"
|
||||||
|
|
||||||
- name: Grab Nextcloud database container information
|
- name: Grab Nextcloud database container information
|
||||||
docker_container_info:
|
community.general.docker_container_info:
|
||||||
name: "{{ nextcloud_dbcontainer }}"
|
name: "{{ nextcloud_dbcontainer }}"
|
||||||
register: nextcloud_dbinfo
|
register: nextcloud_dbinfo
|
||||||
|
|
||||||
- name: Grab Nextcloud container information
|
- name: Grab Nextcloud container information
|
||||||
docker_container_info:
|
community.general.docker_container_info:
|
||||||
name: "{{ nextcloud_container }}"
|
name: "{{ nextcloud_container }}"
|
||||||
register: nextcloud_info
|
register: nextcloud_info
|
||||||
|
|
||||||
- name: Wait for Nextcloud to become available
|
- name: Wait for Nextcloud to become available
|
||||||
wait_for:
|
ansible.builtin.wait_for:
|
||||||
host: "{{ nextcloud_info.container.NetworkSettings.Networks.traefik.IPAddress }}"
|
host: "{{ nextcloud_info.container.NetworkSettings.Networks.traefik.IPAddress }}"
|
||||||
port: 80
|
port: 80
|
||||||
|
|
||||||
- name: Check Nextcloud status
|
- name: Check Nextcloud status
|
||||||
command: "docker exec --user www-data {{ nextcloud_container }}
|
ansible.builtin.command: "docker exec --user www-data {{ nextcloud_container }}
|
||||||
php occ status"
|
php occ status"
|
||||||
register: nextcloud_status
|
register: nextcloud_status
|
||||||
args:
|
args:
|
||||||
removes: "{{ nextcloud_root }}/config/CAN_INSTALL"
|
removes: "{{ nextcloud_root }}/config/CAN_INSTALL"
|
||||||
|
|
||||||
- name: Wait for Nextcloud database to become available
|
- name: Wait for Nextcloud database to become available
|
||||||
wait_for:
|
ansible.builtin.wait_for:
|
||||||
host: "{{ nextcloud_dbinfo.container.NetworkSettings.Networks.nextcloud.IPAddress }}"
|
host: "{{ nextcloud_dbinfo.container.NetworkSettings.Networks.nextcloud.IPAddress }}"
|
||||||
port: 3306
|
port: 3306
|
||||||
|
|
||||||
- name: Install Nextcloud
|
- name: Install Nextcloud
|
||||||
command: 'docker exec --user www-data {{ nextcloud_container }}
|
ansible.builtin.command: 'docker exec --user www-data {{ nextcloud_container }}
|
||||||
php occ maintenance:install
|
php occ maintenance:install
|
||||||
--database "mysql"
|
--database "mysql"
|
||||||
--database-host "{{ nextcloud_dbcontainer }}"
|
--database-host "{{ nextcloud_dbcontainer }}"
|
||||||
@ -83,19 +83,19 @@
|
|||||||
- nextcloud_domain is defined
|
- nextcloud_domain is defined
|
||||||
|
|
||||||
- name: Set Nextcloud's Trusted Proxy
|
- name: Set Nextcloud's Trusted Proxy
|
||||||
command: 'docker exec --user www-data {{ nextcloud_container }}
|
ansible.builtin.command: 'docker exec --user www-data {{ nextcloud_container }}
|
||||||
php occ config:system:set trusted_proxies 0
|
php occ config:system:set trusted_proxies 0
|
||||||
--value="{{ traefik_name }}"'
|
--value="{{ traefik_name }}"'
|
||||||
when: nextcloud_install.changed
|
when: nextcloud_install.changed
|
||||||
|
|
||||||
- name: Set Nextcloud's Trusted Domain
|
- name: Set Nextcloud's Trusted Domain
|
||||||
command: 'docker exec --user www-data {{ nextcloud_container }}
|
ansible.builtin.command: 'docker exec --user www-data {{ nextcloud_container }}
|
||||||
php occ config:system:set trusted_domains 0
|
php occ config:system:set trusted_domains 0
|
||||||
--value="{{ nextcloud_domain }}"'
|
--value="{{ nextcloud_domain }}"'
|
||||||
when: nextcloud_install.changed
|
when: nextcloud_install.changed
|
||||||
|
|
||||||
- name: Preform Nextcloud database maintenance
|
- name: Preform Nextcloud database maintenance
|
||||||
command: "docker exec --user www-data {{ nextcloud_container }} {{ item }}"
|
ansible.builtin.command: "docker exec --user www-data {{ nextcloud_container }} {{ item }}"
|
||||||
loop:
|
loop:
|
||||||
- "php occ maintenance:mode --on"
|
- "php occ maintenance:mode --on"
|
||||||
- "php occ db:add-missing-indices"
|
- "php occ db:add-missing-indices"
|
||||||
@ -104,6 +104,6 @@
|
|||||||
when: nextcloud_install.changed
|
when: nextcloud_install.changed
|
||||||
|
|
||||||
- name: Remove Nextcloud's CAN_INSTALL file
|
- name: Remove Nextcloud's CAN_INSTALL file
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ nextcloud_root }}/config/CAN_INSTALL"
|
path: "{{ nextcloud_root }}/config/CAN_INSTALL"
|
||||||
state: absent
|
state: absent
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
- name: Create nginx root
|
- name: Create nginx root
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ nginx_root }}"
|
path: "{{ nginx_root }}"
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- name: Generate deploy keys
|
- name: Generate deploy keys
|
||||||
openssh_keypair:
|
community.crypto.openssh_keypair:
|
||||||
path: "{{ nginx_repo_key }}"
|
path: "{{ nginx_repo_key }}"
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Clone static website files
|
- name: Clone static website files
|
||||||
git:
|
ansible.builtin.git:
|
||||||
repo: "{{ nginx_repo_url }}"
|
repo: "{{ nginx_repo_url }}"
|
||||||
dest: "{{ nginx_html }}"
|
dest: "{{ nginx_html }}"
|
||||||
version: "{{ nginx_repo_branch }}"
|
version: "{{ nginx_repo_branch }}"
|
||||||
@ -17,7 +17,7 @@
|
|||||||
separate_git_dir: "{{ nginx_repo_dest }}"
|
separate_git_dir: "{{ nginx_repo_dest }}"
|
||||||
|
|
||||||
- name: Start nginx container
|
- name: Start nginx container
|
||||||
docker_container:
|
community.general.docker_container:
|
||||||
name: "{{ nginx_name }}"
|
name: "{{ nginx_name }}"
|
||||||
image: nginx:{{ nginx_version }}
|
image: nginx:{{ nginx_version }}
|
||||||
state: started
|
state: started
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
- name: Install PostgreSQL
|
- name: Install PostgreSQL
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: postgresql
|
name: postgresql
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Trust connections to PostgreSQL
|
- name: Trust connections to PostgreSQL
|
||||||
postgresql_pg_hba:
|
community.general.postgresql_pg_hba:
|
||||||
dest: "{{ postgresql_config }}"
|
dest: "{{ postgresql_config }}"
|
||||||
contype: host
|
contype: host
|
||||||
databases: all
|
databases: all
|
||||||
@ -15,7 +15,7 @@
|
|||||||
loop: "{{ postgresql_trust }}"
|
loop: "{{ postgresql_trust }}"
|
||||||
|
|
||||||
- name: Change PostgreSQL listen addresses
|
- name: Change PostgreSQL listen addresses
|
||||||
postgresql_set:
|
community.general.postgresql_set:
|
||||||
name: listen_addresses
|
name: listen_addresses
|
||||||
value: "{{ postgresql_listen }}"
|
value: "{{ postgresql_listen }}"
|
||||||
become: true
|
become: true
|
||||||
@ -23,19 +23,19 @@
|
|||||||
register: postgresql_config
|
register: postgresql_config
|
||||||
|
|
||||||
- name: Reload PostgreSQL
|
- name: Reload PostgreSQL
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: postgresql
|
name: postgresql
|
||||||
state: reloaded
|
state: reloaded
|
||||||
when: postgresql_hba.changed and not postgresql_config.changed
|
when: postgresql_hba.changed and not postgresql_config.changed
|
||||||
|
|
||||||
- name: Restart PostgreSQL
|
- name: Restart PostgreSQL
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: postgresql
|
name: postgresql
|
||||||
state: restarted
|
state: restarted
|
||||||
when: postgresql_config.changed
|
when: postgresql_config.changed
|
||||||
|
|
||||||
- name: Allow database connections
|
- name: Allow database connections
|
||||||
ufw:
|
community.general.ufw:
|
||||||
rule: allow
|
rule: allow
|
||||||
port: "5432"
|
port: "5432"
|
||||||
proto: tcp
|
proto: tcp
|
||||||
|
@ -1,35 +1,35 @@
|
|||||||
- name: Install Prometheus node exporter
|
- name: Install Prometheus node exporter
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: prometheus-node-exporter
|
name: prometheus-node-exporter
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Run Prometheus node exporter
|
- name: Run Prometheus node exporter
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: prometheus-node-exporter
|
name: prometheus-node-exporter
|
||||||
state: started
|
state: started
|
||||||
|
|
||||||
- name: Create Prometheus data directory
|
- name: Create Prometheus data directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ prom_root }}/prometheus"
|
path: "{{ prom_root }}/prometheus"
|
||||||
state: directory
|
state: directory
|
||||||
owner: nobody
|
owner: nobody
|
||||||
|
|
||||||
- name: Create Prometheus config directory
|
- name: Create Prometheus config directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ prom_root }}/config"
|
path: "{{ prom_root }}/config"
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- name: Install Prometheus configuration
|
- name: Install Prometheus configuration
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: prometheus.yml.j2
|
src: prometheus.yml.j2
|
||||||
dest: "{{ prom_root }}/config/prometheus.yml"
|
dest: "{{ prom_root }}/config/prometheus.yml"
|
||||||
|
|
||||||
- name: Create Prometheus network
|
- name: Create Prometheus network
|
||||||
docker_network:
|
community.general.docker_network:
|
||||||
name: "{{ prom_name }}"
|
name: "{{ prom_name }}"
|
||||||
|
|
||||||
- name: Start Prometheus container
|
- name: Start Prometheus container
|
||||||
docker_container:
|
community.general.docker_container:
|
||||||
name: "{{ prom_name }}"
|
name: "{{ prom_name }}"
|
||||||
image: prom/prometheus:{{ prom_version }}
|
image: prom/prometheus:{{ prom_version }}
|
||||||
state: started
|
state: started
|
||||||
@ -51,7 +51,7 @@
|
|||||||
traefik.enable: "true"
|
traefik.enable: "true"
|
||||||
|
|
||||||
- name: Start Grafana container
|
- name: Start Grafana container
|
||||||
docker_container:
|
community.general.docker_container:
|
||||||
name: "{{ grafana_name }}"
|
name: "{{ grafana_name }}"
|
||||||
image: grafana/grafana:{{ grafana_version }}
|
image: grafana/grafana:{{ grafana_version }}
|
||||||
state: started
|
state: started
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
- name: Reload nginx
|
- name: Reload nginx
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: nginx
|
name: nginx
|
||||||
state: reloaded
|
state: reloaded
|
||||||
listen: reload_nginx
|
listen: reload_nginx
|
||||||
|
@ -1,29 +1,29 @@
|
|||||||
- name: Install nginx
|
- name: Install nginx
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: nginx
|
name: nginx
|
||||||
state: present
|
state: present
|
||||||
update_cache: true
|
update_cache: true
|
||||||
|
|
||||||
- name: Start nginx and enable on boot
|
- name: Start nginx and enable on boot
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: nginx
|
name: nginx
|
||||||
state: started
|
state: started
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
- name: Generate DH Parameters
|
- name: Generate DH Parameters
|
||||||
openssl_dhparam:
|
community.crypto.openssl_dhparam:
|
||||||
path: /etc/ssl/dhparams.pem
|
path: /etc/ssl/dhparams.pem
|
||||||
size: 4096
|
size: 4096
|
||||||
|
|
||||||
- name: Install nginx base configuration
|
- name: Install nginx base configuration
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: nginx.conf.j2
|
src: nginx.conf.j2
|
||||||
dest: /etc/nginx/nginx.conf
|
dest: /etc/nginx/nginx.conf
|
||||||
mode: '0644'
|
mode: '0644'
|
||||||
notify: reload_nginx
|
notify: reload_nginx
|
||||||
|
|
||||||
- name: Install nginx sites configuration
|
- name: Install nginx sites configuration
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: server-nginx.conf.j2
|
src: server-nginx.conf.j2
|
||||||
dest: "/etc/nginx/sites-available/{{ item.domain }}.conf"
|
dest: "/etc/nginx/sites-available/{{ item.domain }}.conf"
|
||||||
mode: '0644'
|
mode: '0644'
|
||||||
@ -32,7 +32,7 @@
|
|||||||
register: nginx_sites
|
register: nginx_sites
|
||||||
|
|
||||||
- name: Enable nginx sites configuration
|
- name: Enable nginx sites configuration
|
||||||
file:
|
ansible.builtin.file:
|
||||||
src: "/etc/nginx/sites-available/{{ item.item.domain }}.conf"
|
src: "/etc/nginx/sites-available/{{ item.item.domain }}.conf"
|
||||||
dest: "/etc/nginx/sites-enabled/{{ item.item.domain }}.conf"
|
dest: "/etc/nginx/sites-enabled/{{ item.item.domain }}.conf"
|
||||||
state: link
|
state: link
|
||||||
@ -41,7 +41,7 @@
|
|||||||
notify: reload_nginx
|
notify: reload_nginx
|
||||||
|
|
||||||
- name: Generate self-signed certificate
|
- name: Generate self-signed certificate
|
||||||
shell: 'openssl req -newkey rsa:4096 -x509 -sha256 -days 3650 -nodes \
|
ansible.builtin.shell: 'openssl req -newkey rsa:4096 -x509 -sha256 -days 3650 -nodes \
|
||||||
-subj "/C=US/ST=Local/L=Local/O=Org/OU=IT/CN=example.com" \
|
-subj "/C=US/ST=Local/L=Local/O=Org/OU=IT/CN=example.com" \
|
||||||
-keyout /etc/ssl/private/nginx-selfsigned.key \
|
-keyout /etc/ssl/private/nginx-selfsigned.key \
|
||||||
-out /etc/ssl/certs/nginx-selfsigned.crt'
|
-out /etc/ssl/certs/nginx-selfsigned.crt'
|
||||||
@ -51,33 +51,33 @@
|
|||||||
notify: reload_nginx
|
notify: reload_nginx
|
||||||
|
|
||||||
- name: Install LE's certbot
|
- name: Install LE's certbot
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: ['certbot', 'python3-certbot-dns-cloudflare']
|
name: ['certbot', 'python3-certbot-dns-cloudflare']
|
||||||
state: present
|
state: present
|
||||||
when: proxy.production is defined and proxy.production
|
when: proxy.production is defined and proxy.production
|
||||||
|
|
||||||
- name: Install Cloudflare API token
|
- name: Install Cloudflare API token
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: cloudflare.ini.j2
|
src: cloudflare.ini.j2
|
||||||
dest: /root/.cloudflare.ini
|
dest: /root/.cloudflare.ini
|
||||||
mode: '0600'
|
mode: '0600'
|
||||||
when: proxy.production is defined and proxy.production and proxy.dns_cloudflare is defined
|
when: proxy.production is defined and proxy.production and proxy.dns_cloudflare is defined
|
||||||
|
|
||||||
- name: Create nginx post renewal hook directory
|
- name: Create nginx post renewal hook directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: /etc/letsencrypt/renewal-hooks/post
|
path: /etc/letsencrypt/renewal-hooks/post
|
||||||
state: directory
|
state: directory
|
||||||
when: proxy.production is defined and proxy.production
|
when: proxy.production is defined and proxy.production
|
||||||
|
|
||||||
- name: Install nginx post renewal hook
|
- name: Install nginx post renewal hook
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
src: reload-nginx.sh
|
src: reload-nginx.sh
|
||||||
dest: /etc/letsencrypt/renewal-hooks/post/reload-nginx.sh
|
dest: /etc/letsencrypt/renewal-hooks/post/reload-nginx.sh
|
||||||
mode: '0755'
|
mode: '0755'
|
||||||
when: proxy.production is defined and proxy.production
|
when: proxy.production is defined and proxy.production
|
||||||
|
|
||||||
- name: Run Cloudflare DNS-01 challenges on wildcard domains
|
- name: Run Cloudflare DNS-01 challenges on wildcard domains
|
||||||
shell: '/usr/bin/certbot certonly \
|
ansible.builtin.shell: '/usr/bin/certbot certonly \
|
||||||
--non-interactive \
|
--non-interactive \
|
||||||
--agree-tos \
|
--agree-tos \
|
||||||
--email "{{ proxy.dns_cloudflare.email }}" \
|
--email "{{ proxy.dns_cloudflare.email }}" \
|
||||||
@ -93,7 +93,7 @@
|
|||||||
notify: reload_nginx
|
notify: reload_nginx
|
||||||
|
|
||||||
- name: Add HTTP and HTTPS firewall rule
|
- name: Add HTTP and HTTPS firewall rule
|
||||||
ufw:
|
community.general.ufw:
|
||||||
rule: allow
|
rule: allow
|
||||||
port: "{{ item }}"
|
port: "{{ item }}"
|
||||||
proto: tcp
|
proto: tcp
|
||||||
|
@ -13,12 +13,12 @@
|
|||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
- name: Install rsnapshot
|
- name: Install rsnapshot
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: rsnapshot
|
name: rsnapshot
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Create rsnapshot system directories
|
- name: Create rsnapshot system directories
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
state: directory
|
state: directory
|
||||||
loop:
|
loop:
|
||||||
@ -26,19 +26,19 @@
|
|||||||
- "{{ rsnapshot_logdir }}"
|
- "{{ rsnapshot_logdir }}"
|
||||||
|
|
||||||
- name: Create snapshot_root directories
|
- name: Create snapshot_root directories
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ item.root | default(rsnapshot_root) }}"
|
path: "{{ item.root | default(rsnapshot_root) }}"
|
||||||
state: directory
|
state: directory
|
||||||
loop: "{{ rsnapshot }}"
|
loop: "{{ rsnapshot }}"
|
||||||
|
|
||||||
- name: Install rsnapshot configuration
|
- name: Install rsnapshot configuration
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: rsnapshot.conf.j2
|
src: rsnapshot.conf.j2
|
||||||
dest: "{{ rsnapshot_confdir }}/{{ item.name }}.conf"
|
dest: "{{ rsnapshot_confdir }}/{{ item.name }}.conf"
|
||||||
loop: "{{ rsnapshot }}"
|
loop: "{{ rsnapshot }}"
|
||||||
|
|
||||||
- name: Install rsnapshot crons
|
- name: Install rsnapshot crons
|
||||||
cron:
|
ansible.builtin.cron:
|
||||||
name: "{{ item.1.interval }} rsnapshot of {{ item.0.name }}"
|
name: "{{ item.1.interval }} rsnapshot of {{ item.0.name }}"
|
||||||
job: "/usr/bin/rsnapshot -c {{ rsnapshot_confdir }}/{{ item.0.name }}.conf {{ item.1.interval }} >/dev/null"
|
job: "/usr/bin/rsnapshot -c {{ rsnapshot_confdir }}/{{ item.0.name }}.conf {{ item.1.interval }} >/dev/null"
|
||||||
user: "root"
|
user: "root"
|
||||||
@ -53,13 +53,13 @@
|
|||||||
- cron
|
- cron
|
||||||
|
|
||||||
- name: Install rsnapshot report script
|
- name: Install rsnapshot report script
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: rsnapshot-report.sh.j2
|
src: rsnapshot-report.sh.j2
|
||||||
dest: /usr/local/bin/rsnapshot-report
|
dest: /usr/local/bin/rsnapshot-report
|
||||||
mode: '0750'
|
mode: '0750'
|
||||||
|
|
||||||
- name: Install rsnapshot report crons
|
- name: Install rsnapshot report crons
|
||||||
cron:
|
ansible.builtin.cron:
|
||||||
name: "{{ item.name }} rsnapshot report email"
|
name: "{{ item.name }} rsnapshot report email"
|
||||||
job: "/usr/local/bin/rsnapshot-report {{ rsnapshot_reportlog }}
|
job: "/usr/local/bin/rsnapshot-report {{ rsnapshot_reportlog }}
|
||||||
| mail -s '{{ item.report.subject | default('Backup Report') }}' {{ item.report.to }}"
|
| mail -s '{{ item.report.subject | default('Backup Report') }}' {{ item.report.to }}"
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
- name: Reload Traefik container
|
- name: Reload Traefik container
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ traefik_root }}/config/dynamic"
|
path: "{{ traefik_root }}/config/dynamic"
|
||||||
state: touch
|
state: touch
|
||||||
listen: reload_traefik
|
listen: reload_traefik
|
||||||
|
|
||||||
- name: Restart Traefik
|
- name: Restart Traefik
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: "{{ docker_compose_service }}@{{ traefik_name }}"
|
name: "{{ docker_compose_service }}@{{ traefik_name }}"
|
||||||
state: restarted
|
state: restarted
|
||||||
listen: restart_traefik
|
listen: restart_traefik
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
- name: Create Traefik directories
|
- name: Create Traefik directories
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ traefik_root }}/config/dynamic"
|
path: "{{ traefik_root }}/config/dynamic"
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- name: Install dynamic security configuration
|
- name: Install dynamic security configuration
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: security.yml.j2
|
src: security.yml.j2
|
||||||
dest: "{{ traefik_root }}/config/dynamic/security.yml"
|
dest: "{{ traefik_root }}/config/dynamic/security.yml"
|
||||||
owner: root
|
owner: root
|
||||||
@ -13,32 +13,32 @@
|
|||||||
notify: reload_traefik
|
notify: reload_traefik
|
||||||
|
|
||||||
- name: Install dynamic non-docker configuration
|
- name: Install dynamic non-docker configuration
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: "external.yml.j2"
|
src: "external.yml.j2"
|
||||||
dest: "{{ traefik_root }}/config/dynamic/{{ item.name }}.yml"
|
dest: "{{ traefik_root }}/config/dynamic/{{ item.name }}.yml"
|
||||||
loop: "{{ traefik_external }}"
|
loop: "{{ traefik_external }}"
|
||||||
when: traefik_external is defined
|
when: traefik_external is defined
|
||||||
|
|
||||||
- name: Install Traefik's docker-compose file
|
- name: Install Traefik's docker-compose file
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: docker-compose.yml.j2
|
src: docker-compose.yml.j2
|
||||||
dest: "{{ traefik_root }}/docker-compose.yml"
|
dest: "{{ traefik_root }}/docker-compose.yml"
|
||||||
notify: restart_traefik
|
notify: restart_traefik
|
||||||
|
|
||||||
- name: Install Traefik's docker-compose variables
|
- name: Install Traefik's docker-compose variables
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: compose-env.j2
|
src: compose-env.j2
|
||||||
dest: "{{ traefik_root }}/.env"
|
dest: "{{ traefik_root }}/.env"
|
||||||
notify: restart_traefik
|
notify: restart_traefik
|
||||||
|
|
||||||
- name: Install static Traefik configuration
|
- name: Install static Traefik configuration
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: traefik.yml.j2
|
src: traefik.yml.j2
|
||||||
dest: "{{ traefik_root }}/config/traefik.yml"
|
dest: "{{ traefik_root }}/config/traefik.yml"
|
||||||
notify: restart_traefik
|
notify: restart_traefik
|
||||||
|
|
||||||
- name: Start and enable Traefik service
|
- name: Start and enable Traefik service
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: "{{ docker_compose_service }}@{{ traefik_name }}"
|
name: "{{ docker_compose_service }}@{{ traefik_name }}"
|
||||||
state: started
|
state: started
|
||||||
enabled: true
|
enabled: true
|
||||||
|
@ -1,52 +1,52 @@
|
|||||||
- name: Install GnuPG
|
- name: Install GnuPG
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: gnupg
|
name: gnupg
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Add AdoptOpenJDK's signing key
|
- name: Add AdoptOpenJDK's signing key
|
||||||
apt_key:
|
ansible.builtin.apt_key:
|
||||||
id: 8ED17AF5D7E675EB3EE3BCE98AC3B29174885C03
|
id: 8ED17AF5D7E675EB3EE3BCE98AC3B29174885C03
|
||||||
url: https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public
|
url: https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public
|
||||||
|
|
||||||
- name: Add MongoDB 3.6's signing key
|
- name: Add MongoDB 3.6's signing key
|
||||||
apt_key:
|
ansible.builtin.apt_key:
|
||||||
id: 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
|
id: 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
|
||||||
url: https://www.mongodb.org/static/pgp/server-3.6.asc
|
url: https://www.mongodb.org/static/pgp/server-3.6.asc
|
||||||
|
|
||||||
- name: Add UniFi's signing key
|
- name: Add UniFi's signing key
|
||||||
apt_key:
|
ansible.builtin.apt_key:
|
||||||
id: 4A228B2D358A5094178285BE06E85760C0A52C50
|
id: 4A228B2D358A5094178285BE06E85760C0A52C50
|
||||||
keyserver: keyserver.ubuntu.com
|
keyserver: keyserver.ubuntu.com
|
||||||
|
|
||||||
- name: Install AdoptOpenJDK repository
|
- name: Install AdoptOpenJDK repository
|
||||||
apt_repository:
|
ansible.builtin.apt_repository:
|
||||||
repo: deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ buster main
|
repo: deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ buster main
|
||||||
mode: 0644
|
mode: 0644
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Install MongoDB 3.6 repository
|
- name: Install MongoDB 3.6 repository
|
||||||
apt_repository:
|
ansible.builtin.apt_repository:
|
||||||
repo: deb http://repo.mongodb.org/apt/debian stretch/mongodb-org/3.6 main
|
repo: deb http://repo.mongodb.org/apt/debian stretch/mongodb-org/3.6 main
|
||||||
mode: 0644
|
mode: 0644
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Install UniFi repository
|
- name: Install UniFi repository
|
||||||
apt_repository:
|
ansible.builtin.apt_repository:
|
||||||
repo: deb https://www.ui.com/downloads/unifi/debian stable ubiquiti
|
repo: deb https://www.ui.com/downloads/unifi/debian stable ubiquiti
|
||||||
mode: 0644
|
mode: 0644
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Install MongoDB 3.6
|
- name: Install MongoDB 3.6
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: mongodb-org
|
name: mongodb-org
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Install OpenJDK 8 LTS
|
- name: Install OpenJDK 8 LTS
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: adoptopenjdk-8-hotspot
|
name: adoptopenjdk-8-hotspot
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Install UniFi
|
- name: Install UniFi
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: unifi
|
name: unifi
|
||||||
state: present
|
state: present
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
- name: Start WordPress database container
|
- name: Start WordPress database container
|
||||||
docker_container:
|
community.general.docker_container:
|
||||||
name: "{{ wordpress_dbcontainer }}"
|
name: "{{ wordpress_dbcontainer }}"
|
||||||
image: mariadb:{{ wordpress_dbversion }}
|
image: mariadb:{{ wordpress_dbversion }}
|
||||||
restart_policy: always
|
restart_policy: always
|
||||||
@ -11,7 +11,7 @@
|
|||||||
MYSQL_PASSWORD: "{{ wordpress_dbpass }}"
|
MYSQL_PASSWORD: "{{ wordpress_dbpass }}"
|
||||||
|
|
||||||
- name: Start WordPress container
|
- name: Start WordPress container
|
||||||
docker_container:
|
community.general.docker_container:
|
||||||
name: "{{ wordpress_container }}"
|
name: "{{ wordpress_container }}"
|
||||||
image: wordpress:{{ wordpress_version }}
|
image: wordpress:{{ wordpress_version }}
|
||||||
restart_policy: always
|
restart_policy: always
|
||||||
|
Loading…
Reference in New Issue
Block a user