adapt role for LDAP

This commit is contained in:
vincent 2021-08-18 18:11:16 +02:00
parent 126d91202e
commit d81fb9153a

View File

@ -67,8 +67,15 @@
ssh_key_file: .ssh/id_rsa # not required. Optionally specify the SSH key filename. If this is a relative filename then it will be relative to the user's home directory. ssh_key_file: .ssh/id_rsa # not required. Optionally specify the SSH key filename. If this is a relative filename then it will be relative to the user's home directory.
uid: "{{ user.uid }}" uid: "{{ user.uid }}"
shell: /bin/bash shell: /bin/bash
when: sssd_configure is not defined or sssd_configure == false
- name: simulate login
stat:
path: "/home/{{user.name}}"
become: true
become_user: "{{user.name}}"
when: sssd_configure == true
- name : set sudoers right
lineinfile: lineinfile:
dest: '/etc/sudoers.d/{{user.name}}' dest: '/etc/sudoers.d/{{user.name}}'
regexp: '{{ item.regexp }}' regexp: '{{ item.regexp }}'
@ -80,16 +87,15 @@
mode: '0440' mode: '0440'
validate: 'visudo -cf "%s"' validate: 'visudo -cf "%s"'
with_items: with_items:
- regexp: '^%{{user.name}}\s' - regexp: '^{{user.name}}\s'
line: '%{{user.name}} ALL = (ALL) NOPASSWD:ALL' line: "{{user.name}} ALL = (ALL) NOPASSWD:ALL"
- name: Ensure /etc/sudoers includes /etc/sudoers.d - name: Ensure /etc/sudoers includes /etc/sudoers.d
lineinfile: lineinfile:
dest: '/etc/sudoers' dest: "/etc/sudoers"
regexp: '^#includedir\s+/etc/sudoers.d$' regexp: '^#includedir\s+/etc/sudoers.d$'
line: '#includedir /etc/sudoers.d' line: "#includedir /etc/sudoers.d"
state: 'present' state: "present"
validate: 'visudo -cf "%s"' validate: 'visudo -cf "%s"'