Add more tests to see wtf is going wrong here..
This commit is contained in:
46
playbooks/tests/check_plugins.yml
Normal file
46
playbooks/tests/check_plugins.yml
Normal file
@@ -0,0 +1,46 @@
|
||||
---
|
||||
- name: Check Available Inventory Plugins
|
||||
hosts: localhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: List all available inventory plugins
|
||||
ansible.builtin.shell: |
|
||||
echo "=== All inventory plugins ==="
|
||||
ansible-doc -t inventory -l 2>/dev/null || echo "ansible-doc failed"
|
||||
echo ""
|
||||
echo "=== Check linode specific plugins ==="
|
||||
ansible-doc -t inventory -l 2>/dev/null | grep -i linode || echo "No linode plugins in doc list"
|
||||
echo ""
|
||||
echo "=== Check plugin files directly ==="
|
||||
find /runner/requirements_collections -name "*.py" -path "*/inventory/*" | grep -i linode || echo "No linode inventory plugins found in files"
|
||||
echo ""
|
||||
echo "=== Collection structure ==="
|
||||
ls -la /runner/requirements_collections/ansible_collections/linode/cloud/plugins/inventory/ 2>/dev/null || echo "Linode inventory directory not found"
|
||||
register: plugin_check
|
||||
ignore_errors: true
|
||||
|
||||
- name: Display plugin check results
|
||||
ansible.builtin.debug:
|
||||
var: plugin_check.stdout_lines
|
||||
|
||||
- name: Test inventory plugin directly
|
||||
ansible.builtin.shell: |
|
||||
echo "=== Test plugin path ==="
|
||||
export ANSIBLE_COLLECTIONS_PATH="/runner/requirements_collections:/usr/share/ansible/collections"
|
||||
ansible-inventory --list -i /dev/stdin << 'EOF'
|
||||
plugin: linode.cloud.inventory
|
||||
access_token: "fake_token_for_test"
|
||||
EOF
|
||||
register: plugin_test
|
||||
ignore_errors: true
|
||||
environment:
|
||||
LINODE_API_TOKEN: "test"
|
||||
|
||||
- name: Display plugin test results
|
||||
ansible.builtin.debug:
|
||||
msg: |
|
||||
Plugin test output:
|
||||
{{ plugin_test.stdout }}
|
||||
|
||||
Plugin test error:
|
||||
{{ plugin_test.stderr }}
|
23
playbooks/tests/test_diff_inv_formats.yml
Normal file
23
playbooks/tests/test_diff_inv_formats.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
# Try 1: Full collection path - inventory/test1.yml
|
||||
---
|
||||
plugin: ansible_collections.linode.cloud.plugins.inventory.inventory
|
||||
access_token: "{{ lookup('env', 'LINODE_API_TOKEN') }}"
|
||||
compose:
|
||||
ansible_host: ipv4[0]
|
||||
ansible_user: phlux
|
||||
|
||||
---
|
||||
# Try 2: Just the collection name - inventory/test2.yml
|
||||
plugin: linode.cloud.inventory
|
||||
access_token: "{{ lookup('env', 'LINODE_API_TOKEN') }}"
|
||||
compose:
|
||||
ansible_host: ipv4[0]
|
||||
ansible_user: phlux
|
||||
|
||||
---
|
||||
# Try 3: Community general version - inventory/test3.yml
|
||||
plugin: community.general.linode
|
||||
api_token: "{{ lookup('env', 'LINODE_API_TOKEN') }}"
|
||||
compose:
|
||||
ansible_host: ipv4[0]
|
||||
ansible_user: phlux
|
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