ansible-role-nginx/tasks/plus/install-debian.yml
Jurgen Verhasselt 3a63b9acf6
Add 'nginx_manage_repo' feature flag and defaults (#420)
Co-authored-by: Jurgen Verhasselt <hello@sjugge.be>
Co-authored-by: Jurgen Verhasselt <sjugge@inuits.eu>
2021-06-14 16:57:18 +02:00

31 lines
1.6 KiB
YAML

---
- name: (Debian/Ubuntu) {{ nginx_license_status is defined | ternary('Remove', 'Configure') }} NGINX Plus license verification
blockinfile:
path: /etc/apt/apt.conf.d/90nginx
create: true
block: |
Acquire::https::{{ (nginx_repository | default(nginx_plus_default_repository_debian)) | regex_search('(?<=https://)[^/]*') }}::Verify-Peer "true";
Acquire::https::{{ (nginx_repository | default(nginx_plus_default_repository_debian)) | regex_search('(?<=https://)[^/]*') }}::Verify-Host "true";
Acquire::https::{{ (nginx_repository | default(nginx_plus_default_repository_debian)) | regex_search('(?<=https://)[^/]*') }}::SslCert "/etc/ssl/nginx/nginx-repo.crt";
Acquire::https::{{ (nginx_repository | default(nginx_plus_default_repository_debian)) | regex_search('(?<=https://)[^/]*') }}::SslKey "/etc/ssl/nginx/nginx-repo.key";
state: "{{ nginx_license_status | default ('present') }}"
mode: 0444
- name: (Debian/Ubuntu) {{ nginx_license_status is defined | ternary('Remove', 'Configure') }} NGINX Plus repository
apt_repository:
filename: nginx-plus
repo: "{{ nginx_repository | default(nginx_plus_default_repository_debian) }}"
update_cache: false
state: "{{ nginx_license_status | default ('present') }}"
mode: 0644
when: nginx_manage_repo | bool
- name: (Debian/Ubuntu) Install NGINX Plus
apt:
name: "nginx-plus{{ nginx_version | default('') }}"
state: "{{ nginx_state }}"
update_cache: true
ignore_errors: "{{ ansible_check_mode }}"
when: nginx_license_status is not defined
notify: (Handler) Run NGINX