Following is the desire output:
ERROR Rendering Code Block
The idea is to pass domain name ie domain.com in playbook and playbook will lookup its A record then check it against the predefined variable. If ip is found in variable then it will display the corresponding key.
Here is my ansible-playbook role:
roles/test/tasks/main.yml
ERROR Rendering Code Block
roles/test/vars/main.yml
ERROR Rendering Code Block
What is the problem? Apart from the fact that hosts
is a reserved variable name.
oh, I want to pass domain name then playbook will resolve its ip and show in which server that domain belongs to.
Why do you want this?
it is just a small portion of a big playbook. You can think it as a small project or also think as I am practicing.