I stand corrected, it does seem you can use with_subelements with a 
dictionary.  The following (on ansible 1.8-devel) will loop through all the 
installation_files

- hosts: localhost
  vars: 
    oracle_app_directory: /app
    oracle_db_homes:
      DB1:
        path: "{{ oracle_app_directory }}/oracle/product/12.1.0/dbhome_1"
        installation_files_directory: /share/oracle/12.1.0/patches
        installation_files:
        - linuxamd64_12c_database_1of2.zip
        - linuxamd64_12c_database_2of2.zip
        unpack_directory: /share/oracle/12.1.0/unpacked
      DB2:
        path: "{{ oracle_app_directory }}/oracle/product/11.2.0/dbhome_1"
        installation_files_directory: /share/oracle/11.2.0/patches
        installation_files:
        - linuxamd64_11g_database_1of2.zip
        - linuxamd64_11g_database_2of2.zip
        unpack_directory: /share/oracle/11.2.0/unpacked
  tasks:
  - debug: msg=" {{ item.1 }}"
    with_subelements:
    - oracle_db_homes
    - installation_files

ansible-playbook -i hosts test.yml |grep msg
TASK: [debug msg=" {{ item.1 }}"] 
*********************************************
    "msg": " linuxamd64_12c_database_1of2.zip"
    "msg": " linuxamd64_12c_database_2of2.zip"
    "msg": " linuxamd64_11g_database_1of2.zip"
    "msg": " linuxamd64_11g_database_2of2.zip"




On Wednesday, November 19, 2014 11:28:34 AM UTC-5, Thomas Krahn wrote:
>
> Hi James
>
> thanks a lot for you help. My first problem is solved :-).
>
> Let me try to explain why i think i need the "dbhome_1" and "dbhome_2". If 
> one of you guys has a solution for this also than my migration to Ansible 
> can go one.
>
> Second Problem:
>
> I have several databases on one host so i wanted to define another 
> variable like this:
>
> oracle_databases:
>   DB1:
>     dbhome: dbhome_1
>     ... some other stuff...
>   DB2:
>     dbhome: dbhome_1
>   DB3:
>     dbhome: dbhome_2
>
> So my idea (like i do it in Puppet) is to use the value of 
> *oracle_database.dbhome* to reference to *oracle_db_home[dbhome].path*.
>
> Any idea?
>

-- 
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/a5f25adc-a4fa-4534-b210-3b4736ca0020%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to