mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 15:06:26 +02:00
Renamed server roles by osi they work on
This commit is contained in:
30
roles/srv-web-7-4-core/tasks/cache_directories.yml
Normal file
30
roles/srv-web-7-4-core/tasks/cache_directories.yml
Normal file
@@ -0,0 +1,30 @@
|
||||
- name: Cleanup all NGINX cache directories
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
path: "{{ item.value }}"
|
||||
state: absent
|
||||
when:
|
||||
- mode_cleanup | bool
|
||||
- run_once_nginx_reverse_proxy is not defined
|
||||
loop: "{{ nginx.directories.cache | dict2items }}"
|
||||
loop_control:
|
||||
label: "{{ item.key }}"
|
||||
|
||||
- name: Ensure all NGINX cache directories exist
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
path: "{{ item.value }}"
|
||||
state: directory
|
||||
owner: "{{ nginx.user }}"
|
||||
group: "{{ nginx.user }}"
|
||||
mode: '0700'
|
||||
|
||||
when: run_once_nginx_reverse_proxy is not defined
|
||||
loop: "{{ nginx.directories.cache | dict2items }}"
|
||||
loop_control:
|
||||
label: "{{ item.key }}"
|
||||
|
||||
- name: run the nginx_reverse_proxy tasks once
|
||||
set_fact:
|
||||
run_once_nginx_reverse_proxy: true
|
||||
when: run_once_nginx_reverse_proxy is not defined
|
60
roles/srv-web-7-4-core/tasks/main.yml
Normal file
60
roles/srv-web-7-4-core/tasks/main.yml
Normal file
@@ -0,0 +1,60 @@
|
||||
---
|
||||
- name: install nginx
|
||||
pacman:
|
||||
name:
|
||||
- nginx
|
||||
- nginx-mod-stream
|
||||
state: present
|
||||
notify: restart nginx
|
||||
when: run_once_srv_web_core is not defined
|
||||
|
||||
- name: "reset (if enabled)"
|
||||
include_tasks: reset.yml
|
||||
when: mode_reset | bool and run_once_srv_web_core is not defined
|
||||
|
||||
- name: Ensure nginx configuration directories are present
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
owner: "{{nginx.user}}"
|
||||
group: "{{nginx.user}}"
|
||||
mode: '0755'
|
||||
recurse: yes
|
||||
loop: >
|
||||
{{
|
||||
[ nginx.directories.configuration ] +
|
||||
(nginx.directories.http.values() | list) +
|
||||
[ nginx.directories.streams ]
|
||||
}}
|
||||
when: run_once_srv_web_core is not defined
|
||||
|
||||
- name: Ensure nginx data storage directories are present
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
recurse: yes
|
||||
owner: "{{nginx.user}}"
|
||||
group: "{{nginx.user}}"
|
||||
mode: '0755'
|
||||
loop: >
|
||||
{{ nginx.directories.data.values() | list }}
|
||||
when: run_once_srv_web_core is not defined
|
||||
|
||||
- name: "Include tasks to create cache directories"
|
||||
include_tasks: cache_directories.yml
|
||||
|
||||
- name: create nginx config file
|
||||
template:
|
||||
src: nginx.conf.j2
|
||||
dest: /etc/nginx/nginx.conf
|
||||
notify: restart nginx
|
||||
when: run_once_srv_web_core is not defined
|
||||
|
||||
- name: flush nginx service
|
||||
meta: flush_handlers
|
||||
when: run_once_srv_web_core is not defined
|
||||
|
||||
- name: run {{ role_name }} once
|
||||
set_fact:
|
||||
run_once_srv_web_core: true
|
||||
when: run_once_srv_web_core is not defined
|
4
roles/srv-web-7-4-core/tasks/reset.yml
Normal file
4
roles/srv-web-7-4-core/tasks/reset.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
- name: "Delete {{nginx.directories.configuration}} directory, when mode_reset"
|
||||
file:
|
||||
path: "{{ nginx.directories.configuration }}"
|
||||
state: absent
|
Reference in New Issue
Block a user