38 lines
1.2 KiB
YAML
38 lines
1.2 KiB
YAML
---
|
|
- 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 }}
|