Skip to content

Commit 619564f

Browse files
committed
test: fix ssh wrapper test
Simplify the inventory to make it easier to debug the nested ansible-playbook --check call Only generate an inventory for the current inventory hostname. Add -b to the nested call for permissions Signed-off-by: Rich Megginson <[email protected]>
1 parent 463d74f commit 619564f

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

tests/inventory.yaml.j2

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
1-
{{ { 'all': { 'hosts': hostvars } } | to_yaml }}
1+
all:
2+
hosts:
3+
{{ inventory_hostname }}:
4+
{% for key in ["ansible_all_ipv4_addresses", "ansible_all_ipv6_addresses",
5+
"ansible_default_ipv4", "ansible_default_ipv6", "ansible_host",
6+
"ansible_port", "ansible_ssh_common_args",
7+
"ansible_ssh_private_key_file","ansible_user"] %}
8+
{% if key in hostvars[inventory_hostname] %}
9+
{{ key }}: {{ hostvars[inventory_hostname][key] }}
10+
{% endif %}
11+
{% endfor %}

tests/tests_ssh_wrapper.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
tasks:
3434
- name: Run ansible-playbook with tests_ssh.yml in check mode
3535
command: |
36-
ansible-playbook -vvv -i {{ tempinventory.path }} --check tests_ssh.yml
36+
ansible-playbook -b -vv -i {{ tempinventory.path }} --check tests_ssh.yml
3737
delegate_to: localhost
3838
changed_when: false
3939

0 commit comments

Comments
 (0)