68 lines
1.8 KiB
YAML
68 lines
1.8 KiB
YAML
---
|
|
|
|
- name: FAIL | Check possible issues
|
|
fail:
|
|
msg: "This ansible version ({{ ansible_version.full}}) is not compatible with your needs (Debian Stretch + htpasswd). Please see https://github.com/HanXHX/ansible-nginx/issues/28"
|
|
when:
|
|
ansible_distribution_major_version | version_compare('9', 'ge') and
|
|
ansible_version.full | version_compare('2.3.2', 'lt') and
|
|
nginx_htpasswd | length > 0
|
|
|
|
- name: APT | Update cache
|
|
apt:
|
|
update_cache: yes
|
|
cache_valid_time: 3600
|
|
changed_when: false
|
|
|
|
- name: APT | Force OpenSSL from backports (fix dependency break)
|
|
apt:
|
|
pkg: openssl
|
|
state: latest
|
|
default_release: "{{ ansible_distribution_release + '-backports' }}"
|
|
when: nginx_backports
|
|
|
|
- name: APT | Install nginx and dependencies
|
|
apt:
|
|
pkg: "{{ nginx_apt_package }}"
|
|
state: present
|
|
default_release: "{{ ansible_distribution_release + '-backports' if nginx_backports else ansible_distribution_release }}"
|
|
|
|
- name: APT | Install nginx modules
|
|
apt:
|
|
pkg: "{{ item }}"
|
|
state: present
|
|
with_items: "{{ nginx_module_packages }}"
|
|
when:
|
|
ansible_distribution_major_version | version_compare('9', 'ge') or
|
|
nginx_backports
|
|
|
|
- name: APT | Install python-passlib
|
|
apt:
|
|
pkg: python-passlib
|
|
state: present
|
|
|
|
- name: STAT | Check acme.sh is installed
|
|
stat:
|
|
path: "{{ nginx_acmesh_dir }}"
|
|
register: acme
|
|
|
|
- block:
|
|
|
|
- name: APT | Install git
|
|
apt:
|
|
pkg: git
|
|
|
|
- name: GIT | Get acme.sh
|
|
git:
|
|
repo: 'https://github.com/Neilpang/acme.sh.git'
|
|
dest: '{{ nginx_acmesh_git_dir }}'
|
|
update: no
|
|
|
|
- name: SHELL | Install acme.sh
|
|
shell: ./acme.sh --install --home {{ nginx_acmesh_dir }} --cert-home {{ nginx_acmesh_dir }}
|
|
args:
|
|
chdir: "{{ nginx_acmesh_git_dir }}"
|
|
creates: "{{ nginx_acmesh_dir }}"
|
|
|
|
when: not acme.stat.exists
|