oasis_roles.molecule_docker_ci

This Role Has Been Deprecated: Please use the version in the oasis_roles.system Ansible Collection

Build Status

molecule_docker_ci

Creates and destroys Docker containers running on the local system for use in a molecule playbook. Can also be used to create and destroy docker containers in a more general sense, but that is not the purpose of this role nor is it a particularly supported use case

This role is adapted from the built-in playbooks created by molecule's init methods. By externalizing this functionality as a role, updates to the playbooks can be made in one central location and updated to account for bugs, etc, etc. Basically, for all the same reasons that playbooks should be composed by roles and that Ansible Galaxy exists at all are the reasons this role should be used for provisioning and destroying resources from Molecule playbooks.

To use the role, you'll need to add it to your requirements.yml file or however you are pulling Ansible roles during your test execution.

Requirements

Ansible 2.4 or higher

Role Variables

Currently the following variables are supported:

General

  • molecule_docker_ci_state - Default: present. Valid options are 'present' and 'absent'. If set to 'absent', it will tear down the molecule instances. Set to 'present' in order to create them.

All other variables are pulled from the molecule context or the molecule.yml file in your scenario. For that reason, this role is very tightly integrated with Molecule and shouldn't really be used elsewhere.

Dependencies

Molecule

Example Playbook

The following two playbooks should be sufficient to bring up and tear down containers in your molecule.yml

create.yml

- hosts: localhost
  roles:
    - role: oasis_roles.molecule_docker_ci

destroy.yml

- hosts: localhost
  roles:
    - role: oasis_roles.molecule_docker_ci
      molecule_docker_ci_state: absent

License

GPLv3

Author Information

Greg Hellings greg.hellings@gmail.com

About

Manage the creation and destruction of container resources for running molecule in a container runtime environment

Install
ansible-galaxy install oasis_roles.molecule_docker_ci
GitHub repository
License
gpl-3.0
Downloads
16.5k