Browse Source

improvements

master
parent
commit
481bb1f263
3 changed files with 15 additions and 12 deletions
  1. +3
    -1
      defaults/main.yml
  2. +1
    -1
      tasks/local.yml
  3. +11
    -10
      tasks/main.yml

+ 3
- 1
defaults/main.yml View File

@@ -4,4 +4,6 @@ ssh_host_key_types:
- rsa - rsa
ssh_ip: "{{ansible_host}}" ssh_ip: "{{ansible_host}}"
ssh_host_key_state: configured 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 View File

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


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

+ 11
- 10
tasks/main.yml View File

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


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


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


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


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


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


- include: file.yml
- import_tasks: local.yml
when: 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

Loading…
Cancel
Save