Thank you again Brian, for all your help.

As I've stated in the explanation of the problem, I've declared groups in 
the host file. It's a group of one, but still a group.
I solved this in the following way:

1. get the value 

  - name: get audit file dest from database
    action: "shell export ORACLE_SID={{ oracle_sid }}; export 
ORACLE_HOME={{ oracle_home }}; printf \"set head off\nselect value from 
v\\$parameter where name = 'audit_file_dest';\" | $ORACLE_HOME/bin/sqlplus 
-S / as sysdba | grep -v ^$"
    when: primary
    register: audit_file_dest

2. set the registered variable as fact

  - name: register audit file dest
    set_fact: audit_file_dest="{{ audit_file_dest.stdout }}"
    when: primary

3. call the fact from another host via the group name and (mandatory, as 
far as I can see) host group number:

  - name: create audit file dest on standby
    file: path={{ hostvars[groups['primary'][0]]['audit_file_dest'] }} 
state=directory
    when: standby

Cheers,
Frits


On Wednesday, December 24, 2014 3:21:53 PM UTC+1, Brian Coca wrote:
>
> you can access the data from other nodes through hostvars: 
>
> hostvars[<hostname>][<varname>] 
>
> On Wed, Dec 24, 2014 at 9:14 AM, Frits Hoogland 
> <[email protected] <javascript:>> wrote: 
> > Thank you Brian! 
> > 
> > Can you help me a bit with that? 
> > 
> > Please mind I created a group of one called 'primary' and a group of one 
> > called 'standby' in the hosts file, not sure if that can be used. 
> > I used that to have specific per node variables declared. 
> > 
> > It would really help in this specific case to have a value/status 
> obtained 
> > on one node to configure the other or others. How is that normally done 
> with 
> > Ansible? 
> > 
> > Cheers, 
> > Frits 
> > 
> > 
> > On Wednesday, December 24, 2014 3:04:36 PM UTC+1, Brian Coca wrote: 
> >> 
> >> register stays on the host and gets reset in the loop to reflect the 
> >> task was skipped, you might want to use a subsequent set_fact and then 
> >> access the variable thourgh hostvars[<primary_host_name>]. 
> >> 
> >> -- 
> >> Brian Coca 
> > 
> > -- 
> > 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 [email protected] <javascript:>. 
> > To post to this group, send email to [email protected] 
> <javascript:>. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/ansible-project/b83afdb7-fa71-4d82-84d5-07f99beaed87%40googlegroups.com.
>  
>
> > 
> > For more options, visit https://groups.google.com/d/optout. 
>
>
>
> -- 
> Brian Coca 
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2d7a9c7f-52cf-4ff0-93a5-11a85706c0e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to