Skip to content
Snippets Groups Projects
Verified Commit 2b949aaf authored by David Mehren's avatar David Mehren
Browse files

Manage default config as block

parent 5209198c
Branches
Tags
No related merge requests found
...@@ -13,8 +13,28 @@ ...@@ -13,8 +13,28 @@
state: absent state: absent
path: /etc/ssh/moduli path: /etc/ssh/moduli
- name: copy config - name: Check if sshf_config is already managed in blocks
lineinfile:
path: /etc/ssh/sshd_config
line: "#BEGIN ANSIBLE MANAGED SSH DEFAULTS"
state: present
check_mode: yes
register: config_no_blocks
- name: Delete old config
file:
path: /etc/ssh/sshd_config
state: absent
when: config_no_blocks.changed
- name: Load config template
set_fact:
sshd_config: "{{ lookup('template', 'templates/sshd_config.conf.j2') }}"
- name: Create default config
notify: start sshd notify: start sshd
template: blockinfile:
src: sshd_config.conf.j2 path: /etc/ssh/sshd_config
dest: /etc/ssh/sshd_config block: "{{ sshd_config }}"
marker: "#{mark} ANSIBLE MANAGED SSH DEFAULTS"
create: yes
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment