-
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.
- Loading branch information
Showing
11 changed files
with
192 additions
and
129 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,39 @@ | ||
--- | ||
- name: Effect systemd service for ssh config changes | ||
- name: Effect systemd service for ssh changes | ||
become: true | ||
ansible.builtin.systemd_service: | ||
daemon_reexec: "{{ change_strategy.daemon_reexec | default(omit) | bool }}" | ||
daemon_reload: "{{ change_strategy.daemon_reload | default(omit) | bool }}" | ||
enabled: "{{ change_strategy.enabled | default(omit) | bool }}" | ||
force: "{{ change_strategy.force | default(omit) | bool }}" | ||
masked: "{{ change_strategy.masked | default(omit) | bool }}" | ||
name: "{{ change_strategy.name | default('ssh.service') }}" | ||
no_block : "{{ change_strategy.no_block | default(omit) | bool }}" | ||
scope: "{{ change_strategy.scope | default(omit) }}" | ||
state: "{{ change_strategy.state | default(omit) }}" | ||
daemon_reexec: "{{ service.daemon_reexec | default(omit) | bool }}" | ||
daemon_reload: "{{ service.daemon_reload | default(omit) | bool }}" | ||
enabled: "{{ service.enabled | default(omit) | bool }}" | ||
force: "{{ service.force | default(omit) | bool }}" | ||
masked: "{{ service.masked | default(omit) | bool }}" | ||
name: "{{ service.name | default('ssh.service') }}" | ||
no_block : "{{ service.no_block | default(omit) | bool }}" | ||
scope: "{{ service.scope | default(omit) }}" | ||
state: "{{ service.state | default(omit) }}" | ||
vars: | ||
change_strategy: "{{ (__ansible__config is defined) | | ||
ternary( | ||
(auth__ssh_config_change_strategy | aybarsm.helper.replace_aliases(__ansible__config.modules.ansible.builtin.systemd_service.aliases)), | ||
auth__ssh_config_change_strategy) }}" | ||
register: auth__ssh_config_apply_changes_systemd_service | ||
listen: "auth__ssh_config_apply_changes" | ||
service: "{{ auth__ssh_changes_strategy | aybarsm.helper.replace_aliases(__ansible__config.modules.ansible.builtin.systemd_service.aliases) }}" | ||
register: auth__ssh_apply_changes_systemd_service | ||
listen: "auth__ssh_apply_changes" | ||
when: | ||
- auth__ssh_config_change_strategy.module is defined | ||
- auth__ssh_config_change_strategy.module == 'systemd_service' | ||
- auth__ssh_changes_strategy.module is defined | ||
- auth__ssh_changes_strategy.module == 'systemd_service' | ||
|
||
- name: Effect service for ssh config changes | ||
- name: Effect service for ssh changes | ||
become: true | ||
ansible.builtin.service: | ||
arguments: "{{ change_strategy.arguments | default(omit) }}" | ||
enabled: "{{ change_strategy.enabled | default(omit) }}" | ||
name: "{{ change_strategy.name | default('ssh.service') }}" | ||
pattern: "{{ change_strategy.pattern | default(omit) }}" | ||
runlevel: "{{ change_strategy.runlevel | default(omit) }}" | ||
sleep: "{{ change_strategy.sleep | default(omit) }}" | ||
state: "{{ change_strategy.state | default(omit) }}" | ||
use: "{{ change_strategy.use | default(omit) }}" | ||
arguments: "{{ service.arguments | default(omit) }}" | ||
enabled: "{{ service.enabled | default(omit) }}" | ||
name: "{{ service.name | default('ssh.service') }}" | ||
pattern: "{{ service.pattern | default(omit) }}" | ||
runlevel: "{{ service.runlevel | default(omit) }}" | ||
sleep: "{{ service.sleep | default(omit) }}" | ||
state: "{{ service.state | default(omit) }}" | ||
use: "{{ service.use | default(omit) }}" | ||
vars: | ||
change_strategy: "{{ (__ansible__config is defined) | | ||
ternary( | ||
(auth__ssh_config_change_strategy | aybarsm.helper.replace_aliases(__ansible__config.modules.ansible.builtin.service.aliases)), | ||
auth__ssh_config_change_strategy) }}" | ||
register: auth__ssh_config_apply_changes_service | ||
listen: "auth__ssh_config_apply_changes" | ||
service: "{{ auth__ssh_changes_strategy | aybarsm.helper.replace_aliases(__ansible__config.modules.ansible.builtin.service.aliases) }}" | ||
register: auth__ssh_apply_changes_service | ||
listen: "auth__ssh_apply_changes" | ||
when: | ||
- auth__ssh_config_change_strategy.module is defined | ||
- auth__ssh_config_change_strategy.module == 'service' | ||
- auth__ssh_changes_strategy.module is defined | ||
- auth__ssh_changes_strategy.module == 'service' |
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
- name: Apply ssh daemon configuration | ||
become: true | ||
ansible.builtin.template: | ||
src: "{{ auth__sshd_config_template }}" | ||
dest: "{{ auth__sshd_config_file }}" | ||
backup: "{{ auth__sshd_config_backup | default(omit) | bool }}" | ||
validate: "{{ auth__sshd_validate | default(omit) }}" | ||
register: auth__sshd_config_apply | ||
notify: "auth__ssh_apply_changes" | ||
when: | ||
- auth__manage_sshd_config | default(false) | bool | ||
- auth__sshd_config_all | type_debug == 'list' | ||
- auth__sshd_config_all | length > 0 | ||
|
||
- name: Apply ssh client configuration | ||
become: true | ||
ansible.builtin.template: | ||
src: "{{ auth__ssh_config_template }}" | ||
dest: "{{ auth__ssh_config_file }}" | ||
backup: "{{ auth__ssh_config_backup | default(omit) | bool }}" | ||
register: auth__ssh_config_apply | ||
notify: "auth__ssh_apply_changes" | ||
when: | ||
- auth__manage_ssh_config | default(false) | bool | ||
- auth__ssh_config_all | type_debug == 'list' | ||
- auth__ssh_config_all | length > 0 | ||
|
||
- name: Run smart sshd configuration changes | ||
ansible.builtin.command: | ||
cmd: /usr/bin/true | ||
changed_when: true | ||
notify: "auth__ssh_apply_changes" | ||
when: | ||
- auth__sshd_validate is defined | ||
- auth__sshd_config_apply is not change | ||
- auth__ssh_config_apply is not change | ||
- auth__ssh_changes_strategy.smart | default(false) | bool | ||
|
||
- name: Effect ssh changes | ||
ansible.builtin.meta: 'flush_handlers' | ||
when: | ||
- auth__ssh_changes_strategy.module is defined | ||
- auth__ssh_changes_strategy.immediate | default(false) | bool | ||
|
This file was deleted.
Oops, something went wrong.
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,2 +1,2 @@ | ||
{{ ansible_managed | comment }} | ||
{{ auth__ssh_config_all | aybarsm.helper.to_querystring('name', 'value', ' ', '\n', 'children', 4, ' ', true) }} | ||
{{ auth__ssh_config_all | aybarsm.helper.to_querystring('name', 'value', ' ', '\n', 'children', 4, ' ', true) }} |
2 changes: 2 additions & 0 deletions
2
roles/auth/templates/etc/ssh/sshd_config.d/50-ansible.conf.j2
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,2 @@ | ||
{{ ansible_managed | comment }} | ||
{{ auth__sshd_config_all | aybarsm.helper.to_querystring('name', 'value', ' ', '\n', 'children', 4, ' ', true) }} |
This file was deleted.
Oops, something went wrong.
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,2 @@ | ||
{{ ansible_managed | comment }} | ||
{{ auth__sudoers_file_all | aybarsm.helper.to_querystring(keyAttr='entry', joinChar='\n\n') }} |
Oops, something went wrong.