Bläddra i källkod

differnetiate saved and fetched state

master
förälder
incheckning
afdd79fb55
3 ändrade filer med 17 tillägg och 9 borttagningar
  1. +10
    -0
      tasks/file.yml
  2. +7
    -0
      tasks/main.yml
  3. +0
    -9
      tasks/save.yml

+ 10
- 0
tasks/file.yml Visa fil

@@ -0,0 +1,10 @@
---
- name: write ssh_known_hosts file
local_action: known_hosts
args:
path: "{{ playbook_dir }}/ssh_known_hosts"
name: "{{ item }}"
key: "{{ item }},{{ hostvars[item].ssh_ip }} ssh-ed25519 {{ hostvars[item].ssh_host_key_ed25519_public }}"
with_items: "{{play_hosts}}"
run_once: true

+ 7
- 0
tasks/main.yml Visa fil

@@ -21,6 +21,13 @@
or not ssh_host_key_state == 'configured'

- include: 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
when:
ssh_host_key_state == 'configured' or
ssh_host_key_state == 'scanned' or


+ 0
- 9
tasks/save.yml Visa fil

@@ -5,12 +5,3 @@

- name: host_vars file
local_action: template src=host_vars.j2 dest=host_vars/{{inventory_hostname}}/ssh_host_key.yml

- name: write ssh_known_hosts file
local_action: known_hosts
args:
path: "{{ playbook_dir }}/ssh_known_hosts"
name: "{{ item }}"
key: "{{ item }},{{ hostvars[item].ssh_ip }} ssh-ed25519 {{ hostvars[item].ssh_host_key_ed25519_public }}"
with_items: "{{play_hosts}}"
run_once: true

Laddar…
Avbryt
Spara