mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2024-11-22 12:41:05 +01:00
Improved performance by executing tasks just once per host
This commit is contained in:
parent
e4c380b2b5
commit
1d2f2875b5
@ -152,7 +152,7 @@ Focuses on web server roles and applications, covering SSL certificates, Nginx c
|
|||||||
- **[Nginx-Https](./roles/nginx-https/)**: Enables HTTPS configuration for Nginx.
|
- **[Nginx-Https](./roles/nginx-https/)**: Enables HTTPS configuration for Nginx.
|
||||||
- **[Nginx-Matomo-Tracking](./roles/nginx-matomo-tracking/)**: Integrates Matomo tracking with Nginx.
|
- **[Nginx-Matomo-Tracking](./roles/nginx-matomo-tracking/)**: Integrates Matomo tracking with Nginx.
|
||||||
- **[Nginx-Redirect](./roles/nginx-domain-redirect/)**: Manages URL redirects in Nginx.
|
- **[Nginx-Redirect](./roles/nginx-domain-redirect/)**: Manages URL redirects in Nginx.
|
||||||
- **[Certbot Nginx](./roles/certbot-nginx/)**: Integrates Certbot with Nginx for SSL certificates.
|
- **[Certbot Nginx](./roles/nginx-certbot/)**: Integrates Certbot with Nginx for SSL certificates.
|
||||||
- **[Postfix](./roles/postfix/)**: Setup for the Postfix mail transfer agent.
|
- **[Postfix](./roles/postfix/)**: Setup for the Postfix mail transfer agent.
|
||||||
|
|
||||||
#### Docker and Containerization
|
#### Docker and Containerization
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
- lsof
|
- lsof
|
||||||
- python-pandas
|
- python-pandas
|
||||||
state: present
|
state: present
|
||||||
|
when: run_once_backup_docker_to_local is not defined
|
||||||
|
|
||||||
- name: pull backup-docker-to-local.git
|
- name: pull backup-docker-to-local.git
|
||||||
git:
|
git:
|
||||||
@ -12,23 +13,26 @@
|
|||||||
update: yes
|
update: yes
|
||||||
register: git_result
|
register: git_result
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
when: run_once_backup_docker_to_local is not defined
|
||||||
|
|
||||||
- name: Warn if repo is not reachable
|
- name: Warn if repo is not reachable
|
||||||
debug:
|
debug:
|
||||||
msg: "Warning: Repository is not reachable."
|
msg: "Warning: Repository is not reachable."
|
||||||
when: git_result.failed
|
when: git_result is defined and git_result.failed is defined and run_once_cleanup_failed_docker_backups is not defined
|
||||||
|
|
||||||
- name: configure backup-docker-to-local.service
|
- name: configure backup-docker-to-local.service
|
||||||
template:
|
template:
|
||||||
src: backup-docker-to-local.service.j2
|
src: backup-docker-to-local.service.j2
|
||||||
dest: /etc/systemd/system/backup-docker-to-local.service
|
dest: /etc/systemd/system/backup-docker-to-local.service
|
||||||
notify: reload backup-docker-to-local.service
|
notify: reload backup-docker-to-local.service
|
||||||
|
when: run_once_backup_docker_to_local is not defined
|
||||||
|
|
||||||
- name: configure backup-docker-to-local.timer.tpl
|
- name: configure backup-docker-to-local.timer.tpl
|
||||||
template: src=backup-docker-to-local.timer.j2 dest=/etc/systemd/system/backup-docker-to-local.timer
|
template: src=backup-docker-to-local.timer.j2 dest=/etc/systemd/system/backup-docker-to-local.timer
|
||||||
register: backup_docker_to_local_timer
|
register: backup_docker_to_local_timer
|
||||||
changed_when: backup_docker_to_local_timer.changed or activate_all_timers | default(false) | bool
|
changed_when: backup_docker_to_local_timer.changed or activate_all_timers | default(false) | bool
|
||||||
notify: restart backup-docker-to-local.timer
|
notify: restart backup-docker-to-local.timer
|
||||||
|
when: run_once_backup_docker_to_local is not defined
|
||||||
|
|
||||||
- name: create {{backup_docker_to_local_folder}}databases.csv
|
- name: create {{backup_docker_to_local_folder}}databases.csv
|
||||||
copy:
|
copy:
|
||||||
@ -36,3 +40,9 @@
|
|||||||
dest: "{{backup_docker_to_local_folder}}databases.csv"
|
dest: "{{backup_docker_to_local_folder}}databases.csv"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
|
when: run_once_backup_docker_to_local is not defined
|
||||||
|
|
||||||
|
- name: run the backup_docker_to_local tasks once
|
||||||
|
set_fact:
|
||||||
|
run_once_backup_docker_to_local: true
|
||||||
|
when: run_once_backup_docker_to_local is not defined
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
user:
|
user:
|
||||||
name: backup
|
name: backup
|
||||||
create_home: yes
|
create_home: yes
|
||||||
|
when: run_once_backups_provider_user is not defined
|
||||||
|
|
||||||
- name: create .ssh directory
|
- name: create .ssh directory
|
||||||
file:
|
file:
|
||||||
@ -10,6 +11,7 @@
|
|||||||
owner: backup
|
owner: backup
|
||||||
group: backup
|
group: backup
|
||||||
mode: '0700'
|
mode: '0700'
|
||||||
|
when: run_once_backups_provider_user is not defined
|
||||||
|
|
||||||
- name: create /home/backup/.ssh/authorized_keys
|
- name: create /home/backup/.ssh/authorized_keys
|
||||||
template:
|
template:
|
||||||
@ -18,6 +20,7 @@
|
|||||||
owner: backup
|
owner: backup
|
||||||
group: backup
|
group: backup
|
||||||
mode: '0644'
|
mode: '0644'
|
||||||
|
when: run_once_backups_provider_user is not defined
|
||||||
|
|
||||||
- name: create /home/backup/ssh-wrapper.sh
|
- name: create /home/backup/ssh-wrapper.sh
|
||||||
copy:
|
copy:
|
||||||
@ -26,6 +29,7 @@
|
|||||||
owner: backup
|
owner: backup
|
||||||
group: backup
|
group: backup
|
||||||
mode: '0700'
|
mode: '0700'
|
||||||
|
when: run_once_backups_provider_user is not defined
|
||||||
|
|
||||||
- name: grant backup sudo rights
|
- name: grant backup sudo rights
|
||||||
copy:
|
copy:
|
||||||
@ -35,3 +39,9 @@
|
|||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
notify: sshd restart
|
notify: sshd restart
|
||||||
|
when: run_once_backups_provider_user is not defined
|
||||||
|
|
||||||
|
- name: run the backups_provider_user tasks once
|
||||||
|
set_fact:
|
||||||
|
run_once_backups_provider_user: true
|
||||||
|
when: run_once_backups_provider_user is not defined
|
@ -4,20 +4,29 @@
|
|||||||
- lsof
|
- lsof
|
||||||
- python-psutil
|
- python-psutil
|
||||||
state: present
|
state: present
|
||||||
|
when: run_once_cleanup_backups_service is not defined
|
||||||
|
|
||||||
- name: "create {{docker_cleanup_backups}}"
|
- name: "create {{docker_cleanup_backups}}"
|
||||||
file:
|
file:
|
||||||
path: "{{docker_cleanup_backups}}"
|
path: "{{docker_cleanup_backups}}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
when: run_once_cleanup_backups_service is not defined
|
||||||
|
|
||||||
- name: create cleanup-backups.py
|
- name: create cleanup-backups.py
|
||||||
copy:
|
copy:
|
||||||
src: "cleanup-backups.py"
|
src: "cleanup-backups.py"
|
||||||
dest: "{{docker_cleanup_backups}}cleanup-backups.py"
|
dest: "{{docker_cleanup_backups}}cleanup-backups.py"
|
||||||
|
when: run_once_cleanup_backups_service is not defined
|
||||||
|
|
||||||
- name: create cleanup-backups.service
|
- name: create cleanup-backups.service
|
||||||
template:
|
template:
|
||||||
src: "cleanup-backups.service.j2"
|
src: "cleanup-backups.service.j2"
|
||||||
dest: "/etc/systemd/system/cleanup-backups.service"
|
dest: "/etc/systemd/system/cleanup-backups.service"
|
||||||
notify: reload cleanup-backups.service
|
notify: reload cleanup-backups.service
|
||||||
|
when: run_once_cleanup_backups_service is not defined
|
||||||
|
|
||||||
|
- name: run the cleanup_backups_service tasks once
|
||||||
|
set_fact:
|
||||||
|
run_once_cleanup_backups_service: true
|
||||||
|
when: run_once_cleanup_backups_service is not defined
|
||||||
|
@ -4,3 +4,9 @@
|
|||||||
state: restarted
|
state: restarted
|
||||||
enabled: yes
|
enabled: yes
|
||||||
daemon_reload: yes
|
daemon_reload: yes
|
||||||
|
when: run_once_cleanup_backup_timer is not defined
|
||||||
|
|
||||||
|
- name: run the cleanup_backup_timer tasks once
|
||||||
|
set_fact:
|
||||||
|
run_once_cleanup_backup_timer: true
|
||||||
|
when: run_once_cleanup_backup_timer is not defined
|
@ -5,3 +5,9 @@
|
|||||||
register: cleanup_backups_timer
|
register: cleanup_backups_timer
|
||||||
changed_when: cleanup_backups_timer.changed or activate_all_timers | default(false) | bool
|
changed_when: cleanup_backups_timer.changed or activate_all_timers | default(false) | bool
|
||||||
notify: restart cleanup-backups.timer
|
notify: restart cleanup-backups.timer
|
||||||
|
when: run_once_cleanup_backups_timer is not defined
|
||||||
|
|
||||||
|
- name: run the cleanup_backups_timer tasks once
|
||||||
|
set_fact:
|
||||||
|
run_once_cleanup_backups_timer: true
|
||||||
|
when: run_once_cleanup_backups_timer is not defined
|
||||||
|
@ -5,14 +5,21 @@
|
|||||||
update: yes
|
update: yes
|
||||||
register: git_result
|
register: git_result
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
when: run_once_cleanup_failed_docker_backups is not defined
|
||||||
|
|
||||||
- name: Warn if repo is not reachable
|
- name: Warn if repo is not reachable
|
||||||
debug:
|
debug:
|
||||||
msg: "Warning: Repository is not reachable."
|
msg: "Warning: Repository is not reachable."
|
||||||
when: git_result.failed
|
when: git_result is defined and git_result.failed is defined and run_once_cleanup_failed_docker_backups is not defined
|
||||||
|
|
||||||
- name: configure cleanup-failed-docker-backups.service
|
- name: configure cleanup-failed-docker-backups.service
|
||||||
template:
|
template:
|
||||||
src: cleanup-failed-docker-backups.service.j2
|
src: cleanup-failed-docker-backups.service.j2
|
||||||
dest: /etc/systemd/system/cleanup-failed-docker-backups.service
|
dest: /etc/systemd/system/cleanup-failed-docker-backups.service
|
||||||
notify: reload cleanup-failed-docker-backups.service daemon
|
notify: reload cleanup-failed-docker-backups.service daemon
|
||||||
|
when: run_once_cleanup_failed_docker_backups is not defined
|
||||||
|
|
||||||
|
- name: run the cleanup_failed_docker_backups tasks once
|
||||||
|
set_fact:
|
||||||
|
run_once_cleanup_failed_docker_backups: true
|
||||||
|
when: run_once_cleanup_failed_docker_backups is not defined
|
@ -5,6 +5,7 @@
|
|||||||
name: ['docker','docker-compose']
|
name: ['docker','docker-compose']
|
||||||
state: present
|
state: present
|
||||||
notify: docker restart
|
notify: docker restart
|
||||||
|
when: run_once_docker is not defined
|
||||||
|
|
||||||
- name: "create {{path_docker_compose_instances}}"
|
- name: "create {{path_docker_compose_instances}}"
|
||||||
file:
|
file:
|
||||||
@ -13,6 +14,7 @@
|
|||||||
mode: 0700
|
mode: 0700
|
||||||
owner: administrator
|
owner: administrator
|
||||||
group: administrator
|
group: administrator
|
||||||
|
when: run_once_docker is not defined
|
||||||
|
|
||||||
- name: "create {{path_docker_volumes}}"
|
- name: "create {{path_docker_volumes}}"
|
||||||
file:
|
file:
|
||||||
@ -21,6 +23,13 @@
|
|||||||
mode: 0700
|
mode: 0700
|
||||||
owner: administrator
|
owner: administrator
|
||||||
group: administrator
|
group: administrator
|
||||||
|
when: run_once_docker is not defined
|
||||||
|
|
||||||
- name: flush docker service
|
- name: flush docker service
|
||||||
meta: flush_handlers
|
meta: flush_handlers
|
||||||
|
when: run_once_docker is not defined
|
||||||
|
|
||||||
|
- name: run the docker tasks once
|
||||||
|
set_fact:
|
||||||
|
run_once_docker: true
|
||||||
|
when: run_once_docker is not defined
|
||||||
|
@ -1,2 +1,8 @@
|
|||||||
- name: install git
|
- name: install git
|
||||||
pacman: name=git state=present
|
pacman: name=git state=present
|
||||||
|
when: run_once_git is not defined
|
||||||
|
|
||||||
|
- name: run the git tasks once
|
||||||
|
set_fact:
|
||||||
|
run_once_git: true
|
||||||
|
when: run_once_git is not defined
|
@ -3,17 +3,20 @@
|
|||||||
path: "{{heal_docker}}"
|
path: "{{heal_docker}}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
when: run_once_heal_docker is not defined
|
||||||
|
|
||||||
- name: create heal-docker.py
|
- name: create heal-docker.py
|
||||||
copy:
|
copy:
|
||||||
src: heal-docker.py
|
src: heal-docker.py
|
||||||
dest: "{{heal_docker}}heal-docker.py"
|
dest: "{{heal_docker}}heal-docker.py"
|
||||||
|
when: run_once_heal_docker is not defined
|
||||||
|
|
||||||
- name: create heal-docker.service
|
- name: create heal-docker.service
|
||||||
template:
|
template:
|
||||||
src: heal-docker.service.j2
|
src: heal-docker.service.j2
|
||||||
dest: /etc/systemd/system/heal-docker.service
|
dest: /etc/systemd/system/heal-docker.service
|
||||||
notify: reload heal-docker.service
|
notify: reload heal-docker.service
|
||||||
|
when: run_once_heal_docker is not defined
|
||||||
|
|
||||||
- name: create heal-docker.timer
|
- name: create heal-docker.timer
|
||||||
template:
|
template:
|
||||||
@ -22,3 +25,9 @@
|
|||||||
register: heal_docker_timer
|
register: heal_docker_timer
|
||||||
changed_when: heal_docker_timer.changed or activate_all_timers | default(false) | bool
|
changed_when: heal_docker_timer.changed or activate_all_timers | default(false) | bool
|
||||||
notify: restart heal-docker.timer
|
notify: restart heal-docker.timer
|
||||||
|
when: run_once_heal_docker is not defined
|
||||||
|
|
||||||
|
- name: run the heal_docker tasks once
|
||||||
|
set_fact:
|
||||||
|
run_once_heal_docker: true
|
||||||
|
when: run_once_heal_docker is not defined
|
@ -3,15 +3,18 @@
|
|||||||
path: "{{health_docker_container_folder}}"
|
path: "{{health_docker_container_folder}}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
when: run_once_health_docker_container is not defined
|
||||||
|
|
||||||
- name: create health-docker-container.sh
|
- name: create health-docker-container.sh
|
||||||
copy:
|
copy:
|
||||||
src: health-docker-container.sh
|
src: health-docker-container.sh
|
||||||
dest: "{{health_docker_container_folder}}health-docker-container.sh"
|
dest: "{{health_docker_container_folder}}health-docker-container.sh"
|
||||||
|
when: run_once_health_docker_container is not defined
|
||||||
|
|
||||||
- name: create health-docker-container.service
|
- name: create health-docker-container.service
|
||||||
template: src=health-docker-container.service.j2 dest=/etc/systemd/system/health-docker-container.service
|
template: src=health-docker-container.service.j2 dest=/etc/systemd/system/health-docker-container.service
|
||||||
notify: reload health-docker-container.service
|
notify: reload health-docker-container.service
|
||||||
|
when: run_once_health_docker_container is not defined
|
||||||
|
|
||||||
- name: create health-docker-container.timer
|
- name: create health-docker-container.timer
|
||||||
template:
|
template:
|
||||||
@ -20,3 +23,9 @@
|
|||||||
register: health_docker_container_timer
|
register: health_docker_container_timer
|
||||||
changed_when: health_docker_container_timer.changed or activate_all_timers | default(false) | bool
|
changed_when: health_docker_container_timer.changed or activate_all_timers | default(false) | bool
|
||||||
notify: restart health-docker-container.timer
|
notify: restart health-docker-container.timer
|
||||||
|
when: run_once_health_docker_container is not defined
|
||||||
|
|
||||||
|
- name: run the health_docker_container tasks once
|
||||||
|
set_fact:
|
||||||
|
run_once_health_docker_container: true
|
||||||
|
when: run_once_health_docker_container is not defined
|
||||||
|
@ -3,15 +3,18 @@
|
|||||||
path: "{{health_docker_volumes_folder}}"
|
path: "{{health_docker_volumes_folder}}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
when: run_once_health_docker_volumes is not defined
|
||||||
|
|
||||||
- name: create health-docker-volumes.sh
|
- name: create health-docker-volumes.sh
|
||||||
copy:
|
copy:
|
||||||
src: health-docker-volumes.sh
|
src: health-docker-volumes.sh
|
||||||
dest: "{{health_docker_volumes_folder}}health-docker-volumes.sh"
|
dest: "{{health_docker_volumes_folder}}health-docker-volumes.sh"
|
||||||
|
when: run_once_health_docker_volumes is not defined
|
||||||
|
|
||||||
- name: create health-docker-volumes.service
|
- name: create health-docker-volumes.service
|
||||||
template: src=health-docker-volumes.service.j2 dest=/etc/systemd/system/health-docker-volumes.service
|
template: src=health-docker-volumes.service.j2 dest=/etc/systemd/system/health-docker-volumes.service
|
||||||
notify: reload health-docker-volumes.service
|
notify: reload health-docker-volumes.service
|
||||||
|
when: run_once_health_docker_volumes is not defined
|
||||||
|
|
||||||
- name: create health-docker-volumes.timer
|
- name: create health-docker-volumes.timer
|
||||||
template:
|
template:
|
||||||
@ -20,3 +23,9 @@
|
|||||||
register: health_docker_volumes_timer
|
register: health_docker_volumes_timer
|
||||||
changed_when: health_docker_volumes_timer.changed or activate_all_timers | default(false) | bool
|
changed_when: health_docker_volumes_timer.changed or activate_all_timers | default(false) | bool
|
||||||
notify: restart health-docker-volumes.timer
|
notify: restart health-docker-volumes.timer
|
||||||
|
when: run_once_health_docker_volumes is not defined
|
||||||
|
|
||||||
|
- name: run the health_docker_volumes tasks once
|
||||||
|
set_fact:
|
||||||
|
run_once_health_docker_volumes: true
|
||||||
|
when: run_once_health_docker_volumes is not defined
|
||||||
|
@ -2,23 +2,27 @@
|
|||||||
pacman:
|
pacman:
|
||||||
name: python-requests
|
name: python-requests
|
||||||
state: present
|
state: present
|
||||||
|
when: run_once_health_nginx is not defined
|
||||||
|
|
||||||
- name: "create {{ health_nginx_folder }}"
|
- name: "create {{ health_nginx_folder }}"
|
||||||
file:
|
file:
|
||||||
path: "{{ health_nginx_folder }}"
|
path: "{{ health_nginx_folder }}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
when: run_once_health_nginx is not defined
|
||||||
|
|
||||||
- name: create health-nginx.py
|
- name: create health-nginx.py
|
||||||
copy:
|
copy:
|
||||||
src: health-nginx.py
|
src: health-nginx.py
|
||||||
dest: "{{ health_nginx_folder }}health-nginx.py"
|
dest: "{{ health_nginx_folder }}health-nginx.py"
|
||||||
|
when: run_once_health_nginx is not defined
|
||||||
|
|
||||||
- name: create health-nginx.service
|
- name: create health-nginx.service
|
||||||
template:
|
template:
|
||||||
src: health-nginx.service.j2
|
src: health-nginx.service.j2
|
||||||
dest: /etc/systemd/system/health-nginx.service
|
dest: /etc/systemd/system/health-nginx.service
|
||||||
notify: reload health-nginx.service
|
notify: reload health-nginx.service
|
||||||
|
when: run_once_health_nginx is not defined
|
||||||
|
|
||||||
- name: create health-nginx.timer
|
- name: create health-nginx.timer
|
||||||
template:
|
template:
|
||||||
@ -27,3 +31,10 @@
|
|||||||
register: health_nginx_timer
|
register: health_nginx_timer
|
||||||
changed_when: health_nginx_timer.changed or activate_all_timers | default(false) | bool
|
changed_when: health_nginx_timer.changed or activate_all_timers | default(false) | bool
|
||||||
notify: restart health-nginx.timer
|
notify: restart health-nginx.timer
|
||||||
|
when: run_once_health_nginx is not defined
|
||||||
|
|
||||||
|
- name: run the health_nginx tasks once
|
||||||
|
set_fact:
|
||||||
|
run_once_health_nginx: true
|
||||||
|
when: run_once_health_nginx is not defined
|
||||||
|
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
- certbot-nginx
|
- nginx-certbot
|
||||||
|
@ -1,6 +1,13 @@
|
|||||||
- name: create nginx letsencrypt config file
|
- name: create nginx letsencrypt config file
|
||||||
template: src=letsencrypt.conf.j2 dest={{nginx_servers_directory}}letsencrypt.conf
|
template: src=letsencrypt.conf.j2 dest={{nginx_servers_directory}}letsencrypt.conf
|
||||||
notify: restart nginx
|
notify: restart nginx
|
||||||
|
when: run_once_letsencrypt is not defined
|
||||||
|
|
||||||
- name: flush nginx service
|
- name: flush nginx service
|
||||||
meta: flush_handlers
|
meta: flush_handlers
|
||||||
|
when: run_once_letsencrypt is not defined
|
||||||
|
|
||||||
|
- name: run the letsencrypt logic just once
|
||||||
|
set_fact:
|
||||||
|
run_once_letsencrypt: true
|
||||||
|
when: run_once_letsencrypt is not defined
|
||||||
|
@ -2,12 +2,14 @@
|
|||||||
pacman:
|
pacman:
|
||||||
name: [certbot,certbot-nginx]
|
name: [certbot,certbot-nginx]
|
||||||
state: present
|
state: present
|
||||||
|
when: run_once_nginx_certbot is not defined
|
||||||
|
|
||||||
- name: configure certbot.service.tpl
|
- name: configure certbot.service.tpl
|
||||||
template:
|
template:
|
||||||
src: certbot.service.j2
|
src: certbot.service.j2
|
||||||
dest: /etc/systemd/system/certbot.service
|
dest: /etc/systemd/system/certbot.service
|
||||||
notify: reload certbot service
|
notify: reload certbot service
|
||||||
|
when: run_once_nginx_certbot is not defined
|
||||||
|
|
||||||
- name: configure certbot.timer.tpl
|
- name: configure certbot.timer.tpl
|
||||||
template:
|
template:
|
||||||
@ -16,3 +18,9 @@
|
|||||||
register: certbot_timer
|
register: certbot_timer
|
||||||
changed_when: certbot_timer.changed or activate_all_timers | default(false) | bool
|
changed_when: certbot_timer.changed or activate_all_timers | default(false) | bool
|
||||||
notify: restart certbot timer
|
notify: restart certbot timer
|
||||||
|
when: run_once_nginx_certbot is not defined
|
||||||
|
|
||||||
|
- name: run the nginx_certbot tasks once
|
||||||
|
set_fact:
|
||||||
|
run_once_nginx_certbot: true
|
||||||
|
when: run_once_nginx_certbot is not defined
|
@ -2,6 +2,7 @@
|
|||||||
- name: install nginx
|
- name: install nginx
|
||||||
pacman: name=nginx state=present
|
pacman: name=nginx state=present
|
||||||
notify: restart nginx
|
notify: restart nginx
|
||||||
|
when: run_once_nginx is not defined
|
||||||
|
|
||||||
- name: Ensure nginx configuration directories are present
|
- name: Ensure nginx configuration directories are present
|
||||||
file:
|
file:
|
||||||
@ -12,10 +13,18 @@
|
|||||||
- "{{nginx_servers_directory}}"
|
- "{{nginx_servers_directory}}"
|
||||||
- "{{nginx_maps_directory}}"
|
- "{{nginx_maps_directory}}"
|
||||||
- "{{nginx_upstreams_directory}}"
|
- "{{nginx_upstreams_directory}}"
|
||||||
|
when: run_once_nginx is not defined
|
||||||
|
|
||||||
- name: create nginx config file
|
- name: create nginx config file
|
||||||
template: src=nginx.conf.j2 dest=/etc/nginx/nginx.conf
|
template: src=nginx.conf.j2 dest=/etc/nginx/nginx.conf
|
||||||
notify: restart nginx
|
notify: restart nginx
|
||||||
|
when: run_once_nginx is not defined
|
||||||
|
|
||||||
- name: flush nginx service
|
- name: flush nginx service
|
||||||
meta: flush_handlers
|
meta: flush_handlers
|
||||||
|
when: run_once_nginx is not defined
|
||||||
|
|
||||||
|
- name: run the nginx tasks once
|
||||||
|
set_fact:
|
||||||
|
run_once_nginx: true
|
||||||
|
when: run_once_nginx is not defined
|
||||||
|
@ -3,3 +3,9 @@
|
|||||||
pacman:
|
pacman:
|
||||||
name: python-pip
|
name: python-pip
|
||||||
state: present
|
state: present
|
||||||
|
when: run_once_python_pip is not defined
|
||||||
|
|
||||||
|
- name: run the python_pip tasks once
|
||||||
|
set_fact:
|
||||||
|
run_once_python_pip: true
|
||||||
|
when: run_once_python_pip is not defined
|
||||||
|
@ -6,3 +6,9 @@
|
|||||||
group: root
|
group: root
|
||||||
mode: '0644'
|
mode: '0644'
|
||||||
notify: sshd restart
|
notify: sshd restart
|
||||||
|
when: run_once_sshd is not defined
|
||||||
|
|
||||||
|
- name: run the sshd tasks once
|
||||||
|
set_fact:
|
||||||
|
run_once_sshd: true
|
||||||
|
when: run_once_sshd is not defined
|
||||||
|
@ -2,3 +2,9 @@
|
|||||||
package:
|
package:
|
||||||
name: sudo
|
name: sudo
|
||||||
state: present
|
state: present
|
||||||
|
when: run_once_sudo is not defined
|
||||||
|
|
||||||
|
- name: run the sudo tasks once
|
||||||
|
set_fact:
|
||||||
|
run_once_sudo: true
|
||||||
|
when: run_once_sudo is not defined
|
@ -1,18 +1,28 @@
|
|||||||
- name: install smtp-forwarder
|
- name: install smtp-forwarder
|
||||||
pacman: name=smtp-forwarder state=present
|
pacman: name=smtp-forwarder state=present
|
||||||
|
when: run_once_systemd_notifier_email is not defined
|
||||||
|
|
||||||
- name: configure msmtprc.conf.j2
|
- name: configure msmtprc.conf.j2
|
||||||
template: src=msmtprc.conf.j2 dest=/root/.msmtprc
|
template: src=msmtprc.conf.j2 dest=/root/.msmtprc
|
||||||
|
when: run_once_systemd_notifier_email is not defined
|
||||||
|
|
||||||
- name: "create {{systemd_notifier_email_folder}}"
|
- name: "create {{systemd_notifier_email_folder}}"
|
||||||
file:
|
file:
|
||||||
path: "{{systemd_notifier_email_folder}}"
|
path: "{{systemd_notifier_email_folder}}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
when: run_once_systemd_notifier_email is not defined
|
||||||
|
|
||||||
- name: configure systemd-notifier-email.sh
|
- name: configure systemd-notifier-email.sh
|
||||||
template: src=systemd-notifier-email.sh.j2 dest={{systemd_notifier_email_folder}}systemd-notifier-email.sh
|
template: src=systemd-notifier-email.sh.j2 dest={{systemd_notifier_email_folder}}systemd-notifier-email.sh
|
||||||
|
when: run_once_systemd_notifier_email is not defined
|
||||||
|
|
||||||
- name: configure systemd-notifier-email.service
|
- name: configure systemd-notifier-email.service
|
||||||
template: src=systemd-notifier-email@.service.j2 dest=/etc/systemd/system/systemd-notifier-email@.service
|
template: src=systemd-notifier-email@.service.j2 dest=/etc/systemd/system/systemd-notifier-email@.service
|
||||||
notify: restart systemd-notifier-email service
|
notify: restart systemd-notifier-email service
|
||||||
|
when: run_once_systemd_notifier_email is not defined
|
||||||
|
|
||||||
|
- name: run the systemd_notifier_email tasks once
|
||||||
|
set_fact:
|
||||||
|
run_once_systemd_notifier_email: true
|
||||||
|
when: run_once_systemd_notifier_email is not defined
|
||||||
|
@ -2,20 +2,29 @@
|
|||||||
pacman:
|
pacman:
|
||||||
name: curl
|
name: curl
|
||||||
state: present
|
state: present
|
||||||
|
when: run_once_systemd_notifier_telegram is not defined
|
||||||
|
|
||||||
- name: Create a directory with a subdirectory
|
- name: Create a directory with a subdirectory
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{systemd_telegram_folder}}"
|
path: "{{systemd_telegram_folder}}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: '0755'
|
mode: '0755'
|
||||||
|
when: run_once_systemd_notifier_telegram is not defined
|
||||||
|
|
||||||
- name: configure systemd-notifier-telegram.sh
|
- name: configure systemd-notifier-telegram.sh
|
||||||
template:
|
template:
|
||||||
src: systemd-notifier-telegram.sh.j2
|
src: systemd-notifier-telegram.sh.j2
|
||||||
dest: "{{ systemd_telegram_script }}"
|
dest: "{{ systemd_telegram_script }}"
|
||||||
|
when: run_once_systemd_notifier_telegram is not defined
|
||||||
|
|
||||||
- name: configure systemd-notifier-telegram.service
|
- name: configure systemd-notifier-telegram.service
|
||||||
template:
|
template:
|
||||||
src: systemd-notifier-telegram@.service.j2
|
src: systemd-notifier-telegram@.service.j2
|
||||||
dest: "/etc/systemd/system/systemd-notifier-telegram@.service"
|
dest: "/etc/systemd/system/systemd-notifier-telegram@.service"
|
||||||
notify: "restart systemd-notifier-telegram service"
|
notify: "restart systemd-notifier-telegram service"
|
||||||
|
when: run_once_systemd_notifier_telegram is not defined
|
||||||
|
|
||||||
|
- name: run the systemd_notifier_telegram tasks once
|
||||||
|
set_fact:
|
||||||
|
run_once_systemd_notifier_telegram: true
|
||||||
|
when: run_once_systemd_notifier_telegram is not defined
|
@ -2,3 +2,9 @@
|
|||||||
systemd:
|
systemd:
|
||||||
name: systemd-notifier.service
|
name: systemd-notifier.service
|
||||||
daemon_reload: yes
|
daemon_reload: yes
|
||||||
|
when: run_once_systemd_notifier_service is not defined
|
||||||
|
|
||||||
|
- name: run the systemd_notifier_service tasks once
|
||||||
|
set_fact:
|
||||||
|
run_once_systemd_notifier_service: true
|
||||||
|
when: run_once_systemd_notifier_service is not defined
|
||||||
|
@ -4,3 +4,9 @@
|
|||||||
src: systemd-notifier@.service.j2
|
src: systemd-notifier@.service.j2
|
||||||
dest: "/etc/systemd/system/systemd-notifier@.service"
|
dest: "/etc/systemd/system/systemd-notifier@.service"
|
||||||
notify: "restart systemd-notifier service"
|
notify: "restart systemd-notifier service"
|
||||||
|
when: run_once_systemd_notifier_service is not defined
|
||||||
|
|
||||||
|
- name: run the systemd_notifier_service tasks once
|
||||||
|
set_fact:
|
||||||
|
run_once_systemd_notifier_service: true
|
||||||
|
when: run_once_systemd_notifier_service is not defined
|
@ -7,6 +7,7 @@
|
|||||||
generate_ssh_key: yes
|
generate_ssh_key: yes
|
||||||
ssh_key_type: rsa
|
ssh_key_type: rsa
|
||||||
ssh_key_bits: 8192
|
ssh_key_bits: 8192
|
||||||
|
when: run_once_user_administrator is not defined
|
||||||
|
|
||||||
- name: "create {{path_administrator_scripts}}"
|
- name: "create {{path_administrator_scripts}}"
|
||||||
file:
|
file:
|
||||||
@ -15,6 +16,7 @@
|
|||||||
owner: administrator
|
owner: administrator
|
||||||
group: administrator
|
group: administrator
|
||||||
mode: 0700
|
mode: 0700
|
||||||
|
when: run_once_user_administrator is not defined
|
||||||
|
|
||||||
- name: create {{path_administrator_home}}.ssh/authorized_keys
|
- name: create {{path_administrator_home}}.ssh/authorized_keys
|
||||||
copy:
|
copy:
|
||||||
@ -23,6 +25,7 @@
|
|||||||
owner: administrator
|
owner: administrator
|
||||||
group: administrator
|
group: administrator
|
||||||
mode: '0644'
|
mode: '0644'
|
||||||
|
when: run_once_user_administrator is not defined
|
||||||
|
|
||||||
- name: grant administrator sudo rights with password
|
- name: grant administrator sudo rights with password
|
||||||
copy:
|
copy:
|
||||||
@ -32,6 +35,7 @@
|
|||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
notify: sshd restart
|
notify: sshd restart
|
||||||
|
when: run_once_user_administrator is not defined
|
||||||
|
|
||||||
- name: "create {{path_administrator_home}}volumes/"
|
- name: "create {{path_administrator_home}}volumes/"
|
||||||
file:
|
file:
|
||||||
@ -40,3 +44,9 @@
|
|||||||
owner: administrator
|
owner: administrator
|
||||||
group: administrator
|
group: administrator
|
||||||
mode: 0700
|
mode: 0700
|
||||||
|
when: run_once_user_administrator is not defined
|
||||||
|
|
||||||
|
- name: run the user_administrator tasks once
|
||||||
|
set_fact:
|
||||||
|
run_once_user_administrator: true
|
||||||
|
when: run_once_user_administrator is not defined
|
Loading…
Reference in New Issue
Block a user