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
f6977acc
Commit
f6977acc
authored
Nov 17, 2014
by
Feanil Patel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Put all keys in the authorized_keys file.
parent
dd0ae966
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
18 deletions
+25
-18
playbooks/roles/user/tasks/main.yml
+11
-18
playbooks/roles/user/templates/authorized_keys.j2
+14
-0
No files found.
playbooks/roles/user/tasks/main.yml
View file @
f6977acc
...
@@ -114,28 +114,21 @@
...
@@ -114,28 +114,21 @@
# 2014/10/14 - using curl instead of get_url because
# 2014/10/14 - using curl instead of get_url because
# get_url was failing due to certificate verification errors
# get_url was failing due to certificate verification errors
-
name
:
copy github key[s] to .ssh/authorized_keys2
-
name
:
get github key[s]
shell
:
>
shell
:
>
curl https://github.com/{{ item.name }}.keys
-o /home/{{ item.name }}/.ssh/authorized_keys2
curl https://github.com/{{ item.name }}.keys
sudo_user
:
"
{{
item.name
}}"
sudo_user
:
"
{{
item.name
}}"
when
:
item.github is defined and item.get('state', 'present') == 'present'
when
:
item.github is defined and item.get('state', 'present') == 'present'
with_items
:
user_info
with_items
:
user_info
register
:
github_keys
-
name
:
set permissions on .ssh/authorized_keys2
file
:
>
-
name
:
update the authorized_keys file
dest=/home/{{ item.name }}/.ssh/authorized_keys2
template
:
mode=0640
src="authorized_keys.j2"
owner={{ item.name }}
dest="/home/{{ item.name }}/.ssh/authorized_keys"
when
:
item.github is defined and item.get('state', 'present') == 'present'
owner="{{ item.name }}"
with_items
:
user_info
mode="600"
when
:
item.get('state', 'present') == 'present'
-
name
:
copy additional authorized keys
copy
:
>
content="{{ '\n'.join(item.authorized_keys) }}"
dest=/home/{{ item.name }}/.ssh/authorized_keys mode=0640
owner={{ item.name }}
mode=0440
when
:
item.authorized_keys is defined and item.get('state', 'present') == 'present'
with_items
:
user_info
with_items
:
user_info
-
name
:
create bashrc file for normal users
-
name
:
create bashrc file for normal users
...
...
playbooks/roles/user/templates/authorized_keys.j2
0 → 100644
View file @
f6977acc
# Keys from github
{% for github_key in github_keys.results -%}
{# None is lowercase in jinja... #}
{%- if github_key.changed -%}
{%- if github_key.item.name == item.name -%}
{{ github_key.stdout }}
{%- endif -%}
{%- endif -%}
{% endfor %}
{% if item.get('authorized_keys') %}
# Explicitly specified keys
{{ '\n'.join(item.authorized_keys) }}
{% endif %}
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