2020-03-25 18:43:32 +01:00
|
|
|
---
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) Check For Build Tools"
|
2020-03-25 18:43:32 +01:00
|
|
|
block:
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Centos/RHEL) Install Python"
|
|
|
|
yum:
|
2020-03-25 18:43:32 +01:00
|
|
|
name:
|
|
|
|
- python3
|
|
|
|
- python3-pip
|
|
|
|
- python3-devel
|
2020-07-27 13:19:12 +02:00
|
|
|
update_cache: true
|
2020-03-25 18:43:32 +01:00
|
|
|
when: ansible_os_family == "RedHat"
|
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Centos/RHEL) Set Python3 Default"
|
2020-03-25 18:43:32 +01:00
|
|
|
alternatives:
|
|
|
|
name: python
|
|
|
|
path: /usr/bin/python3
|
|
|
|
link: /usr/bin/python
|
2020-07-27 13:19:12 +02:00
|
|
|
when:
|
|
|
|
- ansible_os_family == "RedHat"
|
|
|
|
- ansible_distribution_major_version == "8"
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Centos/RHEL) Install Build Tools"
|
|
|
|
yum:
|
2020-03-25 18:43:32 +01:00
|
|
|
name:
|
|
|
|
- "@Development tools"
|
|
|
|
- gcc
|
|
|
|
- glibc
|
|
|
|
- glibc-common
|
|
|
|
- gd
|
|
|
|
- gd-devel
|
|
|
|
- perl-core
|
|
|
|
- wget
|
|
|
|
- ca-certificates
|
|
|
|
- zlib-devel
|
2020-07-27 13:19:12 +02:00
|
|
|
update_cache: true
|
2020-03-25 18:43:32 +01:00
|
|
|
when: ansible_os_family == "RedHat"
|
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Debian) Install Backports Repo For Buster"
|
2020-03-25 18:43:32 +01:00
|
|
|
apt_repository:
|
|
|
|
repo: deb http://ftp.us.debian.org/debian buster-backports main
|
|
|
|
when: ansible_distribution_release == "buster"
|
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Debian/Ubuntu) Install Build Tools"
|
|
|
|
apt:
|
2020-03-25 18:43:32 +01:00
|
|
|
name:
|
2020-06-08 15:46:01 +02:00
|
|
|
- python3-minimal
|
2020-03-25 18:43:32 +01:00
|
|
|
- build-essential
|
|
|
|
- perl
|
|
|
|
- tar
|
|
|
|
- checkinstall
|
|
|
|
- zlib1g-dev
|
|
|
|
- libtemplate-perl
|
2020-07-27 13:19:12 +02:00
|
|
|
update_cache: true
|
2020-03-25 18:43:32 +01:00
|
|
|
when: ansible_os_family == "Debian"
|
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Alpine) Install Build Tools"
|
|
|
|
apk:
|
2020-03-25 18:43:32 +01:00
|
|
|
name:
|
|
|
|
- python
|
|
|
|
- alpine-sdk
|
|
|
|
- build-base
|
|
|
|
- git
|
|
|
|
- wget
|
|
|
|
- perl
|
|
|
|
- linux-headers
|
|
|
|
- tar
|
|
|
|
- openrc
|
2020-07-27 13:19:12 +02:00
|
|
|
update_cache: true
|
2020-03-25 18:43:32 +01:00
|
|
|
when: ansible_os_family == "Alpine"
|
|
|
|
|
2020-07-28 12:26:38 +02:00
|
|
|
- name: "(Install: Alpine) Enable OpenRC"
|
2020-03-25 18:43:32 +01:00
|
|
|
copy:
|
|
|
|
content: ""
|
|
|
|
dest: /run/openrc/softlevel
|
|
|
|
force: no
|
|
|
|
owner: root
|
|
|
|
mode: 0644
|
|
|
|
when: ansible_os_family == "Alpine"
|
2020-07-27 13:19:12 +02:00
|
|
|
when: nginx_install_source_build_tools
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) Check For Source Installs"
|
2020-03-25 18:43:32 +01:00
|
|
|
block:
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) Check For PCRE Install"
|
2020-03-25 18:43:32 +01:00
|
|
|
stat:
|
|
|
|
path: /tmp/{{ pcre_version }}
|
|
|
|
register: pcre_result
|
|
|
|
|
2020-07-28 12:26:38 +02:00
|
|
|
- name: "(Install: Linux) Check For ZLib Install"
|
2020-03-25 18:43:32 +01:00
|
|
|
stat:
|
|
|
|
path: /tmp/{{ zlib_version }}
|
|
|
|
register: zlib_result
|
|
|
|
|
2020-07-28 12:26:38 +02:00
|
|
|
- name: "(Install: Linux) Check For OpenSSL Install"
|
2020-03-25 18:43:32 +01:00
|
|
|
stat:
|
|
|
|
path: /tmp/{{ openssl_version }}
|
|
|
|
register: openssl_result
|
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Centos/RHEL) Install PCRE Dependency From Package"
|
|
|
|
yum:
|
2020-03-25 18:43:32 +01:00
|
|
|
name: pcre-devel
|
2020-07-27 13:19:12 +02:00
|
|
|
update_cache: true
|
|
|
|
when:
|
|
|
|
- nginx_install_source_pcre
|
|
|
|
- ansible_os_family == "RedHat"
|
|
|
|
|
|
|
|
- name: "(Install: Debian/Ubuntu) Install PCRE Dependency From Package"
|
|
|
|
apt:
|
|
|
|
name: libpcre3-dev
|
|
|
|
update_cache: true
|
|
|
|
when:
|
|
|
|
- nginx_install_source_pcre
|
|
|
|
- ansible_os_family == "Debian"
|
|
|
|
|
|
|
|
- name: "(Install: Alpine) Install PCRE Dependency From Package"
|
|
|
|
apk:
|
2020-03-25 18:43:32 +01:00
|
|
|
name: pcre-dev
|
2020-07-27 13:19:12 +02:00
|
|
|
update_cache: true
|
|
|
|
when:
|
|
|
|
- nginx_install_source_pcre
|
|
|
|
- ansible_os_family == "Alpine"
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) Install PCRE Dependence From Source"
|
2020-03-25 18:43:32 +01:00
|
|
|
block:
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) Download PCRE Dependency"
|
2020-03-25 18:43:32 +01:00
|
|
|
get_url:
|
|
|
|
url: "http://ftp.pcre.org/pub/pcre/{{ pcre_version }}.tar.gz"
|
|
|
|
dest: "/tmp/{{ pcre_version }}.tar.gz"
|
|
|
|
register: pcre_source
|
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) Unpack PCRE Dependency"
|
2020-03-25 18:43:32 +01:00
|
|
|
unarchive:
|
|
|
|
copy: no
|
|
|
|
dest: /tmp/
|
|
|
|
src: "{{ pcre_source.dest }}"
|
|
|
|
register: pcre_source_unpack
|
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) Configure PCRE Dependency"
|
2020-03-25 18:43:32 +01:00
|
|
|
command: "./configure"
|
|
|
|
args:
|
|
|
|
chdir: "/tmp/{{ pcre_version }}"
|
|
|
|
register: pcre_configure
|
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) Make PCRE Dependency"
|
2020-03-25 18:43:32 +01:00
|
|
|
make:
|
|
|
|
chdir: "/tmp/{{ pcre_version }}"
|
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) 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:
|
|
|
|
- not pcre_result.stat.exists
|
|
|
|
- not nginx_install_source_pcre
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-07-28 12:26:38 +02:00
|
|
|
- name: "(Install: 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
|
2020-07-27 13:19:12 +02:00
|
|
|
update_cache: true
|
|
|
|
when:
|
|
|
|
- nginx_install_source_zlib
|
|
|
|
- ansible_os_family == "RedHat"
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-07-28 12:26:38 +02:00
|
|
|
- name: "(Install: 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:
|
|
|
|
- nginx_install_source_zlib
|
|
|
|
- ansible_os_family == "Debian"
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-07-28 12:26:38 +02:00
|
|
|
- name: "(Install: Alpine) 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
|
2020-07-27 13:19:12 +02:00
|
|
|
update_cache: true
|
|
|
|
when:
|
|
|
|
- nginx_install_source_zlib
|
|
|
|
- ansible_os_family == "Alpine"
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-07-28 12:26:38 +02:00
|
|
|
- name: "(Install: Linux) Install ZLib Dependency From Source"
|
2020-03-25 18:43:32 +01:00
|
|
|
block:
|
2020-07-28 12:26:38 +02:00
|
|
|
- name: "(Install: Linux) Download ZLib Dependency"
|
2020-03-25 18:43:32 +01:00
|
|
|
get_url:
|
|
|
|
url: "http://zlib.net/{{ zlib_version }}.tar.gz"
|
|
|
|
dest: "/tmp/{{ zlib_version }}.tar.gz"
|
|
|
|
register: zlib_source
|
|
|
|
|
2020-07-28 12:26:38 +02:00
|
|
|
- name: "(Install: Linux) Unpack ZLib Dependency"
|
2020-03-25 18:43:32 +01:00
|
|
|
unarchive:
|
|
|
|
copy: no
|
|
|
|
dest: /tmp/
|
|
|
|
src: "{{ zlib_source.dest }}"
|
|
|
|
register: zlib_source_unpack
|
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) Configure zlib Dependency"
|
2020-03-25 18:43:32 +01:00
|
|
|
command: "./configure"
|
|
|
|
args:
|
|
|
|
chdir: "/tmp/{{ zlib_version }}"
|
|
|
|
register: zlib_configure
|
|
|
|
|
2020-07-28 12:26:38 +02:00
|
|
|
- name: "(Install: Linux) Make ZLib Dependency"
|
2020-03-25 18:43:32 +01:00
|
|
|
make:
|
|
|
|
chdir: "/tmp/{{ zlib_version }}"
|
|
|
|
|
2020-07-28 12:26:38 +02:00
|
|
|
- name: "(Install: Linux) 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:
|
|
|
|
- not zlib_result.stat.exists
|
|
|
|
- not nginx_install_source_zlib
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Centos/RHEL) Install OpenSSL Dependency From Package"
|
|
|
|
yum:
|
2020-03-25 18:43:32 +01:00
|
|
|
name: openssl-devel
|
2020-07-27 13:19:12 +02:00
|
|
|
update_cache: true
|
|
|
|
when:
|
|
|
|
- nginx_install_source_openssl
|
|
|
|
- ansible_os_family == "RedHat"
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Debian/Ubuntu) Install OpenSSL Dependency From Package"
|
|
|
|
apt:
|
2020-03-25 18:43:32 +01:00
|
|
|
name: libssl-dev
|
2020-07-27 13:19:12 +02:00
|
|
|
update_cache: true
|
|
|
|
when:
|
|
|
|
- nginx_install_source_openssl
|
|
|
|
- ansible_os_family == "Debian"
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Alpine) Install OpenSSL Dependency From Package"
|
|
|
|
apk:
|
2020-03-25 18:43:32 +01:00
|
|
|
name: openssl-dev
|
2020-07-27 13:19:12 +02:00
|
|
|
update_cache: true
|
|
|
|
when:
|
|
|
|
- nginx_install_source_openssl
|
|
|
|
- ansible_os_family == "Alpine"
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) Install OpenSSL Dependency From Source"
|
2020-03-25 18:43:32 +01:00
|
|
|
block:
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) Download OpenSSL Dependency"
|
2020-03-25 18:43:32 +01:00
|
|
|
get_url:
|
|
|
|
url: "http://www.openssl.org/source/{{ openssl_version }}.tar.gz"
|
|
|
|
dest: "/tmp/{{ openssl_version }}.tar.gz"
|
|
|
|
register: openssl_source
|
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) Unpack OpenSSL Dependency"
|
2020-03-25 18:43:32 +01:00
|
|
|
unarchive:
|
|
|
|
copy: no
|
|
|
|
dest: /tmp/
|
|
|
|
src: "{{ openssl_source.dest }}"
|
|
|
|
register: openssl_source_unpack
|
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) Configure OpenSSL Dependency"
|
2020-03-25 18:43:32 +01:00
|
|
|
command: "./config --prefix=/usr"
|
|
|
|
args:
|
|
|
|
chdir: "/tmp/{{ openssl_version }}"
|
|
|
|
register: openssl_configure
|
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) Make OpenSSL Dependency"
|
2020-03-25 18:43:32 +01:00
|
|
|
make:
|
|
|
|
chdir: "/tmp/{{ openssl_version }}"
|
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) 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:
|
|
|
|
- not openssl_result.stat.exists
|
|
|
|
- not nginx_install_source_openssl
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) Get NGINX Version"
|
2020-03-25 18:43:32 +01:00
|
|
|
block:
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) Fetch NGINX Version"
|
|
|
|
uri:
|
|
|
|
url: https://trac.nginx.org/nginx/browser
|
|
|
|
return_content: true
|
|
|
|
register: nginx_versions
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) Set NGINX Mainline Version"
|
2020-03-25 18:43:32 +01:00
|
|
|
set_fact:
|
2020-07-27 13:19:12 +02:00
|
|
|
nginx_version: "{{ nginx_versions.content | regex_search('release[^<]*') | regex_replace('release', 'nginx') }}"
|
2020-03-25 18:43:32 +01:00
|
|
|
when: nginx_branch == "mainline"
|
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) Set NGINX Stable Version 1/2"
|
|
|
|
set_fact:
|
|
|
|
nginx_version: "{{ nginx_versions.content | regex_search('stable[^<]*') | regex_replace('stable', 'release') }}"
|
2020-03-25 18:43:32 +01:00
|
|
|
when: nginx_branch == "stable"
|
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) Set NGINX Stable Version 2/2"
|
2020-03-25 18:43:32 +01:00
|
|
|
set_fact:
|
2020-07-27 13:19:12 +02:00
|
|
|
nginx_version: "{{ nginx_versions.content | regex_search(nginx_version + '[^<]*') | regex_replace('release', 'nginx') }}"
|
2020-03-25 18:43:32 +01:00
|
|
|
when: nginx_branch == "stable"
|
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) Set NGINX Download Filename"
|
2020-03-25 18:43:32 +01:00
|
|
|
set_fact:
|
|
|
|
nginx_download_name: "{{ nginx_version }}"
|
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) Check For NGINX Install"
|
2020-03-25 18:43:32 +01:00
|
|
|
stat:
|
|
|
|
path: /usr/sbin/nginx
|
|
|
|
follow: true
|
|
|
|
register: nginx_result
|
|
|
|
|
|
|
|
- name: "(Install: Linux) Add NGINX User"
|
|
|
|
user:
|
|
|
|
name: nginx
|
|
|
|
|
|
|
|
- name: "(Install: Linux) Install NGINX"
|
|
|
|
block:
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) Download NGINX"
|
2020-03-25 18:43:32 +01:00
|
|
|
get_url:
|
|
|
|
url: "http://nginx.org/download/{{ nginx_download_name }}.tar.gz"
|
|
|
|
dest: "/tmp/{{ nginx_download_name }}.tar.gz"
|
|
|
|
register: nginx_source
|
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) Unpack NGINX"
|
2020-03-25 18:43:32 +01:00
|
|
|
unarchive:
|
|
|
|
copy: no
|
|
|
|
dest: /tmp/
|
|
|
|
src: "{{ nginx_source.dest }}"
|
|
|
|
register: nginx_source_unpack
|
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) Configure NGINX"
|
2020-03-25 18:43:32 +01:00
|
|
|
command: >-
|
|
|
|
./configure
|
|
|
|
--prefix=/usr
|
|
|
|
--pid-path=/var/run/nginx.pid
|
|
|
|
--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
|
|
|
|
--with-http_ssl_module
|
|
|
|
--with-stream
|
|
|
|
--with-mail=dynamic
|
|
|
|
{{ 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-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) Make NGINX"
|
2020-03-25 18:43:32 +01:00
|
|
|
make:
|
|
|
|
chdir: "/tmp/{{ nginx_version }}"
|
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) Install NGINX"
|
2020-03-25 18:43:32 +01:00
|
|
|
make:
|
|
|
|
chdir: "/tmp/{{ nginx_version }}"
|
|
|
|
target: install
|
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) 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
|
|
|
|
mode: '0644'
|
|
|
|
when: ansible_service_mgr == "systemd"
|
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) Enable systemd NGINX Service File"
|
2020-03-25 18:43:32 +01:00
|
|
|
systemd:
|
|
|
|
daemon_reload: yes
|
|
|
|
name: nginx
|
|
|
|
state: restarted
|
|
|
|
enabled: yes
|
|
|
|
notify: "(Handler: All OSs) Start NGINX"
|
|
|
|
when: ansible_service_mgr == "systemd"
|
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) 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
|
|
|
|
mode: '0755'
|
|
|
|
when: ansible_service_mgr == "upstart"
|
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) 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
|
|
|
|
mode: '0644'
|
|
|
|
when: ansible_service_mgr == "upstart"
|
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) Enable upstart NGINX Service Reload"
|
2020-03-25 18:43:32 +01:00
|
|
|
command: "initctl reload-configuration"
|
|
|
|
when: ansible_service_mgr == "upstart"
|
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) Start upstart NGINX Service Reload"
|
2020-03-25 18:43:32 +01:00
|
|
|
command: "nginx"
|
|
|
|
notify: "(Handler: All OSs) Start NGINX"
|
|
|
|
when: ansible_service_mgr == "upstart"
|
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) 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
|
|
|
|
mode: '0755'
|
|
|
|
notify: "(Handler: All OSs) Start NGINX"
|
|
|
|
when: ansible_service_mgr == "sysvinit"
|
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) 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
|
|
|
|
mode: '0755'
|
|
|
|
when: ansible_service_mgr == "openrc"
|
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) Enable openrc NGINX Service"
|
2020-03-25 18:43:32 +01:00
|
|
|
command: rc-update add nginx default
|
|
|
|
notify: "(Handler: All OSs) Start NGINX"
|
|
|
|
when: ansible_service_mgr == "openrc"
|
2020-07-27 13:19:12 +02:00
|
|
|
when: not nginx_result.stat.exists
|
2020-03-25 18:43:32 +01:00
|
|
|
|
2020-07-27 13:19:12 +02:00
|
|
|
- name: "(Install: Linux) 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
|