diff --git a/README.md b/README.md index 0693392..85ac98e 100644 --- a/README.md +++ b/README.md @@ -3,21 +3,7 @@ firewall [![Build Status](https://travis-ci.org/robertdebock/ansible-role-firewall.svg?branch=master)](https://travis-ci.org/robertdebock/ansible-role-firewall) -Configures the firewall for your system. - -Different distributions use different firewall implementations. This Ansible role aims to be very simply to use. It's been designed to work with: - -|distribution|firewall | -|------------|---------------| -|Alpine |iptables | -|Archlinux |not implemented| -|CentOS 6 |iptables | -|CentOS 7 |firewalld | -|Debian |uwf | -|Fedora |frewalld | -|OpenSUSE |firealld | -|Ubuntu |uwf | - +The purpose of this role is to install and configure a firewall on your system. Example Playbook ---------------- diff --git a/meta/main.yml b/meta/main.yml index af09234..3b12c90 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -2,7 +2,7 @@ galaxy_info: author: Robert de Bock role_name: firewall - description: Provides firewall for your system + description: The purpose of this role is to install and configure a firewall 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 e51c262..0000000 --- a/meta/purpose.txt +++ /dev/null @@ -1,14 +0,0 @@ -Configures the firewall for your system. - -Different distributions use different firewall implementations. This Ansible role aims to be very simply to use. It's been designed to work with: - -|distribution|firewall | -|------------|---------------| -|Alpine |iptables | -|Archlinux |not implemented| -|CentOS 6 |iptables | -|CentOS 7 |firewalld | -|Debian |uwf | -|Fedora |frewalld | -|OpenSUSE |firealld | -|Ubuntu |uwf | diff --git a/molecule/alpine-edge/playbook.yml b/molecule/alpine-edge/playbook.yml index 7b77785..0ab9e2d 100644 --- a/molecule/alpine-edge/playbook.yml +++ b/molecule/alpine-edge/playbook.yml @@ -1,8 +1,8 @@ --- - name: Converge hosts: all - gather_facts: false - become: true + gather_facts: no + become: yes roles: - robertdebock.bootstrap diff --git a/molecule/archlinux/playbook.yml b/molecule/archlinux/playbook.yml index 7b77785..0ab9e2d 100644 --- a/molecule/archlinux/playbook.yml +++ b/molecule/archlinux/playbook.yml @@ -1,8 +1,8 @@ --- - name: Converge hosts: all - gather_facts: false - become: true + gather_facts: no + become: yes roles: - robertdebock.bootstrap diff --git a/molecule/centos-6/playbook.yml b/molecule/centos-6/playbook.yml index 7b77785..0ab9e2d 100644 --- a/molecule/centos-6/playbook.yml +++ b/molecule/centos-6/playbook.yml @@ -1,8 +1,8 @@ --- - name: Converge hosts: all - gather_facts: false - become: true + gather_facts: no + become: yes roles: - robertdebock.bootstrap diff --git a/molecule/debian-stable/playbook.yml b/molecule/debian-stable/playbook.yml index 7b77785..0ab9e2d 100644 --- a/molecule/debian-stable/playbook.yml +++ b/molecule/debian-stable/playbook.yml @@ -1,8 +1,8 @@ --- - name: Converge hosts: all - gather_facts: false - become: true + gather_facts: no + become: yes roles: - robertdebock.bootstrap diff --git a/molecule/debian-unstable/playbook.yml b/molecule/debian-unstable/playbook.yml index 7b77785..0ab9e2d 100644 --- a/molecule/debian-unstable/playbook.yml +++ b/molecule/debian-unstable/playbook.yml @@ -1,8 +1,8 @@ --- - name: Converge hosts: all - gather_facts: false - become: true + gather_facts: no + become: yes roles: - robertdebock.bootstrap diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index d7f1541..729fb1d 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 7b77785..0ab9e2d 100644 --- a/molecule/fedora-rawhide/playbook.yml +++ b/molecule/fedora-rawhide/playbook.yml @@ -1,8 +1,8 @@ --- - name: Converge hosts: all - gather_facts: false - become: true + gather_facts: no + become: yes roles: - robertdebock.bootstrap diff --git a/molecule/opensuse-leap/playbook.yml b/molecule/opensuse-leap/playbook.yml index 7b77785..0ab9e2d 100644 --- a/molecule/opensuse-leap/playbook.yml +++ b/molecule/opensuse-leap/playbook.yml @@ -1,8 +1,8 @@ --- - name: Converge hosts: all - gather_facts: false - become: true + gather_facts: no + become: yes roles: - robertdebock.bootstrap diff --git a/molecule/opensuse-tumbleweed/playbook.yml b/molecule/opensuse-tumbleweed/playbook.yml index 7b77785..0ab9e2d 100644 --- a/molecule/opensuse-tumbleweed/playbook.yml +++ b/molecule/opensuse-tumbleweed/playbook.yml @@ -1,8 +1,8 @@ --- - name: Converge hosts: all - gather_facts: false - become: true + gather_facts: no + become: yes roles: - robertdebock.bootstrap diff --git a/molecule/ubuntu-artful/playbook.yml b/molecule/ubuntu-artful/playbook.yml index 7b77785..0ab9e2d 100644 --- a/molecule/ubuntu-artful/playbook.yml +++ b/molecule/ubuntu-artful/playbook.yml @@ -1,8 +1,8 @@ --- - name: Converge hosts: all - gather_facts: false - become: true + gather_facts: no + become: yes roles: - robertdebock.bootstrap diff --git a/molecule/ubuntu-devel/playbook.yml b/molecule/ubuntu-devel/playbook.yml index 7b77785..0ab9e2d 100644 --- a/molecule/ubuntu-devel/playbook.yml +++ b/molecule/ubuntu-devel/playbook.yml @@ -1,8 +1,8 @@ --- - name: Converge hosts: all - gather_facts: false - become: true + 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..1a35502 --- /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: firewall-debian + box: debian/stretch64 + - name: firewall-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..0ab9e2d --- /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-firewall 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 }}"