Several changes here
This commit is contained in:
54
playbooks/inventory/linode_workflow.yml
Normal file
54
playbooks/inventory/linode_workflow.yml
Normal file
@@ -0,0 +1,54 @@
|
||||
---
|
||||
# Example workflow that updates inventory and then uses it
|
||||
- name: Step 1 - Update Linode Inventory
|
||||
hosts: localhost
|
||||
gather_facts: true
|
||||
connection: local
|
||||
|
||||
vars:
|
||||
push_to_git: true
|
||||
awx_api_integration: true
|
||||
awx_host: "{{ lookup('env', 'TOWER_HOST') | default('https://localhost') }}"
|
||||
awx_project_id: "{{ lookup('env', 'AWX_PROJECT_ID') | default('') }}"
|
||||
awx_token: "{{ lookup('env', 'AWX_TOKEN') | default('') }}"
|
||||
|
||||
roles:
|
||||
- role: linode_inventory
|
||||
|
||||
- name: Step 2 - Wait for project sync (if using API)
|
||||
hosts: localhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Wait for project sync to complete
|
||||
ansible.builtin.pause:
|
||||
seconds: 30
|
||||
when: awx_api_integration | default(false)
|
||||
|
||||
- name: Manual sync reminder
|
||||
ansible.builtin.debug:
|
||||
msg: |
|
||||
⚠️ MANUAL ACTION REQUIRED ⚠️
|
||||
|
||||
Please manually sync your AWX project now to pull the updated inventory file.
|
||||
Then create/sync an inventory source pointing to: inventory/linode_hosts.json
|
||||
|
||||
After that, you can run jobs against your discovered Linode hosts!
|
||||
when: not (awx_api_integration | default(false))
|
||||
|
||||
# This play would run in a separate job template after inventory is synced
|
||||
- name: Step 3 - Example task using discovered hosts
|
||||
hosts: localhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Instructions for next job template
|
||||
ansible.builtin.debug:
|
||||
msg: |
|
||||
This would be a separate job template that runs after inventory sync.
|
||||
It would target groups like:
|
||||
- tag_k3s
|
||||
- tag_control_plane
|
||||
- tag_worker_node
|
||||
- region_us_southeast
|
||||
|
||||
Example: Create a job template with inventory pointing to the Linode hosts
|
||||
and limit it to specific groups like 'tag_k3s' to run tasks on k3s nodes only.
|
Reference in New Issue
Block a user