Update roles.

This commit is contained in:
Robert de Bock 2019-12-16 07:47:17 +01:00
parent af5f550208
commit 30ec107002
812 changed files with 4952 additions and 20579 deletions

View File

@ -1,7 +1,7 @@
namespace: "robertdebock"
name: "development_environment"
description: Install everything you need to develop Ansible roles.
version: "1.2.0"
version: "1.2.1"
readme: "README.md"
authors:
- "Robert de Bock"

View File

@ -0,0 +1,5 @@
#
# Ansible managed
#
exclude_paths:
- ./meta/exception.yml

View File

@ -7,21 +7,22 @@ about: Create a report to help us improve
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Run this role:
2. See error
**Playbook**
Please paste the playbook you are using. (Consider `requirements.yml` and
optionally the command you've invoked.)
```yaml
YOUR PLAYBOOK HERE
```
**Output**
Show at least the error, possible related output, maybe just all the output.
**Expected behavior**
A clear and concise description of what you expected to happen.
**Error**
Please show the resulting error. If applicable a snippet of the playbook including the role ran with `-vvv`
**Environment**
- Control node OS: [e.g. Debian 9]
- Control node Ansible version: [e.g. 2.6.2]
- Managed node OS: [e.g. CentOS 7]
**Additional context**
Add any other context about the problem here.
- Control node OS: [e.g. Debian 9] (`cat /etc/os-release`)
- Control node Ansible version: [e.g. 2.9.1] (`ansible --version`)
- Managed node OS: [e.g. CentOS 7] (`cat /etc/os-release`)

View File

@ -1,4 +1,7 @@
---
#
# Ansible managed
#
repository:
description: Install and configure ansible on your system.
homepage: https://robertdebock.nl/

View File

@ -1,3 +1,4 @@
molecule/*/.molecule
.molecule
*.log
*.swp
.tox

View File

@ -1,85 +1,44 @@
---
sudo: required
#
# Ansible managed
#
language: python
services: docker
python:
- "3.7"
services:
- docker
env:
- version=">=2.7,<2.8" distro="alpine-latest"
- version="" distro="alpine-latest"
- version="devel" distro="alpine-latest"
- version=">=2.7,<2.8" distro="alpine-edge"
- version="" distro="alpine-edge"
- version="devel" distro="alpine-edge"
- version=">=2.7,<2.8" distro="archlinux"
- version="" distro="archlinux"
- version="devel" distro="archlinux"
- version=">=2.7,<2.8" distro="centos-6"
- version="" distro="centos-6"
- version="devel" distro="centos-6"
- version=">=2.7,<2.8" distro="centos-latest"
- version="" distro="centos-latest"
- version="devel" distro="centos-latest"
- version=">=2.7,<2.8" distro="debian-stable"
- version="" distro="debian-stable"
- version="devel" distro="debian-stable"
- version=">=2.7,<2.8" distro="debian-unstable"
- version="" distro="debian-unstable"
- version="devel" distro="debian-unstable"
- version=">=2.7,<2.8" distro="fedora-latest"
- version="" distro="fedora-latest"
- version="devel" distro="fedora-latest"
- version=">=2.7,<2.8" distro="fedora-rawhide"
- version="" distro="fedora-rawhide"
- version="devel" distro="fedora-rawhide"
- version=">=2.7,<2.8" distro="opensuse-leap"
- version="" distro="opensuse-leap"
- version="devel" distro="opensuse-leap"
- version=">=2.7,<2.8" distro="ubuntu-rolling"
- version="" distro="ubuntu-rolling"
- version="devel" distro="ubuntu-rolling"
- version=">=2.7,<2.8" distro="ubuntu-latest"
- version="" distro="ubuntu-latest"
- version="devel" distro="ubuntu-latest"
- version=">=2.7,<2.8" distro="ubuntu-devel"
- version="" distro="ubuntu-devel"
- version="devel" distro="ubuntu-devel"
global:
namespace="robertdebock"
matrix:
- image="amazonlinux"
- image="alpine"
- image="alpine" tag="edge"
# - namespace="archlinux" image="base"
- image="debian" tag="unstable"
- image="debian"
- image="fedora"
- image="fedora" tag="rawhide"
- image="ubuntu"
matrix:
allow_failures:
- env: version=">=2.7,<2.8" distro="alpine-edge"
- env: version="" distro="alpine-edge"
- env: version="devel" distro="alpine-edge"
- env: version="devel" distro="alpine-latest"
- env: version="devel" distro="archlinux"
- env: version="devel" distro="centos-6"
- env: version="devel" distro="centos-latest"
- env: version="devel" distro="debian-stable"
- env: version=">=2.7,<2.8" distro="debian-unstable"
- env: version="" distro="debian-unstable"
- env: version="devel" distro="debian-unstable"
- env: version="devel" distro="fedora-latest"
- env: version=">=2.7,<2.8" distro="fedora-rawhide"
- env: version="" distro="fedora-rawhide"
- env: version="devel" distro="fedora-rawhide"
- env: version="devel" distro="opensuse-leap"
- env: version="devel" distro="ubuntu-rolling"
- env: version=">=2.7,<2.8" distro="ubuntu-devel"
- env: version="" distro="ubuntu-devel"
- env: version="devel" distro="ubuntu-devel"
- env: version="devel" distro="ubuntu-latest"
- env: image="alpine" tag="edge"
- env: image="debian" tag="unstable"
- env: image="fedora" tag="rawhide"
cache:
- pip
install:
- pip install --upgrade pip
- if [ "${version}" != "devel" ] ; then pip install ansible"${version}" ; fi
- if [ "${version}" = "devel" ] ; then pip install git+https://github.com/ansible/ansible.git@devel ; fi
- pip install molecule
- pip install docker
- pip install tox
script:
- if [ "${expectation}" = "fail" ] ; then ! molecule test --scenario-name "${distro}" ; else molecule test --scenario-name "${distro}" ; fi
- tox --parallel all
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/

View File

@ -2,14 +2,14 @@ ansible
=========
<img src="https://docs.ansible.com/ansible-tower/3.2.4/html_ja/installandreference/_static/images/logo_invert.png" width="10%" height="10%" alt="Ansible logo" align="right"/>
<a href="https://travis-ci.org/robertdebock/ansible-role-ansible"><img src="https://travis-ci.org/robertdebock/ansible-role-ansible.svg?branch=master" alt="Build status" align="left"/></a>
<a href="https://travis-ci.org/robertdebock/ansible-role-ansible"> <img src="https://travis-ci.org/robertdebock/ansible-role-ansible.svg?branch=master" alt="Build status"/></a> <img src="https://img.shields.io/ansible/role/d/35944"/> <img src="https://img.shields.io/ansible/quality/35944"/>
Install and configure ansible on your system.
Example Playbook
----------------
This example is taken from `molecule/resources/playbook.yml`:
This example is taken from `molecule/resources/playbook.yml` and is tested on each push, pull request and release.
```yaml
---
- name: Converge
@ -21,7 +21,7 @@ This example is taken from `molecule/resources/playbook.yml`:
- robertdebock.ansible
```
The machine you are running this on, may need to be prepared.
The machine you are running this on, may need to be prepared, I use this playbook to ensure everything is in place to let the role work.
```yaml
---
- name: Prepare
@ -32,6 +32,24 @@ The machine you are running this on, may need to be prepared.
roles:
- role: robertdebock.bootstrap
- role: robertdebock.epel
- role: robertdebock.buildtools
- role: robertdebock.python_pip
```
After running this role, this playbook runs to verify that everything works, this may be a good example how you can use this role.
```yaml
---
- name: Verify
hosts: all
become: no
gather_facts: no
tasks:
- name: run ansible
shell: ansible --version > ansible.version
args:
creates: ansible.version
```
Also see a [full explanation and example](https://robertdebock.nl/how-to-use-these-roles.html) on how to use these roles.
@ -69,6 +87,8 @@ The following roles can be installed to ensure all requirements are met, using `
---
- robertdebock.bootstrap
- robertdebock.epel
- robertdebock.buildtools
- robertdebock.python_pip
```
@ -84,42 +104,80 @@ Here is an overview of related roles:
Compatibility
-------------
This role has been tested against the following distributions and Ansible version:
This role has been tested on these [container images](https://hub.docker.com/):
|distribution|ansible 2.7|ansible 2.8|ansible devel|
|------------|-----------|-----------|-------------|
|alpine-edge*|yes|yes|yes*|
|alpine-latest|yes|yes|yes*|
|archlinux|yes|yes|yes*|
|centos-6|yes|yes|yes*|
|centos-latest|yes|yes|yes*|
|debian-stable|yes|yes|yes*|
|debian-unstable*|yes|yes|yes*|
|fedora-latest|yes|yes|yes*|
|fedora-rawhide*|yes|yes|yes*|
|opensuse-leap|yes|yes|yes*|
|ubuntu-devel*|yes|yes|yes*|
|ubuntu-latest|yes|yes|yes*|
|ubuntu-rolling|yes|yes|yes*|
|container|tag|allow_failures|
|---------|---|--------------|
|amazonlinux|latest|no|
|alpine|latest|no|
|alpine|edge|yes|
|debian|unstable|yes|
|debian|latest|no|
|fedora|latest|no|
|fedora|rawhide|yes|
|ubuntu|latest|no|
This role has been tested on these Ansible versions:
- ansible>=2.8, <2.9
- ansible>=2.9
- git+https://github.com/ansible/ansible.git@devel
Exceptions
----------
Some variarations of the build matrix do not work. These are the variations and reasons why the build won't work:
| variation | reason |
|---------------------------|------------------------|
| amazonlinux:1 | No package matching 'python3-pip' |
A single star means the build may fail, it's marked as an experimental build.
Testing
-------
[Unit tests](https://travis-ci.org/robertdebock/ansible-role-ansible) are done on every commit and periodically.
[Unit tests](https://travis-ci.org/robertdebock/ansible-role-ansible) are done on every commit, pull request, release and periodically.
If you find issues, please register them in [GitHub](https://github.com/robertdebock/ansible-role-ansible/issues)
To test this role locally please use [Molecule](https://github.com/ansible/molecule):
Testing is done using [Tox](https://tox.readthedocs.io/en/latest/) and [Molecule](https://github.com/ansible/molecule):
[Tox](https://tox.readthedocs.io/en/latest/) tests multiple ansible versions.
[Molecule](https://github.com/ansible/molecule) tests multiple distributions.
To test using the defaults (any installed ansible version, namespace: `robertdebock`, image: `fedora`, tag: `latest`):
```
pip install molecule
molecule test
# Or select a specific image:
image=ubuntu molecule test
# Or select a specific image and a specific tag:
image="debian" tag="stable" tox
```
To test on Amazon EC2, configure [~/.aws/credentials](https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/credentials.html) and set a region using `export AWS_REGION=eu-central-1` before running `molecule test --scenario-name ec2`.
Or you can test multiple versions of Ansible, and select images:
Tox allows multiple versions of Ansible to be tested. To run the default (namespace: `robertdebock`, image: `fedora`, tag: `latest`) tests:
There are many specific scenarios available, please have a look in the `molecule/` directory.
```
tox
# To run CentOS (namespace: `robertdebock`, tag: `latest`)
image="centos" tox
# Or customize more:
image="debian" tag="stable" tox
```
Modules
-------
This role uses the following modules:
```yaml
---
- file
- ini_file
- lineinfile
```
License
-------

View File

@ -1 +1,2 @@
{install_date: 'Tue Sep 17 04:21:03 2019', version: 2.0.7}
install_date: Mon Dec 16 06:44:21 2019
version: 2.1.1

View File

@ -0,0 +1,4 @@
---
exceptions:
- variation: amazonlinux:1
reason: "No package matching 'python3-pip'"

View File

@ -5,26 +5,26 @@ galaxy_info:
description: Install and configure ansible on your system.
license: Apache-2.0
company: none
min_ansible_version: 2.6
min_ansible_version: 2.8
platforms:
- name: Amazon
versions:
- Candidate
- name: Alpine
versions:
- all
- name: ArchLinux
version:
versions:
- all
- name: Debian
versions:
- all
- name: EL
version:
- 6
- 7
- name: Fedora
versions:
- all
- name: OpenSUSE
- 7
- 8
- name: Fedora
versions:
- all
- name: Ubuntu
@ -34,14 +34,5 @@ galaxy_info:
galaxy_tags:
- ansible
- alpine
- archlinux
- centos
- debian
- el
- fedora
- opensuse
- rhel
- ubuntu
dependencies: []

View File

@ -1,27 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ansible-alpine-edge
image: alpine:edge
pre_build_image: yes
command: sh -c "while true ; do sleep 1 ; done"
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: alpine-edge

View File

@ -1,27 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ansible-alpine-latest
image: alpine:latest
pre_build_image: yes
command: sh -c "while true ; do sleep 1 ; done"
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: alpine-latest

View File

@ -1,26 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ansible-archlinux
image: archlinux/base
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: archlinux

View File

@ -1,26 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ansible-centos-6
image: centos:6
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: centos-6

View File

@ -1,26 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ansible-centos-latest
image: centos:latest
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: centos-latest

View File

@ -1,26 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ansible-debian-stable
image: debian:stable
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: debian-stable

View File

@ -1,26 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ansible-debian-unstable
image: debian:unstable
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: debian-unstable

View File

@ -1,4 +1,7 @@
---
#
# Ansible managed
#
dependency:
name: galaxy
options:
@ -8,63 +11,19 @@ lint:
driver:
name: docker
platforms:
- name: ansible-alpine-edge
image: alpine:edge
pre_build_image: yes
command: sh -c "while true ; do sleep 1 ; done"
- name: ansible-alpine-latest
image: alpine:latest
pre_build_image: yes
command: sh -c "while true ; do sleep 1 ; done"
- name: ansible-archlinux
image: archlinux/base
pre_build_image: yes
- name: ansible-centos-6
image: centos:6
pre_build_image: yes
- name: ansible-centos-latest
image: centos:latest
pre_build_image: yes
- name: ansible-debian-stable
image: debian:stable
pre_build_image: yes
- name: ansible-debian-unstable
image: debian:unstable
pre_build_image: yes
- name: ansible-fedora-latest
image: fedora:latest
pre_build_image: yes
- name: ansible-fedora-rawhide
image: fedora:rawhide
pre_build_image: yes
- name: ansible-opensuse-leap
image: opensuse/leap
pre_build_image: yes
- name: ansible-ubuntu-latest
image: ubuntu:latest
pre_build_image: yes
- name: ansible-ubuntu-rolling
image: ubuntu:rolling
pre_build_image: yes
- name: ansible-ubuntu-devel
image: ubuntu:devel
- name: "ansible-${image:-fedora}-${tag:-latest}${TOX_ENVNAME}"
image: "${namespace:-robertdebock}/${image:-fedora}:${tag:-latest}"
command: /sbin/init
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
privileged: yes
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
verifier:
name: ansible
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
inventory:
host_vars:
ansible-fedora-latest:
ansible_python_interpreter: /usr/bin/python3
ansible-fedora-rawhide:
ansible_python_interpreter: /usr/bin/python3
enabled: no
scenario:
name: default

View File

@ -6,6 +6,6 @@
roles:
- role: robertdebock.bootstrap
- role: robertdebock.buildtools
- role: robertdebock.epel
- role: robertdebock.buildtools
- role: robertdebock.python_pip

View File

@ -0,0 +1,11 @@
---
- name: Verify
hosts: all
become: no
gather_facts: no
tasks:
- name: run ansible
shell: ansible --version > ansible.version
args:
creates: ansible.version

View File

@ -1,15 +0,0 @@
# Amazon EC2
To test on Amazon elastic compute cloud (EC2), set this variable:
```
export EC2_REGION=eu-central-1
```
And save the credentials:
```
cat ~/.aws/credentials
[default]
aws_access_key_id=YOUR_KEY_ID
aws_secret_access_key=YOUR_ACCESS_KEY
```

View File

@ -1,125 +0,0 @@
---
- name: Create
hosts: localhost
connection: local
gather_facts: false
no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}"
vars:
ssh_user: ec2-user
ssh_port: 22
security_group_name: molecule
security_group_description: Security group for testing Molecule
security_group_rules:
- proto: tcp
from_port: "{{ ssh_port }}"
to_port: "{{ ssh_port }}"
cidr_ip: '0.0.0.0/0'
- proto: icmp
from_port: 8
to_port: -1
cidr_ip: '0.0.0.0/0'
security_group_rules_egress:
- proto: -1
from_port: 0
to_port: 0
cidr_ip: '0.0.0.0/0'
keypair_name: molecule_key
keypair_path: "{{ lookup('env', 'MOLECULE_EPHEMERAL_DIRECTORY') }}/ssh_key"
tasks:
- name: Create security group
ec2_group:
name: "{{ security_group_name }}"
description: "{{ security_group_name }}"
rules: "{{ security_group_rules }}"
rules_egress: "{{ security_group_rules_egress }}"
- name: Test for presence of local keypair
stat:
path: "{{ keypair_path }}"
register: keypair_local
- name: Delete remote keypair
ec2_key:
name: "{{ keypair_name }}"
state: absent
when: not keypair_local.stat.exists
- name: Create keypair
ec2_key:
name: "{{ keypair_name }}"
register: keypair
- name: Persist the keypair
copy:
dest: "{{ keypair_path }}"
content: "{{ keypair.key.private_key }}"
mode: 0600
when: keypair.changed
- name: Create molecule instance(s)
ec2:
key_name: "{{ keypair_name }}"
image: "{{ item.image }}"
instance_type: "{{ item.instance_type }}"
vpc_subnet_id: "{{ item.vpc_subnet_id }}"
group: "{{ security_group_name }}"
instance_tags:
instance: "{{ item.name }}"
wait: true
assign_public_ip: true
exact_count: 1
count_tag:
instance: "{{ item.name }}"
register: server
with_items: "{{ molecule_yml.platforms }}"
async: 7200
poll: 0
- name: Wait for instance(s) creation to complete
async_status:
jid: "{{ item.ansible_job_id }}"
register: ec2_jobs
until: ec2_jobs.finished
retries: 300
with_items: "{{ server.results }}"
# Mandatory configuration for Molecule to function.
- name: Populate instance config dict
set_fact:
instance_conf_dict: {
'instance': "{{ item.instances[0].tags.instance }}",
'address': "{{ item.instances[0].public_ip }}",
'user': "{{ ssh_user }}",
'port': "{{ ssh_port }}",
'identity_file': "{{ keypair_path }}",
'instance_ids': "{{ item.instance_ids }}", }
with_items: "{{ ec2_jobs.results }}"
register: instance_config_dict
when: server.changed | bool
- name: Convert instance config dict to a list
set_fact:
instance_conf: "{{ instance_config_dict.results | map(attribute='ansible_facts.instance_conf_dict') | list }}"
when: server.changed | bool
- name: Dump instance config
copy:
content: "{{ instance_conf | to_json | from_json | molecule_to_yaml | molecule_header }}"
dest: "{{ molecule_instance_config }}"
when: server.changed | bool
- name: Wait for SSH
wait_for:
port: "{{ ssh_port }}"
host: "{{ item.address }}"
search_regex: SSH
delay: 10
timeout: 320
with_items: "{{ lookup('file', molecule_instance_config) | molecule_from_yaml }}"
- name: Wait for boot process to finish
pause:
minutes: 2

View File

@ -1,47 +0,0 @@
---
- name: Destroy
hosts: localhost
connection: local
gather_facts: false
no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}"
tasks:
- block:
- name: Populate instance config
set_fact:
instance_conf: "{{ lookup('file', molecule_instance_config) | molecule_from_yaml }}"
skip_instances: false
rescue:
- name: Populate instance config when file missing
set_fact:
instance_conf: {}
skip_instances: true
- name: Destroy molecule instance(s)
ec2:
state: absent
instance_ids: "{{ item.instance_ids }}"
register: server
with_items: "{{ instance_conf }}"
when: not skip_instances
async: 7200
poll: 0
- name: Wait for instance(s) deletion to complete
async_status:
jid: "{{ item.ansible_job_id }}"
register: ec2_jobs
until: ec2_jobs.finished
retries: 300
with_items: "{{ server.results }}"
# Mandatory configuration for Molecule to function.
- name: Populate instance config
set_fact:
instance_conf: {}
- name: Dump instance config
copy:
content: "{{ instance_conf | to_json | from_json | molecule_to_yaml | molecule_header }}"
dest: "{{ molecule_instance_config }}"
when: server.changed | bool

View File

@ -1,81 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: ec2
platforms:
- name: ansible-rhel-7
image: ami-c86c3f23
instance_type: t2.micro
vpc_subnet_id: subnet-0e688067
- name: ansible-sles-15
image: ami-0a1886cf45f944eb1
instance_type: t2.micro
vpc_subnet_id: subnet-0e688067
- name: ansible-ubuntu-18.04
image: ami-0bdf93799014acdc4
instance_type: t2.micro
vpc_subnet_id: subnet-0e688067
- name: ansible-amazon-linux-2
image: ami-02ea8f348fa28c108
instance_type: t2.micro
vpc_subnet_id: subnet-0e688067
- name: ansible-centos-7
image: ami-9a183671
instance_type: t2.micro
vpc_subnet_id: subnet-0e688067
- name: ansible-fedora-29
image: ami-0f904cfaa69a1c64c
instance_type: t2.micro
vpc_subnet_id: subnet-0e688067
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
inventory:
host_vars:
ansible-ubuntu-18.04:
ansible_user: ubuntu
ansible-centos-7:
ansible_user: centos
ansible-fedora-29:
ansible_user: fedora
scenario:
name: ec2
create_sequence:
- create
check_sequence:
- destroy
- dependency
- create
- converge
- check
- destroy
converge_sequence:
- dependency
- create
- converge
destroy_sequence:
- destroy
test_sequence:
- lint
- destroy
- dependency
- syntax
- create
- converge
- idempotence
- side_effect
- verify
- destroy

View File

@ -1,30 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ansible-fedora-latest
image: fedora:latest
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
inventory:
group_vars:
all:
ansible_python_interpreter: /usr/bin/python3
scenario:
name: fedora-latest

View File

@ -1,32 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ansible-fedora-rawhide
image: fedora:rawhide
pre_build_image: yes
registry:
url: registry.fedoraproject.org
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
inventory:
group_vars:
all:
ansible_python_interpreter: /usr/bin/python3
scenario:
name: fedora-rawhide

View File

@ -1,26 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ansible-opensuse-leap
image: opensuse/leap
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: opensuse-leap

View File

@ -1,26 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ansible-ubuntu-devel
image: ubuntu:devel
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: ubuntu-devel

View File

@ -1,26 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ansible-ubuntu-latest
image: ubuntu:latest
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: ubuntu-latest

View File

@ -1,26 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ansible-ubuntu-rolling
image: ubuntu:rolling
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: ubuntu-rolling

View File

@ -1,33 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: vagrant
provider:
name: virtualbox
platforms:
- name: ansible-debian
box: debian/stretch64
- name: ansible-fedora
box: fedora/30-cloud-base
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
inventory:
host_vars:
ansible-fedora:
ansible_python_interpreter: /usr/bin/python3
scenario:
name: vagrant

View File

@ -1,3 +1,5 @@
---
- robertdebock.bootstrap
- robertdebock.epel
- robertdebock.buildtools
- robertdebock.python_pip

View File

@ -1,11 +1,21 @@
---
# tasks file for ansible
- name: install ansible
block:
- name: install ansible package (allowed to fail)
package:
name: "{{ ansible_packages }}"
state: present
register: ansible_install_ansible
until: ansible_install_ansible is succeeded
register: ansible_install_ansible_package
until: ansible_install_ansible_package is succeeded
retries: 3
rescue:
- name: install ansible pip
pip:
name: ansible
state: present
register: ansible_install_ansible_pip
until: ansible_install_ansible_pip is succeeded
retries: 3
- name: ensure the ansible directory exists

22
roles/ansible/tox.ini Normal file
View File

@ -0,0 +1,22 @@
#
# Ansible managed
#
[tox]
minversion = 3.7
envlist = py{37}-ansible-{previous,current,next}
skipsdist = true
[testenv]
deps =
previous: ansible>=2.8, <2.9
current: ansible>=2.9
next: git+https://github.com/ansible/ansible.git@devel
docker
molecule
commands =
molecule test
setenv =
TOX_ENVNAME={envname}
MOLECULE_EPHEMERAL_DIRECTORY=/tmp/.molecule/{env:image:fedora}-{env:tag:latest}/{envname}
passenv = namespace image tag

View File

@ -0,0 +1,5 @@
#
# Ansible managed
#
exclude_paths:
- ./meta/exception.yml

View File

@ -7,21 +7,22 @@ about: Create a report to help us improve
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Run this role:
2. See error
**Playbook**
Please paste the playbook you are using. (Consider `requirements.yml` and
optionally the command you've invoked.)
```yaml
YOUR PLAYBOOK HERE
```
**Output**
Show at least the error, possible related output, maybe just all the output.
**Expected behavior**
A clear and concise description of what you expected to happen.
**Error**
Please show the resulting error. If applicable a snippet of the playbook including the role ran with `-vvv`
**Environment**
- Control node OS: [e.g. Debian 9]
- Control node Ansible version: [e.g. 2.6.2]
- Managed node OS: [e.g. CentOS 7]
**Additional context**
Add any other context about the problem here.
- Control node OS: [e.g. Debian 9] (`cat /etc/os-release`)
- Control node Ansible version: [e.g. 2.9.1] (`ansible --version`)
- Managed node OS: [e.g. CentOS 7] (`cat /etc/os-release`)

View File

@ -1,4 +1,7 @@
---
#
# Ansible managed
#
repository:
description: Install ansible-lint on your system.
homepage: https://robertdebock.nl/

View File

@ -1,3 +1,4 @@
molecule/*/.molecule
.molecule
*.log
*.swp
.tox

View File

@ -1,85 +1,42 @@
---
sudo: required
#
# Ansible managed
#
language: python
services: docker
python:
- "3.7"
services:
- docker
env:
- version=">=2.7,<2.8" distro="alpine-latest"
- version="" distro="alpine-latest"
- version="devel" distro="alpine-latest"
- version=">=2.7,<2.8" distro="alpine-edge"
- version="" distro="alpine-edge"
- version="devel" distro="alpine-edge"
- version=">=2.7,<2.8" distro="archlinux"
- version="" distro="archlinux"
- version="devel" distro="archlinux"
- version=">=2.7,<2.8" distro="centos-6" expectation="fail"
- version="" distro="centos-6" expectation="fail"
- version="devel" distro="centos-6" expectation="fail"
- version=">=2.7,<2.8" distro="centos-latest"
- version="" distro="centos-latest"
- version="devel" distro="centos-latest"
- version=">=2.7,<2.8" distro="debian-stable"
- version="" distro="debian-stable"
- version="devel" distro="debian-stable"
- version=">=2.7,<2.8" distro="debian-unstable"
- version="" distro="debian-unstable"
- version="devel" distro="debian-unstable"
- version=">=2.7,<2.8" distro="fedora-latest"
- version="" distro="fedora-latest"
- version="devel" distro="fedora-latest"
- version=">=2.7,<2.8" distro="fedora-rawhide"
- version="" distro="fedora-rawhide"
- version="devel" distro="fedora-rawhide"
- version=">=2.7,<2.8" distro="opensuse-leap"
- version="" distro="opensuse-leap"
- version="devel" distro="opensuse-leap"
- version=">=2.7,<2.8" distro="ubuntu-rolling"
- version="" distro="ubuntu-rolling"
- version="devel" distro="ubuntu-rolling"
- version=">=2.7,<2.8" distro="ubuntu-latest"
- version="" distro="ubuntu-latest"
- version="devel" distro="ubuntu-latest"
- version=">=2.7,<2.8" distro="ubuntu-devel"
- version="" distro="ubuntu-devel"
- version="devel" distro="ubuntu-devel"
global:
namespace="robertdebock"
matrix:
# - namespace="archlinux" image="base"
- image="debian" tag="unstable"
- image="debian"
- image="centos"
- image="fedora"
- image="fedora" tag="rawhide"
- image="opensuse"
- image="ubuntu"
matrix:
allow_failures:
- env: version=">=2.7,<2.8" distro="alpine-edge"
- env: version="" distro="alpine-edge"
- env: version="devel" distro="alpine-edge"
- env: version="devel" distro="alpine-latest"
- env: version="devel" distro="archlinux"
- env: version="devel" distro="centos-6" expectation="fail"
- env: version="devel" distro="centos-latest"
- env: version="devel" distro="debian-stable"
- env: version=">=2.7,<2.8" distro="debian-unstable"
- env: version="" distro="debian-unstable"
- env: version="devel" distro="debian-unstable"
- env: version="devel" distro="fedora-latest"
- env: version=">=2.7,<2.8" distro="fedora-rawhide"
- env: version="" distro="fedora-rawhide"
- env: version="devel" distro="fedora-rawhide"
- env: version="devel" distro="opensuse-leap"
- env: version="devel" distro="ubuntu-rolling"
- env: version=">=2.7,<2.8" distro="ubuntu-devel"
- env: version="" distro="ubuntu-devel"
- env: version="devel" distro="ubuntu-devel"
- env: version="devel" distro="ubuntu-latest"
- env: image="debian" tag="unstable"
- env: image="fedora" tag="rawhide"
cache:
- pip
install:
- pip install --upgrade pip
- if [ "${version}" != "devel" ] ; then pip install ansible"${version}" ; fi
- if [ "${version}" = "devel" ] ; then pip install git+https://github.com/ansible/ansible.git@devel ; fi
- pip install molecule
- pip install docker
- pip install tox
script:
- if [ "${expectation}" = "fail" ] ; then ! molecule test --scenario-name "${distro}" ; else molecule test --scenario-name "${distro}" ; fi
- tox --parallel all
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/

View File

@ -2,14 +2,14 @@ ansible_lint
=========
<img src="https://docs.ansible.com/ansible-tower/3.2.4/html_ja/installandreference/_static/images/logo_invert.png" width="10%" height="10%" alt="Ansible logo" align="right"/>
<a href="https://travis-ci.org/robertdebock/ansible-role-ansible_lint"><img src="https://travis-ci.org/robertdebock/ansible-role-ansible_lint.svg?branch=master" alt="Build status" align="left"/></a>
<a href="https://travis-ci.org/robertdebock/ansible-role-ansible_lint"> <img src="https://travis-ci.org/robertdebock/ansible-role-ansible_lint.svg?branch=master" alt="Build status"/></a> <img src="https://img.shields.io/ansible/role/d/35946"/> <img src="https://img.shields.io/ansible/quality/35946"/>
Install ansible-lint on your system.
Example Playbook
----------------
This example is taken from `molecule/resources/playbook.yml`:
This example is taken from `molecule/resources/playbook.yml` and is tested on each push, pull request and release.
```yaml
---
- name: Converge
@ -21,7 +21,7 @@ This example is taken from `molecule/resources/playbook.yml`:
- robertdebock.ansible_lint
```
The machine you are running this on, may need to be prepared.
The machine you are running this on, may need to be prepared, I use this playbook to ensure everything is in place to let the role work.
```yaml
---
- name: Prepare
@ -36,6 +36,7 @@ The machine you are running this on, may need to be prepared.
- role: robertdebock.python_pip
```
Also see a [full explanation and example](https://robertdebock.nl/how-to-use-these-roles.html) on how to use these roles.
Role Variables
@ -76,42 +77,78 @@ Here is an overview of related roles:
Compatibility
-------------
This role has been tested against the following distributions and Ansible version:
This role has been tested on these [container images](https://hub.docker.com/):
|distribution|ansible 2.7|ansible 2.8|ansible devel|
|------------|-----------|-----------|-------------|
|alpine-edge*|yes|yes|yes*|
|alpine-latest|yes|yes|yes*|
|archlinux|yes|yes|yes*|
|centos-6|no|no|no*|
|centos-latest|yes|yes|yes*|
|debian-stable|yes|yes|yes*|
|debian-unstable*|yes|yes|yes*|
|fedora-latest|yes|yes|yes*|
|fedora-rawhide*|yes|yes|yes*|
|opensuse-leap|yes|yes|yes*|
|ubuntu-devel*|yes|yes|yes*|
|ubuntu-latest|yes|yes|yes*|
|ubuntu-rolling|yes|yes|yes*|
|container|tag|allow_failures|
|---------|---|--------------|
|debian|unstable|yes|
|debian|latest|no|
|centos|latest|no|
|fedora|latest|no|
|fedora|rawhide|yes|
|opensuse|latest|no|
|ubuntu|latest|no|
This role has been tested on these Ansible versions:
- ansible>=2.8, <2.9
- ansible>=2.9
- git+https://github.com/ansible/ansible.git@devel
Exceptions
----------
Some variarations of the build matrix do not work. These are the variations and reasons why the build won't work:
| variation | reason |
|---------------------------|------------------------|
| amazonlinux:1 | No package matching 'python3-pip' |
| amazonlinux | No module named pkg_resources |
A single star means the build may fail, it's marked as an experimental build.
Testing
-------
[Unit tests](https://travis-ci.org/robertdebock/ansible-role-ansible_lint) are done on every commit and periodically.
[Unit tests](https://travis-ci.org/robertdebock/ansible-role-ansible_lint) are done on every commit, pull request, release and periodically.
If you find issues, please register them in [GitHub](https://github.com/robertdebock/ansible-role-ansible_lint/issues)
To test this role locally please use [Molecule](https://github.com/ansible/molecule):
Testing is done using [Tox](https://tox.readthedocs.io/en/latest/) and [Molecule](https://github.com/ansible/molecule):
[Tox](https://tox.readthedocs.io/en/latest/) tests multiple ansible versions.
[Molecule](https://github.com/ansible/molecule) tests multiple distributions.
To test using the defaults (any installed ansible version, namespace: `robertdebock`, image: `fedora`, tag: `latest`):
```
pip install molecule
molecule test
# Or select a specific image:
image=ubuntu molecule test
# Or select a specific image and a specific tag:
image="debian" tag="stable" tox
```
To test on Amazon EC2, configure [~/.aws/credentials](https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/credentials.html) and set a region using `export AWS_REGION=eu-central-1` before running `molecule test --scenario-name ec2`.
Or you can test multiple versions of Ansible, and select images:
Tox allows multiple versions of Ansible to be tested. To run the default (namespace: `robertdebock`, image: `fedora`, tag: `latest`) tests:
There are many specific scenarios available, please have a look in the `molecule/` directory.
```
tox
# To run CentOS (namespace: `robertdebock`, tag: `latest`)
image="centos" tox
# Or customize more:
image="debian" tag="stable" tox
```
Modules
-------
This role uses the following modules:
```yaml
---
- pip
```
License
-------

View File

@ -1 +1,2 @@
{install_date: 'Tue Sep 17 04:21:07 2019', version: 2.0.6}
install_date: Mon Dec 16 06:44:26 2019
version: 2.2.2

View File

@ -0,0 +1,6 @@
---
exceptions:
- variation: amazonlinux:1
reason: "No package matching 'python3-pip'"
- variation: amazonlinux
reason: "No module named pkg_resources"

View File

@ -5,21 +5,18 @@ galaxy_info:
description: Install ansible-lint on your system.
license: Apache-2.0
company: none
min_ansible_version: 2.6
min_ansible_version: 2.8
platforms:
- name: Alpine
versions:
- all
- name: ArchLinux
version:
versions:
- all
- name: Debian
versions:
- all
- name: EL
version:
- 7
versions:
- 8
- name: Fedora
versions:
- all
@ -33,14 +30,8 @@ galaxy_info:
galaxy_tags:
- ansiblelint
- alpine
- archlinux
- centos
- debian
- el
- fedora
- opensuse
- rhel
- ubuntu
dependencies: []

View File

@ -1,27 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ansible_lint-alpine-edge
image: alpine:edge
pre_build_image: yes
command: sh -c "while true ; do sleep 1 ; done"
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: alpine-edge

View File

@ -1,27 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ansible_lint-alpine-latest
image: alpine:latest
pre_build_image: yes
command: sh -c "while true ; do sleep 1 ; done"
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: alpine-latest

View File

@ -1,26 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ansible_lint-archlinux
image: archlinux/base
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: archlinux

View File

@ -1,26 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ansible_lint-centos-6
image: centos:6
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: centos-6

View File

@ -1,26 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ansible_lint-centos-latest
image: centos:latest
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: centos-latest

View File

@ -1,26 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ansible_lint-debian-stable
image: debian:stable
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: debian-stable

View File

@ -1,26 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ansible_lint-debian-unstable
image: debian:unstable
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: debian-unstable

View File

@ -1,4 +1,7 @@
---
#
# Ansible managed
#
dependency:
name: galaxy
options:
@ -8,63 +11,14 @@ lint:
driver:
name: docker
platforms:
- name: ansible_lint-alpine-edge
image: alpine:edge
pre_build_image: yes
command: sh -c "while true ; do sleep 1 ; done"
- name: ansible_lint-alpine-latest
image: alpine:latest
pre_build_image: yes
command: sh -c "while true ; do sleep 1 ; done"
- name: ansible_lint-archlinux
image: archlinux/base
pre_build_image: yes
- name: ansible_lint-centos-6
image: centos:6
pre_build_image: yes
- name: ansible_lint-centos-latest
image: centos:latest
pre_build_image: yes
- name: ansible_lint-debian-stable
image: debian:stable
pre_build_image: yes
- name: ansible_lint-debian-unstable
image: debian:unstable
pre_build_image: yes
- name: ansible_lint-fedora-latest
image: fedora:latest
pre_build_image: yes
- name: ansible_lint-fedora-rawhide
image: fedora:rawhide
pre_build_image: yes
- name: ansible_lint-opensuse-leap
image: opensuse/leap
pre_build_image: yes
- name: ansible_lint-ubuntu-latest
image: ubuntu:latest
pre_build_image: yes
- name: ansible_lint-ubuntu-rolling
image: ubuntu:rolling
pre_build_image: yes
- name: ansible_lint-ubuntu-devel
image: ubuntu:devel
- name: "ansible_lint-${image:-fedora}-${tag:-latest}${TOX_ENVNAME}"
image: "${namespace:-robertdebock}/${image:-fedora}:${tag:-latest}"
command: /sbin/init
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
privileged: yes
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
inventory:
host_vars:
ansible_lint-fedora-latest:
ansible_python_interpreter: /usr/bin/python3
ansible_lint-fedora-rawhide:
ansible_python_interpreter: /usr/bin/python3
scenario:
name: default

View File

@ -1,15 +0,0 @@
# Amazon EC2
To test on Amazon elastic compute cloud (EC2), set this variable:
```
export EC2_REGION=eu-central-1
```
And save the credentials:
```
cat ~/.aws/credentials
[default]
aws_access_key_id=YOUR_KEY_ID
aws_secret_access_key=YOUR_ACCESS_KEY
```

View File

@ -1,125 +0,0 @@
---
- name: Create
hosts: localhost
connection: local
gather_facts: false
no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}"
vars:
ssh_user: ec2-user
ssh_port: 22
security_group_name: molecule
security_group_description: Security group for testing Molecule
security_group_rules:
- proto: tcp
from_port: "{{ ssh_port }}"
to_port: "{{ ssh_port }}"
cidr_ip: '0.0.0.0/0'
- proto: icmp
from_port: 8
to_port: -1
cidr_ip: '0.0.0.0/0'
security_group_rules_egress:
- proto: -1
from_port: 0
to_port: 0
cidr_ip: '0.0.0.0/0'
keypair_name: molecule_key
keypair_path: "{{ lookup('env', 'MOLECULE_EPHEMERAL_DIRECTORY') }}/ssh_key"
tasks:
- name: Create security group
ec2_group:
name: "{{ security_group_name }}"
description: "{{ security_group_name }}"
rules: "{{ security_group_rules }}"
rules_egress: "{{ security_group_rules_egress }}"
- name: Test for presence of local keypair
stat:
path: "{{ keypair_path }}"
register: keypair_local
- name: Delete remote keypair
ec2_key:
name: "{{ keypair_name }}"
state: absent
when: not keypair_local.stat.exists
- name: Create keypair
ec2_key:
name: "{{ keypair_name }}"
register: keypair
- name: Persist the keypair
copy:
dest: "{{ keypair_path }}"
content: "{{ keypair.key.private_key }}"
mode: 0600
when: keypair.changed
- name: Create molecule instance(s)
ec2:
key_name: "{{ keypair_name }}"
image: "{{ item.image }}"
instance_type: "{{ item.instance_type }}"
vpc_subnet_id: "{{ item.vpc_subnet_id }}"
group: "{{ security_group_name }}"
instance_tags:
instance: "{{ item.name }}"
wait: true
assign_public_ip: true
exact_count: 1
count_tag:
instance: "{{ item.name }}"
register: server
with_items: "{{ molecule_yml.platforms }}"
async: 7200
poll: 0
- name: Wait for instance(s) creation to complete
async_status:
jid: "{{ item.ansible_job_id }}"
register: ec2_jobs
until: ec2_jobs.finished
retries: 300
with_items: "{{ server.results }}"
# Mandatory configuration for Molecule to function.
- name: Populate instance config dict
set_fact:
instance_conf_dict: {
'instance': "{{ item.instances[0].tags.instance }}",
'address': "{{ item.instances[0].public_ip }}",
'user': "{{ ssh_user }}",
'port': "{{ ssh_port }}",
'identity_file': "{{ keypair_path }}",
'instance_ids': "{{ item.instance_ids }}", }
with_items: "{{ ec2_jobs.results }}"
register: instance_config_dict
when: server.changed | bool
- name: Convert instance config dict to a list
set_fact:
instance_conf: "{{ instance_config_dict.results | map(attribute='ansible_facts.instance_conf_dict') | list }}"
when: server.changed | bool
- name: Dump instance config
copy:
content: "{{ instance_conf | to_json | from_json | molecule_to_yaml | molecule_header }}"
dest: "{{ molecule_instance_config }}"
when: server.changed | bool
- name: Wait for SSH
wait_for:
port: "{{ ssh_port }}"
host: "{{ item.address }}"
search_regex: SSH
delay: 10
timeout: 320
with_items: "{{ lookup('file', molecule_instance_config) | molecule_from_yaml }}"
- name: Wait for boot process to finish
pause:
minutes: 2

View File

@ -1,47 +0,0 @@
---
- name: Destroy
hosts: localhost
connection: local
gather_facts: false
no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}"
tasks:
- block:
- name: Populate instance config
set_fact:
instance_conf: "{{ lookup('file', molecule_instance_config) | molecule_from_yaml }}"
skip_instances: false
rescue:
- name: Populate instance config when file missing
set_fact:
instance_conf: {}
skip_instances: true
- name: Destroy molecule instance(s)
ec2:
state: absent
instance_ids: "{{ item.instance_ids }}"
register: server
with_items: "{{ instance_conf }}"
when: not skip_instances
async: 7200
poll: 0
- name: Wait for instance(s) deletion to complete
async_status:
jid: "{{ item.ansible_job_id }}"
register: ec2_jobs
until: ec2_jobs.finished
retries: 300
with_items: "{{ server.results }}"
# Mandatory configuration for Molecule to function.
- name: Populate instance config
set_fact:
instance_conf: {}
- name: Dump instance config
copy:
content: "{{ instance_conf | to_json | from_json | molecule_to_yaml | molecule_header }}"
dest: "{{ molecule_instance_config }}"
when: server.changed | bool

View File

@ -1,81 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: ec2
platforms:
- name: ansible_lint-rhel-7
image: ami-c86c3f23
instance_type: t2.micro
vpc_subnet_id: subnet-0e688067
- name: ansible_lint-sles-15
image: ami-0a1886cf45f944eb1
instance_type: t2.micro
vpc_subnet_id: subnet-0e688067
- name: ansible_lint-ubuntu-18.04
image: ami-0bdf93799014acdc4
instance_type: t2.micro
vpc_subnet_id: subnet-0e688067
- name: ansible_lint-amazon-linux-2
image: ami-02ea8f348fa28c108
instance_type: t2.micro
vpc_subnet_id: subnet-0e688067
- name: ansible_lint-centos-7
image: ami-9a183671
instance_type: t2.micro
vpc_subnet_id: subnet-0e688067
- name: ansible_lint-fedora-29
image: ami-0f904cfaa69a1c64c
instance_type: t2.micro
vpc_subnet_id: subnet-0e688067
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
inventory:
host_vars:
ansible_lint-ubuntu-18.04:
ansible_user: ubuntu
ansible_lint-centos-7:
ansible_user: centos
ansible_lint-fedora-29:
ansible_user: fedora
scenario:
name: ec2
create_sequence:
- create
check_sequence:
- destroy
- dependency
- create
- converge
- check
- destroy
converge_sequence:
- dependency
- create
- converge
destroy_sequence:
- destroy
test_sequence:
- lint
- destroy
- dependency
- syntax
- create
- converge
- idempotence
- side_effect
- verify
- destroy

View File

@ -1,30 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ansible_lint-fedora-latest
image: fedora:latest
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
inventory:
group_vars:
all:
ansible_python_interpreter: /usr/bin/python3
scenario:
name: fedora-latest

View File

@ -1,32 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ansible_lint-fedora-rawhide
image: fedora:rawhide
pre_build_image: yes
registry:
url: registry.fedoraproject.org
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
inventory:
group_vars:
all:
ansible_python_interpreter: /usr/bin/python3
scenario:
name: fedora-rawhide

View File

@ -1,26 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ansible_lint-opensuse-leap
image: opensuse/leap
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: opensuse-leap

View File

@ -1,26 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ansible_lint-ubuntu-devel
image: ubuntu:devel
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: ubuntu-devel

View File

@ -1,26 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ansible_lint-ubuntu-latest
image: ubuntu:latest
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: ubuntu-latest

View File

@ -1,26 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ansible_lint-ubuntu-rolling
image: ubuntu:rolling
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: ubuntu-rolling

View File

@ -1,33 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: vagrant
provider:
name: virtualbox
platforms:
- name: ansible_lint-debian
box: debian/stretch64
- name: ansible_lint-fedora
box: fedora/30-cloud-base
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
inventory:
host_vars:
ansible_lint-fedora:
ansible_python_interpreter: /usr/bin/python3
scenario:
name: vagrant

View File

@ -1,9 +1,5 @@
---
# tasks file for ansible_lint
- name: test veriables and environment
assert:
that:
- name: install ansible_lint
pip:
name: "{{ ansible_lint_packages }}"

View File

@ -0,0 +1,22 @@
#
# Ansible managed
#
[tox]
minversion = 3.7
envlist = py{37}-ansible-{previous,current,next}
skipsdist = true
[testenv]
deps =
previous: ansible>=2.8, <2.9
current: ansible>=2.9
next: git+https://github.com/ansible/ansible.git@devel
docker
molecule
commands =
molecule test
setenv =
TOX_ENVNAME={envname}
MOLECULE_EPHEMERAL_DIRECTORY=/tmp/.molecule/{env:image:fedora}-{env:tag:latest}/{envname}
passenv = namespace image tag

5
roles/ara/.ansible-lint Normal file
View File

@ -0,0 +1,5 @@
#
# Ansible managed
#
exclude_paths:
- ./meta/exception.yml

View File

@ -7,21 +7,22 @@ about: Create a report to help us improve
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Run this role:
2. See error
**Playbook**
Please paste the playbook you are using. (Consider `requirements.yml` and
optionally the command you've invoked.)
```yaml
YOUR PLAYBOOK HERE
```
**Output**
Show at least the error, possible related output, maybe just all the output.
**Expected behavior**
A clear and concise description of what you expected to happen.
**Error**
Please show the resulting error. If applicable a snippet of the playbook including the role ran with `-vvv`
**Environment**
- Control node OS: [e.g. Debian 9]
- Control node Ansible version: [e.g. 2.6.2]
- Managed node OS: [e.g. CentOS 7]
**Additional context**
Add any other context about the problem here.
- Control node OS: [e.g. Debian 9] (`cat /etc/os-release`)
- Control node Ansible version: [e.g. 2.9.1] (`ansible --version`)
- Managed node OS: [e.g. CentOS 7] (`cat /etc/os-release`)

View File

@ -1,4 +1,7 @@
---
#
# Ansible managed
#
repository:
description: Install and configure ara on your system.
homepage: https://robertdebock.nl/

View File

@ -1,3 +1,4 @@
molecule/*/.molecule
.molecule
*.log
*.swp
.tox

View File

@ -1,85 +1,41 @@
---
sudo: required
#
# Ansible managed
#
language: python
services: docker
python:
- "3.7"
services:
- docker
env:
- version=">=2.7,<2.8" distro="alpine-latest" expectation="fail"
- version="" distro="alpine-latest" expectation="fail"
- version="devel" distro="alpine-latest" expectation="fail"
- version=">=2.7,<2.8" distro="alpine-edge" expectation="fail"
- version="" distro="alpine-edge" expectation="fail"
- version="devel" distro="alpine-edge" expectation="fail"
- version=">=2.7,<2.8" distro="archlinux"
- version="" distro="archlinux"
- version="devel" distro="archlinux"
- version=">=2.7,<2.8" distro="centos-6" expectation="fail"
- version="" distro="centos-6" expectation="fail"
- version="devel" distro="centos-6" expectation="fail"
- version=">=2.7,<2.8" distro="centos-latest" expectation="fail"
- version="" distro="centos-latest" expectation="fail"
- version="devel" distro="centos-latest" expectation="fail"
- version=">=2.7,<2.8" distro="debian-stable" expectation="fail"
- version="" distro="debian-stable" expectation="fail"
- version="devel" distro="debian-stable" expectation="fail"
- version=">=2.7,<2.8" distro="debian-unstable" expectation="fail"
- version="" distro="debian-unstable" expectation="fail"
- version="devel" distro="debian-unstable" expectation="fail"
- version=">=2.7,<2.8" distro="fedora-latest"
- version="" distro="fedora-latest"
- version="devel" distro="fedora-latest"
- version=">=2.7,<2.8" distro="fedora-rawhide"
- version="" distro="fedora-rawhide"
- version="devel" distro="fedora-rawhide"
- version=">=2.7,<2.8" distro="opensuse-leap" expectation="fail"
- version="" distro="opensuse-leap" expectation="fail"
- version="devel" distro="opensuse-leap" expectation="fail"
- version=">=2.7,<2.8" distro="ubuntu-rolling" expectation="fail"
- version="" distro="ubuntu-rolling" expectation="fail"
- version="devel" distro="ubuntu-rolling" expectation="fail"
- version=">=2.7,<2.8" distro="ubuntu-latest" expectation="fail"
- version="" distro="ubuntu-latest" expectation="fail"
- version="devel" distro="ubuntu-latest" expectation="fail"
- version=">=2.7,<2.8" distro="ubuntu-devel" expectation="fail"
- version="" distro="ubuntu-devel" expectation="fail"
- version="devel" distro="ubuntu-devel" expectation="fail"
global:
namespace="robertdebock"
matrix:
# - namespace="archlinux" image="base"
- image="debian" tag="unstable"
- image="debian"
- image="centos"
- image="fedora"
- image="fedora" tag="rawhide"
- image="ubuntu"
matrix:
allow_failures:
- env: version=">=2.7,<2.8" distro="alpine-edge" expectation="fail"
- env: version="" distro="alpine-edge" expectation="fail"
- env: version="devel" distro="alpine-edge" expectation="fail"
- env: version="devel" distro="alpine-latest" expectation="fail"
- env: version="devel" distro="archlinux"
- env: version="devel" distro="centos-6" expectation="fail"
- env: version="devel" distro="centos-latest" expectation="fail"
- env: version="devel" distro="debian-stable" expectation="fail"
- env: version=">=2.7,<2.8" distro="debian-unstable" expectation="fail"
- env: version="" distro="debian-unstable" expectation="fail"
- env: version="devel" distro="debian-unstable" expectation="fail"
- env: version="devel" distro="fedora-latest"
- env: version=">=2.7,<2.8" distro="fedora-rawhide"
- env: version="" distro="fedora-rawhide"
- env: version="devel" distro="fedora-rawhide"
- env: version="devel" distro="opensuse-leap" expectation="fail"
- env: version="devel" distro="ubuntu-rolling" expectation="fail"
- env: version=">=2.7,<2.8" distro="ubuntu-devel" expectation="fail"
- env: version="" distro="ubuntu-devel" expectation="fail"
- env: version="devel" distro="ubuntu-devel" expectation="fail"
- env: version="devel" distro="ubuntu-latest" expectation="fail"
- env: image="debian" tag="unstable"
- env: image="fedora" tag="rawhide"
cache:
- pip
install:
- pip install --upgrade pip
- if [ "${version}" != "devel" ] ; then pip install ansible"${version}" ; fi
- if [ "${version}" = "devel" ] ; then pip install git+https://github.com/ansible/ansible.git@devel ; fi
- pip install molecule
- pip install docker
- pip install tox
script:
- if [ "${expectation}" = "fail" ] ; then ! molecule test --scenario-name "${distro}" ; else molecule test --scenario-name "${distro}" ; fi
- tox --parallel all
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/

View File

@ -2,14 +2,14 @@ ara
=========
<img src="https://docs.ansible.com/ansible-tower/3.2.4/html_ja/installandreference/_static/images/logo_invert.png" width="10%" height="10%" alt="Ansible logo" align="right"/>
<a href="https://travis-ci.org/robertdebock/ansible-role-ara"><img src="https://travis-ci.org/robertdebock/ansible-role-ara.svg?branch=master" alt="Build status" align="left"/></a>
<a href="https://travis-ci.org/robertdebock/ansible-role-ara"> <img src="https://travis-ci.org/robertdebock/ansible-role-ara.svg?branch=master" alt="Build status"/></a> <img src="https://img.shields.io/ansible/role/d/24687"/> <img src="https://img.shields.io/ansible/quality/24687"/>
Install and configure ara on your system.
Example Playbook
----------------
This example is taken from `molecule/resources/playbook.yml`:
This example is taken from `molecule/resources/playbook.yml` and is tested on each push, pull request and release.
```yaml
---
- name: Converge
@ -21,7 +21,7 @@ This example is taken from `molecule/resources/playbook.yml`:
- robertdebock.ara
```
The machine you are running this on, may need to be prepared.
The machine you are running this on, may need to be prepared, I use this playbook to ensure everything is in place to let the role work.
```yaml
---
- name: Prepare
@ -36,6 +36,7 @@ The machine you are running this on, may need to be prepared.
- robertdebock.python_pip
```
Also see a [full explanation and example](https://robertdebock.nl/how-to-use-these-roles.html) on how to use these roles.
Role Variables
@ -96,42 +97,83 @@ Here is an overview of related roles:
Compatibility
-------------
This role has been tested against the following distributions and Ansible version:
This role has been tested on these [container images](https://hub.docker.com/):
|distribution|ansible 2.7|ansible 2.8|ansible devel|
|------------|-----------|-----------|-------------|
|alpine-edge*|no|no|no*|
|alpine-latest|no|no|no*|
|archlinux|yes|yes|yes*|
|centos-6|no|no|no*|
|centos-latest|no|no|no*|
|debian-stable|no|no|no*|
|debian-unstable*|no|no|no*|
|fedora-latest|yes|yes|yes*|
|fedora-rawhide*|yes|yes|yes*|
|opensuse-leap|no|no|no*|
|ubuntu-devel*|no|no|no*|
|ubuntu-latest|no|no|no*|
|ubuntu-rolling|no|no|no*|
|container|tag|allow_failures|
|---------|---|--------------|
|debian|unstable|yes|
|debian|latest|no|
|centos|latest|no|
|fedora|latest|no|
|fedora|rawhide|yes|
|ubuntu|latest|no|
This role has been tested on these Ansible versions:
- ansible>=2.8, <2.9
- ansible>=2.9
- git+https://github.com/ansible/ansible.git@devel
Exceptions
----------
Some variarations of the build matrix do not work. These are the variations and reasons why the build won't work:
| variation | reason |
|---------------------------|------------------------|
| Alpine | Could not find a version that satisfies the requirement Django>=2.1.5 |
| CentOS | No matching distribution found for Django>=2.1.5 |
| amazonlinux:1 | No package matching 'python3-pip' |
| amazonlinux | No module named pkg_resources |
A single star means the build may fail, it's marked as an experimental build.
Testing
-------
[Unit tests](https://travis-ci.org/robertdebock/ansible-role-ara) are done on every commit and periodically.
[Unit tests](https://travis-ci.org/robertdebock/ansible-role-ara) are done on every commit, pull request, release and periodically.
If you find issues, please register them in [GitHub](https://github.com/robertdebock/ansible-role-ara/issues)
To test this role locally please use [Molecule](https://github.com/ansible/molecule):
Testing is done using [Tox](https://tox.readthedocs.io/en/latest/) and [Molecule](https://github.com/ansible/molecule):
[Tox](https://tox.readthedocs.io/en/latest/) tests multiple ansible versions.
[Molecule](https://github.com/ansible/molecule) tests multiple distributions.
To test using the defaults (any installed ansible version, namespace: `robertdebock`, image: `fedora`, tag: `latest`):
```
pip install molecule
molecule test
# Or select a specific image:
image=ubuntu molecule test
# Or select a specific image and a specific tag:
image="debian" tag="stable" tox
```
To test on Amazon EC2, configure [~/.aws/credentials](https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/credentials.html) and set a region using `export AWS_REGION=eu-central-1` before running `molecule test --scenario-name ec2`.
Or you can test multiple versions of Ansible, and select images:
Tox allows multiple versions of Ansible to be tested. To run the default (namespace: `robertdebock`, image: `fedora`, tag: `latest`) tests:
There are many specific scenarios available, please have a look in the `molecule/` directory.
```
tox
# To run CentOS (namespace: `robertdebock`, tag: `latest`)
image="centos" tox
# Or customize more:
image="debian" tag="stable" tox
```
Modules
-------
This role uses the following modules:
```yaml
---
- import_role
- ini_file
- pip
- service
- systemd
```
License
-------

View File

@ -4,8 +4,6 @@
service:
name: ara
state: restarted
when:
- ansible_virtualization_type != "docker"
become: yes
- name: systemctl daemon-reload

View File

@ -1 +1,2 @@
{install_date: 'Tue Sep 17 04:21:10 2019', version: 2.1.1}
install_date: Mon Dec 16 06:44:30 2019
version: 2.3.2

View File

@ -0,0 +1,10 @@
---
exceptions:
- variation: Alpine
reason: "Could not find a version that satisfies the requirement Django>=2.1.5"
- variation: CentOS
reason: No matching distribution found for Django>=2.1.5
- variation: amazonlinux:1
reason: "No package matching 'python3-pip'"
- variation: amazonlinux
reason: "No module named pkg_resources"

View File

@ -5,25 +5,19 @@ galaxy_info:
description: Install and configure ara on your system.
license: Apache-2.0
company: none
min_ansible_version: 2.6
min_ansible_version: 2.8
platforms:
- name: Alpine
versions:
- all
- name: ArchLinux
version:
versions:
- all
- name: Debian
versions:
- all
- name: EL
version:
- 7
- name: Fedora
versions:
- all
- name: OpenSUSE
- 8
- name: Fedora
versions:
- all
- name: Ubuntu
@ -32,21 +26,14 @@ galaxy_info:
- bionic
galaxy_tags:
- alpine
- ansiblerecordsansible
- ara
- arareportsansible
- archlinux
- centos
- cloud
- debian
- centos
- development
- fedora
- monitoring
- opensuse
- reporting
- rhel
- ubuntu
- web
- reporting
dependencies: []

View File

@ -1,27 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ara-alpine-edge
image: alpine:edge
pre_build_image: yes
command: sh -c "while true ; do sleep 1 ; done"
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: alpine-edge

View File

@ -1,27 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ara-alpine-latest
image: alpine:latest
pre_build_image: yes
command: sh -c "while true ; do sleep 1 ; done"
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: alpine-latest

View File

@ -1,26 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ara-archlinux
image: archlinux/base
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: archlinux

View File

@ -1,26 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ara-centos-6
image: centos:6
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: centos-6

View File

@ -1,26 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ara-centos-latest
image: centos:latest
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: centos-latest

View File

@ -1,26 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ara-debian-stable
image: debian:stable
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: debian-stable

View File

@ -1,26 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ara-debian-unstable
image: debian:unstable
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: debian-unstable

View File

@ -1,4 +1,7 @@
---
#
# Ansible managed
#
dependency:
name: galaxy
options:
@ -8,63 +11,14 @@ lint:
driver:
name: docker
platforms:
- name: ara-alpine-edge
image: alpine:edge
pre_build_image: yes
command: sh -c "while true ; do sleep 1 ; done"
- name: ara-alpine-latest
image: alpine:latest
pre_build_image: yes
command: sh -c "while true ; do sleep 1 ; done"
- name: ara-archlinux
image: archlinux/base
pre_build_image: yes
# - name: ara-centos-6
# image: centos:6
# pre_build_image: yes
- name: ara-centos-latest
image: centos:latest
pre_build_image: yes
- name: ara-debian-stable
image: debian:stable
pre_build_image: yes
- name: ara-debian-unstable
image: debian:unstable
pre_build_image: yes
- name: ara-fedora-latest
image: fedora:latest
pre_build_image: yes
- name: ara-fedora-rawhide
image: fedora:rawhide
pre_build_image: yes
- name: ara-opensuse-leap
image: opensuse/leap
pre_build_image: yes
- name: ara-ubuntu-latest
image: ubuntu:latest
pre_build_image: yes
- name: ara-ubuntu-rolling
image: ubuntu:rolling
pre_build_image: yes
- name: ara-ubuntu-devel
image: ubuntu:devel
- name: "ara-${image:-fedora}-${tag:-latest}${TOX_ENVNAME}"
image: "${namespace:-robertdebock}/${image:-fedora}:${tag:-latest}"
command: /sbin/init
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
privileged: yes
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
inventory:
host_vars:
ara-fedora-latest:
ansible_python_interpreter: /usr/bin/python3
ara-fedora-rawhide:
ansible_python_interpreter: /usr/bin/python3
scenario:
name: default

View File

@ -1,15 +0,0 @@
# Amazon EC2
To test on Amazon elastic compute cloud (EC2), set this variable:
```
export EC2_REGION=eu-central-1
```
And save the credentials:
```
cat ~/.aws/credentials
[default]
aws_access_key_id=YOUR_KEY_ID
aws_secret_access_key=YOUR_ACCESS_KEY
```

View File

@ -1,125 +0,0 @@
---
- name: Create
hosts: localhost
connection: local
gather_facts: false
no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}"
vars:
ssh_user: ec2-user
ssh_port: 22
security_group_name: molecule
security_group_description: Security group for testing Molecule
security_group_rules:
- proto: tcp
from_port: "{{ ssh_port }}"
to_port: "{{ ssh_port }}"
cidr_ip: '0.0.0.0/0'
- proto: icmp
from_port: 8
to_port: -1
cidr_ip: '0.0.0.0/0'
security_group_rules_egress:
- proto: -1
from_port: 0
to_port: 0
cidr_ip: '0.0.0.0/0'
keypair_name: molecule_key
keypair_path: "{{ lookup('env', 'MOLECULE_EPHEMERAL_DIRECTORY') }}/ssh_key"
tasks:
- name: Create security group
ec2_group:
name: "{{ security_group_name }}"
description: "{{ security_group_name }}"
rules: "{{ security_group_rules }}"
rules_egress: "{{ security_group_rules_egress }}"
- name: Test for presence of local keypair
stat:
path: "{{ keypair_path }}"
register: keypair_local
- name: Delete remote keypair
ec2_key:
name: "{{ keypair_name }}"
state: absent
when: not keypair_local.stat.exists
- name: Create keypair
ec2_key:
name: "{{ keypair_name }}"
register: keypair
- name: Persist the keypair
copy:
dest: "{{ keypair_path }}"
content: "{{ keypair.key.private_key }}"
mode: 0600
when: keypair.changed
- name: Create molecule instance(s)
ec2:
key_name: "{{ keypair_name }}"
image: "{{ item.image }}"
instance_type: "{{ item.instance_type }}"
vpc_subnet_id: "{{ item.vpc_subnet_id }}"
group: "{{ security_group_name }}"
instance_tags:
instance: "{{ item.name }}"
wait: true
assign_public_ip: true
exact_count: 1
count_tag:
instance: "{{ item.name }}"
register: server
with_items: "{{ molecule_yml.platforms }}"
async: 7200
poll: 0
- name: Wait for instance(s) creation to complete
async_status:
jid: "{{ item.ansible_job_id }}"
register: ec2_jobs
until: ec2_jobs.finished
retries: 300
with_items: "{{ server.results }}"
# Mandatory configuration for Molecule to function.
- name: Populate instance config dict
set_fact:
instance_conf_dict: {
'instance': "{{ item.instances[0].tags.instance }}",
'address': "{{ item.instances[0].public_ip }}",
'user': "{{ ssh_user }}",
'port': "{{ ssh_port }}",
'identity_file': "{{ keypair_path }}",
'instance_ids': "{{ item.instance_ids }}", }
with_items: "{{ ec2_jobs.results }}"
register: instance_config_dict
when: server.changed | bool
- name: Convert instance config dict to a list
set_fact:
instance_conf: "{{ instance_config_dict.results | map(attribute='ansible_facts.instance_conf_dict') | list }}"
when: server.changed | bool
- name: Dump instance config
copy:
content: "{{ instance_conf | to_json | from_json | molecule_to_yaml | molecule_header }}"
dest: "{{ molecule_instance_config }}"
when: server.changed | bool
- name: Wait for SSH
wait_for:
port: "{{ ssh_port }}"
host: "{{ item.address }}"
search_regex: SSH
delay: 10
timeout: 320
with_items: "{{ lookup('file', molecule_instance_config) | molecule_from_yaml }}"
- name: Wait for boot process to finish
pause:
minutes: 2

View File

@ -1,47 +0,0 @@
---
- name: Destroy
hosts: localhost
connection: local
gather_facts: false
no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}"
tasks:
- block:
- name: Populate instance config
set_fact:
instance_conf: "{{ lookup('file', molecule_instance_config) | molecule_from_yaml }}"
skip_instances: false
rescue:
- name: Populate instance config when file missing
set_fact:
instance_conf: {}
skip_instances: true
- name: Destroy molecule instance(s)
ec2:
state: absent
instance_ids: "{{ item.instance_ids }}"
register: server
with_items: "{{ instance_conf }}"
when: not skip_instances
async: 7200
poll: 0
- name: Wait for instance(s) deletion to complete
async_status:
jid: "{{ item.ansible_job_id }}"
register: ec2_jobs
until: ec2_jobs.finished
retries: 300
with_items: "{{ server.results }}"
# Mandatory configuration for Molecule to function.
- name: Populate instance config
set_fact:
instance_conf: {}
- name: Dump instance config
copy:
content: "{{ instance_conf | to_json | from_json | molecule_to_yaml | molecule_header }}"
dest: "{{ molecule_instance_config }}"
when: server.changed | bool

View File

@ -1,81 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: ec2
platforms:
- name: ara-rhel-7
image: ami-c86c3f23
instance_type: t2.micro
vpc_subnet_id: subnet-0e688067
- name: ara-sles-15
image: ami-0a1886cf45f944eb1
instance_type: t2.micro
vpc_subnet_id: subnet-0e688067
- name: ara-ubuntu-18.04
image: ami-0bdf93799014acdc4
instance_type: t2.micro
vpc_subnet_id: subnet-0e688067
- name: ara-amazon-linux-2
image: ami-02ea8f348fa28c108
instance_type: t2.micro
vpc_subnet_id: subnet-0e688067
- name: ara-centos-7
image: ami-9a183671
instance_type: t2.micro
vpc_subnet_id: subnet-0e688067
- name: ara-fedora-29
image: ami-0f904cfaa69a1c64c
instance_type: t2.micro
vpc_subnet_id: subnet-0e688067
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
inventory:
host_vars:
ara-ubuntu-18.04:
ansible_user: ubuntu
ara-centos-7:
ansible_user: centos
ara-fedora-29:
ansible_user: fedora
scenario:
name: ec2
create_sequence:
- create
check_sequence:
- destroy
- dependency
- create
- converge
- check
- destroy
converge_sequence:
- dependency
- create
- converge
destroy_sequence:
- destroy
test_sequence:
- lint
- destroy
- dependency
- syntax
- create
- converge
- idempotence
- side_effect
- verify
- destroy

View File

@ -1,30 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ara-fedora-latest
image: fedora:latest
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
inventory:
group_vars:
all:
ansible_python_interpreter: /usr/bin/python3
scenario:
name: fedora-latest

View File

@ -1,32 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ara-fedora-rawhide
image: fedora:rawhide
pre_build_image: yes
registry:
url: registry.fedoraproject.org
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
inventory:
group_vars:
all:
ansible_python_interpreter: /usr/bin/python3
scenario:
name: fedora-rawhide

View File

@ -1,26 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ara-opensuse-leap
image: opensuse/leap
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: opensuse-leap

View File

@ -1,26 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ara-ubuntu-devel
image: ubuntu:devel
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: ubuntu-devel

View File

@ -1,26 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ara-ubuntu-latest
image: ubuntu:latest
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: ubuntu-latest

View File

@ -1,26 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: docker
platforms:
- name: ara-ubuntu-rolling
image: ubuntu:rolling
pre_build_image: yes
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
scenario:
name: ubuntu-rolling

View File

@ -1,17 +0,0 @@
*******
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

View File

@ -1,33 +0,0 @@
---
dependency:
name: galaxy
options:
role-file: requirements.yml
lint:
name: yamllint
driver:
name: vagrant
provider:
name: virtualbox
platforms:
- name: ara-debian
box: debian/stretch64
- name: ara-fedora
box: fedora/30-cloud-base
provisioner:
name: ansible
playbooks:
prepare: ../resources/prepare.yml
converge: ../resources/playbook.yml
lint:
name: ansible-lint
options:
exclude:
- meta/version.yml
- meta/exception.yml
inventory:
host_vars:
ara-fedora:
ansible_python_interpreter: /usr/bin/python3
scenario:
name: vagrant

View File

@ -1,13 +1,5 @@
---
# tasks file for ara
- name: install required packages
package:
name: "{{ ara_packages }}"
state: present
register: ara_install_required_packages
until: ara_install_required_packages is succeeded
retries: 3
- name: install ara
pip:
name: ara[server]
@ -18,7 +10,7 @@
- name: create ara service
import_role:
name: service
name: robertdebock.service
- name: find callback_plugins path
block:
@ -65,5 +57,3 @@
name: ara
state: started
enabled: yes
when:
- ansible_virtualization_type != "docker"

Some files were not shown because too many files have changed in this diff Show More