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
c186e6cf
Commit
c186e6cf
authored
8 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
Improve key distribution
parent
06ce3e81
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
tasks/main.yml
+6
-2
6 additions, 2 deletions
tasks/main.yml
tasks/reset.yml
+20
-0
20 additions, 0 deletions
tasks/reset.yml
tasks/tunnel_keys.yml
+15
-0
15 additions, 0 deletions
tasks/tunnel_keys.yml
tasks/user_keys.yml
+1
-3
1 addition, 3 deletions
tasks/user_keys.yml
with
42 additions
and
5 deletions
tasks/main.yml
+
6
−
2
View file @
c186e6cf
---
# file: roles/commonkeys/tasks/main.yml
-
include
:
distribute_tunnel_keys.yml
-
include
:
reset.yml
with_items
:
'
{{
groups.all
}}'
when
:
item != "localhost" and inventory_hostname != "localhost"
-
include
:
distribute_keys.yml
-
include
:
tunnel_keys.yml
-
include
:
user_keys.yml
with_flattened
:
-
'
{{
admins
}}'
-
'
{{
jailusers
}}'
...
...
This diff is collapsed.
Click to expand it.
tasks/reset.yml
0 → 100644
+
20
−
0
View file @
c186e6cf
---
# file: roles/commonauth/tasks/reset.yml
-
name
:
"
Remove
previous
hostname
from
known_hosts"
become
:
no
known_hosts
:
name="{{ item }}"
state="absent"
-
name
:
"
Remove
previous
ip
from
known_hosts"
become
:
no
known_hosts
:
name="{{ hostvars[item]['static_ipv4']|default(hostvars[item]['ansible_default_ipv4']['address']) }}"
state="absent"
-
name
:
"
Include
all
hosts
into
/etc/hosts"
lineinfile
:
dest=/etc/hosts
regexp="^{{ hostvars[item]['static_ipv4']|default(hostvars[item]['ansible_default_ipv4']['address']) }} "
line="{{ hostvars[item]['static_ipv4']|default(hostvars[item]['ansible_default_ipv4']['address']) }} {{ item }}"
This diff is collapsed.
Click to expand it.
tasks/
distribute_
tunnel_keys.yml
→
tasks/tunnel_keys.yml
+
15
−
0
View file @
c186e6cf
---
# file: roles/commonauth/tasks/
distribute_
tunnel_keys.yml
# file: roles/commonauth/tasks/tunnel_keys.yml
-
name
:
"
Include
all
hosts
into
/etc/hosts"
lineinfile
:
dest=/etc/hosts
regexp="^{{ hostvars[item]['static_ipv4']|default(hostvars[item]['ansible_default_ipv4']['address']) }} "
line="{{ hostvars[item]['static_ipv4']|default(hostvars[item]['ansible_default_ipv4']['address']) }} {{ item }}"
with_items
:
'
{{
groups.all
}}'
when
:
item != "localhost" and inventory_hostname != "localhost"
-
name
:
"
Keys
|
Read
public
key
of
tunnel
user"
-
name
:
"
Read
public
key
of
tunnel
user"
shell
:
cat /home/{{ tunnel_user_name }}/.ssh/id_rsa.pub
register
:
pubkey
...
...
This diff is collapsed.
Click to expand it.
tasks/
distribute
_keys.yml
→
tasks/
user
_keys.yml
+
1
−
3
View file @
c186e6cf
# ================= Rebuild keys auth for all admins ===========================
---
# file: roles/commonauth/tasks/
distribute
_keys.yml
# file: roles/commonauth/tasks/
user
_keys.yml
-
name
:
"
Keys
|
Remove
the
fresh
auth
file
in
case
it
does
already
exist"
file
:
...
...
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