Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LSO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
GÉANT Orchestration and Automation Team
GAP
LSO
Commits
39d2fd03
Verified
Commit
39d2fd03
authored
2 years ago
by
Karel van Klink
Browse files
Options
Downloads
Patches
Plain Diff
store collections path from venv as environment variable
parent
b5ae598c
No related branches found
No related tags found
1 merge request
!14
store collections path from venv as environment variable
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lso/routes/common.py
+9
-18
9 additions, 18 deletions
lso/routes/common.py
test/conftest.py
+6
-2
6 additions, 2 deletions
test/conftest.py
with
15 additions
and
20 deletions
lso/routes/common.py
+
9
−
18
View file @
39d2fd03
...
@@ -30,8 +30,7 @@ class PlaybookLaunchResponse(BaseModel):
...
@@ -30,8 +30,7 @@ class PlaybookLaunchResponse(BaseModel):
"""
"""
Running a playbook gives this response.
Running a playbook gives this response.
:param status:
:param PlaybookJobStatus status:
:type status: PlaybookJobStatus
:param job_id:
:param job_id:
:type job_id: str, optional
:type job_id: str, optional
:param info:
:param info:
...
@@ -77,14 +76,10 @@ def _run_playbook_proc(
...
@@ -77,14 +76,10 @@ def _run_playbook_proc(
"""
"""
Internal function for running a playbook.
Internal function for running a playbook.
:param job_id: Identifier of the job that is executed.
:param str job_id: Identifier of the job that is executed.
:type job_id: str
:param str playbook: Name of a playbook.
:param playbook: Name of a playbook.
:param dict extra_vars: Extra variables passed to the Ansible playbook
:type playbook: str
:param str callback: Callback URL to POST to when execution is completed.
: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
"""
"""
ansible_playbook_run
=
ansible_runner
.
run
(
ansible_playbook_run
=
ansible_runner
.
run
(
...
@@ -111,16 +106,12 @@ def run_playbook(
...
@@ -111,16 +106,12 @@ def run_playbook(
"""
"""
Run an Ansible playbook against a specified inventory.
Run an Ansible playbook against a specified inventory.
:param playbook: name of the playbook that is executed.
:param str playbook: name of the playbook that is executed.
:type playbook: str
:param dict extra_vars: Any extra vars needed for the playbook to run.
:param extra_vars: Any extra vars needed for the playbook to run.
:param str inventory: The inventory that the playbook is executed against.
:type extra_vars: dict
:param str callback: Callback URL where the playbook should send a status
:param inventory: The inventory that the playbook is executed against.
:type inventory: str
:param callback: Callback URL where the playbook should send a status
update when execution is completed. This is used for WFO to continue
update when execution is completed. This is used for WFO to continue
with the next step in a workflow.
with the next step in a workflow.
:type callback: str
:return: Result of playbook launch, this could either be successful or
:return: Result of playbook launch, this could either be successful or
unsuccessful.
unsuccessful.
:rtype: :class:`PlaybookLaunchResponse`
:rtype: :class:`PlaybookLaunchResponse`
...
...
This diff is collapsed.
Click to expand it.
test/conftest.py
+
6
−
2
View file @
39d2fd03
...
@@ -57,8 +57,12 @@ def ansible_playbook_bin():
...
@@ -57,8 +57,12 @@ def ansible_playbook_bin():
# Add Ansible Galaxy collection
# Add Ansible Galaxy collection
galaxy_path
=
os
.
path
.
join
(
venv_dir
,
'
bin
'
,
'
ansible-galaxy
'
)
galaxy_path
=
os
.
path
.
join
(
venv_dir
,
'
bin
'
,
'
ansible-galaxy
'
)
subprocess
.
check_call
([
galaxy_path
,
'
collection
'
,
'
install
'
,
subprocess
.
check_call
([
galaxy_path
,
'
collection
'
,
'
install
'
,
TEST_CONFIG
[
'
collection-name
'
]])
TEST_CONFIG
[
'
collection-name
'
],
'
-p
'
,
# FIXME: download Ansible collections to a path inside the venv
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
'
)
yield
os
.
path
.
join
(
venv_dir
,
'
bin
'
,
'
ansible-playbook
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment