This is based on the ansible-distributed Docker connection plug in
This requires a Singularity instance be running.
Make ansible aware of this plugin.
-
Install by copying or symlinking it into a directory ansible will search
$PYTHONPATH/lib/python2.7/site-packages/ansible/plugins/connection/~/.ansible/plugins/connection/usr/share/ansible/plugins/connection
-
Set the configuration directory to this repo. Either set the
ANSIBLE_CONNECTION_PLUGINSenvironment variable or set theDEFAULT_CONNECTION_PLUGIN_PATHin your ansible config file like:
[defaults]
connection_plugins=path/to/repo
See also https://docs.ansible.com/ansible/latest/reference_appendices/config.html
Then you need to tell ansible to use it!
- On the command line with the
-coption
sudo ansible-playbook -c singularity ...
- Via the environment with
ANSIBLE_TRANSPORTvariable
export ANSIBLE_TRANSPORT=singularity
sudo ansible....
-
Set the ansible configurarion variable
DEFAULT_TRANSPORT(under section[defaults], settransport=singularity). -
In your inventory set
ansible_connectionto "singularity" for the container -
In your playbook set the connection option for the play to "singularity"
You need to tell ansible which instances to provision. The host name should be the singularity instance name, with it's schema, e.g. instance://container. If you put this in a file named e.g. hosts then:
cat hosts
instance://container ansible_connection=singularity
sudo ansible-playbook -i hosts playbook.yml