浏览代码

differnetiate saved and fetched state

master
父节点
当前提交
afdd79fb55
共有 3 个文件被更改,包括 17 次插入9 次删除
  1. +10
    -0
      tasks/file.yml
  2. +7
    -0
      tasks/main.yml
  3. +0
    -9
      tasks/save.yml

+ 10
- 0
tasks/file.yml 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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

正在加载...
取消
保存