Hello,
I have no idea how to solve an IP address problem. I need some tips. I have an inventory file with defined hosts:
[clab111]
11.11.11.11
[ clab222]
22.22.22.22
Then I will start working on one host, for example:
The path to the subtitles PLAYBOOK_NAME.yml and inv -limit “clab111”
In the meantime, I will use in the playbook_name.yml, lineinfile module, which should replace any IP address to address of the clab111. I have all the regex, but I do not know how to set the variable that will contain the IP address from the file inventory file for that particular clab111. I tried with hostvars, but without success.
So I need:
- get IP address of (for example) clab111 from inventory file,
- define variable with this clabxxx_ip: {{ my_problem }}
- put here: sed -r ‘s/([0-9]{1,3}.){3}[1-9]{1,3}’/{{ clabxxx_ip }}/g
Thanks for the patience. I spent a ton of time on the “google” solution but without success, it’s my first steps in ansible.
Br,
Mateusz