Add role level tests for 'nginx' role
Introduce full role level test coverage for
'nginx' role.
Change-Id: I7c634775433a2336e43cdfc73d4698d5e2933f0e
Issue-ID: OOM-1913
Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
diff --git a/ansible/roles/nginx/.yamllint b/ansible/roles/nginx/.yamllint
new file mode 100644
index 0000000..ad0be76
--- /dev/null
+++ b/ansible/roles/nginx/.yamllint
@@ -0,0 +1,11 @@
+extends: default
+
+rules:
+ braces:
+ max-spaces-inside: 1
+ level: error
+ brackets:
+ max-spaces-inside: 1
+ level: error
+ line-length: disable
+ truthy: disable
diff --git a/ansible/roles/nginx/defaults/main.yml b/ansible/roles/nginx/defaults/main.yml
index 260de9b..8bf4419 100644
--- a/ansible/roles/nginx/defaults/main.yml
+++ b/ansible/roles/nginx/defaults/main.yml
@@ -4,7 +4,7 @@
http:
nexus:
all_simulated_hosts:
- "{{ simulated_hosts.git + simulated_hosts.http + simulated_hosts.nexus }}"
+ "{{ simulated_hosts.git + simulated_hosts.http + simulated_hosts.nexus }}"
nginx:
ports:
diff --git a/ansible/roles/nginx/molecule/default/molecule.yml b/ansible/roles/nginx/molecule/default/molecule.yml
new file mode 100644
index 0000000..63c4772
--- /dev/null
+++ b/ansible/roles/nginx/molecule/default/molecule.yml
@@ -0,0 +1,30 @@
+---
+dependency:
+ name: galaxy
+driver:
+ name: docker
+lint:
+ name: yamllint
+platforms:
+ - name: infrastructure-server
+ image: molecule-${PREBUILD_PLATFORM_DISTRO:-centos}:${PREBUILD_DISTRO_VERSION:-centos7.6}
+ pre_build_image: true
+ privileged: true
+ override_command: false
+ volumes:
+ - /var/lib/docker
+ groups:
+ - infrastructure
+provisioner:
+ name: ansible
+ env:
+ ANSIBLE_ROLES_PATH: ../../../../test/roles
+ inventory:
+ links:
+ group_vars: ../../../../group_vars
+ lint:
+ name: ansible-lint
+verifier:
+ name: testinfra
+ lint:
+ name: flake8
diff --git a/ansible/roles/nginx/molecule/default/playbook.yml b/ansible/roles/nginx/molecule/default/playbook.yml
new file mode 100644
index 0000000..431bb66
--- /dev/null
+++ b/ansible/roles/nginx/molecule/default/playbook.yml
@@ -0,0 +1,5 @@
+---
+- name: Converge
+ hosts: all
+ roles:
+ - nginx
diff --git a/ansible/roles/nginx/molecule/default/prepare.yml b/ansible/roles/nginx/molecule/default/prepare.yml
new file mode 100644
index 0000000..5c6ff5d
--- /dev/null
+++ b/ansible/roles/nginx/molecule/default/prepare.yml
@@ -0,0 +1,8 @@
+---
+- name: Prepare
+ hosts: all
+ vars_files:
+ - ../../../../roles/nginx/defaults/main.yml
+ roles:
+ - prepare-docker-dind
+ - prepare-nginx