Markus Katharina Brechtel 7 роки тому
джерело
коміт
481bb1f263
3 змінених файлів з 15 додано та 12 видалено
  1. +3
    -1
      defaults/main.yml
  2. +1
    -1
      tasks/local.yml
  3. +11
    -10
      tasks/main.yml

+ 3
- 1
defaults/main.yml Переглянути файл

@@ -4,4 +4,6 @@ ssh_host_key_types:
- rsa
ssh_ip: "{{ansible_host}}"
ssh_host_key_state: configured
ssh_scan_host: "{{inventory_hostname}}"
ssh_scan_host: "{% if ssh_ip is defined %}{{ ssh_ip }}{% else %}{{inventory_hostname}}{% endif %}"

ssh_update_local_known_hosts_file: true

tasks/file.yml → tasks/local.yml Переглянути файл

@@ -1,6 +1,6 @@
---

- name: write ssh_known_hosts file
- name: write local ssh_known_hosts file
local_action: known_hosts
args:
path: "{{ lookup('env','HOME') }}/.ssh/known_hosts"

+ 11
- 10
tasks/main.yml Переглянути файл

@@ -1,17 +1,17 @@
---

- include: regenerate.yml
- import_tasks: regenerate.yml
when: ssh_host_key_state == 'regenerated'

- include: scan.yml
- import_tasks: scan.yml
when: ssh_host_key_state == 'scanned'

- include: setup.yml
- import_tasks: setup.yml
when:
- ssh_host_key_state == 'configured'
- ansible_ssh_host_key_ed25519_public is defined

- include: fetch.yml
- import_tasks: fetch.yml
when:
- ssh_host_key_state == 'configured' or
ssh_host_key_state == 'fetched' or
@@ -20,16 +20,17 @@
and not ansible_ssh_host_key_ed25519_public is defined
or not ssh_host_key_state == 'configured'

- include: save.yml
- import_tasks: save.yml
when:
ssh_host_key_state == 'configured' or
ssh_host_key_state == 'scanned' or
ssh_host_key_state == 'regenerated' or
ssh_host_key_state == 'fetched'

- include: file.yml
- import_tasks: local.yml
when:
ssh_host_key_state == 'configured' or
ssh_host_key_state == 'scanned' or
ssh_host_key_state == 'regenerated' or
ssh_host_key_state == 'saved'
- ssh_host_key_state == 'configured' or
ssh_host_key_state == 'scanned' or
ssh_host_key_state == 'regenerated' or
ssh_host_key_state == 'saved'
- ssh_update_local_known_hosts_file

Завантаження…
Відмінити
Зберегти