您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

29 行
834B

  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