Complex Hiera Structure need help

19 views
Skip to first unread message

ggun

unread,
Aug 23, 2017, 11:49:30 AM8/23/17
to Puppet Developers
Hi Experts,
I need some help in using the complex hiera designed here.
Current puppet version is - 4.7

Use case:
Below is the hiera data

was_data:
  was_default_data:
    hs3sourcepath: 'websphere'
    hwsgroupgid: '405'
    hmwuserid: '404'
    hmwusergrpid: '405'  
    hdaresponse_file: 'xx'
    hibmagentpath: 'xxx'
    hbase_dir: &hbase_dir 'xx'
    hinstance_name: &hinstance_name 'WebSphere'
    prereq_packages:
      - 'xorg-x11-apps'
      - 'xorg-x11-utils' 
    hdmgr_servername: 'xxx'
  was_dmgr_data:
    esa-group-service:
      use_dmgr_profile: 'no'
      pptdmgrsrvsptpath: '/opt/was/ResponseFiles/ESG_DMGR_Creation.txt'
      hdmgr_profile: ESGTSTDMGR01
      hdmgr_cell: ESGTSTCELL01
      hcluster_name: ESGTSTCLUSTER
      hpptdmgrsrvport: xxx
      manage_jdbc_provider: 
        hscope: 'cluster'
        hdbtype: 'Oracle'
        hprovidertype: 'Oracle JDBC Driver'
        himplementation: 'Connection pool data source'
        hclasspath: '/opt/was/oracle/ojdbc6.jar'
   esa-user-profile-service:   
        use_dmgr_profile: 'yes'
        pptdmgrsrvsptpath: '/opt/was/ResponseFiles/ESG_DMGR_Creation.txt'
        hdmgr_profile: ESGTSTDMGR01
        hdmgr_cell: ESGTSTCELL01
        hcluster_name: EUPSTSTCLUSTER
        hpptdmgrsrvport: xxx

Now I iterate through the was_dmgr_data as given below

   if ! empty($was_dmgr_data) {
      $was_dmgr_data.map |$wasdatakey,$wasdatavalue| {
        glic_websphere::glic_dmgr::manage_dmgr { "DMGR Management for ${wasdatakey}":
          *              => $wasdatavalue,
          base_dir       => $hbase_dir,
          instance_name  => $hinstance_name,
          wasdatakey     => $wasdatakey,       
        }      
      }      
    } 

Now if you see I have added additional has to the hash  as 'manage_jdbc_provider' and will be adding one more hash 'manage_jdbc_datasource'

I need to iterate to one more type if the 'manage_jdbc_provider' hash is present. I created a type as shown below 


   if ! empty($was_dmgr_data) {
      $was_dmgr_data.map |$wasdatakey,$wasdatavalue| {
        glic_websphere::glic_dmgr::manage_dmgr { "DMGR Management for ${wasdatakey}":
          *              => $wasdatavalue,
          base_dir       => $hbase_dir,
          instance_name  => $hinstance_name,
          wasdatakey     => $wasdatakey,       
        }      
        if has_key($wasdatavalue, 'manage_jdbc_provider') {
        glic_websphere::glic_dmgr::manage_jdbc_provider {"JDBC Management for ${wasdatakey}":
            *              => $wasdatavalue,
            base_dir       => $hbase_dir,
            instance_name  => $hinstance_name,
            
          }
        }
      }      
    } 

But the problem here I need to have all the input parameters also define in manage_jdbc_provider that are in 'esa-group-service' . How can I pass only specific and require hash data or string data to the type. The hash name such as 'esa-group-service' or 'esa-user-profile-service'  is dynamic .
Reply all
Reply to author
Forward
0 new messages