2020-03-25 18:43:32 +01:00
|
|
|
---
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Check for build tools
|
2020-03-25 18:43:32 +01:00
|
|
|
block:
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: (CentOS/RHEL 8) Setup Python 3
|
2020-08-28 10:30:23 +02:00
|
|
|
block:
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: (CentOS/RHEL 8) Install Python 3
|
2020-08-28 10:30:23 +02:00
|
|
|
yum:
|
|
|
|
name:
|
|
|
|
- python3
|
|
|
|
- python3-pip
|
|
|
|
- python3-devel
|
2021-06-02 17:47:44 +02:00
|
|
|
update_cache: true
|
2020-08-28 10:30:23 +02:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: (Centos/RHEL 8) Set Python 3 as default
|
2020-08-28 10:30:23 +02:00
|
|
|
alternatives:
|
|
|
|
name: python
|
|
|
|
path: /usr/bin/python3
|
|
|
|
link: /usr/bin/python
|
2020-07-27 13:19:12 +02:00
|
|
|
when:
|
2020-09-15 21:27:06 +02:00
|
|
|
- ansible_facts['os_family'] == "RedHat"
|
|
|
|
- ansible_facts['distribution_major_version'] is version('8', '==')
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: (Centos/RHEL) Install build tools
|
2020-07-27 13:19:12 +02:00
|
|
|
yum:
|
2020-03-25 18:43:32 +01:00
|
|
|
name:
|
|
|
|
- "@Development tools"
|
2020-09-15 21:27:06 +02:00
|
|
|
- ca-certificates
|
2020-03-25 18:43:32 +01:00
|
|
|
- gcc
|
|
|
|
- gd
|
|
|
|
- gd-devel
|
2020-09-15 21:27:06 +02:00
|
|
|
- glibc
|
|
|
|
- glibc-common
|
2020-03-25 18:43:32 +01:00
|
|
|
- perl-core
|
|
|
|
- wget
|
|
|
|
- zlib-devel
|
2021-06-02 17:47:44 +02:00
|
|
|
update_cache: true
|
2020-09-15 21:27:06 +02:00
|
|
|
when: ansible_facts['os_family'] == "RedHat"
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: (Debian) Install backports repo for 'buster'
|
2020-03-25 18:43:32 +01:00
|
|
|
apt_repository:
|
2020-08-28 10:30:23 +02:00
|
|
|
filename: buster-backports
|
2020-03-25 18:43:32 +01:00
|
|
|
repo: deb http://ftp.us.debian.org/debian buster-backports main
|
2021-06-02 17:47:44 +02:00
|
|
|
update_cache: true
|
2020-08-28 10:30:23 +02:00
|
|
|
mode: 0644
|
2020-09-15 21:27:06 +02:00
|
|
|
when: ansible_facts['distribution_release'] == "buster"
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: (Debian/Ubuntu) Install build tools
|
2020-07-27 13:19:12 +02:00
|
|
|
apt:
|
2020-03-25 18:43:32 +01:00
|
|
|
name:
|
|
|
|
- build-essential
|
2020-09-15 21:27:06 +02:00
|
|
|
- checkinstall
|
|
|
|
- libtemplate-perl
|
|
|
|
- python3-minimal
|
2020-03-25 18:43:32 +01:00
|
|
|
- perl
|
|
|
|
- tar
|
|
|
|
- zlib1g-dev
|
2021-06-02 17:47:44 +02:00
|
|
|
update_cache: true
|
2020-09-15 21:27:06 +02:00
|
|
|
when: ansible_facts['os_family'] == "Debian"
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: (Alpine Linux) Install build tools
|
2020-07-27 13:19:12 +02:00
|
|
|
apk:
|
2020-03-25 18:43:32 +01:00
|
|
|
name:
|
|
|
|
- alpine-sdk
|
|
|
|
- build-base
|
|
|
|
- git
|
2020-09-15 21:27:06 +02:00
|
|
|
- openrc
|
2020-03-25 18:43:32 +01:00
|
|
|
- perl
|
2020-09-15 21:27:06 +02:00
|
|
|
- python3
|
2020-03-25 18:43:32 +01:00
|
|
|
- linux-headers
|
|
|
|
- tar
|
2020-09-15 21:27:06 +02:00
|
|
|
- wget
|
2021-06-02 17:47:44 +02:00
|
|
|
update_cache: true
|
2020-09-15 21:27:06 +02:00
|
|
|
when: ansible_facts['os_family'] == "Alpine"
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: (Alpine Linux) Enable OpenRC
|
2020-03-25 18:43:32 +01:00
|
|
|
copy:
|
|
|
|
content: ""
|
|
|
|
dest: /run/openrc/softlevel
|
2021-06-02 17:47:44 +02:00
|
|
|
force: false
|
2020-03-25 18:43:32 +01:00
|
|
|
owner: root
|
|
|
|
mode: 0644
|
2020-09-15 21:27:06 +02:00
|
|
|
when: ansible_facts['os_family'] == "Alpine"
|
2020-08-28 10:30:23 +02:00
|
|
|
when: nginx_install_source_build_tools | bool
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Check for source installs
|
2020-03-25 18:43:32 +01:00
|
|
|
block:
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Check for PCRE install
|
2020-03-25 18:43:32 +01:00
|
|
|
stat:
|
|
|
|
path: /tmp/{{ pcre_version }}
|
|
|
|
register: pcre_result
|
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Check for ZLib install
|
2020-03-25 18:43:32 +01:00
|
|
|
stat:
|
|
|
|
path: /tmp/{{ zlib_version }}
|
|
|
|
register: zlib_result
|
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Check for OpenSSL install
|
2020-03-25 18:43:32 +01:00
|
|
|
stat:
|
|
|
|
path: /tmp/{{ openssl_version }}
|
|
|
|
register: openssl_result
|
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: (CentOS/RHEL) Install PCRE dependency from package
|
2020-07-27 13:19:12 +02:00
|
|
|
yum:
|
2020-03-25 18:43:32 +01:00
|
|
|
name: pcre-devel
|
2021-06-02 17:47:44 +02:00
|
|
|
update_cache: true
|
2020-07-27 13:19:12 +02:00
|
|
|
when:
|
2020-08-28 10:30:23 +02:00
|
|
|
- nginx_install_source_pcre | bool
|
2020-09-15 21:27:06 +02:00
|
|
|
- ansible_facts['os_family'] == "RedHat"
|
2020-07-27 13:19:12 +02:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: (Debian/Ubuntu) Install PCRE dependency from package
|
2020-07-27 13:19:12 +02:00
|
|
|
apt:
|
|
|
|
name: libpcre3-dev
|
2021-06-02 17:47:44 +02:00
|
|
|
update_cache: true
|
2020-07-27 13:19:12 +02:00
|
|
|
when:
|
2020-08-28 10:30:23 +02:00
|
|
|
- nginx_install_source_pcre | bool
|
2020-09-15 21:27:06 +02:00
|
|
|
- ansible_facts['os_family'] == "Debian"
|
2020-07-27 13:19:12 +02:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: (Alpine Linux) Install PCRE dependency from package
|
2020-07-27 13:19:12 +02:00
|
|
|
apk:
|
2020-03-25 18:43:32 +01:00
|
|
|
name: pcre-dev
|
2021-06-02 17:47:44 +02:00
|
|
|
update_cache: true
|
2020-07-27 13:19:12 +02:00
|
|
|
when:
|
2020-08-28 10:30:23 +02:00
|
|
|
- nginx_install_source_pcre | bool
|
2020-09-15 21:27:06 +02:00
|
|
|
- ansible_facts['os_family'] == "Alpine"
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Install PCRE dependence from source
|
2020-03-25 18:43:32 +01:00
|
|
|
block:
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Download PCRE dependency
|
2020-03-25 18:43:32 +01:00
|
|
|
get_url:
|
2020-09-15 21:27:06 +02:00
|
|
|
url: "https://ftp.pcre.org/pub/pcre/{{ pcre_version }}.tar.gz"
|
2020-03-25 18:43:32 +01:00
|
|
|
dest: "/tmp/{{ pcre_version }}.tar.gz"
|
2020-08-28 10:30:23 +02:00
|
|
|
mode: 0600
|
2020-03-25 18:43:32 +01:00
|
|
|
register: pcre_source
|
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Unpack PCRE dependency
|
2020-03-25 18:43:32 +01:00
|
|
|
unarchive:
|
2021-06-02 17:47:44 +02:00
|
|
|
copy: false
|
2020-03-25 18:43:32 +01:00
|
|
|
dest: /tmp/
|
|
|
|
src: "{{ pcre_source.dest }}"
|
2020-08-28 10:30:23 +02:00
|
|
|
mode: 0700
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Configure PCRE dependency
|
|
|
|
command: ./configure
|
2020-03-25 18:43:32 +01:00
|
|
|
args:
|
|
|
|
chdir: "/tmp/{{ pcre_version }}"
|
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Make PCRE dependency
|
2020-03-25 18:43:32 +01:00
|
|
|
make:
|
|
|
|
chdir: "/tmp/{{ pcre_version }}"
|
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Install PCRE dependency
|
2020-03-25 18:43:32 +01:00
|
|
|
make:
|
|
|
|
chdir: "/tmp/{{ pcre_version }}"
|
|
|
|
target: install
|
2020-07-27 13:19:12 +02:00
|
|
|
when:
|
2020-08-28 10:30:23 +02:00
|
|
|
- not pcre_result.stat.exists | bool
|
|
|
|
- not nginx_install_source_pcre | bool
|
2020-10-28 20:12:57 +01:00
|
|
|
- not ansible_check_mode | bool
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: (Centos/RHEL) Install ZLib dependency from package
|
2020-07-27 13:19:12 +02:00
|
|
|
yum:
|
2020-03-25 18:43:32 +01:00
|
|
|
name: zlib-devel
|
2021-06-02 17:47:44 +02:00
|
|
|
update_cache: true
|
2020-07-27 13:19:12 +02:00
|
|
|
when:
|
2020-08-28 10:30:23 +02:00
|
|
|
- nginx_install_source_zlib | bool
|
2020-09-15 21:27:06 +02:00
|
|
|
- ansible_facts['os_family'] == "RedHat"
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: (Debian/Ubuntu) Install ZLib dependency from package
|
2020-07-27 13:19:12 +02:00
|
|
|
apt:
|
2020-03-25 18:43:32 +01:00
|
|
|
name: zlib1g-dev
|
2020-07-27 13:19:12 +02:00
|
|
|
update_cache: true
|
|
|
|
when:
|
2020-08-28 10:30:23 +02:00
|
|
|
- nginx_install_source_zlib | bool
|
2020-09-15 21:27:06 +02:00
|
|
|
- ansible_facts['os_family'] == "Debian"
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: (Alpine Linux) Install ZLib dependency from package
|
2020-07-27 13:19:12 +02:00
|
|
|
apk:
|
2020-03-25 18:43:32 +01:00
|
|
|
name: zlib-dev
|
2021-06-02 17:47:44 +02:00
|
|
|
update_cache: true
|
2020-07-27 13:19:12 +02:00
|
|
|
when:
|
2020-08-28 10:30:23 +02:00
|
|
|
- nginx_install_source_zlib | bool
|
2020-09-15 21:27:06 +02:00
|
|
|
- ansible_facts['os_family'] == "Alpine"
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Install ZLib dependency from source
|
2020-03-25 18:43:32 +01:00
|
|
|
block:
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Download ZLib dependency
|
2020-03-25 18:43:32 +01:00
|
|
|
get_url:
|
2020-09-15 21:27:06 +02:00
|
|
|
url: "https://zlib.net/{{ zlib_version }}.tar.gz"
|
2020-03-25 18:43:32 +01:00
|
|
|
dest: "/tmp/{{ zlib_version }}.tar.gz"
|
2020-08-28 10:30:23 +02:00
|
|
|
mode: 0600
|
2020-03-25 18:43:32 +01:00
|
|
|
register: zlib_source
|
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Unpack ZLib dependency
|
2020-03-25 18:43:32 +01:00
|
|
|
unarchive:
|
2021-06-02 17:47:44 +02:00
|
|
|
copy: false
|
2020-03-25 18:43:32 +01:00
|
|
|
dest: /tmp/
|
|
|
|
src: "{{ zlib_source.dest }}"
|
2020-08-28 10:30:23 +02:00
|
|
|
mode: 0700
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Configure ZLib dependency
|
|
|
|
command: ./configure
|
2020-03-25 18:43:32 +01:00
|
|
|
args:
|
|
|
|
chdir: "/tmp/{{ zlib_version }}"
|
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Make ZLib dependency
|
2020-03-25 18:43:32 +01:00
|
|
|
make:
|
|
|
|
chdir: "/tmp/{{ zlib_version }}"
|
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Install ZLib dependency
|
2020-03-25 18:43:32 +01:00
|
|
|
make:
|
|
|
|
chdir: "/tmp/{{ zlib_version }}"
|
|
|
|
target: install
|
2020-07-27 13:19:12 +02:00
|
|
|
when:
|
2020-08-28 10:30:23 +02:00
|
|
|
- not zlib_result.stat.exists | bool
|
|
|
|
- not nginx_install_source_zlib | bool
|
2020-10-28 20:12:57 +01:00
|
|
|
- not ansible_check_mode | bool
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: (CentOS/RHEL) Install OpenSSL dependency from package
|
2020-07-27 13:19:12 +02:00
|
|
|
yum:
|
2020-03-25 18:43:32 +01:00
|
|
|
name: openssl-devel
|
2021-06-02 17:47:44 +02:00
|
|
|
update_cache: true
|
2020-07-27 13:19:12 +02:00
|
|
|
when:
|
2020-08-28 10:30:23 +02:00
|
|
|
- nginx_install_source_openssl | bool
|
2020-09-15 21:27:06 +02:00
|
|
|
- ansible_facts['os_family'] == "RedHat"
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: (Debian/Ubuntu) Install OpenSSL dependency from package
|
2020-07-27 13:19:12 +02:00
|
|
|
apt:
|
2020-03-25 18:43:32 +01:00
|
|
|
name: libssl-dev
|
2021-06-02 17:47:44 +02:00
|
|
|
update_cache: true
|
2020-07-27 13:19:12 +02:00
|
|
|
when:
|
2020-08-28 10:30:23 +02:00
|
|
|
- nginx_install_source_openssl | bool
|
2020-09-15 21:27:06 +02:00
|
|
|
- ansible_facts['os_family'] == "Debian"
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: (Alpine Linux) Install OpenSSL dependency from package
|
2020-07-27 13:19:12 +02:00
|
|
|
apk:
|
2020-03-25 18:43:32 +01:00
|
|
|
name: openssl-dev
|
2021-06-02 17:47:44 +02:00
|
|
|
update_cache: true
|
2020-07-27 13:19:12 +02:00
|
|
|
when:
|
2020-08-28 10:30:23 +02:00
|
|
|
- nginx_install_source_openssl | bool
|
2020-09-15 21:27:06 +02:00
|
|
|
- ansible_facts['os_family'] == "Alpine"
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Install OpenSSL dependency from source
|
2020-03-25 18:43:32 +01:00
|
|
|
block:
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Download OpenSSL dependency
|
2020-03-25 18:43:32 +01:00
|
|
|
get_url:
|
2020-09-15 21:27:06 +02:00
|
|
|
url: "https://www.openssl.org/source/{{ openssl_version }}.tar.gz"
|
2020-03-25 18:43:32 +01:00
|
|
|
dest: "/tmp/{{ openssl_version }}.tar.gz"
|
2020-08-28 10:30:23 +02:00
|
|
|
mode: 0600
|
2020-03-25 18:43:32 +01:00
|
|
|
register: openssl_source
|
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Unpack OpenSSL dependency
|
2020-03-25 18:43:32 +01:00
|
|
|
unarchive:
|
2021-06-02 17:47:44 +02:00
|
|
|
copy: false
|
2020-03-25 18:43:32 +01:00
|
|
|
dest: /tmp/
|
|
|
|
src: "{{ openssl_source.dest }}"
|
2020-08-28 10:30:23 +02:00
|
|
|
mode: 0700
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Configure OpenSSL dependency
|
|
|
|
command: ./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl shared zlib
|
2020-03-25 18:43:32 +01:00
|
|
|
args:
|
|
|
|
chdir: "/tmp/{{ openssl_version }}"
|
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Make OpenSSL dependency
|
2020-03-25 18:43:32 +01:00
|
|
|
make:
|
|
|
|
chdir: "/tmp/{{ openssl_version }}"
|
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Install OpenSSL dependency
|
2020-03-25 18:43:32 +01:00
|
|
|
make:
|
|
|
|
chdir: "/tmp/{{ openssl_version }}"
|
|
|
|
target: install
|
2020-07-27 13:19:12 +02:00
|
|
|
when:
|
2020-08-28 10:30:23 +02:00
|
|
|
- not openssl_result.stat.exists | bool
|
|
|
|
- not nginx_install_source_openssl | bool
|
2020-10-28 20:12:57 +01:00
|
|
|
- not ansible_check_mode | bool
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Get NGINX version
|
2020-03-25 18:43:32 +01:00
|
|
|
block:
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Fetch NGINX version
|
2020-07-27 13:19:12 +02:00
|
|
|
uri:
|
2021-05-26 17:56:36 +02:00
|
|
|
url: https://version.nginx.com/nginx/{{ nginx_branch }}
|
2021-06-02 17:47:44 +02:00
|
|
|
return_content: true
|
|
|
|
check_mode: false
|
2020-07-27 13:19:12 +02:00
|
|
|
register: nginx_versions
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2021-05-26 17:56:36 +02:00
|
|
|
- name: Set NGINX version
|
2020-03-25 18:43:32 +01:00
|
|
|
set_fact:
|
2021-05-26 17:56:36 +02:00
|
|
|
nginx_version: "{{ 'nginx-' + (nginx_versions.content | regex_search('([0-9]+\\.){2}[0-9]+')) }}"
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Check for NGINX install
|
2020-03-25 18:43:32 +01:00
|
|
|
stat:
|
|
|
|
path: /usr/sbin/nginx
|
2021-06-02 17:47:44 +02:00
|
|
|
follow: true
|
2020-03-25 18:43:32 +01:00
|
|
|
register: nginx_result
|
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Add NGINX user
|
2020-03-25 18:43:32 +01:00
|
|
|
user:
|
|
|
|
name: nginx
|
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Install NGINX
|
2020-03-25 18:43:32 +01:00
|
|
|
block:
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Download NGINX
|
2020-03-25 18:43:32 +01:00
|
|
|
get_url:
|
2021-05-26 17:56:36 +02:00
|
|
|
url: "https://nginx.org/download/{{ nginx_version }}.tar.gz"
|
|
|
|
dest: "/tmp/{{ nginx_version }}.tar.gz"
|
2020-08-28 10:30:23 +02:00
|
|
|
mode: 0600
|
2020-03-25 18:43:32 +01:00
|
|
|
register: nginx_source
|
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Unpack NGINX
|
2020-03-25 18:43:32 +01:00
|
|
|
unarchive:
|
2021-06-02 17:47:44 +02:00
|
|
|
copy: false
|
2020-03-25 18:43:32 +01:00
|
|
|
dest: /tmp/
|
|
|
|
src: "{{ nginx_source.dest }}"
|
2020-08-28 10:30:23 +02:00
|
|
|
mode: 0755
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Configure NGINX
|
2020-03-25 18:43:32 +01:00
|
|
|
command: >-
|
|
|
|
./configure
|
|
|
|
--conf-path=/etc/nginx/nginx.conf
|
|
|
|
--error-log-path=/var/log/nginx/error.log
|
|
|
|
--http-log-path=/var/log/nginx/access.log
|
|
|
|
--lock-path=/var/lock/nginx.lock
|
|
|
|
--modules-path=/usr/lib/nginx/modules
|
2020-09-15 21:27:06 +02:00
|
|
|
--prefix=/usr
|
|
|
|
--pid-path=/var/run/nginx.pid
|
2020-03-25 18:43:32 +01:00
|
|
|
--with-http_ssl_module
|
|
|
|
--with-mail=dynamic
|
2020-09-15 21:27:06 +02:00
|
|
|
--with-stream
|
2020-03-25 18:43:32 +01:00
|
|
|
{{ nginx_install_source_pcre | ternary('', '--with-pcre=../' + pcre_version) }}
|
|
|
|
{{ nginx_install_source_zlib | ternary('', '--with-zlib=../' + zlib_version) }}
|
|
|
|
{{ nginx_install_source_openssl | ternary('', '--with-openssl=../' + openssl_version) }}
|
|
|
|
args:
|
|
|
|
chdir: "/tmp/{{ nginx_version }}"
|
|
|
|
register: nginx_configure
|
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Make NGINX
|
2020-03-25 18:43:32 +01:00
|
|
|
make:
|
|
|
|
chdir: "/tmp/{{ nginx_version }}"
|
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Install NGINX
|
2020-03-25 18:43:32 +01:00
|
|
|
make:
|
|
|
|
chdir: "/tmp/{{ nginx_version }}"
|
|
|
|
target: install
|
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Upload systemd NGINX service file
|
2020-03-25 18:43:32 +01:00
|
|
|
copy:
|
|
|
|
src: services/nginx.systemd
|
|
|
|
dest: /lib/systemd/system/nginx.service
|
|
|
|
owner: root
|
|
|
|
group: root
|
2020-08-28 10:30:23 +02:00
|
|
|
mode: 0644
|
2020-09-15 21:27:06 +02:00
|
|
|
when: ansible_facts['service_mgr'] == "systemd"
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Enable systemd NGINX service file
|
2020-03-25 18:43:32 +01:00
|
|
|
systemd:
|
2021-06-02 17:47:44 +02:00
|
|
|
daemon_reload: true
|
2020-03-25 18:43:32 +01:00
|
|
|
name: nginx
|
|
|
|
state: restarted
|
2021-06-02 17:47:44 +02:00
|
|
|
enabled: true
|
2020-09-15 21:27:06 +02:00
|
|
|
when: ansible_facts['service_mgr'] == "systemd"
|
2020-09-17 17:00:27 +02:00
|
|
|
notify: "(Handler) Run NGINX"
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Upload upstart NGINX service file
|
2020-03-25 18:43:32 +01:00
|
|
|
copy:
|
|
|
|
src: services/nginx.upstart
|
|
|
|
dest: /etc/init.d/nginx
|
|
|
|
owner: root
|
|
|
|
group: root
|
2020-08-28 10:30:23 +02:00
|
|
|
mode: 0755
|
2020-09-15 21:27:06 +02:00
|
|
|
when: ansible_facts['service_mgr'] == "upstart"
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Upload Upstart NGINX service conf file
|
2020-03-25 18:43:32 +01:00
|
|
|
copy:
|
|
|
|
src: services/nginx.conf.upstart
|
|
|
|
dest: /etc/init/nginx.conf
|
|
|
|
owner: root
|
|
|
|
group: root
|
2020-08-28 10:30:23 +02:00
|
|
|
mode: 0644
|
2020-09-15 21:27:06 +02:00
|
|
|
when: ansible_facts['service_mgr'] == "upstart"
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Enable Upstart NGINX service reload
|
|
|
|
command: initctl reload-configuration
|
2020-09-15 21:27:06 +02:00
|
|
|
when: ansible_facts['service_mgr'] == "upstart"
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Start Upstart NGINX service reload
|
|
|
|
command: nginx
|
2020-09-15 21:27:06 +02:00
|
|
|
when: ansible_facts['service_mgr'] == "upstart"
|
2020-09-17 17:00:27 +02:00
|
|
|
notify: "(Handler) Run NGINX"
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Upload SysVinit NGINX service file
|
2020-03-25 18:43:32 +01:00
|
|
|
copy:
|
|
|
|
src: services/nginx.sysvinit
|
|
|
|
dest: /etc/init.d/nginx
|
|
|
|
owner: root
|
|
|
|
group: root
|
2020-08-28 10:30:23 +02:00
|
|
|
mode: 0755
|
2020-09-15 21:27:06 +02:00
|
|
|
when: ansible_facts['service_mgr'] == "sysvinit"
|
2020-09-17 17:00:27 +02:00
|
|
|
notify: "(Handler) Run NGINX"
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Upload OpenRC NGINX service file
|
2020-03-25 18:43:32 +01:00
|
|
|
copy:
|
|
|
|
src: services/nginx.openrc
|
|
|
|
dest: /etc/init.d/nginx
|
|
|
|
owner: root
|
|
|
|
group: root
|
2020-08-28 10:30:23 +02:00
|
|
|
mode: 0755
|
2020-09-15 21:27:06 +02:00
|
|
|
when: ansible_facts['service_mgr'] == "openrc"
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Enable OpenRC NGINX service
|
2020-03-25 18:43:32 +01:00
|
|
|
command: rc-update add nginx default
|
2020-09-15 21:27:06 +02:00
|
|
|
when: ansible_facts['service_mgr'] == "openrc"
|
2020-09-19 17:32:17 +02:00
|
|
|
notify: (Handler) Run NGINX
|
2020-10-28 20:12:57 +01:00
|
|
|
when:
|
|
|
|
- not nginx_result.stat.exists | bool
|
|
|
|
- not ansible_check_mode | bool
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Cleanup downloads
|
2020-03-25 18:43:32 +01:00
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: absent
|
|
|
|
loop:
|
|
|
|
- "{{ pcre_source.dest }}"
|
|
|
|
- "{{ zlib_source.dest }}"
|
|
|
|
- "{{ openssl_source.dest }}"
|
|
|
|
- "{{ nginx_source.dest }}"
|
|
|
|
when: item is defined
|