Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cyber-sandbox-creator
Manage
Activity
Members
Labels
Plan
Issues
10
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MUNI-KYPO-CSC
cyber-sandbox-creator
Commits
b09af3bb
Commit
b09af3bb
authored
4 years ago
by
Attila Farkas
Browse files
Options
Downloads
Patches
Plain Diff
pass extra_vars file directly to ansible
parent
53baa471
No related branches found
No related tags found
1 merge request
!15
Resolve "Support Jinja templates in files with extra_vars"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/vagrant_generator.py
+30
-3
30 additions, 3 deletions
modules/vagrant_generator.py
with
30 additions
and
3 deletions
modules/vagrant_generator.py
+
30
−
3
View file @
b09af3bb
...
...
@@ -133,15 +133,23 @@ def _create_ansible_commands(playbook_location, input_definitions, flags):
install_mode
[
"
value
"
]
=
"
pip
"
commands
.
append
(
install_mode
)
if
"
extra_vars
"
in
flags
and
flags
[
"
extra_vars
"
]:
if
"
ansible_local
"
in
flags
and
flags
[
"
ansible_local
"
]:
extra_vars_location
=
"
/vagrant/extra_vars.yml
"
else
:
extra_vars_location
=
flags
[
"
ansible_local
"
]
user_extra_vars
=
dict
()
user_extra_vars
[
"
type
"
]
=
"
string
"
user_extra_vars
[
"
command
"
]
=
"
raw_arguments
"
user_extra_vars
[
"
value
"
]
=
"
--extra-vars=@
"
+
extra_vars_location
commands
.
append
(
user_extra_vars
)
extravars
=
dict
()
extravars
[
"
type
"
]
=
"
dictionary
"
extravars
[
"
command
"
]
=
"
extra_vars
"
extravars
[
"
dictionary
"
]
=
dict
()
extravars
[
"
dictionary
"
][
"
ansible_python_interpreter
"
]
=
\
"
\"
/usr/bin/python3
\"
"
if
"
extra_vars
"
in
flags
and
flags
[
"
extra_vars
"
]:
user_extra_vars
=
open_yaml
(
flags
[
"
extra_vars
"
])
extravars
[
"
dictionary
"
].
update
(
user_extra_vars
)
commands
.
append
(
extravars
)
return
commands
...
...
@@ -187,6 +195,25 @@ def _call_provisioner(input_definitions, flags):
"""
Create entry to vagrant definitions for calling the provisioner.
"""
provisioner_calls
=
[]
if
"
extra_vars
"
in
flags
and
flags
[
"
extra_vars
"
]
and
\
"
ansible_local
"
in
flags
and
flags
[
"
ansible_local
"
]:
copy_extra_vars
=
dict
()
copy_extra_vars
[
"
type
"
]
=
"
provision
"
copy_extra_vars
[
"
provisioner
"
]
=
"
file
"
copy_extra_vars
[
"
note
"
]
=
"
copy extra_vars to target machine
"
source_arg
=
dict
()
source_arg
[
"
type
"
]
=
"
string
"
source_arg
[
"
command
"
]
=
"
source
"
source_arg
[
"
value
"
]
=
flags
[
"
extra_vars
"
]
destination_arg
=
dict
()
destination_arg
[
"
type
"
]
=
"
string
"
destination_arg
[
"
command
"
]
=
"
destination
"
destination_arg
[
"
value
"
]
=
"
/vagrant/extra_vars.yml
"
copy_extra_vars
[
"
commands
"
]
=
[
source_arg
,
destination_arg
]
provisioner_calls
.
append
(
copy_extra_vars
)
config_playbook
=
dict
()
config_playbook
[
"
type
"
]
=
"
provision
"
if
"
ansible_local
"
in
flags
and
flags
[
"
ansible_local
"
]:
...
...
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