Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Ansible Framework Container
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
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
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
Ansible
Playbooks
Ansible Framework Container
Commits
d848ca62
Commit
d848ca62
authored
9 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
Allow inithost to work with different initial auth methods
parent
53799340
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
inithost.sh
+15
-2
15 additions, 2 deletions
inithost.sh
inithost.yml
+6
-4
6 additions, 4 deletions
inithost.yml
setup_local.yml
+3
-0
3 additions, 0 deletions
setup_local.yml
with
24 additions
and
6 deletions
inithost.sh
+
15
−
2
View file @
d848ca62
...
...
@@ -5,13 +5,26 @@ cd $( cd $(dirname $(realpath $0)) ; pwd )
if
[
"
$2
"
==
""
]
then
echo
"Usage"
echo
"inithost.sh HOST IP"
echo
"inithost.sh HOST IP
[USER [KEYFILE]]
"
exit
101
;
fi
HOST
=
$1
IP
=
$2
ROOT
=
root
KEYFILE
=
--ask-pass
shift
shift
if
[
"
$1
"
!=
""
]
then
ROOT
=
$1
shift
fi
if
[
"
$1
"
!=
""
]
then
KEYFILE
=
--private-key
=
$1
shift
fi
./ansible-playbook.sh inithost
--ask-pass
--extra-vars
=
"host=
$HOST
inithostip=
$IP
"
--tags
=
"prepare"
"
$@
"
./ansible-playbook.sh inithost
--extra-vars
=
"
inituser=
$ROOT
host=
$HOST
inithostip=
$IP
firstuser=
$USER
"
--tags
=
"prepare"
$KEYFILE
"
$@
"
./ansible-playbook.sh inithost
--extra-vars
=
"host=
$HOST
inithostip=
$IP
distribute_keys=true"
--tags
=
"config"
"
$@
"
This diff is collapsed.
Click to expand it.
inithost.yml
+
6
−
4
View file @
d848ca62
...
...
@@ -18,7 +18,7 @@
-
'
{{
inithostip
}}'
-
'
{{
host
}}'
-
name
:
"
InitHost
|
Copy
root
id
to
new
host"
shell
:
"
ssh-copy-id
-i
root@{{
inithostip
}}
-o
PasswordAuthentication=yes
-o
PubkeyAuthentication=no"
shell
:
"
ssh-copy-id
-i
root@{{
inithostip
}}
-o
PasswordAuthentication=yes
-o
PubkeyAuthentication=no
-o
IdentitiesOnly=yes
"
register
:
inithost_ssh_copy_id
changed_when
:
"
inithost_ssh_copy_id.rc
!=
0"
failed_when
:
false
...
...
@@ -35,17 +35,18 @@
lineinfile
:
dest=/etc/hosts
regexp="^{{ inithostip }} "
line={{ inithostip }} {{ host }}
line=
"
{{ inithostip }} {{ host }}
"
-
name
:
"
Setup
first
user"
hosts
:
"
{{
host
}}"
gather_facts
:
false
user
:
root
user
:
"
{{
inituser
}}"
sudo
:
yes
tags
:
-
prepare
vars
:
first_user
:
-
name
:
"
{{
lookup('env','USER')
}}"
-
name
:
"
{{
firstuser
}}"
password
:
"
{{
ansible_sudo_pass|password_hash('sha512')
}}"
tasks
:
-
name
:
"
InitHost
|
Create
first
user"
...
...
@@ -71,6 +72,7 @@
-
name
:
"
Security
setup"
hosts
:
"
{{
host
}}"
gather_facts
:
true
sudo
:
yes
tags
:
-
config
...
...
This diff is collapsed.
Click to expand it.
setup_local.yml
+
3
−
0
View file @
d848ca62
...
...
@@ -112,3 +112,6 @@
-
option
:
"
scp_if_ssh"
value
:
"
True"
section
:
"
ssh_connection"
-
option
:
"
ssh_args"
value
:
"
-o
IdentitiesOnly=yes"
section
:
"
ssh_connection"
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