Skip to content
Snippets Groups Projects
Commit c745813f authored by nimrod's avatar nimrod
Browse files

Merge branch 'master' of /home/nimrod/Documents/Shore/Ansible/example

# Conflicts:
#	README.rst
#	defaults/main.yml
#	handlers/main.yml
#	molecule.yml
#	tasks/main.yml
#	tests/playbook.yml
#	vars/main.yml
parents d1047706 4551361a
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,7 @@
- id: check-merge-conflict
- id: flake8
- id: check-symlinks
- repo: https://www.shore.co.il/git/ansible-pre-commit
- repo: https://github.com/adarnimrod/ansible-pre-commit.git
sha: 0fadd691465b97db8992cfc66650f630e433324b
hooks:
- id: ansible-syntax-check
......
---
language: python
python: "2.7"
dist: trusty
sudo: false
group: beta
services: [docker]
cache:
- pip
- directories:
- $HOME/.pre-commit
install:
- pip install -r tests/requirements.txt | cat
- ansible-galaxy install git+file://$(pwd),$(git rev-parse --abbrev-ref HEAD) -p .molecule/roles
- molecule dependency
script:
- pre-commit run --all-files
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
email: false
bgp-spamd
#########
Provision spamd with spam list distributed via bpg. For more information visit
`bgp-spamd.net <http://bgp-spamd.net/>`_. Configuration of PF is more custom and
out of scope for this role, however one can include the configuration snippet
created by this role by adding the following to your :code:`pf.conf`.
.. image:: https://travis-ci.org/adarnimrod/bgp-spamd.svg?branch=master
:target: https://travis-ci.org/adarnimrod/bgp-spamd
Provision spamd with spam list distributed via BGP using OpenBGPD on OpenBSD.
For more information visit `bgp-spamd.net <http://bgp-spamd.net/>`_.
Configuration of PF is more custom and out of scope for this role, however one
can include the configuration snippet created by this role by adding the
following to your :code:`pf.conf`.
.. code::
......@@ -23,8 +27,7 @@ your :code:`pf.conf`.
Requirements
------------
See :code:`meta/main.yml`, :code:`tests/requirements.yml` and assertions at
the top of :code:`tasks/main.yml`.
See :code:`meta/main.yml` and assertions at the top of :code:`tasks/main.yml`.
Role Variables
--------------
......@@ -44,21 +47,22 @@ See :code:`tests/playbook.yml`.
Testing
-------
Testing requires Virtualbox and Vagrant and Python 2.7. Install the Python
dependencies, add pre-commit hooks by running:
Testing requires Python 2.7 and either Docker or Vagrant and Virtualbox.
Install the Python dependencies, dependent roles and roles required for
testing:
.. code:: shell
pip install -r tests/requirements.txt
pre-commit install
ansible-galaxy install git+file://$(pwd),$(git rev-parse --abbrev-ref HEAD) -p .molecule/roles
molecule dependency
To run the full test suite:
.. code:: shell
ansible-galaxy install git+file://$(pwd),$(git rev-parse --abbrev-ref HEAD) -p .molecule/roles
molecule test --platform all
pre-commit run --all-files
molecule test --platform all
License
-------
......@@ -73,3 +77,9 @@ Nimrod Adar, `contact me <nimrod@shore.co.il>`_ or visit my `website
<https://www.shore.co.il/>`_. Patches are welcome via `git send-email
<http://git-scm.com/book/en/v2/Git-Commands-Email>`_. The repository is located
at: https://www.shore.co.il/git/.
TODO
----
- Better tests in Travis CI (currently everything is done offline because of
dependency on VirtualBox).
......@@ -5,6 +5,7 @@ retry_files_enabled = False
roles_path = .molecule/roles:.molecule/../roles:../:../../
command_warnings = True
deprecation_warnings = True
callback_whitelist = profile_tasks
[ssh_connection]
pipelining = True
---
# defaults file for ansible-role-bgp-spamd
# defaults file for bgp-spamd
spamd_hostname: '{{ ansible_fqdn }}' # The hostname sent by spamd.
spamd_alloweddomains: [] # Allowed domains to be whitelisted.
---
# handlers file for ansible-role-bgp-spamd
# handlers file for bgp-spamd
- name: Reload PF
command: /sbin/pfctl -f /etc/pf.conf
......
galaxy_info:
author: Nimrod Adar
description: An example Ansible role
description: Provision spamd with spam list distributed via BGP using OpenBGPD on OpenBSD
company: Shore technologies
license: MIT
min_ansible_version: 2.0
......
......@@ -4,6 +4,9 @@ ansible:
playbook: tests/playbook.yml
diff: True
config_file: ../ansible.cfg
dependency:
name: galaxy
requirements_file: tests/requirements.yml
vagrant:
......@@ -14,7 +17,7 @@ vagrant:
- name: openbsd
box: kaorimatz/openbsd-6.0-amd64
instances:
- name: ansible-role-bgp-spamd
- name: bgp-spamd
options:
append_platform_to_hostname: yes
raw_config_args:
......
---
# tasks file for ansible-role-bgp-spamd
# tasks file for bgp-spamd
- name: Assertions
assert:
......
---
- hosts: ansible-role-bgp-spamd-openbsd
- hosts: bgp-spamd-openbsd
gather_facts: false
roles: [openbsd_bootstrap]
roles: [openbsd-bootstrap]
- hosts: all
pre_tasks:
......@@ -11,5 +11,5 @@
dest: /etc/pf.conf
state: present
roles:
- role: ansible-role-bgp-spamd
- role: bgp-spamd
spamd_alloweddomains: ["{{ ansible_domain }}"]
ansible==2.2.0.0
testinfra==1.4.3
molecule==1.13.0
ansible-lint==3.4.4
pre-commit==0.9.3
testinfra==1.4.5
molecule==1.17.0
ansible-lint==3.4.8
pre-commit==0.9.4
piprot==0.9.7
python-vagrant==0.5.14
docker-py==1.10.6
netaddr==0.7.18
passlib==1.7.0
bcrypt==3.1.1
---
- src: https://www.shore.co.il/git/ansible-role-openbsd-bootstrap
scm: git
name: openbsd_bootstrap
- src: https://www.shore.co.il/git/ansible-role-debian-bootstrap
scm: git
name: debian_bootstrap
- src: adarnimrod.openbsd-bootstrap
name: openbsd-bootstrap
- src: adarnimrod.debian-bootstrap
name: debian-bootstrap
from testinfra.utils.ansible_runner import AnsibleRunner
testinfra_hosts = AnsibleRunner('.molecule/ansible_inventory').get_hosts('all')
def test_example(Command):
assert Command('uname').rc == 0
def test_root(Command, Sudo):
with Sudo():
assert Command('whoami').stdout == 'root'
assert Command('whoami').stdout.strip() == 'root'
---
# vars file for ansible-role-bgp-spamd
# vars file for bgp-spamd
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment