biemond-orawls icon indicating copy to clipboard operation
biemond-orawls copied to clipboard

using orawls module with stages

Open mal1410 opened this issue 7 years ago • 1 comments

Hi,

We are using the orawls module to manage a simple weblogic infrastructure.

We succeeded installing weblogic and creating a domain using the class orawls::weblogic and the defined type orawls::domain (with wls_setting) resp. in 2 different classes in our manifest. But, for sequencing reasons between our module, we are now introducing stages. When both classes are given the same stage (even if the given stage is main), the installation fails (looks like trying to create the domain first).

When both classes are given a different stage, they are executed properly. If we change the orawls::weblogic definition by its equivalent defined type orawls::weblogic_type it works fine using the same stage.

Do you have some clue about this issue? We want to be sure that our work around is correct before enforcing our design.

here a snippet of our init.pp:

class {'prof_weblogic::install_weblogic': stage => mw, } -> class {'prof_weblogic::create_weblogic_domain': stage => mw, }

here a snippet of our prof_weblogic::install_weblogic:

orawls::weblogic_type{'base':

        version              => hiera('prof_weblogic::wls_version'),
        filename             => hiera('prof_weblogic::wls_filename'),
        jdk_home_dir         => hiera('prof_weblogic::wls_jdk_home_dir'),
        oracle_base_home_dir => hiera('prof_weblogic::wls_oracle_base_home_dir'),
        middleware_home_dir  => hiera('prof_weblogic::wls_middleware_home_dir'),
        weblogic_home_dir    => hiera('prof_weblogic::wls_weblogic_home_dir'),
        os_user              => $prof_weblogic::os_constants::oracle_user,
        os_group             => $prof_weblogic::os_constants::dba_group,
        download_dir         => hiera('prof_weblogic::download_dir'),
        source               => hiera('prof_weblogic::software_installation_source_path'),
        log_output           => hiera('prof_weblogic::wls_log_output'),
        remote_file          => $prof_weblogic::weblogic_common_constants::remote_file,
        wls_domains_dir      => hiera('prof_weblogic::wls_domains_dir'),
        wls_apps_dir         => hiera('prof_weblogic::wls_apps_dir'),
        fmw_infra            => $prof_weblogic::weblogic_common_constants::fmw_infra,
        temp_directory       => hiera('prof_weblogic::temp_directory'),
        java_parameters      => '',
    }

    # This does not work
    # class { 'orawls::weblogic':
    #     # stage                => mw,
    #     version              => hiera('prof_weblogic::wls_version'),
    #     filename             => hiera('prof_weblogic::wls_filename'),
    #     jdk_home_dir         => hiera('prof_weblogic::wls_jdk_home_dir'),
    #     oracle_base_home_dir => hiera('prof_weblogic::wls_oracle_base_home_dir'),
    #     middleware_home_dir  => hiera('prof_weblogic::wls_middleware_home_dir'),
    #     weblogic_home_dir    => hiera('prof_weblogic::wls_weblogic_home_dir'),
    #     os_user              => $prof_weblogic::os_constants::oracle_user,
    #     os_group             => $prof_weblogic::os_constants::dba_group,
    #     download_dir         => hiera('prof_weblogic::download_dir'),
    #     source               => hiera('prof_weblogic::software_installation_source_path'),
    #     log_output           => hiera('prof_weblogic::wls_log_output'),
    #     remote_file          => $prof_weblogic::weblogic_common_constants::remote_file,
    #     wls_domains_dir      => hiera('prof_weblogic::wls_domains_dir'),
    #     wls_apps_dir         => hiera('prof_weblogic::wls_apps_dir'),
    #     fmw_infra            => $prof_weblogic::weblogic_common_constants::fmw_infra,
    #     temp_directory       => hiera('prof_weblogic::temp_directory'),
    # }

here a snippet of our prof_weblogic::create_weblogic_domain:

 wls_setting { "${domain_name}":
    debug_module                 => hiera('prof_weblogic::wls_debug_module'),
    custom_trust                 => hiera('prof_weblogic::wls_custom_trust'),
    user                         => $prof_weblogic::os_constants::oracle_user,
    weblogic_home_dir            => hiera('prof_weblogic::wls_weblogic_home_dir'),
    connect_url                  => "t3://${::fqdn}:${adminserver_port}",
    weblogic_user                => hiera('prof_weblogic::wls_weblogic_user'),
    weblogic_password            => hiera('prof_weblogic::wls_weblogic_user_pwd'),
    use_default_value_when_empty => false,
  }

  orawls::domain { "${domain_name}":
    version                     => hiera('prof_weblogic::wls_version'),
    weblogic_home_dir           => hiera('prof_weblogic::wls_weblogic_home_dir'),
    middleware_home_dir         => hiera('prof_weblogic::wls_middleware_home_dir'),
    jdk_home_dir                => hiera('prof_weblogic::wls_jdk_home_dir'),
    domain_template             => $prof_weblogic::weblogic_common_constants::wls_template,
    domain_name                 => $domain_name,
    development_mode            => hiera('prof_weblogic::wls_develoment_mode'),
    adminserver_name            => hiera('prof_weblogic::wls_admin_server_name'),
    adminserver_address         => $::fqdn,
    adminserver_port            => $adminserver_port,
    nodemanager_secure_listener => hiera('prof_weblogic::wls_nodemanager_secure_listener'),
    nodemanager_port            => hiera('prof_weblogic::wls_nodemanager_port'),
    nodemanager_address         => $::fqdn,
    # java_arguments              => hiera('wls_nodemanager_java_arguments'),
    weblogic_user               => hiera('prof_weblogic::wls_weblogic_user'),
    weblogic_password           => hiera('prof_weblogic::wls_weblogic_user_pwd'),
    os_user                     => $prof_weblogic::os_constants::oracle_user,
    os_group                    => $prof_weblogic::os_constants::dba_group,
    log_dir                     => hiera('prof_weblogic::wls_log_dir'),
    download_dir                => hiera('prof_weblogic::download_dir'),
    log_output                  => hiera('prof_weblogic::wls_log_output'),
    wls_domains_dir             => hiera('prof_weblogic::wls_domains_dir'),
    wls_apps_dir                => hiera('prof_weblogic::wls_apps_dir'),
    require                     => Wls_setting["${domain_name}"],
  }

Thanks in advance, Regards

mal1410 avatar Sep 08 '16 07:09 mal1410

Hi,

Puppet ordering can very strange and tricky. I don't have a clue what it can be but using weblogic define instead of the class is fine. the class is just a thin wrapper which calls the define

from the Doc, it doesn't look it will work in all situations.

Limitations and known issues https://docs.puppet.com/puppet/latest/reference/lang_run_stages.html

In order to assign a class to a stage, you must use the resource-like class declaration syntax and supply the stage explicitly. You cannot assign classes to stages with the include function, or by relying on automatic parameter lookup from hiera while using resource-like class declarations.

You cannot subscribe to or notify resources across a stage boundary.

Classes that contain other classes (with either the contain function or the anchor pattern) can sometimes behave badly if declared with a run stage — if the contained class is only declared by its container, it will work fine, but if it is also declared anywhere outside its container, it will often create a dependency cycle that will prevent the involved classes from being applied.

Due to these limitations, stages should only be used with the simplest of classes, and only when absolutely necessary. Mass dependencies like package repositories are effectively the only valid use case.

biemond avatar Sep 08 '16 09:09 biemond