diff --git a/inventory/linode.linode.yml b/inventory/linode.linode.yml new file mode 100644 index 0000000..d94f705 --- /dev/null +++ b/inventory/linode.linode.yml @@ -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 diff --git a/inventory/linode_minimal.yaml b/inventory/linode_minimal.yaml deleted file mode 100644 index fc7ce22..0000000 --- a/inventory/linode_minimal.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -plugin: community.general.linode -api_token: "{{ lookup('env', 'LINODE_API_TOKEN') }}" - -compose: - ansible_host: ipv4[0] - ansible_user: phlux diff --git a/requirements.yaml b/requirements.yaml index 552adfe..647c90b 100644 --- a/requirements.yaml +++ b/requirements.yaml @@ -1,2 +1,5 @@ +--- collections: - - community.general + - name: community.general + version: ">=6.0.0,<9.0.0" # More compatible version range + - name: linode.cloud