neillturner / kitchen-ansible

Ansible Provisioner for Test Kitchen
Other
350 stars 134 forks source link

`role_path` in ansible.cfg is ignored. #284

Closed adborden closed 6 years ago

adborden commented 6 years ago

We have an unusual setup where we vendor our third-party galaxy roles in /roles/vendor. In order to reference roles as user.role-name instead of vendor/user.role-name, we set roles_path = roles:roles/vendor in ansible.cfg to make this work.

Unfortunately with kitchen-ansible, it seems that in setting ANSIBLE_ROLES_PATH, the roles_path in our config does not apply.

          ANSIBLE_ROLES_PATH=/tmp/kitchen/roles sudo -E -s  ansible-playbook -i /tmp/kitchen/hosts  -c local -M /tmp/kitchen/modules -v         /tmp/kitchen/default.yml
)
       Using /etc/ansible/ansible.cfg as config file
       ERROR! the role 'gsa.datagov-deploy-apache2' was not found in /tmp/kitchen/roles:/tmp/kitchen/roles:/tmp/kitchen

       The error appears to have been in '/tmp/kitchen/default.yml': line 6, column 7, but may
       be elsewhere in the file depending on the exact syntax problem.

       The offending line appears to be:

           - software/ckan/common
           - gsa.datagov-deploy-apache2
             ^ here
adborden commented 6 years ago

We've worked around the issue by overriding ANSIBLE_ROLES_PATH:

#.kitchen.yml
provisioner:
  env_vars:
    ANSIBLE_ROLES_PATH: /tmp/kitchen/roles:/tmp/kitchen/roles/vendor
neillturner commented 6 years ago

it is using the /tmp/kitchen/roles directory by default so doesn't use the ansible.cfg role_path

adborden commented 6 years ago

Thanks, would you clarify?

Is there something we're doing wrong or is this something kitchen-ansible won't fix?