zuul-jobs/test-playbooks/multinode/multi-node-known-hosts.yaml
Sorin Sbarnea 57415688ce Remove ansible-lint path exclusions
Fixes several rules with test-playbooks and remove path exclusions.

Since we introduced the progressive mode, exclusions are no longer
needed and not haivng them will assure newly added code follows
the same guidelines.

Change-Id: I0a72d34aff8cf23172e26c7f44e0f61571ec74b6
2021-04-27 08:22:32 +00:00

32 lines
1.1 KiB
YAML

- name: Test the multi-node-known-hosts role
hosts: all
roles:
- multi-node-known-hosts
post_tasks:
- name: lookup known_hosts file
command: cat ~/.ssh/known_hosts
register: known_hosts
- name: Set up host addresses
set_fact:
host_addresses: >
{% set hosts = [] -%}
{% for host, vars in hostvars.items() -%}
{% if vars['nodepool']['private_ipv4'] | length > 0 -%}
{% set _ = hosts.append(vars['nodepool']['private_ipv4']) -%}
{% endif -%}
{% if vars['nodepool']['public_ipv4'] | length > 0 -%}
{% set _ = hosts.append(vars['nodepool']['public_ipv4']) -%}
{% endif -%}
{% if vars['nodepool']['public_ipv6'] | length > 0 -%}
{% set _ = hosts.append(vars['nodepool']['public_ipv6']) -%}
{% endif -%}
{% endfor -%}
{{- hosts | sort | unique -}}
- name: assert that hosts are in known_hosts
assert:
that:
- "item in known_hosts.stdout"
with_items: "{{ host_addresses }}"