Skip to content
Snippets Groups Projects
Commit 3572080e authored by Karel van Klink's avatar Karel van Klink :smiley_cat:
Browse files

Merge branch 'feature/fix-pipeline' into 'develop'

store collections path from venv as environment variable

See merge request !14
parents 1ec676bf 39d2fd03
No related branches found
No related tags found
1 merge request!14store collections path from venv as environment variable
......@@ -30,8 +30,7 @@ class PlaybookLaunchResponse(BaseModel):
"""
Running a playbook gives this response.
:param status:
:type status: PlaybookJobStatus
:param PlaybookJobStatus status:
:param job_id:
:type job_id: str, optional
:param info:
......@@ -77,14 +76,10 @@ def _run_playbook_proc(
"""
Internal function for running a playbook.
:param job_id: Identifier of the job that is executed.
:type job_id: str
:param playbook: Name of a playbook.
:type playbook: str
:param extra_vars: Extra variables passed to the Ansible playbook
:type extra_vars: dict
:param callback: Callback URL to POST to when execution is completed.
:type callback: str
:param str job_id: Identifier of the job that is executed.
:param str playbook: Name of a playbook.
:param dict extra_vars: Extra variables passed to the Ansible playbook
:param str callback: Callback URL to POST to when execution is completed.
"""
ansible_playbook_run = ansible_runner.run(
......@@ -111,16 +106,12 @@ def run_playbook(
"""
Run an Ansible playbook against a specified inventory.
:param playbook: name of the playbook that is executed.
:type playbook: str
:param extra_vars: Any extra vars needed for the playbook to run.
:type extra_vars: dict
:param inventory: The inventory that the playbook is executed against.
:type inventory: str
:param callback: Callback URL where the playbook should send a status
:param str playbook: name of the playbook that is executed.
:param dict extra_vars: Any extra vars needed for the playbook to run.
:param str inventory: The inventory that the playbook is executed against.
:param str callback: Callback URL where the playbook should send a status
update when execution is completed. This is used for WFO to continue
with the next step in a workflow.
:type callback: str
:return: Result of playbook launch, this could either be successful or
unsuccessful.
:rtype: :class:`PlaybookLaunchResponse`
......
......@@ -57,8 +57,12 @@ def ansible_playbook_bin():
# Add Ansible Galaxy collection
galaxy_path = os.path.join(venv_dir, 'bin', 'ansible-galaxy')
subprocess.check_call([galaxy_path, 'collection', 'install',
TEST_CONFIG['collection-name']])
# FIXME: download Ansible collections to a path inside the venv
TEST_CONFIG['collection-name'], '-p',
os.path.join(venv_dir, 'collections')])
# Set the environment variable for the custom collections path
os.environ['ANSIBLE_COLLECTIONS_PATH'] = \
os.path.join(venv_dir, 'collections')
yield os.path.join(venv_dir, 'bin', 'ansible-playbook')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment