mirror of
https://github.com/roles-ansible/ansible_role_sshd.git
synced 2024-08-16 11:59:49 +02:00
now using ansible builtin stuff to manage sshd
This commit is contained in:
parent
8d5e1f32ba
commit
7d8c04a8c8
2 changed files with 11 additions and 23 deletions
|
@ -1,42 +1,30 @@
|
||||||
---
|
---
|
||||||
- name: Generate new ssh host key pair if necessary
|
- name: Generate new ssh host key pair if necessary
|
||||||
become: yes
|
become: true
|
||||||
command: ssh-keygen -t ecdsa -f 'ssh_host_{{ item }}_key' -P '' -q
|
community.crypto.openssh_keypair:
|
||||||
args:
|
path: "/etc/ssh/ssh_host_{{ item }}_key"
|
||||||
chdir: '/etc/ssh/'
|
type: "{{ item }}"
|
||||||
creates: 'ssh_host_{{ item }}_key.pub'
|
|
||||||
notify:
|
|
||||||
- systemctl restart ssh
|
|
||||||
with_items: "{{ sshd__key_types }}"
|
with_items: "{{ sshd__key_types }}"
|
||||||
when:
|
when:
|
||||||
- sshd__manage_key_types | bool
|
- sshd__manage_key_types | bool
|
||||||
|
|
||||||
- name: Remove unwanted host keys
|
|
||||||
become: yes
|
|
||||||
file:
|
|
||||||
path: '/etc/ssh/ssh_host_{{ item }}_key'
|
|
||||||
state: absent
|
|
||||||
with_items:
|
|
||||||
- rsa
|
|
||||||
- dsa
|
|
||||||
notify:
|
notify:
|
||||||
- systemctl restart ssh
|
- systemctl restart ssh
|
||||||
|
|
||||||
- name: make sure the correct keys are available
|
- name: make sure only the correct keys are available
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: '/etc/ssh/ssh_host_{{ item }}_key'
|
path: '/etc/ssh/ssh_host_{{ item }}_key'
|
||||||
state: absent
|
state: absent
|
||||||
become: yes
|
become: true
|
||||||
with_items:
|
with_items:
|
||||||
- "{{ sshd__key_types_list | difference( sshd__key_types ) }}"
|
- "{{ sshd__key_types_list | difference( sshd__key_types ) }}"
|
||||||
notify:
|
notify:
|
||||||
- systemctl restart ssh
|
- systemctl restart ssh
|
||||||
|
|
||||||
- name: make sure the correct pubkeys are available
|
- name: make sure only the correct pubkeys are available
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: '/etc/ssh/ssh_host_{{ item }}_key.pub'
|
path: '/etc/ssh/ssh_host_{{ item }}_key.pub'
|
||||||
state: absent
|
state: absent
|
||||||
become: yes
|
become: true
|
||||||
with_items:
|
with_items:
|
||||||
- "{{ sshd__key_types_list | difference( sshd__key_types ) }}"
|
- "{{ sshd__key_types_list | difference( sshd__key_types ) }}"
|
||||||
notify:
|
notify:
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
---
|
---
|
||||||
playbook_version_number: 4099 # should be over ninethousand
|
playbook_version_number: 4100 # should be over ninethousand
|
||||||
playbook_version_path: 'role-sshd_chaos-bodensee_github.com.version'
|
playbook_version_path: 'role-sshd_chaos-bodensee_github.com.version'
|
||||||
|
|
Loading…
Reference in a new issue