Python source to build cultclassik/ansible-control container.
This container will listen for an HTTP POST on the root URL. Once it receives that request it will clone the repo at GIT_URL into the GIT_DIR, then it will execute ANSIBLE_CMD as the SSH_USER with the provided SSH key.
Requires a working installation of Docker CE or EE.
A repository containing your Ansible code.
Target systems must have the SSH_USER created and have the public key that corresponds to the mapped private key file. This user probably needs sudo rights.
docker build -t cultclassik/ansible-control .
- SSH_USER: User name of the user that will be used to execute Ansible run
- GIT_URL: Full URL of the Ansible repo that should be cloned and run
- GIT_DIR: Directory name to clone the repo in to
- ANSIBLE_CMD: The command to run to execute Ansible, i.e. "ansible-playbook /ansible/main.yml"
docker run -name ansible-control \ -e SSH_USER=myuser \ -e GIT_URL=https://www.github.com/myurl \ -e ANSIBLE_CMD=ansible-playbook /ansible/main.yml \ -l traefik.enable=true \ -l traefik.frontend.rule=Host:home.diehlabs.com;PathPrefixStrip:/ansible \ -l traefik.port=8000 \ -v /data/mysshkey.rsa:/key.rsa \ cultclassik/ansible-control
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
18.01.2020: Initial version created
Chris Diehl wrote this. Based on another project I created to initiate r10k deployments for Puppet Open Source Server from Github webhooks.
Use it, improve it.