Something like this ? (not tested)

action: lineinfile dest="/etc/zabbix/zabbix_agentd.conf" backup=yes
state=present regexp="^ListenIP=0.0.0.0" line="ListenIP={{
ansible_default_ipv4 }}"

Regards,


Le 02/12/2015 21:20, saikrishnakhan...@gmail.com a écrit :
> Hi Jean
>
>  tasks:
>   - name: set hostname
>     action: hostname name=devcfgl02
>
>   - name: create zabbix group
>     action: group name=zabbix gid=1100
>
>   - name: create zabbix user
>     action: user name=zabbix uid=1100 group=zabbix comment="Zabbix
> Monitoring User" home="/home/zabbix"
>
>   - name: add zabbix restart with yum
>     yum:
> name=http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpm
> state=present
>
>   - name: Ensure that zabbix is installed
>     yum: pkg=zabbix-agent state=installed
>
>   - name: Ensure that zabbix is running
>     service: name=zabbix-agent state=started enabled=yes
>
>   - name: zabbix-server restarted
>     service: name=zabbix-agent state=restarted enabled=yes
>
>   - name: change zabbix_agent.conf server
>     action: lineinfile dest="/etc/zabbix/zabbix_agentd.conf"
> backup=yes state=present regexp="Server=127.0.0.1"
> line="Server=prdmonapp1"
>
>   - name: change zabbix_agent.conf server
>     action: lineinfile dest="/etc/zabbix/zabbix_agentd.conf"
> backup=yes state=present regexp="ServerActive=127.0.0.1"
> line="ServerActive=prdmonapp1:10045"
>
>   - name: change zabbix_agent.conf server
>     action: lineinfile dest="/etc/zabbix/zabbix_agentd.conf"
> backup=yes state=present regexp="ListenIP=0.0.0.0"
>
> What action do i have to use here in the last step to fetch its own
> server ip and replace the ListenIP in the config file.
>
>
> On Wednesday, December 2, 2015 at 11:12:03 AM UTC-6,
> saikrish...@gmail.com wrote:
>
>     Can any one please help me how can I write a script to fetch its
>     own IP Address.
>
> -- 
> You received this message because you are subscribed to the Google
> Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to ansible-project+unsubscr...@googlegroups.com
> <mailto:ansible-project+unsubscr...@googlegroups.com>.
> To post to this group, send email to ansible-project@googlegroups.com
> <mailto:ansible-project@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/31a72b53-cc29-4395-b614-834656c46f90%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/31a72b53-cc29-4395-b614-834656c46f90%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/565F53C0.4060604%40lenhof.eu.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to