"Next I want to read every line in that local file, connect to only those
hosts specified, and run the script providing the dbname as an argument. "

Sounds like you should perhaps write a dynamic inventory script that
understands this file, *OR* change your playbook1 system to generate
something in ansible inventory format.

However, you should be aware of concurrency issues of interlacing output.
 In general, avoiding dynamic generation of such files and using the
"add_host" module might be easier.




On Wed, Aug 6, 2014 at 1:55 PM, Michael Baydoun <[email protected]>
wrote:

> I have a playbook that runs on all database servers, gathers information
> about every database found, does error checking and eliminated duplicates
> (same db on mulitple servers).  The result is an output file that contains
> three fields for every database "DBNAME SCRIPTNAME HOSTNAME"
>
> Next I want to read every line in that local file, connect to only those
> hosts specified, and run the script providing the dbname as an argument.
>  How can I read that dynamic local file and populated multiple variables
> for additional use?
>
> Example file
> ProdDB script1.sh host1
> DevDB script47.sh host4
>
> I want to do something like this
>
>   - name: retrieve tablespace data
>     shell: /path/{{ scriptname }} {{ dbname }}
>     delegate_to: {{ hostname }}
>     with items from file local.generated where field 1 is dbname, field 2
> is scriptname, and field 3 is hostname
>     register: tablespace_data
>
> whether or not I use delegate_to, or call another playbook with extra
> vars, I still need to populate variables based on their position in a 1-n
> row text file.  Any ideas how I can pull something like that off?
>
> --
> 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/4d72f74d-b895-4805-9594-b41406c559a2%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/4d72f74d-b895-4805-9594-b41406c559a2%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 [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/CA%2BnsWgwhS0xWG-e2mKLJgXc20Zhx7P8%2BKLxe_7SwfFB29Kb7KA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to