Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
configuration
Commits
76e3ed83
Commit
76e3ed83
authored
Jun 21, 2016
by
arbabnazar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OPS-1433 grant-ssh access job should fail if user has no keys
parent
1ab59651
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
15 deletions
+30
-15
playbooks/roles/user/tasks/main.yml
+30
-15
No files found.
playbooks/roles/user/tasks/main.yml
View file @
76e3ed83
...
...
@@ -74,13 +74,13 @@
-
debug
:
var
:
user_info
-
name
:
c
reate the edxadmin group
-
name
:
C
reate the edxadmin group
group
:
name
:
edxadmin
state
:
present
# some AMIs (such as EMR master nodes) don't read the config files out of /etc/sudoers.d by default
-
name
:
e
nsure sudoers.d is read
-
name
:
E
nsure sudoers.d is read
lineinfile
:
dest
:
/etc/sudoers
state
:
present
...
...
@@ -89,7 +89,7 @@
validate
:
'
visudo
-cf
%s'
# give full sudo admin access to the edxadmin group
-
name
:
g
rant full sudo access to the edxadmin group
-
name
:
G
rant full sudo access to the edxadmin group
copy
:
content
:
"
%edxadmin
ALL=(ALL)
NOPASSWD:ALL"
dest
:
/etc/sudoers.d/edxadmin
...
...
@@ -98,7 +98,7 @@
mode
:
0440
validate
:
'
visudo
-cf
%s'
-
name
:
c
reate the users
-
name
:
C
reate the users
user
:
name
:
"
{{
item.name
}}"
shell
:
/bin/bash
...
...
@@ -106,21 +106,32 @@
state
:
"
{{
item.state
|
default('present')
}}"
with_items
:
"
{{
user_info
}}"
-
name
:
a
ssign admin role to admin users
-
name
:
A
ssign admin role to admin users
user
:
name
:
"
{{
item.name
}}"
groups
:
edxadmin
when
:
item.type is defined and item.type == 'admin' and item.get('state', 'present') == 'present'
with_items
:
"
{{
user_info
}}"
-
name
:
get github key(s) and update the authorized_keys file
-
name
:
Check the ssh key(s) for user(s) over github
uri
:
url
:
"
https://github.com/{{
item.name
}}.keys"
with_items
:
"
{{
user_info
}}"
register
:
github_users_return
-
fail
:
msg
:
"
User
{{
item.item.name
}}
didn't
added
ssh
key
to
his
account
over
github"
with_items
:
"
{{
github_users_return.results
}}"
when
:
item.content_length == "0"
-
name
:
Get github key(s) and update the authorized_keys file
authorized_key
:
user
:
"
{{
item.name
}}"
key
:
"
https://github.com/{{
item.name
}}.keys"
when
:
item.github is defined and item.get('state', 'present') == 'present'
with_items
:
"
{{
user_info
}}"
-
name
:
c
reate bashrc file for normal users
-
name
:
C
reate bashrc file for normal users
template
:
src
:
default.bashrc.j2
dest
:
"
/home/{{
item.name
}}/.bashrc"
...
...
@@ -129,7 +140,7 @@
when
:
not (item.type is defined and item.type == 'restricted') and item.get('state', 'present') == 'present'
with_items
:
"
{{
user_info
}}"
-
name
:
c
reate .profile for all users
-
name
:
C
reate .profile for all users
template
:
src
:
default.profile.j2
dest
:
"
/home/{{
item.name
}}/.profile"
...
...
@@ -141,14 +152,14 @@
########################################################
# All tasks below this line are for restricted users
-
name
:
m
odify shell for restricted users
-
name
:
M
odify shell for restricted users
user
:
name
:
"
{{
item.name
}}"
shell
:
/bin/rbash
when
:
item.type is defined and item.type == 'restricted' and item.get('state', 'present') == 'present'
with_items
:
"
{{
user_info
}}"
-
name
:
c
reate bashrc file for restricted users
-
name
:
C
reate bashrc file for restricted users
template
:
src
:
restricted.bashrc.j2
dest
:
"
/home/{{
item.name
}}/.bashrc"
...
...
@@ -157,7 +168,7 @@
when
:
item.type is defined and item.type == 'restricted' and item.get('state', 'present') == 'present'
with_items
:
"
{{
user_info
}}"
-
name
:
c
reate sudoers file from template
-
name
:
C
reate sudoers file from template
template
:
dest
:
/etc/sudoers.d/99-restricted
src
:
restricted.sudoers.conf.j2
...
...
@@ -169,12 +180,16 @@
# Prevent restricted user from updating their PATH and
# environment by ensuring root ownership
-
name
:
change home directory ownership to root for restricted users
shell
:
"
chown
-R
root:{{
item.name
}}
/home/{{
item.name
}}"
-
name
:
Change home directory ownership to root for restricted users
file
:
path
:
"
/home/{{
item.name
}}"
owner
:
root
group
:
"
{{
item.name
}}"
recurse
:
yes
when
:
item.type is defined and item.type == 'restricted' and item.get('state', 'present') == 'present'
with_items
:
"
{{
user_info
}}"
-
name
:
c
reate ~/bin directory
-
name
:
C
reate ~/bin directory
file
:
path
:
"
/home/{{
item.name
}}/bin"
state
:
directory
...
...
@@ -184,7 +199,7 @@
when
:
item.type is defined and item.type == 'restricted' and item.get('state', 'present') == 'present'
with_items
:
"
{{
user_info
}}"
-
name
:
c
reate allowed command links
-
name
:
C
reate allowed command links
file
:
src
:
"
{{
item[1]
}}"
dest
:
"
/home/{{
item[0].name
}}/bin/{{
item[1]|basename
}}"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment