Files
EX407-Ansible-Automation/playbooks/var_playbook.yml
2020-03-05 14:07:37 +01:00

13 lines
285 B
YAML

---
- hosts: labservers
vars:
inv_file: /home/cloud_user/vars/inv.txt
tasks:
- name: create file
file:
path: "{{inv_file}}"
state: touch
- name: generate inventory
lineinfile:
path: "{{inv_file}}"
line: "{{ groups['labservers']|join(' ') }}"