Add more tests to see wtf is going wrong here..
This commit is contained in:
37
playbooks/tests/test_inv_with_collection_path.yml
Normal file
37
playbooks/tests/test_inv_with_collection_path.yml
Normal file
@@ -0,0 +1,37 @@
|
||||
---
|
||||
- name: Test Inventory with Collection Paths
|
||||
hosts: localhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Test inventory with explicit collection path
|
||||
ansible.builtin.shell: |
|
||||
export ANSIBLE_COLLECTIONS_PATH="/runner/requirements_collections:/usr/share/ansible/collections"
|
||||
export LINODE_API_TOKEN="${LINODE_API_TOKEN}"
|
||||
|
||||
# Create temp inventory file
|
||||
cat > /tmp/test_inventory.yml << 'EOF'
|
||||
plugin: linode.cloud.inventory
|
||||
access_token: "{{ lookup('env', 'LINODE_API_TOKEN') }}"
|
||||
compose:
|
||||
ansible_host: ipv4[0]
|
||||
ansible_user: phlux
|
||||
EOF
|
||||
|
||||
echo "=== Testing inventory ==="
|
||||
ansible-inventory -i /tmp/test_inventory.yml --list
|
||||
register: inventory_test
|
||||
ignore_errors: true
|
||||
environment:
|
||||
ANSIBLE_COLLECTIONS_PATH: "/runner/requirements_collections:/usr/share/ansible/collections"
|
||||
LINODE_API_TOKEN: "{{ lookup('env', 'LINODE_API_TOKEN') }}"
|
||||
|
||||
- name: Display inventory test results
|
||||
ansible.builtin.debug:
|
||||
msg: |
|
||||
Return code: {{ inventory_test.rc }}
|
||||
|
||||
Stdout:
|
||||
{{ inventory_test.stdout }}
|
||||
|
||||
Stderr:
|
||||
{{ inventory_test.stderr }}
|
Reference in New Issue
Block a user