This commit is contained in:
@ -1,6 +1,6 @@
|
||||
---
|
||||
- name: "Install nginx via apt"
|
||||
ansible.builtin.apt:
|
||||
apt:
|
||||
update_cache: yes
|
||||
state: present
|
||||
name:
|
||||
@ -19,7 +19,7 @@
|
||||
port: https
|
||||
|
||||
- name: Copy default nginx config
|
||||
ansible.builtin.copy:
|
||||
copy:
|
||||
src: nginx.conf
|
||||
dest: /etc/nginx/nginx.conf
|
||||
owner: root
|
||||
@ -27,28 +27,28 @@
|
||||
mode: '0644'
|
||||
|
||||
- name: Enable and restart nginx daemon
|
||||
ansible.builtin.service:
|
||||
service:
|
||||
name: nginx
|
||||
state: restarted
|
||||
enabled: yes
|
||||
|
||||
- name: Generate certificate for all proxied domains
|
||||
ansible.builtin.command:
|
||||
command:
|
||||
cmd: certbot certonly --non-interactive --agree-tos -m tormakristof@tormakristof.eu --nginx -d {{item.domain}}
|
||||
with_items: "{{ proxy }}"
|
||||
|
||||
- name: Generate certificate for all static sites
|
||||
ansible.builtin.command:
|
||||
command:
|
||||
cmd: certbot certonly --non-interactive --agree-tos -m tormakristof@tormakristof.eu --nginx -d {{item.domain}}
|
||||
with_items: "{{ static }}"
|
||||
|
||||
- name: Generate certificate for all redirect sites
|
||||
ansible.builtin.command:
|
||||
command:
|
||||
cmd: certbot certonly --non-interactive --agree-tos -m tormakristof@tormakristof.eu --nginx -d {{item.domain}}
|
||||
with_items: "{{ redirect }}"
|
||||
|
||||
- name: "Generate certbot script"
|
||||
ansible.builtin.template:
|
||||
template:
|
||||
src: certbot.sh
|
||||
dest: /etc/cron.weekly/certbot
|
||||
owner: root
|
||||
@ -56,7 +56,7 @@
|
||||
mode: '0700'
|
||||
|
||||
- name: "Generate nginx configuration"
|
||||
ansible.builtin.template:
|
||||
template:
|
||||
src: nginx.conf
|
||||
dest: /etc/nginx/nginx.conf
|
||||
owner: root
|
||||
@ -64,41 +64,41 @@
|
||||
mode: '0644'
|
||||
|
||||
- name: Validate nginx configuration
|
||||
ansible.builtin.command:
|
||||
command:
|
||||
cmd: nginx -t
|
||||
|
||||
- name: Reload nginx after configuration change
|
||||
ansible.builtin.service:
|
||||
service:
|
||||
name: nginx
|
||||
state: reloaded
|
||||
|
||||
- name: "Remove any existing static file directories"
|
||||
ansible.builtin.file:
|
||||
file:
|
||||
path: "{{ item.directory }}"
|
||||
state: absent
|
||||
with_items: "{{ static }}"
|
||||
|
||||
- name: "Checkout static websites from git"
|
||||
ansible.builtin.git:
|
||||
git:
|
||||
repo: "{{ item.repo }}"
|
||||
dest: "{{ item.directory }}"
|
||||
with_items: "{{ static }}"
|
||||
|
||||
- name: "Remove .git directory from static websites"
|
||||
ansible.builtin.file:
|
||||
file:
|
||||
path: "{{ item.directory }}/.git"
|
||||
state: absent
|
||||
with_items: "{{ static }}"
|
||||
|
||||
- name: "Install nginx exporter"
|
||||
ansible.builtin.apt:
|
||||
apt:
|
||||
update_cache: yes
|
||||
state: present
|
||||
name:
|
||||
- prometheus-nginx-exporter
|
||||
|
||||
- name: Copy nginx exporter config
|
||||
ansible.builtin.copy:
|
||||
copy:
|
||||
src: prometheus-nginx-exporter
|
||||
dest: /etc/default/prometheus-nginx-exporter
|
||||
owner: root
|
||||
@ -106,7 +106,7 @@
|
||||
mode: '0644'
|
||||
|
||||
- name: Enable and restart exporter daemon
|
||||
ansible.builtin.service:
|
||||
service:
|
||||
name: prometheus-nginx-exporter
|
||||
state: restarted
|
||||
enabled: yes
|
||||
|
Reference in New Issue
Block a user