From 2e455870aad4947c516c7e507a8a207e59af88f4 Mon Sep 17 00:00:00 2001 From: Robert de Bock Date: Tue, 6 Nov 2018 21:04:13 +0100 Subject: [PATCH] Same playbook for all tests, updated README.md --- README.md | 3 +- meta/main.yml | 2 +- meta/purpose.txt | 1 - molecule/alpine-edge/playbook.yml | 4 +- molecule/archlinux/playbook.yml | 4 +- molecule/centos-6/playbook.yml | 4 +- molecule/debian-stable/playbook.yml | 4 +- molecule/debian-unstable/playbook.yml | 4 +- molecule/default/molecule.yml | 3 ++ molecule/fedora-rawhide/playbook.yml | 4 +- molecule/opensuse-leap/playbook.yml | 4 +- molecule/opensuse-tumbleweed/playbook.yml | 4 +- molecule/ubuntu-artful/playbook.yml | 4 +- molecule/ubuntu-devel/playbook.yml | 4 +- molecule/vagrant/INSTALL.rst | 17 ++++++++ molecule/vagrant/molecule.yml | 29 +++++++++++++ molecule/vagrant/playbook.yml | 9 ++++ molecule/vagrant/tests/test_default.yml | 8 ++++ molecule/vagrant/verify.yml | 53 +++++++++++++++++++++++ 19 files changed, 141 insertions(+), 24 deletions(-) delete mode 100644 meta/purpose.txt create mode 100644 molecule/vagrant/INSTALL.rst create mode 100644 molecule/vagrant/molecule.yml create mode 100644 molecule/vagrant/playbook.yml create mode 100644 molecule/vagrant/tests/test_default.yml create mode 100644 molecule/vagrant/verify.yml diff --git a/README.md b/README.md index 0d0b336..6102fe9 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,7 @@ xinetd [![Build Status](https://travis-ci.org/robertdebock/ansible-role-xinetd.svg?branch=master)](https://travis-ci.org/robertdebock/ansible-role-xinetd) -Provides xinetd for your system. - +The purpose of this role is to install and configure xinetd on your system. Example Playbook ---------------- diff --git a/meta/main.yml b/meta/main.yml index 7e9385f..bc1d916 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -2,7 +2,7 @@ galaxy_info: author: Robert de Bock role_name: xinetd - description: Provides xinetd for your system. + description: The purpose of this role is to install and configure xinetd on your system. license: Apache-2.0 company: none min_ansible_version: 2.4 diff --git a/meta/purpose.txt b/meta/purpose.txt deleted file mode 100644 index c45c2dd..0000000 --- a/meta/purpose.txt +++ /dev/null @@ -1 +0,0 @@ -Provides xinetd for your system. diff --git a/molecule/alpine-edge/playbook.yml b/molecule/alpine-edge/playbook.yml index b0f01a9..bf248f2 100644 --- a/molecule/alpine-edge/playbook.yml +++ b/molecule/alpine-edge/playbook.yml @@ -1,8 +1,8 @@ --- - name: Converge hosts: all - become: true - gather_facts: false + gather_facts: no + become: yes roles: - robertdebock.bootstrap diff --git a/molecule/archlinux/playbook.yml b/molecule/archlinux/playbook.yml index b0f01a9..bf248f2 100644 --- a/molecule/archlinux/playbook.yml +++ b/molecule/archlinux/playbook.yml @@ -1,8 +1,8 @@ --- - name: Converge hosts: all - become: true - gather_facts: false + gather_facts: no + become: yes roles: - robertdebock.bootstrap diff --git a/molecule/centos-6/playbook.yml b/molecule/centos-6/playbook.yml index b0f01a9..bf248f2 100644 --- a/molecule/centos-6/playbook.yml +++ b/molecule/centos-6/playbook.yml @@ -1,8 +1,8 @@ --- - name: Converge hosts: all - become: true - gather_facts: false + gather_facts: no + become: yes roles: - robertdebock.bootstrap diff --git a/molecule/debian-stable/playbook.yml b/molecule/debian-stable/playbook.yml index b0f01a9..bf248f2 100644 --- a/molecule/debian-stable/playbook.yml +++ b/molecule/debian-stable/playbook.yml @@ -1,8 +1,8 @@ --- - name: Converge hosts: all - become: true - gather_facts: false + gather_facts: no + become: yes roles: - robertdebock.bootstrap diff --git a/molecule/debian-unstable/playbook.yml b/molecule/debian-unstable/playbook.yml index b0f01a9..bf248f2 100644 --- a/molecule/debian-unstable/playbook.yml +++ b/molecule/debian-unstable/playbook.yml @@ -1,8 +1,8 @@ --- - name: Converge hosts: all - become: true - gather_facts: false + gather_facts: no + become: yes roles: - robertdebock.bootstrap diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 6e02b1e..d14ffc4 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -42,6 +42,9 @@ provisioner: name: ansible lint: name: ansible-lint + config_options: + defaults: + callback_plugins: /usr/lib/python2.7/site-packages/ara/plugins/callbacks scenario: name: default verifier: diff --git a/molecule/fedora-rawhide/playbook.yml b/molecule/fedora-rawhide/playbook.yml index b0f01a9..bf248f2 100644 --- a/molecule/fedora-rawhide/playbook.yml +++ b/molecule/fedora-rawhide/playbook.yml @@ -1,8 +1,8 @@ --- - name: Converge hosts: all - become: true - gather_facts: false + gather_facts: no + become: yes roles: - robertdebock.bootstrap diff --git a/molecule/opensuse-leap/playbook.yml b/molecule/opensuse-leap/playbook.yml index b0f01a9..bf248f2 100644 --- a/molecule/opensuse-leap/playbook.yml +++ b/molecule/opensuse-leap/playbook.yml @@ -1,8 +1,8 @@ --- - name: Converge hosts: all - become: true - gather_facts: false + gather_facts: no + become: yes roles: - robertdebock.bootstrap diff --git a/molecule/opensuse-tumbleweed/playbook.yml b/molecule/opensuse-tumbleweed/playbook.yml index b0f01a9..bf248f2 100644 --- a/molecule/opensuse-tumbleweed/playbook.yml +++ b/molecule/opensuse-tumbleweed/playbook.yml @@ -1,8 +1,8 @@ --- - name: Converge hosts: all - become: true - gather_facts: false + gather_facts: no + become: yes roles: - robertdebock.bootstrap diff --git a/molecule/ubuntu-artful/playbook.yml b/molecule/ubuntu-artful/playbook.yml index b0f01a9..bf248f2 100644 --- a/molecule/ubuntu-artful/playbook.yml +++ b/molecule/ubuntu-artful/playbook.yml @@ -1,8 +1,8 @@ --- - name: Converge hosts: all - become: true - gather_facts: false + gather_facts: no + become: yes roles: - robertdebock.bootstrap diff --git a/molecule/ubuntu-devel/playbook.yml b/molecule/ubuntu-devel/playbook.yml index b0f01a9..bf248f2 100644 --- a/molecule/ubuntu-devel/playbook.yml +++ b/molecule/ubuntu-devel/playbook.yml @@ -1,8 +1,8 @@ --- - name: Converge hosts: all - become: true - gather_facts: false + gather_facts: no + become: yes roles: - robertdebock.bootstrap diff --git a/molecule/vagrant/INSTALL.rst b/molecule/vagrant/INSTALL.rst new file mode 100644 index 0000000..ca81c7b --- /dev/null +++ b/molecule/vagrant/INSTALL.rst @@ -0,0 +1,17 @@ +******* +Vagrant driver installation guide +******* + +Requirements +============ + +* Vagrant +* Virtualbox, Parallels, VMware Fusion, VMware Workstation or VMware Desktop +* python-vagrant + +Install +======= + +.. code-block:: bash + + $ sudo pip install python-vagrant diff --git a/molecule/vagrant/molecule.yml b/molecule/vagrant/molecule.yml new file mode 100644 index 0000000..0c1117a --- /dev/null +++ b/molecule/vagrant/molecule.yml @@ -0,0 +1,29 @@ +--- +dependency: + name: galaxy + options: + role-file: requirements.yml +driver: + name: vagrant + provider: + name: virtualbox +lint: + name: yamllint +platforms: + - name: xinetd-debian + box: debian/stretch64 + - name: xinetd-fedora + box: fedora/28-cloud-base +provisioner: + name: ansible + lint: + name: ansible-lint + config_options: + defaults: + callback_plugins: /usr/lib/python2.7/site-packages/ara/plugins/callbacks +scenario: + name: vagrant +verifier: + name: goss + lint: + name: yamllint diff --git a/molecule/vagrant/playbook.yml b/molecule/vagrant/playbook.yml new file mode 100644 index 0000000..bf248f2 --- /dev/null +++ b/molecule/vagrant/playbook.yml @@ -0,0 +1,9 @@ +--- +- name: Converge + hosts: all + gather_facts: no + become: yes + + roles: + - robertdebock.bootstrap + - ansible-role-xinetd diff --git a/molecule/vagrant/tests/test_default.yml b/molecule/vagrant/tests/test_default.yml new file mode 100644 index 0000000..7f40386 --- /dev/null +++ b/molecule/vagrant/tests/test_default.yml @@ -0,0 +1,8 @@ +# Molecule managed + +--- +file: + /etc/hosts: + exists: true + owner: root + group: root diff --git a/molecule/vagrant/verify.yml b/molecule/vagrant/verify.yml new file mode 100644 index 0000000..5948e4d --- /dev/null +++ b/molecule/vagrant/verify.yml @@ -0,0 +1,53 @@ +--- +# This is an example playbook to execute goss tests. +# Tests need distributed to the appropriate ansible host/groups +# prior to execution by `goss validate`. + +- name: Verify + hosts: all + become: true + vars: + goss_version: v0.3.6 + goss_arch: amd64 + goss_dst: /usr/local/bin/goss + goss_sha256sum: 53dd1156ab66f2c4275fd847372e6329d895cfb2f0bcbec5f86c1c4df7236dde + goss_url: "https://github.com/aelsabbahy/goss/releases/download/{{ goss_version }}/goss-linux-{{ goss_arch }}" + goss_test_directory: /tmp + goss_format: documentation + tasks: + - name: Download and install Goss + get_url: + url: "{{ goss_url }}" + dest: "{{ goss_dst }}" + sha256sum: "{{ goss_sha256sum }}" + mode: 0755 + register: download_goss + until: download_goss is succeeded + retries: 3 + + - name: Copy Goss tests to remote + copy: + src: "{{ item }}" + dest: "{{ goss_test_directory }}/{{ item | basename }}" + with_fileglob: + - "{{ lookup('env', 'MOLECULE_VERIFIER_TEST_DIRECTORY') }}/test_*.yml" + + - name: Register test files + shell: "ls {{ goss_test_directory }}/test_*.yml" + register: test_files + + - name: Execute Goss tests + command: "{{ goss_dst }} -g {{ item }} validate --format {{ goss_format }}" + register: test_results + with_items: "{{ test_files.stdout_lines }}" + + - name: Display details about the Goss results + debug: + msg: "{{ item.stdout_lines }}" + with_items: "{{ test_results.results }}" + + - name: Fail when tests fail + fail: + msg: "Goss failed to validate" + when: item.rc != 0 + with_items: "{{ test_results.results }}"