Skip to content

Commit cb661f3

Browse files
committed
Add/modify/remove files, make the skeleton specific to Ansible roles
1 parent 2b479fd commit cb661f3

12 files changed

+137
-18
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ repos:
5454
rev: v4.1.0a0
5555
hooks:
5656
- id: ansible-lint
57-
# files: molecule/default/playbook.yml
57+
files: molecule/default/playbook.yml
5858
- repo: https://github.com/antonbabenko/pre-commit-terraform.git
5959
rev: v1.11.0
6060
hooks:

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ install:
88
- pip install --upgrade -r requirements-test.txt
99
script:
1010
- pre-commit run --all-files
11+
- molecule test

CONTRIBUTING.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ Before contributing, we encourage you to read our CONTRIBUTING policy
1515

1616
If you want to report a bug or request a new feature, the most direct
1717
method is to [create an
18-
issue](https://github.com/cisagov/skeleton-generic/issues) in this
19-
repository. We recommend that you first search through existing
18+
issue](https://github.com/cisagov/skeleton-ansible-role/issues) in
19+
this repository. We recommend that you first search through existing
2020
issues (both open and closed) to check if your particular issue has
2121
already been reported. If it has then you might want to add a comment
2222
to the existing issue. If it hasn't then feel free to create a new
@@ -25,8 +25,8 @@ one.
2525
## Pull requests ##
2626

2727
If you choose to [submit a pull
28-
request](https://github.com/cisagov/skeleton-generic/pulls), you will
29-
notice that our continuous integration (CI) system runs a fairly
28+
request](https://github.com/cisagov/skeleton-ansible-role/pulls), you
29+
will notice that our continuous integration (CI) system runs a fairly
3030
extensive set of linters and syntax checkers. Your pull request may
3131
fail these checks, and that's OK. If you want you can stop there and
3232
wait for us to make the necessary corrections to ensure your code
@@ -79,9 +79,9 @@ can create and configure the Python virtual environment with these
7979
commands:
8080

8181
```bash
82-
cd skeleton-generic
83-
pyenv virtualenv <python_version_to_use> skeleton-generic
84-
pyenv local skeleton-generic
82+
cd skeleton-ansible-role
83+
pyenv virtualenv <python_version_to_use> skeleton-ansible-role
84+
pyenv local skeleton-ansible-role
8585
pip install -r requirements-dev.txt
8686
```
8787

README.md

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,38 @@
1-
# skeleton-generic #
1+
# skeleton-ansible-role #
22

3-
[![Build Status](https://travis-ci.com/cisagov/skeleton-generic.svg?branch=develop)](https://travis-ci.com/cisagov/skeleton-generic)
3+
[![Build Status](https://travis-ci.com/cisagov/skeleton-ansible-role.svg?branch=develop)](https://travis-ci.com/cisagov/skeleton-ansible-role)
44

5-
This is a generic skeleton project that can be used to quickly get a
6-
new [cisagov](https://github.com/cisagov) GitHub project started.
7-
This skeleton project contains [licensing information](LICENSE.md), as
8-
well as [pre-commit hooks](https://pre-commit.com) and a [Travis
9-
CI](https://travis-ci.com) configuration appropriate for the major
10-
languages that we use.
5+
This is a skeleton project that can be used to quickly get a new
6+
[cisagov](https://github.com/cisagov) Ansible role GitHub project
7+
started. This skeleton project contains [licensing
8+
information](LICENSE.md), as well as [pre-commit
9+
hooks](https://pre-commit.com) and a [Travis
10+
CI](https://travis-ci.com) configuration appropriate for an Ansible
11+
role.
1112

12-
In many cases you will instead want to use one of the more specific
13-
skeleton projects derived from this one.
13+
## Requirements ##
14+
15+
None.
16+
17+
## Role Variables ##
18+
19+
None.
20+
21+
## Dependencies ##
22+
23+
None.
24+
25+
## Example Playbook ##
26+
27+
Here's how to use it in a playbook:
28+
29+
```yaml
30+
- hosts: all
31+
become: yes
32+
become_method: sudo
33+
roles:
34+
- skeleton
35+
```
1436
1537
## Contributing ##
1638
@@ -29,3 +51,7 @@ dedication](https://creativecommons.org/publicdomain/zero/1.0/).
2951
All contributions to this project will be released under the CC0
3052
dedication. By submitting a pull request, you are agreeing to comply
3153
with this waiver of copyright interest.
54+
55+
## Author Information ##
56+
57+
First Last - <[email protected]>

meta/main.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
galaxy_info:
3+
author: First Last
4+
description: Skeleton Ansible role
5+
company: CISA NCATS
6+
license: CC0
7+
min_ansible_version: 2.0
8+
platforms:
9+
- name: Debian
10+
versions:
11+
- stretch
12+
- name: Amazon
13+
versions:
14+
- 2018.03
15+
galaxy_tags:
16+
- skeleton
17+
18+
dependencies: []

molecule/default/Dockerfile.j2

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Molecule managed
2+
3+
{% if item.registry is defined %}
4+
FROM {{ item.registry.url }}/{{ item.image }}
5+
{% else %}
6+
FROM {{ item.image }}
7+
{% endif %}
8+
9+
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
10+
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \
11+
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; \
12+
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \
13+
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
14+
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi

molecule/default/INSTALL.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
*******
2+
Docker driver installation guide
3+
*******
4+
5+
Requirements
6+
============
7+
8+
* General molecule dependencies (see https://molecule.readthedocs.io/en/latest/installation.html)
9+
* Docker Engine
10+
* docker-py
11+
* docker
12+
13+
Install
14+
=======
15+
16+
$ sudo pip install docker-py

molecule/default/molecule.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
dependency:
3+
name: galaxy
4+
driver:
5+
name: docker
6+
lint:
7+
name: yamllint
8+
platforms:
9+
- name: debian9
10+
image: debian:stretch-slim
11+
- name: amazon2018.03
12+
image: amazonlinux:2018.03
13+
provisioner:
14+
name: ansible
15+
lint:
16+
name: ansible-lint
17+
scenario:
18+
name: default
19+
verifier:
20+
name: testinfra
21+
lint:
22+
name: flake8

molecule/default/playbook.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
- name: Converge
3+
hosts: all
4+
roles:
5+
- role: skeleton-role
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import os
2+
import pytest
3+
4+
import testinfra.utils.ansible_runner
5+
6+
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
7+
os.environ["MOLECULE_INVENTORY_FILE"]
8+
).get_hosts("all")
9+
10+
11+
@pytest.mark.parametrize("x", [True])
12+
def test_packages(host, x):
13+
assert x

requirements-test.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
black
2+
docker # Needed for molecule to work correctly
3+
molecule
24
pre-commit
35
pyupgrade

tasks/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
# tasks file for skeleton

0 commit comments

Comments
 (0)