File tree Expand file tree Collapse file tree 17 files changed +178
-84
lines changed Expand file tree Collapse file tree 17 files changed +178
-84
lines changed Original file line number Diff line number Diff line change @@ -5,8 +5,9 @@ services:
5
5
- docker
6
6
env :
7
7
- scenario : default
8
+ - scenario : module
8
9
- scenario : stable_push
9
- - scenario : template_module
10
+ - scenario : template
10
11
- scenario : unit
11
12
before_install :
12
13
- sudo apt-get -qq update
Original file line number Diff line number Diff line change
1
+ # Molecule managed
2
+
3
+ {% if item .registry is defined %}
4
+ FROM {{ item.registry.url }}/{{ item.image }}
5
+ {% else %}
6
+ FROM {{ item.image }}
7
+ {% endif %}
8
+
9
+ {% if item .env is defined %}
10
+ {% for var , value in item .env .items () %}
11
+ {% if value %}
12
+ ENV {{ var }} {{ value }}
13
+ {% endif %}
14
+ {% endfor %}
15
+ {% endif %}
16
+
17
+ RUN \
18
+ if [ $(command -v apt-get) ]; then \
19
+ apt-get update \
20
+ && apt-get install -y python sudo bash ca-certificates iproute2 curl \
21
+ && apt-get clean; \
22
+ elif [ $(command -v dnf) ]; then \
23
+ dnf makecache \
24
+ && dnf --assumeyes install python sudo python-devel python*-dnf bash iproute \
25
+ && dnf clean all; \
26
+ elif [ $(command -v yum) ]; then \
27
+ yum makecache fast \
28
+ && yum install -y python sudo yum-plugin-ovl bash iproute \
29
+ && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf \
30
+ && yum clean all; \
31
+ elif [ $(command -v zypper) ]; then \
32
+ zypper refresh \
33
+ && zypper install -y python sudo bash python-xml iproute2 \
34
+ && zypper clean -a; \
35
+ elif [ $(command -v apk) ]; then \
36
+ apk update \
37
+ && apk add --no-cache python sudo bash ca-certificates; \
38
+ elif [ $(command -v xbps-install) ]; then \
39
+ xbps-install -Syu \
40
+ && xbps-install -y python sudo bash ca-certificates iproute2 \
41
+ && xbps-remove -O; \
42
+ fi
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 6
6
platforms :
7
7
- name : centos-6
8
8
image : centos:6
9
+ dockerfile : ../common/Dockerfile.j2
9
10
- name : centos-7
10
- image : centos/systemd
11
+ image : centos:7
12
+ dockerfile : ../common/Dockerfile.j2
11
13
privileged : True
12
- volume_mounts :
14
+ volumes :
13
15
- " /sys/fs/cgroup:/sys/fs/cgroup:rw"
14
16
command : " /usr/sbin/init"
17
+ tty : True
15
18
- name : debian-stretch
16
- image : debian:stretch
19
+ image : debian:stretch-slim
20
+ dockerfile : ../common/Dockerfile.j2
17
21
- name : debian-buster
18
- image : debian:buster
22
+ image : debian:buster-slim
23
+ dockerfile : ../common/Dockerfile.j2
19
24
- name : ubuntu-xenial
20
25
image : ubuntu:xenial
26
+ dockerfile : ../common/Dockerfile.j2
21
27
- name : ubuntu-bionic
22
28
image : ubuntu:bionic
29
+ dockerfile : ../common/Dockerfile.j2
23
30
provisioner :
24
31
name : ansible
25
32
lint :
Original file line number Diff line number Diff line change 4
4
pre_tasks :
5
5
- name : " Set repo if Debian"
6
6
set_fact :
7
- version : " =1.17.4 -1~{{ ansible_distribution_release }}"
7
+ version : " =1.17.6 -1~{{ ansible_distribution_release }}"
8
8
when : ansible_os_family == "Debian"
9
9
- name : " Set repo if RedHat"
10
10
set_fact :
11
- version : " -1.17.4 -1.el{{ ansible_distribution_major_version }}.ngx"
11
+ version : " -1.17.6 -1.el{{ ansible_distribution_major_version }}.ngx"
12
12
when : ansible_os_family == "RedHat"
13
13
roles :
14
14
- role : ansible-role-nginx
Original file line number Diff line number Diff line change
1
+ ---
2
+ driver :
3
+ name : docker
4
+ lint :
5
+ name : yamllint
6
+ platforms :
7
+ - name : centos-6
8
+ image : centos:6
9
+ dockerfile : ../common/Dockerfile.j2
10
+ - name : centos-7
11
+ image : centos:7
12
+ dockerfile : ../common/Dockerfile.j2
13
+ privileged : True
14
+ volumes :
15
+ - " /sys/fs/cgroup:/sys/fs/cgroup:rw"
16
+ command : " /usr/sbin/init"
17
+ tty : True
18
+ - name : debian-stretch
19
+ image : debian:stretch-slim
20
+ dockerfile : ../common/Dockerfile.j2
21
+ - name : debian-buster
22
+ image : debian:buster-slim
23
+ dockerfile : ../common/Dockerfile.j2
24
+ - name : ubuntu-xenial
25
+ image : ubuntu:xenial
26
+ dockerfile : ../common/Dockerfile.j2
27
+ - name : ubuntu-bionic
28
+ image : ubuntu:bionic
29
+ dockerfile : ../common/Dockerfile.j2
30
+ provisioner :
31
+ name : ansible
32
+ lint :
33
+ name : ansible-lint
34
+ verifier :
35
+ name : testinfra
36
+ lint :
37
+ name : flake8
Original file line number Diff line number Diff line change
1
+ ---
2
+ - name : Converge
3
+ hosts : all
4
+ roles :
5
+ - role : ansible-role-nginx
6
+ vars :
7
+ nginx_debug_output : true
8
+
9
+ nginx_modules :
10
+ njs : true
11
+ perl : true
12
+ waf : false
13
+ geoip : true
14
+ image_filter : true
15
+ rtmp : true
16
+ xslt : true
Original file line number Diff line number Diff line change
1
+ import os
2
+
3
+ import testinfra .utils .ansible_runner
4
+
5
+ testinfra_hosts = testinfra .utils .ansible_runner .AnsibleRunner (os .environ ['MOLECULE_INVENTORY_FILE' ]).get_hosts ('all' ) # noqa E501
6
+
7
+
8
+ def test_nginx_is_installed (host ):
9
+ ngx = host .package ("nginx" )
10
+ assert ngx .is_installed
11
+
12
+
13
+ def test_nginx_running_and_enabled (host ):
14
+ ngx = host .service ("nginx" )
15
+ assert ngx .is_running
16
+ assert ngx .is_enabled
17
+
18
+
19
+ def test_hosts_file (host ):
20
+ ngx = host .file ('/etc/hosts' )
21
+ assert ngx .exists
22
+ assert ngx .user == 'root'
23
+ assert ngx .group == 'root'
24
+
25
+
26
+ def test_endpoint (host ):
27
+ command = """curl -I http://localhost/"""
28
+ cmd = host .run (command )
29
+ assert '200 OK' in cmd .stdout
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 9
9
platforms :
10
10
- name : centos-6
11
11
image : centos:6
12
+ dockerfile : ../common/Dockerfile.j2
12
13
- name : centos-7
13
- image : centos/systemd
14
+ image : centos:7
15
+ dockerfile : ../common/Dockerfile.j2
14
16
privileged : True
15
- volume_mounts :
17
+ volumes :
16
18
- " /sys/fs/cgroup:/sys/fs/cgroup:rw"
17
19
command : " /usr/sbin/init"
20
+ tty : True
18
21
- name : debian-stretch
19
- image : debian:stretch
22
+ image : debian:stretch-slim
23
+ dockerfile : ../common/Dockerfile.j2
20
24
- name : debian-buster
21
- image : debian:buster
25
+ image : debian:buster-slim
26
+ dockerfile : ../common/Dockerfile.j2
22
27
- name : ubuntu-xenial
23
28
image : ubuntu:xenial
29
+ dockerfile : ../common/Dockerfile.j2
24
30
- name : ubuntu-bionic
25
31
image : ubuntu:bionic
32
+ dockerfile : ../common/Dockerfile.j2
26
33
provisioner :
27
34
name : ansible
28
35
lint :
You can’t perform that action at this time.
0 commit comments