Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
float
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container registry
Model registry
Operate
Environments
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
Show more breadcrumbs
ai3
float
Commits
2bcff0eb
Commit
2bcff0eb
authored
6 months ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
Allow controlling ansible_become and user-related params
Using a command-line flag.
parent
a66d3074
Branches
Branches containing commit
No related tags found
1 merge request
!304
Fix CI issues with vmine / floatup
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
float
+19
-8
19 additions, 8 deletions
float
with
19 additions
and
8 deletions
float
+
19
−
8
View file @
2bcff0eb
...
...
@@ -162,13 +162,7 @@ DEFAULT_VARS = {
# Ansible inventory (hosts are created dynamically).
'
inventory
'
:
{
'
hosts
'
:
{},
'
group_vars
'
:
{
'
vagrant
'
:
{
'
ansible_user
'
:
'
vagrant
'
,
'
ansible_become
'
:
True
,
'
ansible_ssh_private_key_file
'
:
'
~/.vagrant.d/insecure_private_key
'
,
},
},
'
group_vars
'
:
{},
},
# Ansible configuration.
...
...
@@ -346,7 +340,7 @@ def _render_skel(target_dir, ctx):
def
command_create_env
(
path
,
services
,
passwords
,
playbooks
,
roles_path
,
num_hosts
,
additional_host_groups
,
additional_configs
,
ram
,
domain
,
infra_domain
,
extra_vars
):
become
,
extra_vars
):
all_vars
=
DEFAULT_VARS
# Set paths in the internal config.
...
...
@@ -355,6 +349,20 @@ def command_create_env(path, services, passwords, playbooks,
all_vars
[
'
passwords_yml_path
'
]
=
passwords
all_vars
[
'
playbooks
'
]
=
playbooks
# Set connection-related user parameters.
if
become
==
'
root
'
:
all_vars
[
'
inventory
'
][
'
group_vars
'
][
'
vagrant
'
]
=
{
'
ansible_user
'
:
'
root
'
,
'
ansible_become
'
:
False
,
}
else
:
all_vars
[
'
inventory
'
][
'
group_vars
'
][
'
vagrant
'
]
=
{
'
ansible_user
'
:
become
,
'
ansible_become
'
:
True
,
# For legacy compatibility reasons.
'
ansible_ssh_private_key_file
'
:
'
~/.vagrant.d/insecure_private_key
'
,
}
# Extend the Ansible roles_path.
if
roles_path
:
for
rpath
in
roles_path
.
split
(
'
:
'
):
...
...
@@ -548,6 +556,9 @@ memberships, using the --additional-host-group command-line option.
create_env_parser
.
add_argument
(
'
--ram
'
,
metavar
=
'
MB
'
,
type
=
int
,
default
=
3072
,
help
=
'
RAM for each VM when using --vagrant (default: 3072)
'
)
create_env_parser
.
add_argument
(
'
--become
'
,
metavar
=
'
USER
'
,
default
=
'
vagrant
'
,
help
=
'
ansible_user, disable ansible_become if
"
root
"'
)
create_env_parser
.
add_argument
(
'
--additional-host-group
'
,
metavar
=
'
GROUP=HOST1[,HOST2...]
'
,
dest
=
'
additional_host_groups
'
,
...
...
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