Oops. Forgot to update the role
This commit is contained in:
@@ -1,20 +1,11 @@
|
|||||||
---
|
---
|
||||||
- name: Fetch Linode instances
|
- name: Get Linode inventory using local module
|
||||||
linode.cloud.linode_instance_info:
|
linode_inventory:
|
||||||
api_token: "{{ linode_token }}"
|
register: linode_result
|
||||||
register: linodes
|
|
||||||
|
|
||||||
- name: Build inventory lines
|
- name: Write inventory to file
|
||||||
set_fact:
|
|
||||||
linode_inventory: |
|
|
||||||
{% for linode in linodes.data %}
|
|
||||||
{{ linode.label }} ansible_host={{ linode.ipv4[0] }} {% for tag in linode.tags %}group_{{ tag }}=true {% endfor %}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
- name: Write dynamic inventory to file
|
|
||||||
copy:
|
copy:
|
||||||
dest: /tmp/linode_inventory.ini
|
dest: /tmp/linode_inventory.json
|
||||||
content: |
|
content: "{{ linode_result | to_nice_json }}"
|
||||||
[all]
|
mode: '0644'
|
||||||
{{ linode_inventory }}
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user