Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
Starting the project with a simple boilerplate.
  • Loading branch information
faabiosr committed Feb 12, 2019
0 parents commit 38e39d1
Show file tree
Hide file tree
Showing 15 changed files with 272 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@
*.retry
*/__pycache__
*.pyc
18 changes: 18 additions & 0 deletions .travis.yml
@@ -0,0 +1,18 @@
---
language: python
services: docker

env:
global:
- ROLE_NAME: consul

install:
- pip install -r requirements.txt

before_script:
- cd ../
- mv ansible-role-${ROLE_NAME} fabiorphp.${ROLE_NAME}
- cd fabiorphp.${ROLE_NAME}

script:
- molecule test
74 changes: 74 additions & 0 deletions CODE_OF_CONDUCT.md
@@ -0,0 +1,74 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at fabiorphp@gmail.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
56 changes: 56 additions & 0 deletions CONTRIBUTING.md
@@ -0,0 +1,56 @@
# Contributing

By participating to this project, you agree to abide our [code of conduct](/CODE_OF_CONDUCT.md).

## Setup your machine

Prerequisites:

* [Python](https://www.python.org)
* [Ansible](https://ansible.com/)
* [Docker](https://docker.com)

Clone `ansible-role-consul` from source into your favorite path:
```sh
$ git clone git@github.com:fabiorphp/ansible-role-consul.git
$ cd ansible-role-consul
```

Install Python dependencies (Please use the Python Virtualenv):
```sh
$ pip install -r requirements.txt
```

## Running tests
After the installation of python dependencies run the command below:
```sh
$ molecule test
```

## Create a commit

Commit messages should be well formatted.
Start your commit message with the type. Choose one of the following:
`feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `chore`, `revert`, `add`, `remove`, `move`, `bump`, `update`, `release`

After a colon, you should give the message a title, starting with uppercase and ending without a dot.
Keep the width of the text at 72 chars.
The title must be followed with a newline, then a more detailed description.

Please reference any GitHub issues on the last line of the commit message (e.g. `See #123`, `Closes #123`, `Fixes #123`).

An example:

```
docs: Add example for --release-notes flag
I added an example to the docs of the `--release-notes` flag to make
the usage more clear. The example is an realistic use case and might
help others to generate their own changelog.
See #284
```

## Submit a pull request

Push your branch to your `ansible-role-consul` fork and open a pull request against the master branch.
21 changes: 21 additions & 0 deletions LICENSE
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2019 Fábio da Silva Ribeiro

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.
11 changes: 11 additions & 0 deletions README.md
@@ -0,0 +1,11 @@
# Ansible Role: Consul
An ansible role to install and configure Consul agent.

## Requirements
- [Ansible >= 2.5](https://ansible.com/)

## Dependencies
None.

## Author Information
This role was created in 2019 by [Fábio Ribeiro](https://github.com/fabiorphp).
2 changes: 2 additions & 0 deletions defaults/main.yml
@@ -0,0 +1,2 @@
---
# defaults file for fabiorphp.consul
20 changes: 20 additions & 0 deletions meta/main.yml
@@ -0,0 +1,20 @@
---
dependencies: []

galaxy_info:
author: fabiorphp
description: An ansible role to install and configure Consul agent.
license: "license (BSD, MIT)"
min_ansible_version: 2.5
platforms:
- name: EL
versions:
- 7
galaxy_tags:
- hashicorp
- consul
- service
- discovery
- mesh
- kv
- health
14 changes: 14 additions & 0 deletions molecule/default/Dockerfile.j2
@@ -0,0 +1,14 @@
# Molecule managed

{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}

RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi
22 changes: 22 additions & 0 deletions molecule/default/molecule.yml
@@ -0,0 +1,22 @@
---
dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
options:
config-file: molecule/default/yaml-lint.yml
platforms:
- name: instance
image: centos:7
provisioner:
name: ansible
lint:
name: ansible-lint
scenario:
name: default
verifier:
name: testinfra
lint:
name: flake8
5 changes: 5 additions & 0 deletions molecule/default/playbook.yml
@@ -0,0 +1,5 @@
---
- name: Converge
hosts: all
roles:
- role: fabiorphp.consul
14 changes: 14 additions & 0 deletions molecule/default/tests/test_default.py
@@ -0,0 +1,14 @@
import os

import testinfra.utils.ansible_runner

testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')


def test_hosts_file(host):
f = host.file('/etc/hosts')

assert f.exists
assert f.user == 'root'
assert f.group == 'root'
6 changes: 6 additions & 0 deletions molecule/default/yaml-lint.yml
@@ -0,0 +1,6 @@
---
extends: default
rules:
line-length:
max: 180
level: warning
4 changes: 4 additions & 0 deletions requirements.txt
@@ -0,0 +1,4 @@
ansible>=2.5
docker-py==1.10.6
molecule==2.19.0
pyOpenSSL==18.0.0
2 changes: 2 additions & 0 deletions tasks/main.yml
@@ -0,0 +1,2 @@
---
# tasks file for fabiorphp.consul

0 comments on commit 38e39d1

Please sign in to comment.