Starting with version 0.2.0 Ansible Container provides the ability to add local to the Ansible Build Container
by using the
--roles-path option. So if you have roles already installed on the local file system, you can simply
reference the local path for the build container to use.
For example, if roles are locally installed in
/etc/ansible/roles, the following will make the roles available
inside the build container:
$ ansible-container build --roles-path /etc/ansible/roles
main.yml playbook refer to roles by name. For example, if the role
apache is installed in
locally, then the following will execute the role as part of
- name: Example play hosts: web roles: - name: Install apache role: apache
If using Docker Machine, be aware that mounting paths outside of the user’s home directory to a container may require additional steps. For more details see the Docker tutorial, Manage data in containers.
If you choose to access locally installed roles using
--roles-path, then you must include the
option when running the
shipit commands. During these operations the
main.yml playbook is
accessed using the
--list-hosts option to determine the list of hosts affected by the playbook. If roles cannot be
accessed, Ansible Playbook will fail to parse
Starting in version 0.2.0 Ansible Container will automatically install roles included in a
requirements.yml file placed in
ansible directory. If you are unfamiliar with
requirements.yml, see Installing Multiple Roles From a File.
roles_path is set to
/etc/ansible/roles on the build container, and roles will be installed there. No special
changes are required in
main.yml. To run an installed role simply refer to it by name.