Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
commonauth
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
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
Roles
commonauth
Commits
aa619440
Commit
aa619440
authored
9 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
Get inithost to work with Ansible 1.9.x
parent
d12c6ee0
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
defaults/main.yml
+3
-1
3 additions, 1 deletion
defaults/main.yml
tasks/commonauth.yml
+4
-4
4 additions, 4 deletions
tasks/commonauth.yml
tasks/distribute_keys.yml
+14
-14
14 additions, 14 deletions
tasks/distribute_keys.yml
templates/etc_hosts
+1
-5
1 addition, 5 deletions
templates/etc_hosts
with
22 additions
and
24 deletions
defaults/main.yml
+
3
−
1
View file @
aa619440
commonauth_extras
:
[]
auth_certs
:
[]
auth_keys
:
[]
static_ipv4
:
'
192.168.1.1'
distribute_keys
:
false
This diff is collapsed.
Click to expand it.
tasks/commonauth.yml
+
4
−
4
View file @
aa619440
...
...
@@ -30,11 +30,11 @@
mode=644
with_items
:
admins
-
include
:
distribute_
cert
s.yml
when
:
distribute_
cert
s
-
include
:
distribute_
key
s.yml
when
:
distribute_
key
s
-
name
:
"
User
|
Install
Public
Key
For
Extra
Users"
authorized_key
:
user={{ item.username }}
key="{{ lookup('file', inventory_dir + '/files/keys/' + item.
cert
name + '.d2s.pub') }}"
with_items
:
auth_
cert
s
key="{{ lookup('file', inventory_dir + '/files/keys/' + item.
key
name + '.d2s.pub') }}"
with_items
:
auth_
key
s
This diff is collapsed.
Click to expand it.
tasks/distribute_
cert
s.yml
→
tasks/distribute_
key
s.yml
+
14
−
14
View file @
aa619440
# ================= Rebuild
cert
auth for all admins ===========================
# ================= Rebuild
keys
auth for all admins ===========================
---
# file: roles/commonauth/tasks/distribute_
cert
s.yml
# file: roles/commonauth/tasks/distribute_
key
s.yml
-
name
:
"
Cert
s
|
Remove
the
fresh
auth
file
in
case
it
does
already
exist"
-
name
:
"
Key
s
|
Remove
the
fresh
auth
file
in
case
it
does
already
exist"
file
:
path=/home/{{ item }}/.ssh/auth_keys_fresh
state=absent
with_items
:
admins
-
name
:
"
Cert
s
|
Install
Public
Keys
For
Desktop-To-Server
Communication
in
a
fresh
file"
-
name
:
"
Key
s
|
Install
Public
Keys
For
Desktop-To-Server
Communication
in
a
fresh
file"
authorized_key
:
user={{ item }}
key={{ lookup('file', inventory_dir + '/files/keys/' + item + '.d2s.pub') }}
key=
"
{{ lookup('file', inventory_dir + '/files/keys/' + item + '.d2s.pub') }}
"
path=/home/{{ item }}/.ssh/fresh_auth_keys_{{ item }}
with_items
:
admins
-
name
:
"
Cert
s
|
Read
public
key
of
tunnel
user"
-
name
:
"
Key
s
|
Read
public
key
of
tunnel
user"
command
:
more /home/{{ tunnel_user_name }}/.ssh/id_rsa.pub
register
:
pubkey
-
name
:
"
Cert
s
|
Distribute
public
key
of
tunnel
user"
-
name
:
"
Key
s
|
Distribute
public
key
of
tunnel
user"
authorized_key
:
user={{ tunnel_user_name }}
key={{ pubkey.stdout }} {{ inventory_hostname }}
key=
"
{{ pubkey.stdout }} {{ inventory_hostname }}
"
path=/home/{{ tunnel_user_name }}/.ssh/fresh_auth_keys_tunnel_{{ inventory_hostname }}
delegate_to
:
'
{{
item
}}'
with_items
:
groups.all
-
name
:
"
Cert
s
|
Merge
all
public
keys"
-
name
:
"
Key
s
|
Merge
all
public
keys"
shell
:
cat /home/{{ item }}/.ssh/fresh_auth_keys* > /home/{{ item }}/.ssh/auth_keys_fresh
with_items
:
admins
-
name
:
"
Cert
s
|
Remove
temp
files"
-
name
:
"
Key
s
|
Remove
temp
files"
shell
:
rm /home/{{ item }}/.ssh/fresh_auth_keys_*
with_items
:
admins
-
name
:
"
Cert
s
|
Set
ownership
of
authorized
key
file"
-
name
:
"
Key
s
|
Set
ownership
of
authorized
key
file"
shell
:
chown {{ item }}:root /home/{{ item }}/.ssh/auth_keys_fresh
with_items
:
admins
-
name
:
"
Cert
s
|
Set
permission
for
authorized
key
file"
-
name
:
"
Key
s
|
Set
permission
for
authorized
key
file"
shell
:
chmod 600 /home/{{ item }}/.ssh/auth_keys_fresh
with_items
:
admins
-
name
:
"
Cert
s
|
Make
sure
the
authorized_keys
file
exists"
-
name
:
"
Key
s
|
Make
sure
the
authorized_keys
file
exists"
file
:
name=/home/{{ item }}/.ssh/authorized_keys
state=touch
with_items
:
admins
-
name
:
"
Cert
s
|
Move
the
fresh
auth
file
to
replace
the
old
one"
-
name
:
"
Key
s
|
Move
the
fresh
auth
file
to
replace
the
old
one"
shell
:
rm /home/{{ item }}/.ssh/authorized_keys && mv /home/{{ item }}/.ssh/auth_keys_fresh /home/{{ item }}/.ssh/authorized_keys
with_items
:
admins
This diff is collapsed.
Click to expand it.
templates/etc_hosts
+
1
−
5
View file @
aa619440
...
...
@@ -25,11 +25,7 @@ ff02::2 ip6-allrouters
{% endfor %}
{% endif %}
{% endif %}
{% if hostvars[host]['static_ipv4'] is defined %}
{{hostvars[host]['static_ipv4']}} {{host}}
{% elif hostvars[host]['ansible_default_ipv4'] is defined %}
{{hostvars[host]['ansible_default_ipv4']['address']}} {{host}}
{% endif %}
{{hostvars[host]['ansible_default_ipv4']['address']|default(hostvars[host]['static_ipv4'])}} {{host}}
{% endif %}
{% endfor %}
...
...
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