diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 49a2d36..a8abddc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 @@ -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)$ diff --git a/tasks/users.yml b/tasks/users.yml index 81e0b53..02863e9 100644 --- a/tasks/users.yml +++ b/tasks/users.yml @@ -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" diff --git a/templates/config/extra.in b/templates/config/extra.in index ae3eaad..25b9ff9 100644 --- a/templates/config/extra.in +++ b/templates/config/extra.in @@ -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) diff --git a/templates/keys/ssh_config b/templates/keys/ssh_config new file mode 100644 index 0000000..8e3c416 --- /dev/null +++ b/templates/keys/ssh_config @@ -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 diff --git a/tutorial-env/bin/python b/tutorial-env/bin/python new file mode 120000 index 0000000..b8a0adb --- /dev/null +++ b/tutorial-env/bin/python @@ -0,0 +1 @@ +python3 \ No newline at end of file diff --git a/tutorial-env/bin/python3 b/tutorial-env/bin/python3 new file mode 120000 index 0000000..ae65fda --- /dev/null +++ b/tutorial-env/bin/python3 @@ -0,0 +1 @@ +/usr/bin/python3 \ No newline at end of file diff --git a/tutorial-env/lib64 b/tutorial-env/lib64 new file mode 120000 index 0000000..7951405 --- /dev/null +++ b/tutorial-env/lib64 @@ -0,0 +1 @@ +lib \ No newline at end of file diff --git a/tutorial-env/pyvenv.cfg b/tutorial-env/pyvenv.cfg new file mode 100644 index 0000000..3ac3b9e --- /dev/null +++ b/tutorial-env/pyvenv.cfg @@ -0,0 +1,3 @@ +home = /usr/bin +include-system-site-packages = false +version = 3.7.8