diff --git a/.travis.yml b/.travis.yml index ed57177..e699d13 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,10 +5,20 @@ services: - docker env: - scenario: default + - scenario: default_alpine + - scenario: default_centos - scenario: module + - scenario: module_alpine + - scenario: module_centos - scenario: stable_push + - scenario: stable_push_alpine + - scenario: stable_push_centos - scenario: template + - scenario: template_alpine + - scenario: template_centos - scenario: unit + - scenario: unit_alpine + - scenario: unit_centos before_install: - sudo apt-get -qq update install: diff --git a/molecule/common/Dockerfile.j2 b/molecule/common/Dockerfile.j2 index dee58c6..f815648 100644 --- a/molecule/common/Dockerfile.j2 +++ b/molecule/common/Dockerfile.j2 @@ -19,6 +19,10 @@ RUN \ apt-get update \ && apt-get install -y python sudo bash ca-certificates iproute2 curl \ && apt-get clean; \ + elif [ $(command -v dnf) ] && [ $(rpm -E %{rhel}) -eq 8 ]; then \ + dnf makecache \ + && dnf --assumeyes install python3 python3-devel python3-dnf python3-pip bash iproute \ + && dnf clean all; \ elif [ $(command -v dnf) ]; then \ dnf makecache \ && dnf --assumeyes install python sudo python-devel python*-dnf bash iproute \ diff --git a/molecule/stable_push/files/http/default.conf b/molecule/common/files/http/default.conf similarity index 100% rename from molecule/stable_push/files/http/default.conf rename to molecule/common/files/http/default.conf diff --git a/molecule/stable_push/files/nginx.conf b/molecule/common/files/nginx.conf similarity index 100% rename from molecule/stable_push/files/nginx.conf rename to molecule/common/files/nginx.conf diff --git a/molecule/default/playbook.yml b/molecule/common/playbook_default.yml similarity index 100% rename from molecule/default/playbook.yml rename to molecule/common/playbook_default.yml diff --git a/molecule/module/playbook.yml b/molecule/common/playbook_module.yml similarity index 100% rename from molecule/module/playbook.yml rename to molecule/common/playbook_module.yml diff --git a/molecule/stable_push/playbook.yml b/molecule/common/playbook_stable_push.yml similarity index 100% rename from molecule/stable_push/playbook.yml rename to molecule/common/playbook_stable_push.yml diff --git a/molecule/template/playbook.yml b/molecule/common/playbook_template.yml similarity index 100% rename from molecule/template/playbook.yml rename to molecule/common/playbook_template.yml diff --git a/molecule/unit/playbook.yml b/molecule/common/playbook_unit.yml similarity index 100% rename from molecule/unit/playbook.yml rename to molecule/common/playbook_unit.yml diff --git a/molecule/default/tests/test_default.py b/molecule/common/test_default/test_default.py similarity index 100% rename from molecule/default/tests/test_default.py rename to molecule/common/test_default/test_default.py diff --git a/molecule/module/tests/test_default.py b/molecule/common/test_module/test_default.py similarity index 100% rename from molecule/module/tests/test_default.py rename to molecule/common/test_module/test_default.py diff --git a/molecule/stable_push/tests/test_default.py b/molecule/common/test_stable_push/test_default.py similarity index 100% rename from molecule/stable_push/tests/test_default.py rename to molecule/common/test_stable_push/test_default.py diff --git a/molecule/template/tests/test_default.py b/molecule/common/test_template/test_default.py similarity index 100% rename from molecule/template/tests/test_default.py rename to molecule/common/test_template/test_default.py diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 90dbc2b..6440eef 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -4,29 +4,6 @@ driver: lint: name: yamllint platforms: - - name: alpine-3.8 - image: alpine:3.8 - dockerfile: ../common/Dockerfile.j2 - command: "/sbin/init" - - name: alpine-3.9 - image: alpine:3.9 - dockerfile: ../common/Dockerfile.j2 - command: "/sbin/init" - - name: alpine-3.10 - image: alpine:3.10 - dockerfile: ../common/Dockerfile.j2 - command: "/sbin/init" - - name: centos-6 - image: centos:6 - dockerfile: ../common/Dockerfile.j2 - - name: centos-7 - image: centos:7 - dockerfile: ../common/Dockerfile.j2 - privileged: True - volumes: - - "/sys/fs/cgroup:/sys/fs/cgroup:rw" - command: "/usr/sbin/init" - tty: True - name: debian-stretch image: debian:stretch-slim dockerfile: ../common/Dockerfile.j2 @@ -41,9 +18,12 @@ platforms: dockerfile: ../common/Dockerfile.j2 provisioner: name: ansible + playbooks: + converge: ../common/playbook_default.yml lint: name: ansible-lint verifier: name: testinfra + directory: ../common/test_default lint: name: flake8 diff --git a/molecule/default_alpine/molecule.yml b/molecule/default_alpine/molecule.yml new file mode 100644 index 0000000..1736825 --- /dev/null +++ b/molecule/default_alpine/molecule.yml @@ -0,0 +1,38 @@ +--- +driver: + name: docker +lint: + name: yamllint +platforms: + - name: alpine-3.8 + image: alpine:3.8 + dockerfile: ../common/Dockerfile.j2 + privileged: True + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + command: "/sbin/init" + - name: alpine-3.9 + image: alpine:3.9 + dockerfile: ../common/Dockerfile.j2 + privileged: True + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + command: "/sbin/init" + - name: alpine-3.10 + image: alpine:3.10 + dockerfile: ../common/Dockerfile.j2 + privileged: True + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + command: "/sbin/init" +provisioner: + name: ansible + playbooks: + converge: ../common/playbook_default.yml + lint: + name: ansible-lint +verifier: + name: testinfra + directory: ../common/test_default + lint: + name: flake8 diff --git a/molecule/default_centos/molecule.yml b/molecule/default_centos/molecule.yml new file mode 100644 index 0000000..6767a98 --- /dev/null +++ b/molecule/default_centos/molecule.yml @@ -0,0 +1,34 @@ +--- +driver: + name: docker +lint: + name: yamllint +platforms: + - name: centos-6 + image: centos:6 + dockerfile: ../common/Dockerfile.j2 + - name: centos-7 + image: centos:7 + dockerfile: ../common/Dockerfile.j2 + privileged: True + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + command: "/usr/sbin/init" + - name: centos-8 + image: centos:8 + dockerfile: ../common/Dockerfile.j2 + privileged: True + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + command: "/usr/sbin/init" +provisioner: + name: ansible + playbooks: + converge: ../common/playbook_default.yml + lint: + name: ansible-lint +verifier: + name: testinfra + directory: ../common/test_default + lint: + name: flake8 diff --git a/molecule/module/molecule.yml b/molecule/module/molecule.yml index 90dbc2b..7810f7f 100644 --- a/molecule/module/molecule.yml +++ b/molecule/module/molecule.yml @@ -4,29 +4,6 @@ driver: lint: name: yamllint platforms: - - name: alpine-3.8 - image: alpine:3.8 - dockerfile: ../common/Dockerfile.j2 - command: "/sbin/init" - - name: alpine-3.9 - image: alpine:3.9 - dockerfile: ../common/Dockerfile.j2 - command: "/sbin/init" - - name: alpine-3.10 - image: alpine:3.10 - dockerfile: ../common/Dockerfile.j2 - command: "/sbin/init" - - name: centos-6 - image: centos:6 - dockerfile: ../common/Dockerfile.j2 - - name: centos-7 - image: centos:7 - dockerfile: ../common/Dockerfile.j2 - privileged: True - volumes: - - "/sys/fs/cgroup:/sys/fs/cgroup:rw" - command: "/usr/sbin/init" - tty: True - name: debian-stretch image: debian:stretch-slim dockerfile: ../common/Dockerfile.j2 @@ -41,9 +18,12 @@ platforms: dockerfile: ../common/Dockerfile.j2 provisioner: name: ansible + playbooks: + converge: ../common/playbook_module.yml lint: name: ansible-lint verifier: name: testinfra + directory: ../common/test_module lint: name: flake8 diff --git a/molecule/module_alpine/molecule.yml b/molecule/module_alpine/molecule.yml new file mode 100644 index 0000000..5d5338c --- /dev/null +++ b/molecule/module_alpine/molecule.yml @@ -0,0 +1,38 @@ +--- +driver: + name: docker +lint: + name: yamllint +platforms: + - name: alpine-3.8 + image: alpine:3.8 + dockerfile: ../common/Dockerfile.j2 + privileged: True + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + command: "/sbin/init" + - name: alpine-3.9 + image: alpine:3.9 + dockerfile: ../common/Dockerfile.j2 + privileged: True + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + command: "/sbin/init" + - name: alpine-3.10 + image: alpine:3.10 + dockerfile: ../common/Dockerfile.j2 + privileged: True + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + command: "/sbin/init" +provisioner: + name: ansible + playbooks: + converge: ../common/playbook_module.yml + lint: + name: ansible-lint +verifier: + name: testinfra + directory: ../common/test_module + lint: + name: flake8 diff --git a/molecule/module_centos/molecule.yml b/molecule/module_centos/molecule.yml new file mode 100644 index 0000000..5aad329 --- /dev/null +++ b/molecule/module_centos/molecule.yml @@ -0,0 +1,34 @@ +--- +driver: + name: docker +lint: + name: yamllint +platforms: + - name: centos-6 + image: centos:6 + dockerfile: ../common/Dockerfile.j2 + - name: centos-7 + image: centos:7 + dockerfile: ../common/Dockerfile.j2 + privileged: True + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + command: "/usr/sbin/init" + - name: centos-8 + image: centos:8 + dockerfile: ../common/Dockerfile.j2 + privileged: True + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + command: "/usr/sbin/init" +provisioner: + name: ansible + playbooks: + converge: ../common/playbook_module.yml + lint: + name: ansible-lint +verifier: + name: testinfra + directory: ../common/test_module + lint: + name: flake8 diff --git a/molecule/stable_push/molecule.yml b/molecule/stable_push/molecule.yml index f65a662..7d6e4b3 100644 --- a/molecule/stable_push/molecule.yml +++ b/molecule/stable_push/molecule.yml @@ -7,29 +7,6 @@ driver: lint: name: yamllint platforms: - - name: alpine-3.8 - image: alpine:3.8 - dockerfile: ../common/Dockerfile.j2 - command: "/sbin/init" - - name: alpine-3.9 - image: alpine:3.9 - dockerfile: ../common/Dockerfile.j2 - command: "/sbin/init" - - name: alpine-3.10 - image: alpine:3.10 - dockerfile: ../common/Dockerfile.j2 - command: "/sbin/init" - - name: centos-6 - image: centos:6 - dockerfile: ../common/Dockerfile.j2 - - name: centos-7 - image: centos:7 - dockerfile: ../common/Dockerfile.j2 - privileged: True - volumes: - - "/sys/fs/cgroup:/sys/fs/cgroup:rw" - command: "/usr/sbin/init" - tty: True - name: debian-stretch image: debian:stretch-slim dockerfile: ../common/Dockerfile.j2 @@ -44,9 +21,12 @@ platforms: dockerfile: ../common/Dockerfile.j2 provisioner: name: ansible + playbooks: + converge: ../common/playbook_stable_push.yml lint: name: ansible-lint verifier: name: testinfra + directory: ../common/test_stable_push lint: name: flake8 diff --git a/molecule/stable_push_alpine/molecule.yml b/molecule/stable_push_alpine/molecule.yml new file mode 100644 index 0000000..afe6e59 --- /dev/null +++ b/molecule/stable_push_alpine/molecule.yml @@ -0,0 +1,41 @@ +--- +dependency: + name: shell + command: pip install python-nginx +driver: + name: docker +lint: + name: yamllint +platforms: + - name: alpine-3.8 + image: alpine:3.8 + dockerfile: ../common/Dockerfile.j2 + privileged: True + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + command: "/sbin/init" + - name: alpine-3.9 + image: alpine:3.9 + dockerfile: ../common/Dockerfile.j2 + privileged: True + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + command: "/sbin/init" + - name: alpine-3.10 + image: alpine:3.10 + dockerfile: ../common/Dockerfile.j2 + privileged: True + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + command: "/sbin/init" +provisioner: + name: ansible + playbooks: + converge: ../common/playbook_stable_push.yml + lint: + name: ansible-lint +verifier: + name: testinfra + directory: ../common/test_stable_push + lint: + name: flake8 diff --git a/molecule/stable_push_centos/molecule.yml b/molecule/stable_push_centos/molecule.yml new file mode 100644 index 0000000..b9e1dd7 --- /dev/null +++ b/molecule/stable_push_centos/molecule.yml @@ -0,0 +1,37 @@ +--- +dependency: + name: shell + command: pip install python-nginx +driver: + name: docker +lint: + name: yamllint +platforms: + - name: centos-6 + image: centos:6 + dockerfile: ../common/Dockerfile.j2 + - name: centos-7 + image: centos:7 + dockerfile: ../common/Dockerfile.j2 + privileged: True + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + command: "/usr/sbin/init" + - name: centos-8 + image: centos:8 + dockerfile: ../common/Dockerfile.j2 + privileged: True + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + command: "/usr/sbin/init" +provisioner: + name: ansible + playbooks: + converge: ../common/playbook_stable_push.yml + lint: + name: ansible-lint +verifier: + name: testinfra + directory: ../common/test_stable_push + lint: + name: flake8 diff --git a/molecule/template/molecule.yml b/molecule/template/molecule.yml index f65a662..479e813 100644 --- a/molecule/template/molecule.yml +++ b/molecule/template/molecule.yml @@ -7,29 +7,6 @@ driver: lint: name: yamllint platforms: - - name: alpine-3.8 - image: alpine:3.8 - dockerfile: ../common/Dockerfile.j2 - command: "/sbin/init" - - name: alpine-3.9 - image: alpine:3.9 - dockerfile: ../common/Dockerfile.j2 - command: "/sbin/init" - - name: alpine-3.10 - image: alpine:3.10 - dockerfile: ../common/Dockerfile.j2 - command: "/sbin/init" - - name: centos-6 - image: centos:6 - dockerfile: ../common/Dockerfile.j2 - - name: centos-7 - image: centos:7 - dockerfile: ../common/Dockerfile.j2 - privileged: True - volumes: - - "/sys/fs/cgroup:/sys/fs/cgroup:rw" - command: "/usr/sbin/init" - tty: True - name: debian-stretch image: debian:stretch-slim dockerfile: ../common/Dockerfile.j2 @@ -44,9 +21,12 @@ platforms: dockerfile: ../common/Dockerfile.j2 provisioner: name: ansible + playbooks: + converge: ../common/playbook_template.yml lint: name: ansible-lint verifier: name: testinfra + directory: ../common/test_template lint: name: flake8 diff --git a/molecule/template_alpine/molecule.yml b/molecule/template_alpine/molecule.yml new file mode 100644 index 0000000..1dc586e --- /dev/null +++ b/molecule/template_alpine/molecule.yml @@ -0,0 +1,41 @@ +--- +dependency: + name: shell + command: pip install python-nginx +driver: + name: docker +lint: + name: yamllint +platforms: + - name: alpine-3.8 + image: alpine:3.8 + dockerfile: ../common/Dockerfile.j2 + privileged: True + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + command: "/sbin/init" + - name: alpine-3.9 + image: alpine:3.9 + dockerfile: ../common/Dockerfile.j2 + privileged: True + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + command: "/sbin/init" + - name: alpine-3.10 + image: alpine:3.10 + dockerfile: ../common/Dockerfile.j2 + privileged: True + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + command: "/sbin/init" +provisioner: + name: ansible + playbooks: + converge: ../common/playbook_template.yml + lint: + name: ansible-lint +verifier: + name: testinfra + directory: ../common/test_template + lint: + name: flake8 diff --git a/molecule/template_centos/molecule.yml b/molecule/template_centos/molecule.yml new file mode 100644 index 0000000..8926d27 --- /dev/null +++ b/molecule/template_centos/molecule.yml @@ -0,0 +1,37 @@ +--- +dependency: + name: shell + command: pip install python-nginx +driver: + name: docker +lint: + name: yamllint +platforms: + - name: centos-6 + image: centos:6 + dockerfile: ../common/Dockerfile.j2 + - name: centos-7 + image: centos:7 + dockerfile: ../common/Dockerfile.j2 + privileged: True + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + command: "/usr/sbin/init" + - name: centos-8 + image: centos:8 + dockerfile: ../common/Dockerfile.j2 + privileged: True + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + command: "/usr/sbin/init" +provisioner: + name: ansible + playbooks: + converge: ../common/playbook_template.yml + lint: + name: ansible-lint +verifier: + name: testinfra + directory: ../common/test_template + lint: + name: flake8 diff --git a/molecule/unit/molecule.yml b/molecule/unit/molecule.yml index f8c5762..8727894 100644 --- a/molecule/unit/molecule.yml +++ b/molecule/unit/molecule.yml @@ -4,29 +4,6 @@ driver: lint: name: yamllint platforms: - - name: alpine-3.8 - image: alpine:3.8 - dockerfile: ../common/Dockerfile.j2 - command: "/sbin/init" - - name: alpine-3.9 - image: alpine:3.9 - dockerfile: ../common/Dockerfile.j2 - command: "/sbin/init" - - name: alpine-3.10 - image: alpine:3.10 - dockerfile: ../common/Dockerfile.j2 - command: "/sbin/init" - - name: centos-6 - image: centos:6 - dockerfile: ../common/Dockerfile.j2 - - name: centos-7 - image: centos:7 - dockerfile: ../common/Dockerfile.j2 - privileged: True - volumes: - - "/sys/fs/cgroup:/sys/fs/cgroup:rw" - command: "/usr/sbin/init" - tty: True - name: debian-stretch image: debian:stretch-slim dockerfile: ../common/Dockerfile.j2 @@ -41,5 +18,7 @@ platforms: dockerfile: ../common/Dockerfile.j2 provisioner: name: ansible + playbooks: + converge: ../common/playbook_unit.yml lint: name: ansible-lint diff --git a/molecule/unit_alpine/molecule.yml b/molecule/unit_alpine/molecule.yml new file mode 100644 index 0000000..fc951d0 --- /dev/null +++ b/molecule/unit_alpine/molecule.yml @@ -0,0 +1,33 @@ +--- +driver: + name: docker +lint: + name: yamllint +platforms: + - name: alpine-3.8 + image: alpine:3.8 + dockerfile: ../common/Dockerfile.j2 + privileged: True + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + command: "/sbin/init" + - name: alpine-3.9 + image: alpine:3.9 + dockerfile: ../common/Dockerfile.j2 + privileged: True + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + command: "/sbin/init" + - name: alpine-3.10 + image: alpine:3.10 + dockerfile: ../common/Dockerfile.j2 + privileged: True + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + command: "/sbin/init" +provisioner: + name: ansible + playbooks: + converge: ../common/playbook_unit.yml + lint: + name: ansible-lint diff --git a/molecule/unit_centos/molecule.yml b/molecule/unit_centos/molecule.yml new file mode 100644 index 0000000..ca68187 --- /dev/null +++ b/molecule/unit_centos/molecule.yml @@ -0,0 +1,29 @@ +--- +driver: + name: docker +lint: + name: yamllint +platforms: + - name: centos-6 + image: centos:6 + dockerfile: ../common/Dockerfile.j2 + - name: centos-7 + image: centos:7 + dockerfile: ../common/Dockerfile.j2 + privileged: True + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + command: "/usr/sbin/init" + - name: centos-8 + image: centos:8 + dockerfile: ../common/Dockerfile.j2 + privileged: True + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + command: "/usr/sbin/init" +provisioner: + name: ansible + playbooks: + converge: ../common/playbook_unit.yml + lint: + name: ansible-lint diff --git a/tasks/modules/install-modules.yml b/tasks/modules/install-modules.yml index 7179d6d..d055fe4 100644 --- a/tasks/modules/install-modules.yml +++ b/tasks/modules/install-modules.yml @@ -6,16 +6,23 @@ when: nginx_modules.perl | default(false) - import_tasks: install-geoip.yml - when: nginx_modules.geoip | default(false) + when: + - nginx_modules.geoip | default(false) + - ansible_os_family != "RedHat" + - ansible_distribution_major_version != "8" - import_tasks: install-image-filter.yml when: nginx_modules.image_filter | default(false) - import_tasks: install-rtmp.yml - when: nginx_modules.rtmp | default(false) and nginx_type == "plus" + when: + - nginx_modules.rtmp | default(false) + - nginx_type == "plus" - import_tasks: install-xslt.yml when: nginx_modules.xslt | default(false) - import_tasks: install-waf.yml - when: nginx_modules.waf | default(false) and nginx_type == "plus" + when: + - nginx_modules.waf | default(false) + - nginx_type == "plus" diff --git a/tasks/modules/install-perl.yml b/tasks/modules/install-perl.yml index e76d8ac..3e484d9 100644 --- a/tasks/modules/install-perl.yml +++ b/tasks/modules/install-perl.yml @@ -1,4 +1,9 @@ --- +- name: "(Install: All OSs) Install Perl Dependency" + package: + name: perl + state: present + - name: "(Install: All OSs) Install NGINX Open Source Perl Module" package: name: nginx-module-perl diff --git a/tasks/opensource/install-oss-linux.yml b/tasks/opensource/install-oss-linux.yml index 93a68ea..701fc64 100644 --- a/tasks/opensource/install-oss-linux.yml +++ b/tasks/opensource/install-oss-linux.yml @@ -14,13 +14,11 @@ - import_tasks: setup-suse.yml when: ansible_os_family == "Suse" - when: - - nginx_install_from == "nginx_repository" + when: nginx_install_from == "nginx_repository" - name: "(Install: Linux) Install NGINX package" package: name: "nginx{{ nginx_version | default('') }}" state: present - when: - - nginx_install_from == "os_repository" + when: nginx_install_from == "os_repository" notify: "(Handler: All OSs) Start NGINX" diff --git a/tasks/opensource/setup-redhat.yml b/tasks/opensource/setup-redhat.yml index edad599..30e2604 100644 --- a/tasks/opensource/setup-redhat.yml +++ b/tasks/opensource/setup-redhat.yml @@ -18,7 +18,13 @@ enabled: yes gpgcheck: yes +- name: "(Install: CentOS/RedHat) Install Required CentOS/RedHat Dependencies" + yum: + name: openssl + - name: "(Install: CentOS/RedHat) Install NGINX" yum: name: "nginx{{ nginx_version | default('') }}" + disablerepo: "*" + enablerepo: "nginx" notify: "(Handler: All OSs) Start NGINX"