Skip to content

Commit

Permalink
Merge pull request #10 from clouddrove/CD-230
Browse files Browse the repository at this point in the history
update role with ssh config file
  • Loading branch information
Nikita Dugar authored Sep 25, 2020
2 parents a2d5ac8 + c782e61 commit fadc56b
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: v2.2.3
rev: v3.2.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
Expand All @@ -15,7 +15,7 @@ repos:
- id: check-added-large-files

- repo: https://github.com/ansible/ansible-lint.git
rev: v4.1.0
rev: v4.3.5
hooks:
- id: ansible-lint
files: \.(yaml|yml)$
19 changes: 18 additions & 1 deletion tasks/users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,32 @@
comment: 'created with ansible'
with_items: '{{ users }}'

- name: modify .ssh permissions
file:
path: '/home/{{ item.username }}/.ssh'
state: directory
owner: "{{ item.username }}"
group: "{{ item.username }}"
mode: 0700
with_items: '{{ users }}'

- name: setup | authorized key upload
authorized_key:
user: "{{ item.username }}"
key: "{{ lookup('file', './../../_ssh/{{ Env }}/{{ item.username }}.pub') }}"
key: "{{ lookup('file', './../../_ssh/'+Env+'/'+item.username+'.pub') }}"
path: '/home/{{ item.username }}/.ssh/authorized_keys'
manage_dir: false
with_items: '{{ users }}'

- name: transfer ssh config /etc/ssh/ssh_config
copy:
src: templates/keys/ssh_config
dest: /home/{{ item.username }}/.ssh/config
owner: "{{ item.username }}"
group: "{{ item.username }}"
mode: 0600
with_items: '{{ users }}'

- name: sudoers | update sudoers file and validate
lineinfile:
dest: "/etc/sudoers"
Expand Down
6 changes: 3 additions & 3 deletions templates/config/extra.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ mins=$((${upSeconds}/60%60))
hours=$((${upSeconds}/3600%24))
days=$((${upSeconds}/86400))
UPTIME=`printf "%d days, %02dh%02dm%02ds" "$days" "$hours" "$mins" "$secs"`

# get the load averages
read one five fifteen rest < /proc/loadavg
echo "$(tput setaf 033)

echo "$(tput setaf 033)
___ _ ___ _ _ ___ $(tput setaf 033)|$(tput setaf 244)| $(tput setaf 033) HostName...........:$(tput setaf 244) $(tput bold)`perl -e "print uc('$TEXT');"`$(tput sgr0)$(tput setaf 033)
/ __|| | / _ \ | | | || \ $(tput setaf 033)|$(tput setaf 244)| $(tput setaf 033) OS.................:$(tput setaf 244) `uname -srmo`$(tput setaf 033)
| (__ | |__ | (_) || |_| || |) | $(tput setaf 033)|$(tput setaf 244)| $(tput setaf 033) Uptime.............:$(tput setaf 244) ${UPTIME}$(tput setaf 033)
Expand Down
9 changes: 9 additions & 0 deletions templates/keys/ssh_config
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#{{ ansible_managed }}
Host *
LogLevel QUIET
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
ControlMaster auto
ControlPersist 10m
ControlPath /tmp/instance_socket-%r@%h:%p
ForwardAgent yes
1 change: 1 addition & 0 deletions tutorial-env/bin/python
1 change: 1 addition & 0 deletions tutorial-env/bin/python3
1 change: 1 addition & 0 deletions tutorial-env/lib64
3 changes: 3 additions & 0 deletions tutorial-env/pyvenv.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
home = /usr/bin
include-system-site-packages = false
version = 3.7.8

0 comments on commit fadc56b

Please sign in to comment.