Hi,

I'm trying to access hostvar in replace module but I could not access the 
same. 



hosts:
-------
[server1]
server1.com

[userpc]
userpc.com ansible_ssh_user=dinesh

[server1:vars]
ansible_ssh_user=test
host_ip=1.1.1.1

play-book:
--------------

---
- hosts: userpc
  tasks:
    - replace:
        path: "/tmp/test_params.yaml"
        regexp: 'private_ip:\s+\d+.\d+.\d+.\d+'
        replace: 'private_ip: {{ hostvars.[serverFqdn]['host_ip'] }}'
        backup: yes


command:
-------------
ansible-playbook update.yml  --ask-pass  -e "serverFqdn=server1.com"


Note:

The use case here is that the host_ip of 'server1.com' should be accessible 
in 'userpc' task. 

Could you help to resolve this?  

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to