Im trying to access the server information from CSV file. Based on this information, I want to target the host.
The CSV file contains the following information. based on this CSV file, when ever we pass the instance name using --extra-vars the task should execute on the corresponding server.
Is it possible. Can any one help me with the playbook.
- name: msg="Match 'Li' on the first column, but return the 3rd column (columns start counting after the match)"
debug: msg="The atomic mass of Lithium is {{ lookup('csvfile', 'Li file=elements.csv delimiter=, col=2') }}"
and it is returning the hostname. I want to save the result hostname in a variable and will used to execute the tasks.