1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 19:52:06 +00:00
iiab/roles/iiab-admin/tasks/admin-user.yml

68 lines
1.4 KiB
YAML
Raw Normal View History

- name: Create iiab-admin user and password
user:
name: "{{ iiab_admin_user }}"
password: "{{ iiab_admin_passw_hash }}"
update_password: on_create
shell: /bin/bash
2017-05-27 18:09:50 +00:00
- name: Create a wheel group
group:
name: wheel
state: present
2017-05-27 18:09:50 +00:00
- name: Create a sudo group (redhat)
group:
name: sudo
state: present
2017-05-27 18:09:50 +00:00
when: is_redhat
- name: Add user to wheel group
user:
name: "{{ iiab_admin_user }}"
groups: wheel,sudo
2017-05-27 18:09:50 +00:00
- name: Create root .ssh
file:
path: /root/.ssh
owner: root
group: root
mode: 0700
state: directory
2017-05-27 18:09:50 +00:00
- name: Install dummy root keys as placeholder
copy:
src: dummy_authorized_keys
dest: /root/.ssh/authorized_keys
owner: root
group: root
mode: 0600
force: no
2017-10-27 15:44:19 +00:00
- name: Edit the sudoers file -- first make it editable
file:
path: /etc/sudoers
mode: 0640
2017-05-27 18:09:50 +00:00
2017-10-27 15:44:19 +00:00
- name: Have sudo log all commands it handles
lineinfile:
regexp: logfile
2017-12-07 16:33:33 +00:00
line: "Defaults logfile = /var/log/sudo.log"
dest: /etc/sudoers
state: present
2017-05-27 18:09:50 +00:00
2017-10-27 15:44:19 +00:00
- name: Lets wheel sudo without password
lineinfile:
line: "%wheel ALL= NOPASSWD: ALL"
dest: /etc/sudoers
2017-05-27 18:09:50 +00:00
2017-10-27 15:44:19 +00:00
- name: Remove the line which requires tty
lineinfile:
regexp: requiretty
dest: /etc/sudoers
state: absent
2017-10-27 15:44:19 +00:00
- name: End editing the sudoers file -- protect it again
file:
path: /etc/sudoers
mode: 0440