From a287e741842f67d0a04c48276221d85f16079d55 Mon Sep 17 00:00:00 2001 From: Opal <847966@proton.me> Date: Sat, 15 Oct 2022 15:27:41 -0700 Subject: merging code between old emacsconf repo, to sachac's emacsconf repo --- roles/base/tasks/main.yml | 54 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 roles/base/tasks/main.yml (limited to 'roles/base/tasks') diff --git a/roles/base/tasks/main.yml b/roles/base/tasks/main.yml new file mode 100644 index 0000000..8d2280b --- /dev/null +++ b/roles/base/tasks/main.yml @@ -0,0 +1,54 @@ +--- +# User & Group Creation +- name: create groups + group: + name: "{{ item.value.group }}" + state: "{{ item.value.state }}" + loop: "{{ init_users | dict2items }}" + +- name: create users + user: + name: "{{ item.value.name }}" + group: "{{ item.value.group }}" + groups: "{{ item.value.groups }}" + create_home: "{{ item.value.create_home }}" + state: "{{ item.value.state }}" + shell: "{{ item.value.shell }}" + loop: "{{ init_users | dict2items }}" + +# SSH Initial Setup +- name: create .ssh dirs + file: + path: "/home/{{ item.value.name }}/.ssh" + state: directory + mode: 0700 + owner: "{{ item.value.name }}" + group: "{{ item.value.group }}" + loop: "{{ init_users | dict2items }}" + + +- name: Copy keys to users + authorized_key: + user: "{{ item.value.name }}" + state: present + key: "{{ lookup('file', 'keys/{{ item.value.name }}') }}" + loop: "{{ init_users | dict2items }}" + + +- name: Copy custom sshd_config + copy: + src: sshd_config + dest: "/etc/ssh/sshd_config.d/emacsconf_ssh.conf" + mode: 0644 + owner: root + group: root + +# Sudoers +- name: sudoers.d entries + copy: + src: "sudoers.d/" + dest: "/etc/sudoers.d/" + mode: 0440 + owner: root + group: root + force: no -- cgit v1.2.3