Add Alpine tests to all molecule scenarios (#191)

* Use distro specific Ansible modules to install NGINX

* Install NGINX directly in Alpine distributions from the official repository to avoid naming conflicts

* Set travis_wait parameter to max timeout setting
This commit is contained in:
Alessandro Fael Garcia 2019-11-24 02:10:55 +01:00 committed by GitHub
parent 59e0170313
commit f6c48c12d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 102 additions and 5 deletions

View File

@ -14,6 +14,6 @@ before_install:
install: install:
- pip install molecule[docker] - pip install molecule[docker]
script: script:
- molecule test -s $scenario - travis_wait 50 molecule test -s $scenario
notifications: notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/ webhooks: https://galaxy.ansible.com/api/v1/notifications/

View File

@ -4,6 +4,18 @@ driver:
lint: lint:
name: yamllint name: yamllint
platforms: 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 - name: centos-6
image: centos:6 image: centos:6
dockerfile: ../common/Dockerfile.j2 dockerfile: ../common/Dockerfile.j2

View File

@ -7,6 +7,18 @@ driver:
lint: lint:
name: yamllint name: yamllint
platforms: 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 - name: centos-6
image: centos:6 image: centos:6
dockerfile: ../common/Dockerfile.j2 dockerfile: ../common/Dockerfile.j2

View File

@ -7,6 +7,18 @@ driver:
lint: lint:
name: yamllint name: yamllint
platforms: 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 - name: centos-6
image: centos:6 image: centos:6
dockerfile: ../common/Dockerfile.j2 dockerfile: ../common/Dockerfile.j2

View File

@ -4,6 +4,18 @@ driver:
lint: lint:
name: yamllint name: yamllint
platforms: 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 - name: centos-6
image: centos:6 image: centos:6
dockerfile: ../common/Dockerfile.j2 dockerfile: ../common/Dockerfile.j2

View File

@ -1,10 +1,30 @@
--- ---
- name: Converge - name: Converge
hosts: all hosts: all
pre_tasks:
- name: "Set module if Alpine"
set_fact:
module:
- "unit-perl"
- "unit-php7"
- "unit-python3"
when: ansible_os_family == "Alpine"
- name: "Set module if Debian/RedHat"
set_fact:
module:
- "unit-perl"
- "unit-php"
- "unit-ruby"
when: ansible_os_family == "Debian"
- name: "Set module if RedHat"
set_fact:
module:
- "unit-php"
- "unit-go"
when: ansible_os_family == "RedHat"
roles: roles:
- role: ansible-role-nginx - role: ansible-role-nginx
vars: vars:
nginx_enable: false nginx_enable: false
nginx_unit_enable: true nginx_unit_enable: true
nginx_unit_modules: nginx_unit_modules: "{{ module }}"
- unit-php

View File

@ -14,11 +14,13 @@
- import_tasks: setup-suse.yml - import_tasks: setup-suse.yml
when: ansible_os_family == "Suse" when: ansible_os_family == "Suse"
when: nginx_install_from == "nginx_repository" when:
- nginx_install_from == "nginx_repository"
- name: "(Install: Linux) Install NGINX package" - name: "(Install: Linux) Install NGINX package"
package: package:
name: "nginx{{ nginx_version | default('') }}" name: "nginx{{ nginx_version | default('') }}"
state: present state: present
when: ansible_os_family in nginx_linux_families when:
- nginx_install_from == "os_repository"
notify: "(Handler: All OSs) Start NGINX" notify: "(Handler: All OSs) Start NGINX"

View File

@ -14,3 +14,15 @@
path: /etc/apk/repositories path: /etc/apk/repositories
insertafter: EOF insertafter: EOF
line: "{{ repository }}" line: "{{ repository }}"
- name: "(Install: Alpine) Install Required Alpine Dependencies"
apk:
name:
- openssl
- pcre
- name: "(Install: Alpine) Install NGINX"
apk:
name: "nginx{{ nginx_version | default('') }}"
repository: "{{ repository }}"
notify: "(Handler: All OSs) Start NGINX"

View File

@ -18,3 +18,8 @@
repo: "{{ item }}" repo: "{{ item }}"
with_items: with_items:
- "{{ repository }}" - "{{ repository }}"
- name: "(Install: Debian/Ubuntu) Install NGINX"
apt:
name: "nginx{{ nginx_version | default('') }}"
notify: "(Handler: All OSs) Start NGINX"

View File

@ -17,3 +17,8 @@
description: NGINX Repository description: NGINX Repository
enabled: yes enabled: yes
gpgcheck: yes gpgcheck: yes
- name: "(Install: CentOS/RedHat) Install NGINX"
yum:
name: "nginx{{ nginx_version | default('') }}"
notify: "(Handler: All OSs) Start NGINX"

View File

@ -13,3 +13,8 @@
zypper_repository: zypper_repository:
name: "nginx-{{ nginx_branch }}" name: "nginx-{{ nginx_branch }}"
repo: "{{ repository }}" repo: "{{ repository }}"
- name: "(Install: SUSE) Install NGINX"
zypper:
name: "nginx{{ nginx_version | default('') }}"
notify: "(Handler: All OSs) Start NGINX"