54 lines
1.4 KiB
YAML
54 lines
1.4 KiB
YAML
---
|
|
- name: "Install gpg-agent"
|
|
ansible.builtin.apt:
|
|
name: gpg-agent
|
|
state: present
|
|
update_cache: true
|
|
cache_valid_time: 3600
|
|
|
|
- name: "Add NGINX signing key"
|
|
ansible.builtin.apt_key:
|
|
url: https://nginx.org/keys/nginx_signing.key
|
|
state: present
|
|
|
|
- name: "Add NGINX repository"
|
|
notify: "Update apt cache"
|
|
ansible.builtin.apt_repository:
|
|
repo: "deb http://nginx.org/packages/{{ ansible_distribution | lower }}/ {{ ansible_distribution_release }} nginx"
|
|
state: present
|
|
|
|
- name: "Install specific NGINX version"
|
|
notify: "Start nginx"
|
|
ansible.builtin.apt:
|
|
name: "nginx={{ nginx_version }}*"
|
|
state: present
|
|
|
|
- name: "Remove default site configuration if it exists"
|
|
notify: "Reload nginx"
|
|
ansible.builtin.file:
|
|
path: /etc/nginx/conf.d/default.conf
|
|
state: absent
|
|
|
|
- name: "Deploy a single site configuration"
|
|
when: site is defined
|
|
notify: "Reload nginx"
|
|
ansible.builtin.copy:
|
|
dest: "/etc/nginx/conf.d/{{ site.confname }}.conf"
|
|
owner: root
|
|
group: root
|
|
mode: "0644"
|
|
content: "{{ site.content }}"
|
|
|
|
- name: "Deploy custom site configurations"
|
|
when: dir_sites is defined
|
|
with_fileglob:
|
|
- "{{ dir_sites }}/*.conf"
|
|
notify: "Reload nginx"
|
|
ansible.builtin.copy:
|
|
src: "{{ item }}"
|
|
dest: "/etc/nginx/conf.d/{{ item | basename }}"
|
|
owner: root
|
|
group: root
|
|
mode: '0644'
|
|
# validate: '/usr/sbin/nginx -t -c %s'
|