ansible-role-nginx/tasks/modules/install-modules.yml

53 lines
2.9 KiB
YAML

---
- name: (CentOS) Install GeoIP EPEL dependencies
ansible.builtin.yum:
name: epel-release
when:
- ansible_facts['distribution'] == "CentOS"
- '"geoip" in nginx_modules'
- nginx_install_epel_release | bool
- name: (RHEL) Install GeoIP2 and/or OpenTracing EPEL dependencies
block:
- name: (RHEL) Import EPEL GPG key
ansible.builtin.rpm_key:
state: present
key: https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-{{ ansible_facts['distribution_major_version'] }}
- name: (RHEL) Install package dependencies
ansible.builtin.yum:
name: https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_facts['distribution_major_version'] }}.noarch.rpm
when:
- ansible_facts['distribution'] == "RedHat"
- (ansible_facts['distribution_major_version'] == 7 and '"geoip2" in nginx_modules')
or '"opentracing" in nginx_modules'
- nginx_install_epel_release | bool
- name: Setup NGINX modules
ansible.builtin.package:
name: "nginx-{{ (nginx_type == 'plus') | ternary('plus-', '') }}module-{{ item.name | default(item) }}\
{{ item.version | default(nginx_version) | default('') }}{{ (nginx_repository is not defined and ansible_facts['os_family'] == 'Alpine' and nginx_type != 'plus') | ternary('@nginx', '') }}"
state: "{{ item.state | default('present') }}"
loop: "{{ nginx_modules }}"
when:
- (item.name | default(item) in nginx_modules_list and nginx_type == 'opensource')
or (item.name | default(item) in nginx_plus_modules_list and nginx_type == 'plus')
- not (item.name | default(item) == "auth-spnego")
or not (ansible_facts['os_family'] == "Alpine" and (ansible_facts['distribution_version'] | regex_search('^[0-9]+\\.[0-9]+') is version('3.8', '==')))
- not (item.name | default(item) == "brotli")
or not ((ansible_facts['os_family'] == "Alpine")
or (ansible_facts['distribution'] == "Amazon")
or (ansible_facts['os_family'] == "Debian" and ansible_facts['distribution_major_version'] is version('9', '=='))
or (ansible_facts['distribution'] == "OracleLinux")
or (ansible_facts['os_family'] == "RedHat" and ansible_facts['distribution_major_version'] is version('8', '<'))
or (ansible_facts['os_family'] == "Suse" and ansible_facts['distribution_major_version'] is version('12', '<')))
- not (item.name | default(item) == "geoip")
or not ((ansible_facts['os_family'] == "FreeBSD")
or (ansible_facts['os_family'] == "RedHat" and ansible_facts['distribution_major_version'] is version('8', '==')))
- not (item.name | default(item) == "geoip2")
or not ((ansible_facts['distribution'] == 'Amazon')
or (ansible_facts['os_family'] == "Suse"))
- not (item.name | default(item) == "opentracing")
or not ((ansible_facts['distribution'] == 'Amazon')
or (ansible_facts['os_family'] == "Suse" and ansible_facts['distribution_major_version'] is version('12', '==')))