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

- Initial commit.

parents
No related branches found
No related tags found
No related merge requests found
*.sw[po]
~*
*~
.DS_Store
__pycache__
*.py[cod]
.cache/
.molecule/
.vagrant/
*.log
*.retry
- repo: git://github.com/pre-commit/pre-commit-hooks
sha: adbb569fe9a64ad9bce3b53a77f1bc39ef31f682
hooks:
- id: check-added-large-files
- id: check-json
- id: check-xml
- id: check-yaml
- id: check-merge-conflict
- repo: https://www.shore.co.il/git/ansible-pre-commit/
sha: 4c651d686a9a88f9ec65d9490897fee71cdce98d
hooks:
- id: ansible-pre-commit
files: tests/playbook.yml
The MIT License (MIT)
Copyright (c) 2016 Adar Nimrod
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Example
#######
An (empty) example Ansible role complete with working tests out of the box. For
more information read the `blog post
<https://www.shore.co.il/blog/ansible-example-role/>`_.
Requirements
------------
- `Ansible 2.0 or later <https://www.ansible.com/>`_.
- `OpenBSD 5.9 or later <http://www.openbsd.org/>`_.
Role Variables
--------------
None.
Dependencies
------------
See :code:`meta/main.yml`.
Example Playbook
----------------
See :code:`tests/playbook.yml`.
Testing
-------
To install the dependencies:
.. code:: shell
ansible-galaxy install git+file://$(pwd),$(git rev-parse --abbrev-ref HEAD)
To run the full test suite:
.. code:: shell
molecule test
License
-------
This software is licensed under the MIT license (see the :code:`LICENSE.txt`
file).
Author Information
------------------
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/.
[defaults]
host_key_checking = False
retry_files_enabled = False
roles_path = .molecule/roles
command_warnings = True
deprecation_warnings = True
---
# defaults file for ansible-role-example
---
# handlers file for ansible-role-example
galaxy_info:
author: Nimrod Adar
description: An example Ansible role
company: Shore technologies
license: MIT
min_ansible_version: 2.0
platforms:
- name: OpenBSD
versions:
- 5.9
galaxy_tags: [ ansible ]
dependencies:
- src: https://www.shore.co.il/git/ansible-role-openbsd-bootstrap
scm: git
name: bootstrap
---
ansible:
verbose: v
playbook: tests/playbook.yml
molecule:
testinfra_dir: tests
ansible_config_template: ansible.cfg
vagrant:
platforms:
- name: openbsd
box: kaorimatz/openbsd-5.9-amd64
instances:
- name: ansible-role-nsd
options:
append_platform_to_hostname: yes
raw_config_args:
- 'vm.synced_folder ".", "/vagrant", disabled: true'
---
# tasks file for ansible-role-example
- assert:
that:
- ansible_os_family == 'OpenBSD'
- ansible_distribution_release == '5.9'
---
- hosts: all
gather_facts: false
roles:
- role: ansible-role-example
def test_example(Command):
assert Command('uname').rc == 0
---
# vars file for ansible-role-example
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment