[tripleo][openstack-ansible][kolla-ansible] Packaging Ansible role and action_plugin for consuming outside OpenStack easily

Chandan kumar chkumar246 at gmail.com
Tue Mar 19 11:51:47 UTC 2019


>From last few months, we have started using
openstack-ansible-os_tempest role developed
under openstack-ansible project in TripleO for running tempest

os_tempest[1] role depends on ansible-role-python_venv_build[2] role
and ansible-config_template[3]
action plugin.

In order to install these dependencies with os_tempest,
we have changed the setup.cfg [data_files] section based on
tripleo-quickstart setup.py file

data_files =
usr/local/share/tripleo-quickstart/roles = roles/*

for python_venv_build and ansible-config_template, we tweaked
role_path and action_plugin
in ansible.cfg https://github.com/openstack/tripleo-quickstart/blob/master/ansible.cfg#L16

It is working fine. Later on, we started checking other roles and
action plugins available
on openstack ecosystem in order to make user experience easier, we found that
ansible-role-tripleo-modify-image dumps it's files in
directory [ https://github.com/openstack/ansible-role-tripleo-modify-image/blob/master/setup.cfg#L23]
and  kolla-ansible is dumping all stuff at share/kolla-ansible/ansible

and ceph-ansible can copied the config_template action_plugin to their own repo
so that end-user can just clone the role & action_plugin and just do
python setup.py install

In all above case, these are using python packaging format.

Currently ansible looks for roles and plugins by default at following
different places from

action_plugins:  ~/.ansible/plugins/action:/usr/share/ansible/plugins/action
roles_path: default:

By seeing that, we thought use to introduce requirements.yaml file to keep the
ansible role requirements and then use ansible-galaxy install -r
it will install both the dependencies to ~/.ansible/roles directory but
it will not load config_template action plugins and for enduser, we explicitly
export the ANSIBLE_ACTION_PLUGINS to ~/.ansible/roles/config_template
which is too much for an end user.

Patch example: https://review.openstack.org/#/q/topic:ostempest_packaging+(status:open+OR+status:merged)

For end user, we are looking for solution something like that or may
be something better:
git clone <os_tempest> then
ansible-galaxy install or python setup.py install and we are done
to run the playbook.

But as you see above, different projects uses different ways of packaging
the role and action plugins.

Do we have defined standard around packaging ansible roles and ansible modules
in OpenStack so that it will be easily consumable so that ansible can easily
find the role and action_plugins?
Like in terms of where to keep ansible role & action plugin  while using
setup.cfg or any other format.

Thanks for reading,

[1.] https://github.com/openstack/openstack-ansible-os_tempest/
[2.] https://github.com/openstack/ansible-role-python_venv_build
[3.] https://github.com/openstack/ansible-config_template


Chandan Kumar

More information about the openstack-discuss mailing list