Working with YaK core, we created a YaK component to deploy WebLogic Domains, Fusion Middleware Forms & Reports and Fusion Middleware ADF infrastructure. The idea is to be able to deploy such kind of infrastructure in different Clouds or on-Premise without any line change at component level. During the development phase I run in an issue I never saw before. The ansible automatic deployment of a Fusion Middleware Forms & Reports infrastructure failed during the WebLogic domain creation with the following error:

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

Load properties file
/u01/app/weblogic/admin/etc//fr-domain/domain.properties
>>>Domain template loaded: /u01/app/weblogic/12c/Middleware/wlserver/common/templates/wls/wls.jar
SAVE DOMAIN
>>>Domain updated.
READ DOMAIN
>>>Domain readed.
Error: runCmd() failed. Do dumpStack() to see details.
Problem invoking WLST - Traceback (innermost last):
  File "/u01/app/weblogic/admin/etc/fr-domain/CreateDomain.py", line 191, in ?
  File "/tmp/WLSTOfflineIni7805615143527482407.py", line 143, in updateDomain
  File "/tmp/WLSTOfflineIni7805615143527482407.py", line 19, in command
64254: Error occurred in "OPSS Processing" phase execution
64254: Encountered error: SecurityContext:
 Domain Name: fr-domain
 JDBC URL: opss-audit-DBDS:jdbc:oracle:thin:@//vm08.it.dbi-services.com:1521/MD
 JDBC URL: opss-data-source:jdbc:oracle:thin:@//vm08.it.dbi-services.com:1521/MD
 JNDI Name: opss-audit-DBDS:jdbc/AuditAppendDataSource
 JNDI Name: opss-data-source:jdbc/OpssDataSource
 Driver Name: opss-audit-DBDS:oracle.jdbc.OracleDriver
 Driver Name: opss-data-source:oracle.jdbc.OracleDriver
 Persistence Type: DATABASE
 Platform: WLS
 Scratch Dir: scratch
 Reconfig Domain: false
 Shared Secret Store: null
 Extension: true
 DisableManagementOperations: falseJDBC Properties:
user:vm12FR_IAU_APPEND
username:vm12FR_IAU_APPENDJDBC Properties:
user:vm12FR_OPSS
username:vm12FR_OPSS
64254: Check log for more detail.
null
        at com.oracle.cie.domain.script.jython.CommandExceptionHandler.handleException(CommandExceptionHandler.java:69)
        at com.oracle.cie.domain.script.jython.WLScriptContext.handleException(WLScriptContext.java:3085)
        at com.oracle.cie.domain.script.jython.WLScriptContext.runCmd(WLScriptContext.java:738)
        at sun.reflect.GeneratedMethodAccessor146.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)

com.oracle.cie.domain.script.jython.WLSTException: com.oracle.cie.domain.script.jython.WLSTException: Error updating domain:
64254: Error occurred in "OPSS Processing" phase execution
64254: Encountered error: SecurityContext:
 Domain Name: fr-domain
 JDBC URL: opss-audit-DBDS:jdbc:oracle:thin:@//vm08.it.dbi-services.com:1521/MD
 JDBC URL: opss-data-source:jdbc:oracle:thin:@//vm08.it.dbi-services.com:1521/MD
 JNDI Name: opss-audit-DBDS:jdbc/AuditAppendDataSource
 JNDI Name: opss-data-source:jdbc/OpssDataSource
 Driver Name: opss-audit-DBDS:oracle.jdbc.OracleDriver
 Driver Name: opss-data-source:oracle.jdbc.OracleDriver
 Persistence Type: DATABASE
 Platform: WLS
 Scratch Dir: scratch
 Reconfig Domain: false
 Shared Secret Store: null
 Extension: true
 DisableManagementOperations: falseJDBC Properties:
user:vm12FR_IAU_APPEND
username:vm12FR_IAU_APPENDJDBC Properties:
user:vm12FR_OPSS
username:vm12FR_OPSS
64254: Check log for more detail.
null

The following WLST command was called in ansible to create the WebLogic domain

 /u01/app/weblogic/12c/Middleware/oracle_common/common/bin/wlst.sh CreateDomain.py fr-domain

The issue is that a first run of the ansible code created partially the WebLogic Domain and registered it to the OPSS layer. The only solution is to drop the repository created and the WebLogic domain files and start again the deployment.
To create and drop the Fusion Middleware repository, the Repository Creation utility is used in silent mode. The following template is used in ansible and the resulting script is called to drop the Fusion Middleware repository from the database.

#!/bin/bash
SCRIPT=$(readlink -f $0)
SCRIPT_PATH=$(dirname $SCRIPT)

JAVA_HOME={{ pv_java_home }}
export JAVA_HOME

{{ pv_mw_home }}/oracle_common/bin/rcu \
  -silent \
  -dropRepository \
  -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 }} \
  -component IAU \
  -component IAU_APPEND \
  -component IAU_VIEWER \
  -component OPSS \
  -component STB \
  -component MDS \
  -f < {{ pv_domain_config_location }}/passwords.txt

The ansible command line to delete the repository using the YaK core is shown below:

ansible-playbook components/weblogic_domain/playbooks/linux/deploy_fr.yml -t fmw-repository-deletion -e target=aws_dbi_test/srv-rhel8-wls/FMW_FR

We have the same kind of template for the Fusion Middleware repository creation. Once the Fusion Middleware Repository has been dropped, the new ansible deployment with Fusion Middleware domain creation worked without any issue.

ansible-playbook components/weblogic_domain/playbooks/linux/deploy_fr.yml -t all -e target=aws_dbi_test/srv-rhel8-wls/FMW_FR