ansible-role-nginx/tasks/plus/setup-license.yml

50 lines
1.4 KiB
YAML

---
- name: (Debian/Red Hat/SLES OSs) Set up NGINX Plus license
block:
- name: (Debian/Red Hat/SLES OSs) Create SSL directory
ansible.builtin.file:
path: /etc/ssl/nginx
state: directory
mode: 0755
- name: (Debian/Red Hat/SLES OSs) Copy NGINX Plus certificate and license key
ansible.builtin.copy:
src: "{{ item }}"
dest: /etc/ssl/nginx
decrypt: true
mode: 0444
loop:
- "{{ nginx_license['certificate'] }}"
- "{{ nginx_license['key'] }}"
when: ansible_facts['os_family'] != "Alpine"
- name: (Alpine Linux) Set up NGINX Plus license
block:
- name: (Alpine Linux) Create APK directory
ansible.builtin.file:
path: /etc/apk
state: directory
mode: 0755
- name: (Alpine Linux) Copy NGINX Plus key
ansible.builtin.copy:
src: "{{ nginx_license['key'] }}"
dest: /etc/apk/cert.key
decrypt: true
mode: 0444
- name: (Alpine Linux) Copy NGINX Plus certificate
ansible.builtin.copy:
src: "{{ nginx_license['certificate'] }}"
dest: /etc/apk/cert.pem
decrypt: true
mode: 0444
when: ansible_facts['os_family'] == "Alpine"
- name: (SLES) Combine NGINX Plus certificate and license key
ansible.builtin.assemble:
src: /etc/ssl/nginx
dest: /etc/ssl/nginx/nginx-repo-bundle.crt
mode: 0444
when: ansible_facts['os_family'] == "Suse"