Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
commonkeys
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
commonkeys
Commits
e533402c
Commit
e533402c
authored
7 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
Dstribute pub keys of all admins to all hosts in the same farm
parent
5b59e338
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tasks/admin_keys.yml
+14
-0
14 additions, 0 deletions
tasks/admin_keys.yml
tasks/main.yml
+5
-3
5 additions, 3 deletions
tasks/main.yml
with
19 additions
and
3 deletions
tasks/
tunnel
_keys.yml
→
tasks/
admin
_keys.yml
+
14
−
0
View file @
e533402c
---
# file: roles/commonkeys/tasks/
tunnel
_keys.yml
# file: roles/commonkeys/tasks/
admin
_keys.yml
-
name
:
"
Read
public
key
of
tunnel
user"
shell
:
cat /home/{{
tunnel_
user
_
name }}/.ssh/id_rsa.pub
-
name
:
"
Read
public
key
of
admin
user"
shell
:
cat /home/{{ username }}/.ssh/id_rsa.pub
register
:
pubkey
-
name
:
"
Distribute
public
key
of
tunnel
user"
-
name
:
"
Distribute
public
key
of
admin
user"
authorized_key
:
user='{{
tunnel_
user
_
name }}'
user='{{ username }}'
key="{{ hostvars[item].pubkey.stdout }} {{ item }}"
path='/home/{{
tunnel_
user
_
name }}/.ssh/fresh_auth_keys_tunnel_{{ item }}'
path='/home/{{ username }}/.ssh/fresh_auth_keys_tunnel_{{ item }}'
with_items
:
'
{{
groups.all
}}'
when
:
item != "localhost" and inventory_hostname != "localhost" and hostvars[item].pubkey is defined
This diff is collapsed.
Click to expand it.
tasks/main.yml
+
5
−
3
View file @
e533402c
...
...
@@ -14,9 +14,11 @@
loop_var
:
hostname
when
:
hostname != "localhost" and inventory_hostname != "localhost"
-
name
:
"
Tunnel
keys"
include
:
tunnel_keys.yml
when
:
tunnel_user_name|default('systunnel') in admins
-
name
:
"
Admin
keys"
include
:
admin_keys.yml
loop_control
:
loop_var
:
username
with_items
:
'
{{
admins
}}'
tags
:
'
Keys'
-
name
:
"
User
keys"
...
...
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