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
167787ed
Commit
167787ed
authored
9 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
General improvements
parent
b8f08fe1
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
tasks/commonauth.yml
+33
-23
33 additions, 23 deletions
tasks/commonauth.yml
tasks/distribute_keys.yml
+0
-15
0 additions, 15 deletions
tasks/distribute_keys.yml
tasks/distribute_tunnel_keys.yml
+15
-0
15 additions, 0 deletions
tasks/distribute_tunnel_keys.yml
with
48 additions
and
38 deletions
tasks/commonauth.yml
+
33
−
23
View file @
167787ed
---
# file: roles/commonauth/tasks/commonauth.yml
-
name
:
"
Common
|
Create
The
/etc/hosts
File"
-
name
:
"
Create
The
/etc/hosts
File"
template
:
src=etc_hosts
dest=/etc/hosts
owner=root
group=root
mode=
0
644
src=
'
etc_hosts
'
dest=
'
/etc/hosts
'
owner=
'
root
'
group=
'
root
'
mode=
'
644
'
-
name
:
"
User
|
Create
All
Required
Users"
-
name
:
"
Create
All
Required
Users"
user
:
name={{ item }}
group=root
groups=
root,sudo,
www-data
home=/home/{{ item }}
name=
'
{{ item }}
'
group=
'
root
'
groups=
"{{ users[item].groups|default('
www-data
') }}"
home=
'
/home/{{ item }}
'
generate_ssh_key=yes
ssh_key_bits=2048
password={{ initial_password }}
update_password=on_create
with_items
:
admins
password='{{ initial_password }}'
update_password='on_create'
with_flattened
:
-
admins
-
jailusers
-
name
:
"
User
|
Copy
SSH
Config
For
Server-To-Server
Communication
For
Admins"
-
name
:
"
Copy
SSH
Config
For
Server-To-Server
Communication
For
Admins"
template
:
src=ssh_config
dest=/home/{{ item }}/.ssh/config
owner={{ item }}
group=root
mode=644
with_items
:
admins
src='ssh_config'
dest='/home/{{ item }}/.ssh/config'
owner='{{ item }}'
group='root'
mode='644'
with_flattened
:
-
admins
-
jailusers
-
include
:
distribute_tunnel_keys.yml
when
:
distribute_keys
-
include
:
distribute_keys.yml
with_flattened
:
-
admins
-
jailusers
when
:
distribute_keys
#TODO: Make sure that the user already exists
-
name
:
"
User
|
Install
Public
Key
For
Extra
Users"
-
name
:
"
Install
Public
Key
For
Extra
Users"
authorized_key
:
user={{ item.username }}
user=
'
{{ item.username }}
'
key="{{ lookup('file', inventory_dir + '/files/keys/' + item.keyname + '.d2s.pub') }}"
with_items
:
auth_keys
This diff is collapsed.
Click to expand it.
tasks/distribute_keys.yml
+
0
−
15
View file @
167787ed
...
...
@@ -7,27 +7,12 @@
file
:
path=/home/{{ item }}/.ssh/auth_keys_fresh
state=absent
with_items
:
admins
-
name
:
"
Keys
|
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') }}"
path=/home/{{ item }}/.ssh/fresh_auth_keys_{{ item }}
with_items
:
admins
-
name
:
"
Keys
|
Read
public
key
of
tunnel
user"
command
:
more /home/{{ tunnel_user_name }}/.ssh/id_rsa.pub
register
:
pubkey
-
name
:
"
Keys
|
Distribute
public
key
of
tunnel
user"
authorized_key
:
user={{ tunnel_user_name }}
key="{{ pubkey.stdout }} {{ inventory_hostname }}"
path=/home/{{ tunnel_user_name }}/.ssh/fresh_auth_keys_tunnel_{{ inventory_hostname }}
delegate_to
:
'
{{
item
}}'
with_items
:
groups.all
when
:
item != "localhost" and inventory_hostname != "localhost"
-
name
:
"
Keys
|
Merge
all
public
keys"
shell
:
cat /home/{{ item }}/.ssh/fresh_auth_keys* > /home/{{ item }}/.ssh/auth_keys_fresh
...
...
This diff is collapsed.
Click to expand it.
tasks/distribute_tunnel_keys.yml
0 → 100644
+
15
−
0
View file @
167787ed
---
# file: roles/commonauth/tasks/distribute_tunnel_keys.yml
-
name
:
"
Keys
|
Read
public
key
of
tunnel
user"
command
:
more /home/{{ tunnel_user_name }}/.ssh/id_rsa.pub
register
:
pubkey
-
name
:
"
Distribute
public
key
of
tunnel
user"
authorized_key
:
user='{{ tunnel_user_name }}'
key="{{ pubkey.stdout }} {{ inventory_hostname }}"
path='/home/{{ tunnel_user_name }}/.ssh/fresh_auth_keys_tunnel_{{ inventory_hostname }}'
delegate_to
:
'
{{
item
}}'
with_items
:
groups.all
when
:
item != "localhost" and inventory_hostname != "localhost"
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