Browse Source

Inject both paths for validations roles location

We're in a weird state with validations roles in different locations.
Let's reflect it in the variables.
Also, let's point to a valid "groups.yaml" location.

Closes-Bug: #1895507
Depends-On: https://review.opendev.org/#/c/752187/
Change-Id: Iee198b04f962a3a049515d7b70584f55413bba6f
(cherry picked from commit cbb798dde1)
changes/29/752129/4
Cédric Jeanneret 2 weeks ago
committed by Cédric Jeanneret (Tengu)
parent
commit
0b43745613
2 changed files with 29 additions and 14 deletions
  1. +11
    -8
      tripleoclient/constants.py
  2. +18
    -6
      tripleoclient/utils.py

+ 11
- 8
tripleoclient/constants.py View File

@@ -93,10 +93,8 @@ ENABLE_SSH_ADMIN_SSH_PORT_TIMEOUT = 600

ADDITIONAL_ARCHITECTURES = ['ppc64le']

DEFAULT_VALIDATIONS_BASEDIR = (
"/usr/share/ansible"
if os.path.exists("/usr/share/ansible/validation-playbooks")
else "/usr/share/openstack-tripleo-validations")
DEFAULT_VALIDATIONS_BASEDIR = "/usr/share/ansible"
DEFAULT_VALIDATIONS_LEGACY_BASEDIR = "/usr/share/openstack-tripleo-validations"

VALIDATIONS_LOG_BASEDIR = '/var/log/validations'

@@ -107,14 +105,19 @@ ANSIBLE_INVENTORY = os.path.join(DEFAULT_WORK_DIR,
'{}/tripleo-ansible-inventory.yaml')

ANSIBLE_VALIDATION_DIR = (
"/usr/share/ansible/validation-playbooks"
if os.path.exists("/usr/share/ansible/validation-playbooks")
else "/usr/share/openstack-tripleo-validations/playbooks")
os.path.join(DEFAULT_VALIDATIONS_LEGACY_BASEDIR, 'playbooks')
if os.path.join(DEFAULT_VALIDATIONS_LEGACY_BASEDIR, 'playbooks')
else "/usr/share/ansible/validation-playbooks"
)

ANSIBLE_TRIPLEO_PLAYBOOKS = \
'/usr/share/ansible/tripleo-playbooks'

VALIDATION_GROUPS_INFO = '%s/groups.yaml' % DEFAULT_VALIDATIONS_BASEDIR
VALIDATION_GROUPS_INFO = (
'/usr/share/ansible/groups.yaml'
if os.path.exists('/usr/share/ansible/groups.yaml')
else os.path.join(DEFAULT_VALIDATIONS_LEGACY_BASEDIR, 'groups.yaml')
)

# ctlplane network defaults
CTLPLANE_CIDR_DEFAULT = '192.168.24.0/24'


+ 18
- 6
tripleoclient/utils.py View File

@@ -485,11 +485,13 @@ def run_ansible_playbook(playbook, inventory, workdir, playbook_dir=None,
'/usr/share/ansible/plugins/modules:'
'/usr/share/ceph-ansible/library:'
'/usr/share/ansible-modules:'
'{}/library:'
'{}/library'.format(
constants.CLOUD_HOME_DIR,
os.path.join(workdir, 'modules'),
os.path.join(cwd, 'modules'),
constants.DEFAULT_VALIDATIONS_BASEDIR
constants.DEFAULT_VALIDATIONS_BASEDIR,
constants.DEFAULT_VALIDATIONS_LEGACY_BASEDIR
)
)
env['ANSIBLE_LOOKUP_PLUGINS'] = os.path.expanduser(
@@ -498,11 +500,13 @@ def run_ansible_playbook(playbook, inventory, workdir, playbook_dir=None,
'/usr/share/ansible/tripleo-plugins/lookup:'
'/usr/share/ansible/plugins/lookup:'
'/usr/share/ceph-ansible/plugins/lookup:'
'{}/lookup_plugins:'
'{}/lookup_plugins'.format(
constants.CLOUD_HOME_DIR,
os.path.join(workdir, 'lookup'),
os.path.join(cwd, 'lookup'),
constants.DEFAULT_VALIDATIONS_BASEDIR
constants.DEFAULT_VALIDATIONS_BASEDIR,
constants.DEFAULT_VALIDATIONS_LEGACY_BASEDIR
)
)
env['ANSIBLE_CALLBACK_PLUGINS'] = os.path.expanduser(
@@ -511,11 +515,13 @@ def run_ansible_playbook(playbook, inventory, workdir, playbook_dir=None,
'/usr/share/ansible/tripleo-plugins/callback:'
'/usr/share/ansible/plugins/callback:'
'/usr/share/ceph-ansible/plugins/callback:'
'{}/callback_plugins:'
'{}/callback_plugins'.format(
constants.CLOUD_HOME_DIR,
os.path.join(workdir, 'callback'),
os.path.join(cwd, 'callback'),
constants.DEFAULT_VALIDATIONS_BASEDIR
constants.DEFAULT_VALIDATIONS_BASEDIR,
constants.DEFAULT_VALIDATIONS_LEGACY_BASEDIR
)
)
env['ANSIBLE_ACTION_PLUGINS'] = os.path.expanduser(
@@ -524,11 +530,13 @@ def run_ansible_playbook(playbook, inventory, workdir, playbook_dir=None,
'/usr/share/ansible/tripleo-plugins/action:'
'/usr/share/ansible/plugins/action:'
'/usr/share/ceph-ansible/plugins/actions:'
'{}/action_plugins:'
'{}/action_plugins'.format(
constants.CLOUD_HOME_DIR,
os.path.join(workdir, 'action'),
os.path.join(cwd, 'action'),
constants.DEFAULT_VALIDATIONS_BASEDIR
constants.DEFAULT_VALIDATIONS_BASEDIR,
constants.DEFAULT_VALIDATIONS_LEGACY_BASEDIR
)
)
env['ANSIBLE_FILTER_PLUGINS'] = os.path.expanduser(
@@ -537,11 +545,13 @@ def run_ansible_playbook(playbook, inventory, workdir, playbook_dir=None,
'/usr/share/ansible/tripleo-plugins/filter:'
'/usr/share/ansible/plugins/filter:'
'/usr/share/ceph-ansible/plugins/filter:'
'{}/filter_plugins:'
'{}/filter_plugins'.format(
constants.CLOUD_HOME_DIR,
os.path.join(workdir, 'filter'),
os.path.join(cwd, 'filter'),
constants.DEFAULT_VALIDATIONS_BASEDIR
constants.DEFAULT_VALIDATIONS_BASEDIR,
constants.DEFAULT_VALIDATIONS_LEGACY_BASEDIR
)
)
env['ANSIBLE_ROLES_PATH'] = os.path.expanduser(
@@ -551,11 +561,13 @@ def run_ansible_playbook(playbook, inventory, workdir, playbook_dir=None,
'/usr/share/ansible/roles:'
'/usr/share/ceph-ansible/roles:'
'/etc/ansible/roles:'
'{}/roles:'
'{}/roles'.format(
constants.CLOUD_HOME_DIR,
os.path.join(workdir, 'roles'),
os.path.join(cwd, 'roles'),
constants.DEFAULT_VALIDATIONS_BASEDIR
constants.DEFAULT_VALIDATIONS_BASEDIR,
constants.DEFAULT_VALIDATIONS_LEGACY_BASEDIR
)
)
env['ANSIBLE_CALLBACK_WHITELIST'] = callback_whitelist


Loading…
Cancel
Save