Re: [ansible-project] update /etc/cron.allow on multiple nodes diff values

2017-01-24 Thread Johannes Kastl
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


[ansible-project] update /etc/cron.allow on multiple nodes diff values

2017-01-24 Thread Kiran Kumar
hello all

i need to update  /etc/cron.allow  on many servers

below is eg

x oracle
y db
x prod
...
..




===

it works for a single node 

- 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: 'oracle'


==

how can i do it for huge number of nodes ?

-- 
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/75fa68be-2a33-4ebb-8e74-c983e320c8ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.