選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

regenerate.yml 834B

12345678910111213141516171819202122232425262728
  1. ---
  2. - name: ssh config directory
  3. file:
  4. path: "{{ root_target_directory | default('') }}/etc/ssh"
  5. state: directory
  6. - name: delete old ssh host private keys
  7. #file:
  8. # path: "{{ item }}"
  9. # state: absent
  10. #with_fileglob:
  11. # - "{{ root_target_directory | default('') }}/etc/ssh/ssh_host_*"
  12. shell: rm {{ root_target_directory | default('') }}/etc/ssh/ssh_host_*
  13. args:
  14. warn: false
  15. register: _ssh_delete_host_keys_command
  16. failed_when: _ssh_delete_host_keys_command.rc > 1
  17. changed_when: _ssh_delete_host_keys_command.rc == 0
  18. - name: generate new ssh host keys
  19. command: ssh-keygen -f {{ root_target_directory | default('') }}/etc/ssh/ssh_host_{{item}}_key -N "" -t {{item}}
  20. with_items: "{{ssh_host_key_types}}"
  21. - service:
  22. name: sshd
  23. state: reloaded
  24. when: not root_target_directory is defined