https://github.com/moshloop/ansible-run
https://github.com/moshloop/ansible-run
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/moshloop/ansible-run
- Owner: moshloop
- Created: 2018-06-06T17:38:59.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-08-18T13:03:14.000Z (almost 7 years ago)
- Last Synced: 2025-05-20T08:09:37.643Z (about 1 year ago)
- Language: Shell
- Size: 824 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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"
```