this is a pain in the ass lmao

This commit is contained in:
2025-08-07 20:54:38 -05:00
parent d1bf628691
commit 76756e07f5
3 changed files with 58 additions and 8 deletions

View File

@@ -0,0 +1,54 @@
---
plugin: linode.cloud.inventory
access_token: "{{ lookup('env', 'LINODE_API_TOKEN') }}"
# Use Linode labels as hostnames
strict: false
# Create groups
keyed_groups:
# Group by region: region_us_southeast
- key: region
prefix: region
separator: "_"
# Group by instance type: type_g6_standard_6
- key: type
prefix: type
separator: "_"
# Group by status: status_running
- key: status
prefix: status
separator: "_"
# Group by tags: tag_k3s, tag_debian, etc.
- key: tags
prefix: tag
separator: "_"
# Set host variables
compose:
ansible_host: ipv4[0]
ansible_user: phlux
linode_id: id
linode_region: region
linode_type: type
linode_status: status
linode_tags: tags
# Add convenience variables for your tags
is_k3s: "'k3s' in (tags | default([]))"
is_control_plane: "'control-plane' in (tags | default([]))"
is_worker_node: "'worker-node' in (tags | default([]))"
is_debian: "'Debian' in (tags | default([]))"
is_ubuntu: "'Ubuntu' in (tags | default([]))"
# Optional: Only include running instances
filters:
- status == "running"
# Cache settings
cache: true
cache_plugin: memory
cache_timeout: 300

View File

@@ -1,7 +0,0 @@
---
plugin: community.general.linode
api_token: "{{ lookup('env', 'LINODE_API_TOKEN') }}"
compose:
ansible_host: ipv4[0]
ansible_user: phlux

View File

@@ -1,2 +1,5 @@
---
collections: collections:
- community.general - name: community.general
version: ">=6.0.0,<9.0.0" # More compatible version range
- name: linode.cloud