Skip to content

Commit 28d1da5

Browse files
authored
Add proper support for building NGINX from source in CentOS 6 (#320)
1 parent 17b5c87 commit 28d1da5

File tree

10 files changed

+56
-10
lines changed

10 files changed

+56
-10
lines changed

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
---
22
language: python
33
services: docker
4+
branches:
5+
only:
6+
- main
47
jobs:
58
include:
69
- name: "(Debian/Ubuntu) Install Specific Version"
@@ -70,5 +73,6 @@ install:
7073
- pip install docker==4.3.1
7174
script:
7275
- travis_wait 50 molecule test -s $scenario
76+
7377
notifications:
7478
webhooks: https://galaxy.ansible.com/api/v1/notifications/

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ ENHANCEMENTS:
3030
BUG FIXES:
3131

3232
* NGINX Plus repository data for RHEL based distros is now appropriately set.
33+
* Building NGINX from source should now work as expected in CentOS/RHEL 6 systems running Python `2.6` or earlier versions of `2.7`.
3334

3435
## 0.16.0 (August 28, 2020)
3536

molecule/default_centos/molecule.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ platforms:
99
- name: centos-6
1010
image: centos:6
1111
dockerfile: ../common/Dockerfile.j2
12+
privileged: true
13+
volumes:
14+
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
15+
command: "/sbin/init"
1216
- name: centos-7
1317
image: centos:7
1418
dockerfile: ../common/Dockerfile.j2

molecule/module_centos/molecule.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ platforms:
99
- name: centos-6
1010
image: centos:6
1111
dockerfile: ../common/Dockerfile.j2
12+
privileged: true
13+
volumes:
14+
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
15+
command: "/sbin/init"
1216
- name: centos-7
1317
image: centos:7
1418
dockerfile: ../common/Dockerfile.j2

molecule/plus_centos/molecule.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ platforms:
99
- name: centos-6
1010
image: centos:6
1111
dockerfile: ../common/Dockerfile.j2
12+
privileged: true
13+
volumes:
14+
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
15+
command: "/sbin/init"
1216
- name: centos-7
1317
image: centos:7
1418
dockerfile: ../common/Dockerfile.j2

molecule/source_centos/molecule.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ lint: |
66
yamllint .
77
ansible-lint --force-color
88
platforms:
9+
- name: centos-6
10+
image: centos:6
11+
dockerfile: ../common/Dockerfile.j2
12+
privileged: true
13+
volumes:
14+
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
15+
command: "/sbin/init"
916
- name: centos-7
1017
image: centos:7
1118
dockerfile: ../common/Dockerfile.j2

molecule/stable_push_centos/molecule.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ platforms:
99
- name: centos-6
1010
image: centos:6
1111
dockerfile: ../common/Dockerfile.j2
12+
privileged: true
13+
volumes:
14+
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
15+
command: "/sbin/init"
1216
- name: centos-7
1317
image: centos:7
1418
dockerfile: ../common/Dockerfile.j2

molecule/template_centos/molecule.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ platforms:
99
- name: centos-6
1010
image: centos:6
1111
dockerfile: ../common/Dockerfile.j2
12+
privileged: true
13+
volumes:
14+
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
15+
command: "/sbin/init"
1216
- name: centos-7
1317
image: centos:7
1418
dockerfile: ../common/Dockerfile.j2

molecule/unit_centos/molecule.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ platforms:
99
- name: centos-6
1010
image: centos:6
1111
dockerfile: ../common/Dockerfile.j2
12+
privileged: true
13+
volumes:
14+
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
15+
command: "/sbin/init"
1216
- name: centos-7
1317
image: centos:7
1418
dockerfile: ../common/Dockerfile.j2

tasks/opensource/install-source.yml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
---
22
- name: "Check for build tools"
33
block:
4-
- name: "(CentOS/RHEL 8) Setup python 3"
4+
- name: "(CentOS/RHEL 8) Setup Python 3"
55
block:
6-
- name: "(CentOS/RHEL 8) Install python 3"
6+
- name: "(CentOS/RHEL 8) Install Python 3"
77
yum:
88
name:
99
- python3
1010
- python3-pip
1111
- python3-devel
1212
update_cache: yes
1313

14-
- name: "(Centos/RHEL 8) Set python 3 as default"
14+
- name: "(Centos/RHEL 8) Set Python 3 as default"
1515
alternatives:
1616
name: python
1717
path: /usr/bin/python3
@@ -36,7 +36,7 @@
3636
update_cache: yes
3737
when: ansible_facts['os_family'] == "RedHat"
3838

39-
- name: "(Debian) Install backports repo for buster"
39+
- name: "(Debian) Install backports repo for 'buster'"
4040
apt_repository:
4141
filename: buster-backports
4242
repo: deb http://ftp.us.debian.org/debian buster-backports main
@@ -130,6 +130,8 @@
130130
url: "https://ftp.pcre.org/pub/pcre/{{ pcre_version }}.tar.gz"
131131
dest: "/tmp/{{ pcre_version }}.tar.gz"
132132
mode: 0600
133+
validate_certs: >-
134+
{{ (ansible_facts['os_family'] == 'RedHat' and ansible_facts['distribution_major_version'] is version('6', '==')) | ternary('no', 'yes') }}
133135
register: pcre_source
134136

135137
- name: "Unpack PCRE dependency"
@@ -187,6 +189,8 @@
187189
url: "https://zlib.net/{{ zlib_version }}.tar.gz"
188190
dest: "/tmp/{{ zlib_version }}.tar.gz"
189191
mode: 0600
192+
validate_certs: >-
193+
{{ (ansible_facts['os_family'] == 'RedHat' and ansible_facts['distribution_major_version'] is version('6', '==')) | ternary('no', 'yes') }}
190194
register: zlib_source
191195

192196
- name: "Unpack ZLib dependency"
@@ -244,6 +248,8 @@
244248
url: "https://www.openssl.org/source/{{ openssl_version }}.tar.gz"
245249
dest: "/tmp/{{ openssl_version }}.tar.gz"
246250
mode: 0600
251+
validate_certs: >-
252+
{{ (ansible_facts['os_family'] == 'RedHat' and ansible_facts['distribution_major_version'] is version('6', '==')) | ternary('no', 'yes') }}
247253
register: openssl_source
248254

249255
- name: "Unpack OpenSSL dependency"
@@ -276,6 +282,8 @@
276282
uri:
277283
url: https://trac.nginx.org/nginx/browser
278284
return_content: yes
285+
validate_certs: >-
286+
{{ (ansible_facts['os_family'] == 'RedHat' and ansible_facts['distribution_major_version'] is version('6', '==')) | ternary('no', 'yes') }}
279287
register: nginx_versions
280288

281289
- name: "Set NGINX mainline version"
@@ -314,6 +322,8 @@
314322
url: "https://nginx.org/download/{{ nginx_download_name }}.tar.gz"
315323
dest: "/tmp/{{ nginx_download_name }}.tar.gz"
316324
mode: 0600
325+
validate_certs: >-
326+
{{ (ansible_facts['os_family'] == 'RedHat' and ansible_facts['distribution_major_version'] is version('6', '==')) | ternary('no', 'yes') }}
317327
register: nginx_source
318328

319329
- name: "Unpack NGINX"
@@ -379,7 +389,7 @@
379389
mode: 0755
380390
when: ansible_facts['service_mgr'] == "upstart"
381391

382-
- name: "Upload upstart NGINX service conf file"
392+
- name: "Upload Upstart NGINX service conf file"
383393
copy:
384394
src: services/nginx.conf.upstart
385395
dest: /etc/init/nginx.conf
@@ -388,16 +398,16 @@
388398
mode: 0644
389399
when: ansible_facts['service_mgr'] == "upstart"
390400

391-
- name: "Enable upstart NGINX service reload"
401+
- name: "Enable Upstart NGINX service reload"
392402
command: "initctl reload-configuration"
393403
when: ansible_facts['service_mgr'] == "upstart"
394404

395-
- name: "Start upstart NGINX service reload"
405+
- name: "Start Upstart NGINX service reload"
396406
command: "nginx"
397407
when: ansible_facts['service_mgr'] == "upstart"
398408
notify: "(Handler) Start NGINX"
399409

400-
- name: "Upload sysvinit NGINX service file"
410+
- name: "Upload SysVinit NGINX service file"
401411
copy:
402412
src: services/nginx.sysvinit
403413
dest: /etc/init.d/nginx
@@ -407,7 +417,7 @@
407417
when: ansible_facts['service_mgr'] == "sysvinit"
408418
notify: "(Handler) Start NGINX"
409419

410-
- name: "Upload openrc NGINX service file"
420+
- name: "Upload OpenRC NGINX service file"
411421
copy:
412422
src: services/nginx.openrc
413423
dest: /etc/init.d/nginx
@@ -416,7 +426,7 @@
416426
mode: 0755
417427
when: ansible_facts['service_mgr'] == "openrc"
418428

419-
- name: "Enable openrc NGINX service"
429+
- name: "Enable OpenRC NGINX service"
420430
command: rc-update add nginx default
421431
when: ansible_facts['service_mgr'] == "openrc"
422432
notify: "(Handler) Start NGINX"

0 commit comments

Comments
 (0)