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
OpenEdx
configuration
Commits
21b8a4d3
Commit
21b8a4d3
authored
7 years ago
by
Joseph Mulloy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add optional fail when ssh keys missing OPS-1433
parent
fc3c121b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
+19
-2
playbooks/roles/user/defaults/main.yml
+10
-0
playbooks/roles/user/tasks/main.yml
+9
-2
No files found.
playbooks/roles/user/defaults/main.yml
View file @
21b8a4d3
...
...
@@ -38,3 +38,13 @@ user_info: []
user_debian_pkgs
:
# This is needed for the uri module to work correctly.
-
python-httplib2
# Boolean variable that will cause the user module to stop Ansible with a
# failure if a user that has been configured to have their keys pulled from
# GitHub does not have any ssh keys configured on GitHub. This is set to
# false by default as we normally do not wish to interrupt Ansible, but
# we wish to selectively enable it for a particular Jenkins job that adds
# users. In the default false state this playbook will only print a warning
# message, but not halt.
#
user_fail_missing_keys
:
false
This diff is collapsed.
Click to expand it.
playbooks/roles/user/tasks/main.yml
View file @
21b8a4d3
...
...
@@ -124,16 +124,23 @@
-
name
:
Check the ssh key(s) for user(s) over github
uri
:
url
:
"
https://github.com/{{
item.name
}}.keys"
return_content
:
true
# We don't care if absent users lack ssh keys
when
:
item.get('state', 'present') == 'present'
with_items
:
"
{{
user_info
}}"
register
:
github_users_return
-
debug
:
msg
:
"
User
{{
item.item.name
}}
doesn't
have
an
SSH
key
associated
with
their
account"
msg
:
"
User
{{
item.item.name
}}
doesn't
have
an
SSH
key
associated
with
their
github
account"
with_items
:
"
{{
github_users_return.results
|
default([])
}}"
# We skip users in the previous task, and they end up with no content_length
when
:
item.get('content_length') and item.content_length == "0"
when
:
('content' in item and item.content == "")
-
fail
:
msg
:
"
User
{{
item.item.name
}}
doesn't
have
an
SSH
key
associated
with
their
github
account"
with_items
:
"
{{
github_users_return.results
|
default([])
}}"
# We skip users in the previous task, and they end up with no content_length
when
:
(user_fail_missing_keys and 'content' in item and item.content == "")
-
name
:
Get github key(s) and update the authorized_keys file
authorized_key
:
...
...
This diff is collapsed.
Click to expand it.
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