During the YaK weblogic_domain component development phase, I added the Oracle fusion middleware forms & Reports and the Oracle fusion middleware infrastructure for Application development Framework (ADF) deployments to the weblogic_domain component. I encountered an issue that the WebLogic domain was created but it was missing the Metadata Service repository (MDS) connection and thus deploying ADF applications was failing. Even after configuring the WebLogic domain with Java Required Files (JRF), as described in the blog “Using Ansible to install WebLogic 12c R2 (12.2.1) and Fusion Middleware Infrastructure on Oracle Linux 7.1” , the MDS connection was still not configured.

Doing some researches I came to the information that the WebLogic domain templates below are not enough to configure fully such WebLogic Domain:

wls_template=middleware_home + '/wls_server/common/templates/wls/wls.jar';
em_template=middleware_home + '/em/common/templates/wls/oracle.em_wls_template.jar';

The Oracle WSM Policy Manager extension template is required too but needs to be applied properly as there is no automatic domain configuration like using the Forms & Reports domain extension templates.

I found the nice github Oracle Fusion Middleware Infrastructure on Docker project that gave me all information needed for my ansible project. The needed WebLogic Domain extension templates are the following:

1:
  name: 'Oracle JRF - 12.2.1.4'
  location: '/oracle_common/common/templates/wls/oracle.jrf_template.jar'
2:
  name: 'Oracle JRF WS Async - 12.2.1.4'
  location: '/oracle_common/common/templates/wls/oracle.jrf.ws.async_template.jar'
3:
  name: 'Oracle WSM Policy Manager - 12.2.1.4'
  location: '/oracle_common/common/templates/wls/oracle.wsmpm_template.jar'
4:
  name: 'Oracle Enterprise Manager - 12.2.1.4'
  location: '/em/common/templates/wls/oracle.em_wls_template.jar'

Additionally to the standard WebLogic wls template to create the basic WebLogic Domain

/wlserver/common/templates/wls/wls.jar

Note that all those templates are located based on the Oracle Home directory.

But once the right templates are used, the FMW deployments and services needs to be applied to the WebLogic Servers. If not, the following error is raised:

CFGFWK-64254: Error occurred in "Artifacts Generation" phase execution
Encountered error: CFGFWK-64038: The app-svc-name "wsm-pm" must have target.
CFGFWK-64038: The app-svc-name "wsm-pm" must have target.
CFGFWK-64038: Provide a valid target During ConfigMapping

No error is reported for the JRF because the enterprise Manager template automatically configures JRF on the Administration Server but the managed servers will miss JRF.
The application of the FMW deployments and services to the WebLogic Managed Servers is done by using the setServerGroups WLST command. The two JRF-MAN-SVR and WSMPM-MAN-SVR server groups ensure that the Oracle JRF and Oracle Web Services Manager (OWSM) services are targeted to the Managed Servers you are creating.

groups=[ "JRF-MAN-SVR", "WSMPM-MAN-SVR" ]
setServerGroups(server_name,groups)

The ansible role part to create the WebLogic Domain is using two templates. The first one is a shell script using the Repository Creation Utility (RCU) to create the repository and the second one is a python script to create the FMW WebLogic Domain.

CreateRepo.j2 jinja template

SCRIPT=$(readlink -f $0)
SCRIPT_PATH=$(dirname $SCRIPT)

JAVA_HOME={{ pv_java_home }}
export JAVA_HOME

{{ pv_mw_home }}/oracle_common/bin/rcu \
  -silent \
  -createRepository \
  -databaseType ORACLE \
  -connectString {{ pv_weblogic_domain_details.dbserver_name }}:{{ pv_weblogic_domain_details.dbserver_port }}/{{ pv_weblogic_domain_details.dbserver_service }} \
  -dbUser sys \
  -dbRole SYSDBA \
  -schemaPrefix {{ pv_weblogic_domain_details.repository_prefix }} \
  -useSamePasswordForAllSchemaUsers true \
  -component IAU \
  -component IAU_APPEND \
  -component IAU_VIEWER \
  -component OPSS \
  -component STB \
  -component WLS \
  -component MDS \
  -f < {{ pv_domain_config_location }}/passwords.txt

CreateDomain.j2 jinja template (not the complete code but only the interesting parts after the basic domain was created).

# Read the domain
readDomain(domainpath);
print '>>>Domain readed.'
# Apply the FMW extensions templates
{% if pv_fusion_template is defined %}
{% for key,value in pv_fusion_template_list.items() %}
addTemplate('{{ pv_mw_home }}/{{ value.location }}')
{% endfor %}
setOption('AppDir', applicationpath )
{% endif %}
# Create the machines
try:
  for mm in MACHINES.split('|'):
    if mm :
      # create the machine
      m = mm.split(',')
      createNewMachine(m[0],m[1],m[2],m[3],m[4])

except Exception, e:
  print "The machines creation failed, check reason",e
  exit(exitcode=2)
# Create the clusters and assigned managed servers
try:
  for cluster in CLUSTERS.split('|'):
    if cluster :
      found = 0
      for cc in cluster.split(':'):
        if found == 0 :
          clusterName = cc
          createCluster(clusterName)
          found = 1
        else:
          server = cc.split(',')
          createManagedServer(server[0],server[1],server[2],server[3],server[4])
          assignManagedServerToCluster(server[0],clusterName)

except Exception, e:
  print "The clusters creation failed, check reason",e
  exit(exitcode=2)
# Create the standalone managed servers
try:
  for server in SERVERS.split('|'):
    if server :
      serverAttributes = server.split(',')
      createManagedServer(serverAttributes[0],serverAttributes[1],serverAttributes[2],serverAttributes[3],serverAttributes[4])

except Exception, e:
  print "The servers creation failed, check reason",e
  exit(exitcode=2)
# Update the JDBC data sources described set the FMW templates
try:
  configureJDBCDataSource(REPO_DATA_SOURCE_USER_PREFIX, REPO_DATA_SOURCE_URL, REPO_DATA_SOURCE_TEST, DSPassword)
  print '>>>JDBC updated.'
  # Place all Managed Servers in the Server Groups
  groups=[ "JRF-MAN-SVR", "WSMPM-MAN-SVR" ]
  for server in SERVERS.split('|'):
    if server :
      serverAttributes = server.split(',')
      setServerGroups(serverAttributes[0],groups)

  for cluster in CLUSTERS.split('|'):
    if cluster :
      found = 0
      for cc in cluster.split(':'):
        if found == 0 :
          clusterName = cc
          found = 1
        else:
          server = cc.split(',')
          setServerGroups(server[0],groups)
# Create Applications dedicated data sources
{% if pv_weblogic_domain_details.create_JDBC_Connection is defined %}
{% for key,value in pv_weblogic_domain_details.ds_connections.items() %}
try:
  createJDBCDataSource( "{{ value.ds_name }}", JDBC_REPO_DATA_SOURCE_URL, "{{ value.ds_jndi_name }}", "{{ value.ds_schema }}", "{{ value.ds_target }}", JDBC_REPO_DATA_SOURCE_TEST, JDBC_DSPassword)
except Exception, e:
  print "The JDBCDataSource {{ value.ds_name }} creation failed, check reason",e
  exit(exitcode=2)
updateDomain()
{% endfor %}
{% endif %}

Now the extract of the ansible role to create the WebLogic Domain

- name: Execute create repository script
  become: true
  become_user: '{{ pv_oracle_user }}'
  shell: "{{ pv_domain_config_location }}/create_repo.sh"
  when: pv_create_repo_schemas is defined and pv_create_repo_schemas and pv_adminFlag
  register: rcu_results
  failed_when: rcu_results.stdout | regex_search('ERROR') and not( rcu_results.stdout | regex_search('RCU-6016') )
  #ignore_errors: true
  tags:
    - wls-domain-creation
- name: Remove password response file for repository creation
  become: true
  become_user: '{{ pv_oracle_user }}'
  file:
    path: "{{ pv_domain_config_location }}/passwords.txt"
    state: absent
  when: pv_create_repo_schemas is defined and pv_create_repo_schemas
  tags:
    - wls-domain-creation

- name: Execute Create Domain Script
  become: true
  become_user: '{{ pv_oracle_user }}'
  command: "{{ pv_mw_home }}/oracle_common/common/bin/wlst.sh {{ pv_domain_config_location }}/CreateDomain.py {{ pv_domain_name }}"
  environment:
    WLS_ADMIN_USER: '{{ pv_weblogic_domain_details.weblogic_admin }}'
    WLS_ADMIN_PASSWORD: '{{ pv_weblogic_secrets.weblogic_admin_pass }}'
    WLS_NM_USER: '{{ pv_weblogic_domain_details.nm_user }}'
    WLS_NM_PASSWORD: '{{ pv_weblogic_secrets.nodemanager_password }}'
    DS_PASSWORD: "{{ pv_weblogic_secrets.datasource_password | default('') }}"
    JDBC_DS_PASSWORD: "{{ pv_weblogic_secrets.jdbc_datasource_password | default('') }}"
    WEBLOGIC_DOMAIN_DEF_DIR: '{{ pv_domain_config_base }}'
    MW_CONFIG_HOME: '{{ pv_config_base }}'
  args:
    creates: '{{ pv_domains_base }}/{{ pv_domain_name }}/startWebLogic.sh'
  when: pv_adminFlag
  register: createdomain_output
  tags:
    - wls-domain-creation

Now with YaK weblogic_domain component, we are able to deploy WebLogic domains clustered or not, Fusion Middleware Forms & Reports, Fusion Middleware infrastructure for ADF applications to on-premises platforms, or on different platforms on the Cloud (AWS, Azure, OCI). YaK core takes care of the infrastructure and Yak WebLogic_domain component takes care of the WebLogic or Fusion Middleware applications servers.