An open API service indexing awesome lists of open source software.

https://github.com/moshloop/ansible-run


https://github.com/moshloop/ansible-run

Last synced: 9 months ago
JSON representation

Awesome Lists containing this project

README

          

# Ansible Runner

A wrapper that runs ansible in a docker container to eliminate python dependency hell, bundles the dependencies needed for the following modules:

* aws
* azure
* vmware
* bigip
* panos
* win

### ansible-run
```bash
pip install ansible-run
ansible-run
# drop into a shell with ansible and friends pre-installed
```

**Environment Variables:**
* `AWS_*` environment variables

**Volumes:**
* `/ssh` (for use with [whilp/ssh-agent](https://github.com/whilp/ssh-agent))
* `/var/run/docker.sock` (so that docker can talk to itself)
* `~/.aws`
* `~/.ansible`
* `/work`
* `$PWD`

### ansible-role
```bash
ansible-role moshloop.java # cross-platform install of java
```

### ansible-test

`ansible-test` will test a playbook using a docker container:

```bash
ansible-test playbook.yml # defaults to centos7
image=ubuntu1804 ansible-test playbook.yml
```

The playbook will be tested for idempotency by running it a 2nd time and ensuring nothing is marked as changed, disable it with:
```bash
idempotency=false ansible-test playbook.yml
```

Once the playbook is run any [InSpec](https://www.inspec.io) (.rb) or [bats](https://github.com/sstephenson/bats) (.bats) tests found with the same name (e.g. `playbook.rb`) will be executed.

See it in action [here](https://github.com/moshloop/ansible-java/tree/master/tests)

### ansible-vault-run

`ansible-vault-run` will decrypt a vault and run a script with the variables exported as environment variables
echo "Decrypts an ansible-vault and runs script with the contents as environment variables"
```bash
ansible-vault-run vault "echo \$password"
```