2019-02-05 08:35:45 +01:00
|
|
|
---
|
|
|
|
# Filter SSH on groups
|
|
|
|
- name: Filter SSH on groups
|
2020-09-04 09:56:02 +02:00
|
|
|
when: ansible_facts['hostname'] != "camelot" # Camelot is accessible for everyone
|
2019-02-05 08:35:45 +01:00
|
|
|
lineinfile:
|
|
|
|
dest: /etc/ssh/sshd_config
|
2019-03-23 19:13:02 +01:00
|
|
|
regexp: ^AllowGroups
|
|
|
|
line: AllowGroups root sudoldap aurore ssh
|
2019-03-23 19:25:04 +01:00
|
|
|
state: present
|
2019-02-05 08:35:45 +01:00
|
|
|
|
|
|
|
# To gain root access with ldap rights
|
|
|
|
- name: Install SUDO package
|
|
|
|
package:
|
|
|
|
name: sudo
|
|
|
|
state: present
|
2019-03-03 19:28:57 +01:00
|
|
|
register: package_result
|
|
|
|
retries: 3
|
|
|
|
until: package_result is succeeded
|
2019-02-05 08:35:45 +01:00
|
|
|
|
|
|
|
# Set sudo group
|
2019-03-23 13:49:53 +01:00
|
|
|
- name: Configure sudoers sudo group
|
2019-02-05 08:35:45 +01:00
|
|
|
lineinfile:
|
|
|
|
dest: /etc/sudoers
|
2019-03-23 19:13:02 +01:00
|
|
|
regexp: ^%{{ sudo_group }}
|
2019-03-12 07:48:09 +01:00
|
|
|
line: "%{{ sudo_group }} ALL=(ALL:ALL) ALL"
|
2019-03-23 19:25:04 +01:00
|
|
|
state: present
|
2019-03-23 19:42:09 +01:00
|
|
|
validate: /usr/sbin/visudo -cf %s
|
2019-03-23 13:49:53 +01:00
|
|
|
|
|
|
|
# Set sudo location group
|
|
|
|
- name: Configure sudoers sudo location group
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/sudoers
|
2019-03-23 19:13:02 +01:00
|
|
|
regexp: ^%{{ sudo_group_location }}
|
2019-03-23 13:49:53 +01:00
|
|
|
line: "%{{ sudo_group_location }} ALL=(ALL:ALL) ALL"
|
2019-03-23 19:25:04 +01:00
|
|
|
state: present
|
2019-03-23 19:42:09 +01:00
|
|
|
validate: /usr/sbin/visudo -cf %s
|
2019-03-23 13:49:53 +01:00
|
|
|
when: sudo_group_location is defined
|