I'm going to see if the community module works at this point. Fuck it.
This commit is contained in:
@@ -1,14 +1,52 @@
|
||||
plugin: linode.cloud.linode
|
||||
token: "{{ lookup('env', 'LINODE_TOKEN') }}"
|
||||
keyed_groups:
|
||||
- prefix: tag
|
||||
key: tags
|
||||
- prefix: region
|
||||
key: region
|
||||
- prefix: type
|
||||
key: type
|
||||
hostnames:
|
||||
- label
|
||||
compose:
|
||||
ansible_host: ipv4
|
||||
---
|
||||
plugin: community.general.linode
|
||||
|
||||
# Your Linode API token (will be injected by AWX credential)
|
||||
api_token: "{{ linode_api_token | default(lookup('env', 'LINODE_API_TOKEN')) }}"
|
||||
|
||||
# Use Linode labels as hostnames (exactly what you wanted!)
|
||||
strict: false
|
||||
|
||||
# Create groups based on Linode attributes
|
||||
keyed_groups:
|
||||
# Group by region: linode_region_us_southeast
|
||||
- key: region
|
||||
prefix: linode_region
|
||||
separator: "_"
|
||||
|
||||
# Group by instance type: linode_type_g6_standard_6
|
||||
- key: type
|
||||
prefix: linode_type
|
||||
separator: "_"
|
||||
|
||||
# Group by status: linode_status_running
|
||||
- key: status
|
||||
prefix: linode_status
|
||||
separator: "_"
|
||||
|
||||
# Group by tags: linode_tag_k3s, linode_tag_debian, etc.
|
||||
- key: tags
|
||||
prefix: linode_tag
|
||||
separator: "_"
|
||||
|
||||
# Set host variables
|
||||
compose:
|
||||
# Use primary IPv4 as ansible_host
|
||||
ansible_host: ipv4[0]
|
||||
ansible_user: phlux
|
||||
|
||||
# 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 (optional but recommended)
|
||||
cache: true
|
||||
cache_plugin: memory
|
||||
cache_timeout: 300
|
||||
|
@@ -1,2 +1,3 @@
|
||||
requests>=2.25.0
|
||||
urllib3>=1.26.0
|
||||
linode_api4 >= 2.0.0
|
||||
|
2
requirements.yaml
Normal file
2
requirements.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
collections:
|
||||
- community.general
|
Reference in New Issue
Block a user