From a94f91f4aaf5e436c7886a0a57806a97216a3916 Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Thu, 18 Jul 2019 13:30:34 -0500 Subject: [PATCH] Add galaxy role path which will be ignored by git This change will ensure that local testing, with online roles installed via galaxy, are not creating a dirty git tree. To build the separation an empty directory "roles.galaxy" has been added which the galaxy command will use to install external roles. All of the role path settings have been updated to accomodate this new directory. Change-Id: If68fa43231b2efbcdc046070a098bd49f47cfdb2 Signed-off-by: Kevin Carter --- .gitignore | 3 +++ .pre-commit-config.yaml | 7 +++---- ansible-test-env.rc | 2 +- tox.ini | 5 +++-- tripleo_ansible/roles.galaxy/.gitkeep | 0 5 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 tripleo_ansible/roles.galaxy/.gitkeep diff --git a/.gitignore b/.gitignore index 4856b1531..a40894086 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,6 @@ nosetests.xml # Playbook retry files *.retry + +# roles +tripleo_ansible/roles.galaxy/* \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6217f5eba..137387c2c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -31,11 +31,10 @@ repos: files: \.(yaml|yml)$ entry: >- ansible-lint --force-color -v -x "ANSIBLE0006,ANSIBLE0007,ANSIBLE0010,ANSIBLE0012,ANSIBLE0013,ANSIBLE0016" - --exclude=tripleo_ansible/roles/openstack-operations/tasks/restore_galera.yml - --exclude=tripleo_ansible/roles/openstack-operations/tasks/restore_redis.yml + --exclude=tripleo_ansible/roles.galaxy # TODO(cloudnull): These codes were added to pass the lint check. - # All of these ignore codes should be resolved in - # future PRs. + # Things found within roles.galaxy are external + # and not something maintained here. - repo: https://github.com/openstack-dev/bashate.git rev: 0.6.0 hooks: diff --git a/ansible-test-env.rc b/ansible-test-env.rc index 346b8c92f..b21feac17 100644 --- a/ansible-test-env.rc +++ b/ansible-test-env.rc @@ -5,7 +5,7 @@ export ANSIBLE_CALLBACK_PLUGINS="${TRIPLEO_ANSIBLE_WORKPATH}/tripleo_ansible/ans export ANSIBLE_FILTER_PLUGINS="${TRIPLEO_ANSIBLE_WORKPATH}/tripleo_ansible/ansible_plugins/filter" export ANSIBLE_LIBRARY="${TRIPLEO_ANSIBLE_WORKPATH}/tripleo_ansible/ansible_plugins/modules" export ANSIBLE_MODULE_UTILS="${TRIPLEO_ANSIBLE_WORKPATH}/tripleo_ansible/ansible_plugins/module_utils" -export ANSIBLE_ROLES_PATH="${TRIPLEO_ANSIBLE_WORKPATH}/tripleo_ansible/roles" +export ANSIBLE_ROLES_PATH="${TRIPLEO_ANSIBLE_WORKPATH}/tripleo_ansible/roles.galaxy:${TRIPLEO_ANSIBLE_WORKPATH}/tripleo_ansible/roles" export ANSIBLE_INVENTORY="${TRIPLEO_ANSIBLE_WORKPATH}/tests/hosts.ini" export ANSIBLE_RETRY_FILES_ENABLED="0" export ANSIBLE_LOAD_CALLBACK_PLUGINS="1" diff --git a/tox.ini b/tox.ini index 32984ed3e..aa2c55a2c 100644 --- a/tox.ini +++ b/tox.ini @@ -14,7 +14,7 @@ setenv = ANSIBLE_FILTER_PLUGINS={toxinidir}/tripleo_ansible/ansible_plugins/filter ANSIBLE_LIBRARY={toxinidir}/tripleo_ansible/ansible_plugins/modules ANSIBLE_MODULE_UTILS={toxinidir}/tripleo_ansible/ansible_plugins/module_utils - ANSIBLE_ROLES_PATH={toxinidir}/tripleo_ansible/roles + ANSIBLE_ROLES_PATH={toxinidir}/tripleo_ansible/roles.galaxy:{toxinidir}/tripleo_ansible/roles ANSIBLE_INVENTORY={toxinidir}/tests/hosts.ini ANSIBLE_NOCOWS=1 ANSIBLE_RETRY_FILES_ENABLED=0 @@ -47,7 +47,8 @@ envdir = {toxworkdir}/linters deps = {[testenv:linters]deps} commands = - bash -c "ansible-galaxy install -fr {toxinidir}/tripleo_ansible/ansible-role-requirements.yml" + bash -c "ANSIBLE_ROLES_PATH='{toxinidir}/tripleo_ansible/roles.galaxy' \ + ansible-galaxy install -fr {toxinidir}/tripleo_ansible/ansible-role-requirements.yml" python -m pre_commit run ansible-lint -a [testenv:yamllint] diff --git a/tripleo_ansible/roles.galaxy/.gitkeep b/tripleo_ansible/roles.galaxy/.gitkeep new file mode 100644 index 000000000..e69de29bb