On 24.01.17 03:30 Kiran Kumar wrote:
> x oracle
> y db
> x prod
I assume the x should be the hostname, and the second column should be
the line in /etc/hosts.allow?
> how can i do it for huge number of nodes ?
You put more than one host in the "- hosts:" line? ;-)
Seriously, put the x=oracle values in the host_vars for each hosts.
Call it something describing, hostname_in_etc_hosts_allow and set it
to oracle on host x (host_vars/x/main.yml), and to db on host y.
Then put the variable hostname_in_etc_hosts_allow in your task:
- name: Add a word in remote file
hosts: temp
remote_user: xx
sudo: yes
tasks:
- name: edit cron.allow
lineinfile:
destfile: /etc/cron.allow
line: '{{ hostname_in_etc_hosts_allow }}'
Johannes
BTW: "sudo: yes" is being substituted by "become: yes" and
"become_method: sudo" for quite some time, might throw an error in
future releases.
--
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/99f74d76-5db0-1d3e-5773-e47b6d183714%40ojkastl.de.
For more options, visit https://groups.google.com/d/optout.
signature.asc
Description: OpenPGP digital signature