-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PRE - role: auth - sudoers config optimisation
- Loading branch information
Showing
9 changed files
with
126 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
--- | ||
# Require for configuration management | ||
- name: Load aybarsm ansible role main variables | ||
ansible.builtin.include_vars: "../ansible/vars/main.yml" | ||
ansible.builtin.include_vars: ../ansible/vars/main.yml | ||
|
||
- name: Include groups tasks | ||
ansible.builtin.include_tasks: | ||
file: groups.yml | ||
when: | ||
- auth__role_enabled | default(false) | bool | ||
- auth__manage_groups | default(false) | bool | ||
# - name: Include groups tasks | ||
# ansible.builtin.include_tasks: | ||
# file: groups.yml | ||
# when: | ||
# - auth__role_enabled | default(false) | bool | ||
# - auth__manage_groups | default(false) | bool | ||
|
||
- name: Include users tasks | ||
ansible.builtin.include_tasks: | ||
file: users.yml | ||
when: | ||
- auth__role_enabled | default(false) | bool | ||
- auth__manage_users | default(false) | bool | ||
# - name: Include users tasks | ||
# ansible.builtin.include_tasks: | ||
# file: users.yml | ||
# when: | ||
# - auth__role_enabled | default(false) | bool | ||
# - auth__manage_users | default(false) | bool | ||
|
||
- name: Include authroized keys tasks | ||
ansible.builtin.include_tasks: | ||
file: authorized_keys.yml | ||
when: | ||
- auth__role_enabled | default(false) | bool | ||
- auth__manage_authorized_keys | default(false) | bool | ||
# - name: Include authroized keys tasks | ||
# ansible.builtin.include_tasks: | ||
# file: authorized_keys.yml | ||
# when: | ||
# - auth__role_enabled | default(false) | bool | ||
# - auth__manage_authorized_keys | default(false) | bool | ||
|
||
- name: Include ssh config tasks | ||
ansible.builtin.include_tasks: | ||
file: ssh_config.yml | ||
when: | ||
- auth__role_enabled | default(false) | bool | ||
- auth__manage_ssh_config | default(false) | bool | ||
# - name: Include ssh config tasks | ||
# ansible.builtin.include_tasks: | ||
# file: ssh_config.yml | ||
# when: | ||
# - auth__role_enabled | default(false) | bool | ||
# - auth__manage_ssh_config | default(false) | bool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
- name: Apply sudoers configuration template | ||
become: true | ||
ansible.builtin.template: | ||
src: "{{ auth__ssh_config_template }}" | ||
dest: "{{ auth__ssh_config_file }}" | ||
backup: "{{ auth__ssh_config_backup | default(omit) | bool }}" | ||
validate: "{{ auth__sshd_validate | default(omit) }}" | ||
register: auth__sudoers_apply | ||
when: | ||
- auth__sudoers_all | type_debug == 'list' | ||
- auth__sudoers_all | length > 0 | ||
|
||
- name: Apply sudoers configuration via community.general.sudoers module | ||
become: true | ||
community.general.sudoers: | ||
commands: "{{ item.commands | default(omit) }}" | ||
groups: "{{ item.groups | default(omit) }}" | ||
host: "{{ item.host | default(omit) }}" | ||
name: "{{ item.name }}" | ||
noexec: "{{ item.noexec | default(omit) | bool }}" | ||
nopassword: "{{ item.nopassword | default(omit) | bool }}" | ||
runas: "{{ item.runas | default(omit) }}" | ||
setenv: "{{ item.setenv | default(omit) | bool }}" | ||
state: "{{ item.state | default(omit) }}" | ||
sudoers_path: "{{ item.sudoers_path | default(omit) }}" | ||
user: "{{ item.user | default(omit) }}" | ||
validation: "{{ item.validation | default(omit) }}" | ||
loop: "{{ auth__sudoers_module_all }}" | ||
register: auth__sudoers_module_apply | ||
when: | ||
- auth__sudoers_module_all | type_debug == 'list' | ||
- auth__sudoers_module_all | length > 0 | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{{ ansible_managed | comment }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters