Run ansible directly in the cluster i.e. as deployment script after a successful build
Working directory is /home/ansible
.
The inventory is set to contain only localhost
(as it is intended to run kubernetes.core.k8s[_info]
packages)
Hint: use connection: local
in your playbooks. Otherwise ansible will attempt to ssh into localhost.
(If you know how to set this in ansible.cfg or the inventory, please let me know via issue)
Runs ansible-playbook $PLAYBOOK
Runs ansible-playbook run/main.yaml
. Mount the ansible scripts to /home/ansible/run
Runs ansible-playbook run.yaml
.
Runs ansible-playbook main.yaml
.
Runs sleep $SLEEP
. Useful for debugging purposes.
Use kubectl exec -it -n <namespace> <podname> -- ash
to log into the instance and run ansible commands from there.
See builtins
folder for built in yaml files.
Some examples:
Delete all pods wich run $TARGET_IMAGE
(env variable).
Set PLAYBOOK
to builtin/deletePodsByImage.yaml