From 508602b0426bdf1412bd6fb3350fece0cae2e7c8 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 1 Jun 2020 06:41:24 +0200 Subject: port admin-users role to openbsd and move to core --- roles/core/admin-users/tasks/main.yml | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 roles/core/admin-users/tasks/main.yml (limited to 'roles/core/admin-users/tasks/main.yml') diff --git a/roles/core/admin-users/tasks/main.yml b/roles/core/admin-users/tasks/main.yml new file mode 100644 index 00000000..c8a4c756 --- /dev/null +++ b/roles/core/admin-users/tasks/main.yml @@ -0,0 +1,37 @@ +--- +- name: load os/distrubtion/version specific variables + include_vars: "{{ item }}" + with_first_found: + - files: + - "{{ ansible_distribution_release }}.yml" + - "{{ ansible_distribution }}.yml" + - "{{ ansible_os_family }}.yml" + +- name: load os/distrubtion/version specific tasks + vars: + params: + files: + - "{{ ansible_distribution_release }}.yml" + - "{{ ansible_distribution }}.yml" + - "{{ ansible_os_family }}.yml" + loop: "{{ q('first_found', params) }}" + loop_control: + loop_var: tasks_file + include_tasks: "{{ tasks_file }}" + +- name: add admin users + loop: "{{ admin_users_group | union(admin_users_host) }}" + user: + name: "{{ item }}" + state: present + password: "{{ user_passwords[item] }}" + groups: "{{ admin_users_groups }}" + append: yes + shell: "{{ users[item].shell | default(admin_users_default_shell) }}" + +- name: install ssh keys for admin users + loop: "{{ admin_users_group | union(admin_users_host) }}" + authorized_key: + user: "{{ item }}" + key: "{{ users[item].ssh | join('\n') }}" + exclusive: yes -- cgit v1.2.3