Deploying ADF application1.2.2.1.4.0 in Glassfish 4.1 - oracle-adf
I have Deployed oracle jdeveloper 1.2.2.1.4.0 in glassfish server 4.1,But when i inter username and password for login page ,just get refreshed ,but in log file i see the login is correct and i see the print message after login .my problem is i can't move between pages.
same problem but no answer: Deploying ADF application in Glassfish 4
this is from logs:
[2021-11-23T07:53:56.616+0200] [glassfish 4.1] [WARNING] [] [oracle.adf.share.config.ADFConfigFactory] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646836616] [levelValue: 900] [[
Resource META-INF/adf-config.xml not found on the classpath.]]
[2021-11-23T07:53:56.616+0200] [glassfish 4.1] [WARNING] [] [oracle.adf.share.config.ADFConfigFactory] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646836616] [levelValue: 900] [[
A default implementation of ADFConfig is being created for application. This can lead to unexpected results in some cases. Please add a basic META-INF/adf-config.xml to your classpath to avoid functional errors.]]
[2021-11-23T07:53:56.616+0200] [glassfish 4.1] [INFO] [] [oracle.adf.share.ADFContext.applicationScope] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646836616] [levelValue: 800] [[
adding applicationScope with key oracle.adf.share.config.FallbackConfigImpl#284b32fc]]
[2021-11-23T07:53:56.820+0200] [glassfish 4.1] [INFO] [] [oracle.adfinternal.controller.state.ControllerState] [tid: _ThreadID=27 _ThreadName=http-listener-1(2)] [timeMillis: 1637646836820] [levelValue: 800] [[
ADFc: Limiting the number of RootViewPorts to 20]]
[2021-11-23T07:54:06.044+0200] [glassfish 4.1] [WARNING] [] [oracle.adfinternal.view.rich.marshal.DefaultMarshalingService] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646846044] [levelValue: 900] [[
ADF_FACES-60142:ParserConfigurationException was thrown. The feature 'http://xml.org/sax/features/external-general-entities' is probably not supported by your XML processor.]]
[2021-11-23T07:54:06.044+0200] [glassfish 4.1] [WARNING] [] [oracle.adfinternal.view.rich.marshal.DefaultMarshalingService] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646846044] [levelValue: 900] [[
ADF_FACES-60142:ParserConfigurationException was thrown. The feature 'http://apache.org/xml/features/disallow-doctype-decl' is probably not supported by your XML processor.]]
[2021-11-23T07:54:06.044+0200] [glassfish 4.1] [WARNING] [] [oracle.adfinternal.view.rich.marshal.DefaultMarshalingService] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646846044] [levelValue: 900] [[
ADF_FACES-60142:ParserConfigurationException was thrown. The feature 'http://xml.org/sax/features/external-parameter-entities' is probably not supported by your XML processor.]]
[2021-11-23T07:54:06.044+0200] [glassfish 4.1] [WARNING] [] [oracle.adfinternal.view.rich.marshal.DefaultMarshalingService] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646846044] [levelValue: 900] [[
ADF_FACES-60142:ParserConfigurationException was thrown. The feature 'http://apache.org/xml/features/nonvalidating/load-external-dtd' is probably not supported by your XML processor.]]
[2021-11-23T07:54:07.403+0200] [glassfish 4.1] [WARNING] [] [oracle.adf.share.security] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847403] [levelValue: 900] [[
ADF Credential Store is not supported on this platform. Using the ADFNoCredentialSupportStore instead.]]
[2021-11-23T07:54:07.403+0200] [glassfish 4.1] [WARNING] [] [oracle.adf.share.security] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847403] [levelValue: 900] [[
ADF Credential Store is not supported on this platform. Using the ADFNoCredentialSupportStore instead.]]
[2021-11-23T07:54:07.731+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847731] [levelValue: 800] [[
loadImportedJpx - entering for jpx: model.Model]]
[2021-11-23T07:54:07.778+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847778] [levelValue: 800] [[
Loaded field type 'URI' -> 'oracle.adfinternal.model.businesseditor.fieldTypes.URI' from 'oracle.adf.businesseditor.model.Model.jpx']]
[2021-11-23T07:54:07.778+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847778] [levelValue: 800] [[
Loaded field type 'Phone' -> 'oracle.adfinternal.model.businesseditor.fieldTypes.Phone' from 'oracle.adf.businesseditor.model.Model.jpx']]
[2021-11-23T07:54:07.778+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847778] [levelValue: 800] [[
Loaded field type 'Email' -> 'oracle.adfinternal.model.businesseditor.fieldTypes.Email' from 'oracle.adf.businesseditor.model.Model.jpx']]
[2021-11-23T07:54:07.778+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847778] [levelValue: 800] [[
loadImportedJpx - found jpx: oracle.adf.businesseditor.model.Model.jpx]]
[2021-11-23T07:54:07.778+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847778] [levelValue: 800] [[
loadImportedJpx - found jpx: oracle.adfinternal.model.businesseditor.adfmBusinessEditorModel.jpx]]
[2021-11-23T07:54:07.778+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847778] [levelValue: 800] [[
loadImportedJpx - this jpx added: model.Model.jpx]]
[2021-11-23T07:54:07.794+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847794] [levelValue: 800] [[
registerJpxes - jpxList 0: oracle.adf.businesseditor.model.Model]]
[2021-11-23T07:54:07.794+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847794] [levelValue: 800] [[
registerJpxes - jpxList 1: oracle.adfinternal.model.businesseditor.adfmBusinessEditorModel]]
[2021-11-23T07:54:07.794+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847794] [levelValue: 800] [[
registerJpxes - jpxList 2: model.Model]]
[2021-11-23T07:54:07.794+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847794] [levelValue: 800] [[
registerJpxes - jpxList 3: oracle.jbo.syscat.SysCat]]
[2021-11-23T07:54:07.794+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847794] [levelValue: 800] [[
getMergedJpx - mainJpxName: null, not found]]
[2021-11-23T07:54:07.794+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847794] [levelValue: 800] [[
getMergedJpx - merged jpx is merged CP jpx]]
[2021-11-23T07:54:07.794+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847794] [levelValue: 800] [[
getMergedJpx - merged cpx]]
[2021-11-23T07:54:07.794+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847794] [levelValue: 800] [[
Jpx FullName: __JPX_Merged__]]
[2021-11-23T07:54:07.794+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847794] [levelValue: 800] [[
Jpx mSubstitutes: 16]]
[2021-11-23T07:54:07.794+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847794] [levelValue: 800] [[
Jpx mDiscrCatalog: 9]]
[2021-11-23T07:54:07.794+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847794] [levelValue: 800] [[
Jpx mFieldTypes: 3]]
[2021-11-23T07:54:07.794+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847794] [levelValue: 800] [[
registerSubstitutes - old: oracle.jbo.syscat.SysCatEOEntityDef->oracle.adf.businesseditor.syscatext.entities.EntityObjectDefinition]]
[2021-11-23T07:54:07.794+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847794] [levelValue: 800] [[
registerSubstitutes - old: oracle.jbo.syscat.SysCatOperationDef->oracle.adf.businesseditor.syscatext.views.OperationDefinition]]
[2021-11-23T07:54:07.794+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847794] [levelValue: 800] [[
registerSubstitutes - old: oracle.jbo.syscat.SysCatEditableViewDef->oracle.adf.businesseditor.syscatext.views.PublishedViewObjectDefinition]]
[2021-11-23T07:54:07.794+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847794] [levelValue: 800] [[
registerSubstitutes - old: oracle.jbo.syscat.SysCatPDefViewObject->oracle.adf.businesseditor.syscatext.views.ViewObjectExtension]]
[2021-11-23T07:54:07.794+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847794] [levelValue: 800] [[
registerSubstitutes - old: oracle.jbo.syscat.SysCatViewLinkDef->oracle.adf.businesseditor.syscatext.views.ViewLinkDefinition]]
[2021-11-23T07:54:07.794+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847794] [levelValue: 800] [[
registerSubstitutes - old: oracle.jbo.syscat.SysCatEOAttributeDef->oracle.adf.businesseditor.syscatext.entities.AttributeDefinition]]
[2021-11-23T07:54:07.810+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847810] [levelValue: 800] [[
registerSubstitutes - old: oracle.jbo.syscat.SysCatPDefEntityObject->oracle.adf.businesseditor.syscatext.views.EntityObjectExtension]]
[2021-11-23T07:54:07.810+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847810] [levelValue: 800] [[
registerSubstitutes - old: oracle.jbo.syscat.SysCatViewDef->oracle.adf.businesseditor.syscatext.views.ViewObjectDefinition]]
[2021-11-23T07:54:07.810+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847810] [levelValue: 800] [[
registerSubstitutes - old: oracle.jbo.syscat.SysCatEOPDefEntityObject->oracle.adf.businesseditor.syscatext.entities.EntityObjectExtension]]
[2021-11-23T07:54:07.810+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847810] [levelValue: 800] [[
registerSubstitutes - old: oracle.jbo.syscat.SysCatEOViewLinkDef->oracle.adf.businesseditor.syscatext.entities.ViewLinkDefinition]]
[2021-11-23T07:54:07.810+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847810] [levelValue: 800] [[
registerSubstitutes - old: oracle.jbo.syscat.SysCatEntityDef->oracle.adf.businesseditor.syscatext.views.EntityObjectDefinition]]
[2021-11-23T07:54:07.810+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847810] [levelValue: 800] [[
registerSubstitutes - old: oracle.jbo.syscat.SysCatEntityAssoc->oracle.adf.businesseditor.syscatext.views.EntityAssociation]]
[2021-11-23T07:54:07.810+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847810] [levelValue: 800] [[
registerSubstitutes - old: oracle.jbo.syscat.SysCatEOPDefViewObject->oracle.adf.businesseditor.syscatext.entities.ViewObjectExtension]]
[2021-11-23T07:54:07.810+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847810] [levelValue: 800] [[
registerSubstitutes - old: oracle.jbo.syscat.SysCatAttributeDef->oracle.adf.businesseditor.syscatext.views.AttributeDefinition]]
[2021-11-23T07:54:07.810+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847810] [levelValue: 800] [[
registerSubstitutes - old: oracle.jbo.syscat.SysCatEOViewDef->oracle.adf.businesseditor.syscatext.entities.ViewObjectDefinition]]
[2021-11-23T07:54:07.810+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.Jpx] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646847810] [levelValue: 800] [[
registerSubstitutes - old: oracle.jbo.syscat.SysCatEOEntityAssoc->oracle.adf.businesseditor.syscatext.entities.EntityAssociation]]
[2021-11-23T07:54:08.138+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.customizations.def] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646848138] [levelValue: 800] [[
oracle.jbo.convert.pdefs not set]]
[2021-11-23T07:54:08.138+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.customizations.def] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646848138] [levelValue: 800] [[
DefinitionManager.mConvertPDefs = 0]]
[2021-11-23T07:54:09.997+0200] [glassfish 4.1] [INFO] [] [AssocDefLogger] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646849997] [levelValue: 800] [[
Assoc accessor added, accessorName = Spares]]
[2021-11-23T07:54:10.169+0200] [glassfish 4.1] [INFO] [] [AssocDefLogger] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646850169] [levelValue: 800] [[
Assoc accessor added, accessorName = Maintenance]]
[2021-11-23T07:54:11.325+0200] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.dol] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646851325] [levelValue: 800] [[
visiting unvisited references]]
[2021-11-23T07:54:13.138+0200] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=28 _ThreadName=Thread-8] [timeMillis: 1637646853138] [levelValue: 800] [[
hellllllo=APPSYSnullnullnullnull]]
[2021-11-23T07:54:13.153+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.ViewCriteria] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646853153] [levelValue: 800] [[
Invalid operator used for VCItem Username in VC __DefaultViewCriteria__]]
[2021-11-23T07:54:13.169+0200] [glassfish 4.1] [INFO] [] [oracle.adf.model.log.ViewCriteria] [tid: _ThreadID=28 _ThreadName=http-listener-1(3)] [timeMillis: 1637646853169] [levelValue: 800] [[
Invalid operator used for VCItem Password in VC __DefaultViewCriteria__]]
I changed JSF from version 2.2 to 2.1 and it works well
Related
Get specific parts of the output in Ansible
I need to get only specific parts of the output from Ansible, but it is giving me the whole information. I've tried using filtering unsuccessfully. This is the playbook I am testing with (it has a loop and is probably what is throwing me off) - name: PLAYBOOK -> Testing hosts: esxi gather_facts: no vars_files: - vars.yml vars: vmnic: - vmnic0 - vmnic1 tasks: - name: Get NIC driver/firmware details - shell shell: esxcli network nic get -n {{ item }} | grep -e Driver -e Firmware -e Version -e Name loop: "{{ vmnic }}" register: nic_details - name: Output NIC driver/firmware details debug: var=item.stdout_lines loop: "{{ nic_details['results'] }}" This is the output I get for one host, I only need the last bit i.e. Driver Info, Driver, Firmware Version, Version and `Name of each VMNIC. ok: [srv-pocte02.test.local] => (item={'changed': True, 'end': '2022-05-19 15:50:50.326514', 'stdout': ' Driver Info: \n Driver: igbn\n Firmware Version: 1.61.0:0x8000090e\n Version: 1.4.1\n Name: vmnic0', 'cmd': 'esxcli network nic get -n vmnic0 | grep -e Driver -e Firmware -e Version -e Name', 'stderr': '', 'start': '2022-05-19 15:50:49.515808', 'invocation': {'module_args': {'stdin_add_newline': True, 'argv': None, 'stdin': None, 'removes': None, 'creates': None, 'warn': False, '_uses_shell': True, 'executable': None, 'chdir': None, 'strip_empty_ends': True, '_raw_params': 'esxcli network nic get -n vmnic0 | grep -e Driver -e Firmware -e Version -e Name'}}, 'rc': 0, 'msg': '', 'delta': '0:00:00.810706', 'stdout_lines': [' Driver Info: ', ' Driver: igbn', ' Firmware Version: 1.61.0:0x8000090e', ' Version: 1.4.1', ' Name: vmnic0'], 'stderr_lines': [], 'failed': False, 'item': 'vmnic0', 'ansible_loop_var': 'item'}) => { "ansible_loop_var": "item", "item": { "ansible_loop_var": "item", "changed": true, "cmd": "esxcli network nic get -n vmnic0 | grep -e Driver -e Firmware -e Version -e Name", "delta": "0:00:00.810706", "end": "2022-05-19 15:50:50.326514", "failed": false, "invocation": { "module_args": { "_raw_params": "esxcli network nic get -n vmnic0 | grep -e Driver -e Firmware -e Version -e Name", "_uses_shell": true, "argv": null, "chdir": null, "creates": null, "executable": null, "removes": null, "stdin": null, "stdin_add_newline": true, "strip_empty_ends": true, "warn": false } }, "item": "vmnic0", "msg": "", "rc": 0, "start": "2022-05-19 15:50:49.515808", "stderr": "", "stderr_lines": [], "stdout": " Driver Info: \n Driver: igbn\n Firmware Version: 1.61.0:0x8000090e\n Version: 1.4.1\n Name: vmnic0", "stdout_lines": [ " Driver Info: ", " Driver: igbn", " Firmware Version: 1.61.0:0x8000090e", " Version: 1.4.1", " Name: vmnic0" ] }, "item.stdout_lines": [ " Driver Info: ", " Driver: igbn", " Firmware Version: 1.61.0:0x8000090e", " Version: 1.4.1", " Name: vmnic0" ] } ok: [srv-pocte02.test.local] => (item={'start': '2022-05-19 15:50:50.867894', 'msg': '', 'cmd': 'esxcli network nic get -n vmnic1 | grep -e Driver -e Firmware -e Version -e Name', 'rc': 0, 'invocation': {'module_args': {'stdin_add_newline': True, 'stdin': None, 'removes': None, 'strip_empty_ends': True, '_uses_shell': True, 'creates': None, 'warn': False, 'chdir': None, 'executable': None, '_raw_params': 'esxcli network nic get -n vmnic1 | grep -e Driver -e Firmware -e Version -e Name', 'argv': None}}, 'changed': True, 'stderr': '', 'end': '2022-05-19 15:50:51.706813', 'stdout': ' Driver Info: \n Driver: igbn\n Firmware Version: 1.61.0:0x8000090e\n Version: 1.4.1\n Name: vmnic1', 'delta': '0:00:00.838919', 'stdout_lines': [' Driver Info: ', ' Driver: igbn', ' Firmware Version: 1.61.0:0x8000090e', ' Version: 1.4.1', ' Name: vmnic1'], 'stderr_lines': [], 'failed': False, 'item': 'vmnic1', 'ansible_loop_var': 'item'}) => { "ansible_loop_var": "item", "item": { "ansible_loop_var": "item", "changed": true, "cmd": "esxcli network nic get -n vmnic1 | grep -e Driver -e Firmware -e Version -e Name", "delta": "0:00:00.838919", "end": "2022-05-19 15:50:51.706813", "failed": false, "invocation": { "module_args": { "_raw_params": "esxcli network nic get -n vmnic1 | grep -e Driver -e Firmware -e Version -e Name", "_uses_shell": true, "argv": null, "chdir": null, "creates": null, "executable": null, "removes": null, "stdin": null, "stdin_add_newline": true, "strip_empty_ends": true, "warn": false } }, "item": "vmnic1", "msg": "", "rc": 0, "start": "2022-05-19 15:50:50.867894", "stderr": "", "stderr_lines": [], "stdout": " Driver Info: \n Driver: igbn\n Firmware Version: 1.61.0:0x8000090e\n Version: 1.4.1\n Name: vmnic1", "stdout_lines": [ " Driver Info: ", " Driver: igbn", " Firmware Version: 1.61.0:0x8000090e", " Version: 1.4.1", " Name: vmnic1" ] }, "item.stdout_lines": [ " Driver Info: ", " Driver: igbn", " Firmware Version: 1.61.0:0x8000090e", " Version: 1.4.1", " Name: vmnic1" ] }
You can use the map filter to extract one field of a list of dictionaries. It can also be used to map one filter to each items of the list, for example, a from_yaml that could help you have dictionaries out of the string you get in stdout. Given the task: - debug: var: nic_details.results | map(attribute="stdout") | map('from_yaml') This would result in: nic_details.results | map(attribute="stdout") | map('from_yaml'): - Driver Info: Driver: igbn Firmware Version: 1.61.0:0x8000090e Version: 1.4.1 Name: vmnic0 - Driver Info: Driver: igbn Firmware Version: 1.61.0:0x8000090e Version: 1.4.1 Name: vmnic1
Ansible loop within a loop
I'm really struggling to get my head around loops within Ansible when it comes to wanting more than one loop in a task. Right now I'm writing a task to create some registry entries within Ansible and have the following which does work, - name: Windows SSL/TLS Configuration ansible.windows.win_regedit: path: HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\{{ item.type }} name: '{{ item.property }}' data: '{{ item.value }}' type: dword state: present loop: - type: Server property: Enabled value: 0 - type: Server property: DisabledByDefault value: 1 - type: Client property: Enabled value: 0 - type: Client property: DisabledByDefault value: 1 However what I want to do is replace "SSL 3.0" with something like "{{ item.protocol }}" and be able to have it replaced with "SSL 2.0", "SSL 3.0" and "TLS 1.0", then creating the same entries within each of those. I'd have liked to do them all within the same task, rather than having to run the exact same task 3 times with just one difference in the path. Is what I want to do even possible?
Use loop_control to set loop_var. Otherwise the inner and outer loop use the same loop variable, which does not work. See the documentation: Defining inner and outer variable names with loop_var The documentation explains, that you have to put the inner loop into a different file in order to include it with include_tasks. If you do not want that, you can add the protocols to each item in order to use with_subelements. Example: - hosts: localhost connection: local vars: protocols: - "SSL 2.0" - "SSL 3.0" - "TLS 1.0" keys: - type: Server property: Enabled value: 0 protocols: "{{ protocols }}" - type: Server property: DisabledByDefault value: 1 protocols: "{{ protocols }}" - type: Client property: Enabled value: 0 protocols: "{{ protocols }}" - type: Client property: DisabledByDefault value: 1 protocols: "{{ protocols }}" tasks: - debug: msg="{{item.0.type}} {{item.0.property}} {{item.0.value}} {{item.1}}" with_subelements: - "{{ keys }}" - protocols This will generate 12 keys: $ ansible-playbook example.yaml [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' PLAY [localhost] ********************************************************************************************** TASK [Gathering Facts] **************************************************************************************** ok: [localhost] TASK [debug] ************************************************************************************************** ok: [localhost] => (item=[{'type': 'Server', 'property': 'Enabled', 'value': 0}, 'SSL 2.0']) => { "msg": "Server Enabled 0 SSL 2.0" } ok: [localhost] => (item=[{'type': 'Server', 'property': 'Enabled', 'value': 0}, 'SSL 3.0']) => { "msg": "Server Enabled 0 SSL 3.0" } ok: [localhost] => (item=[{'type': 'Server', 'property': 'Enabled', 'value': 0}, 'TLS 1.0']) => { "msg": "Server Enabled 0 TLS 1.0" } ok: [localhost] => (item=[{'type': 'Server', 'property': 'DisabledByDefault', 'value': 1}, 'SSL 2.0']) => { "msg": "Server DisabledByDefault 1 SSL 2.0" } ok: [localhost] => (item=[{'type': 'Server', 'property': 'DisabledByDefault', 'value': 1}, 'SSL 3.0']) => { "msg": "Server DisabledByDefault 1 SSL 3.0" } ok: [localhost] => (item=[{'type': 'Server', 'property': 'DisabledByDefault', 'value': 1}, 'TLS 1.0']) => { "msg": "Server DisabledByDefault 1 TLS 1.0" } ok: [localhost] => (item=[{'type': 'Client', 'property': 'Enabled', 'value': 0}, 'SSL 2.0']) => { "msg": "Client Enabled 0 SSL 2.0" } ok: [localhost] => (item=[{'type': 'Client', 'property': 'Enabled', 'value': 0}, 'SSL 3.0']) => { "msg": "Client Enabled 0 SSL 3.0" } ok: [localhost] => (item=[{'type': 'Client', 'property': 'Enabled', 'value': 0}, 'TLS 1.0']) => { "msg": "Client Enabled 0 TLS 1.0" } ok: [localhost] => (item=[{'type': 'Client', 'property': 'DisabledByDefault', 'value': 1}, 'SSL 2.0']) => { "msg": "Client DisabledByDefault 1 SSL 2.0" } ok: [localhost] => (item=[{'type': 'Client', 'property': 'DisabledByDefault', 'value': 1}, 'SSL 3.0']) => { "msg": "Client DisabledByDefault 1 SSL 3.0" } ok: [localhost] => (item=[{'type': 'Client', 'property': 'DisabledByDefault', 'value': 1}, 'TLS 1.0']) => { "msg": "Client DisabledByDefault 1 TLS 1.0" } PLAY RECAP **************************************************************************************************** localhost : ok=2 changed=0 unreachable=0 failed=0
Ansible nested loop over hostvars
I am trying to loop over all of the hosts that I've in the host_vars folder and get their corresponding interfaces, the interfaces var itself is a list. problem: I can access the host_vars and get the desired data, except that the interface variable is a list and I want to loop over it. What it looks like: Loop through host_vars Get the first host on the list Loop over the interfaces Repeat To simplify things I am using debug in my example: - name: TEST_101 debug: var: hostvars[item]['interfaces'][X]['name'] loop: "{{ groups['all'] }}" X: is the corresponding interface index The following are two of the host_vars files. core_01 --- ansible_host: 192.168.1.202 site: XX-DC role: CORE model: CSR1000v interfaces: - name: vlan 1 description: "EDGE_RTR IF" ipv4: 192.168.100.3/24 state: merged enabled: true - name: vlan 100 description: "IT IF" ipv4: 172.31.1.1/24 state: merged enabled: true core_02 --- ansible_host: 192.168.12.210 interfaces: - name: ethernet 0/0 description: "ISP_01 IF PRIMARY" #The discription on the interface ipv4: 10.0.0.2/24 state: merged enabled: true - name: ethernet 0/1 description: "CORE_SW IF PRIMARY" #The discription on the interface ipv4: 192.168.100.1/24 state: merged enabled: true The output when the script is run: PLAY [Populate NetBox DataBase] ************************************************************************************************************************************************************ TASK [build_netbox_db : Create interface within Netbox with only required information] ***************************************************************************************************** ok: [localhost] => (item=edge_01) => { "ansible_loop_var": "item", "hostvars[item]['interfaces'][0]['name']": "ethernet 0/0", "item": "edge_01" } ok: [localhost] => (item=edge_02) => { "ansible_loop_var": "item", "hostvars[item]['interfaces'][0]['name']": "ethernet 0/0", "item": "edge_02" } ok: [localhost] => (item=csr1k_01) => { "ansible_loop_var": "item", "hostvars[item]['interfaces'][0]['name']": "ethernet 0/0", "item": "csr1k_01" } ok: [localhost] => (item=core_01) => { "ansible_loop_var": "item", "hostvars[item]['interfaces'][0]['name']": "vlan 1", "item": "core_01" } PLAY RECAP ********************************************************************************************************************************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 X is replaced with an index number. In a sense, I want to loop twice, once over the host, then over the interfaces of that particular host.
As soon as you delegate the task back to your local, then you don't need to loop on the groups['all'] anymore, and you can let Ansible do the normal process of targeting all the hosts defined in the hosts directive. Then, you just have to loop on the interfaces variable of all hosts. Given the playbook: - hosts: core_01,core_02 ## I am limiting myslef to two hosts here, ## but `all` would do just fine if you want to target all ## hosts in your inventory gather_facts: no tasks: - debug: msg: "{{ item.name }}" loop: "{{ interfaces }}" delegate_to: 127.0.0.1 loop_control: label: "{{ item.name }}" This will yield the recap: PLAY [core_01,core_02] ******************************************************************************************** TASK [debug] ****************************************************************************************************** ok: [core_01] => (item=vlan 1) => msg: vlan 1 ok: [core_01] => (item=vlan 100) => msg: vlan 100 ok: [core_02] => (item=ethernet 0/0) => msg: ethernet 0/0 ok: [core_02] => (item=ethernet 0/1) => msg: ethernet 0/1 PLAY RECAP ******************************************************************************************************** core_01 : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 core_02 : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
How to loop over inventory_hostname in Ansible
I'm trying to add all the hosts of the dynamic inventory to the group: reachable. Here is my playbook. $ cat collect_try.yaml --- - hosts: "{{ env }}:&{{ zone }}" become: true tasks: - add_host: name: "{{ inventory_hostname }}" group: reachable - name: dynamicgroup hosts: reachable gather_facts: false tasks: - debug: msg="{{ inventory_hostname }} is reachable" Here is my output: TASK [Gathering Facts] ok: [vm1.nodekite.com] ok: [vm2.nodekite.com] ok: [vm3.nodekite.com] ok: [vm4.nodekite.com] TASK [add_host] changed: [vm1.nodekite.com] => { "add_host": { "groups": [ "reachable" ], "host_name": "vm1.nodekite.com", "host_vars": { "group": "reachable" } }, "changed": true } PLAY [dynamicgroup] META: ran handlers TASK [debug] ok: [vm1.nodekite.com] => { "msg": "vm1.nodekite.com is reachable" PLAY RECAP: vm1.nodekite.com : ok=3 changed=1 unreachable=0 <===== vm2.nodekite.com : ok=1 changed=0 unreachable=0 vm3.nodekite.com : ok=1 changed=0 unreachable=0 vm4.nodekite.com : ok=1 changed=0 unreachable=0 How to use loops to add all the hosts to the "group": "reachable". could someone please assist.
From add_host documentation notes: This module bypasses the play host loop and only runs once for all the hosts in the play, if you need it to iterate use a with-loop construct. In your specific case (i.e. dynamic host pattern in your play), you should be able to achieve your requirements using the inventory_hostnames lookup, e.g (not fully tested): - name: Collect reachable hosts hosts: localhost gather_facts: false tasks: - name: Push hosts to "reachable" group vars: pattern: "{{ env }}:&{{ zone }}" add_host: name: "{{ item }}" group: reachable loop: "{{ query('inventory_hostnames', pattern) }}"
Is there any way to get output of top 5 servers only among all hosts in ansible-playbook
I'm having an issue ansible condition and loops: I would like to get the output of top 5 servers only but the following playbook giving the output of all hosts instead of 2 hosts. --- - name: hosts: all tasks: - name: command: hostname -i register: out - set_fact: my_ip = "{{out.stdout_lines}}" with_items: [1,2] when: item <= 2 output: TASK [set_fact] ********************************************************************************************************************************************* task path: /home/ec2-user/ansible/mm.yml:9 ok: [s1] => (item=1) => {"ansible_facts": {"_raw_params": "my_ip = \"[u'172.31.45.164']\""}, "ansible_loop_var": "item", "changed": false, "item": 1} ok: [s1] => (item=2) => {"ansible_facts": {"_raw_params": "my_ip = \"[u'172.31.45.164']\""}, "ansible_loop_var": "item", "changed": false, "item": 2} ok: [ansible] => (item=1) => {"ansible_facts": {"_raw_params": "my_ip = \"[u'172.31.39.107']\""}, "ansible_loop_var": "item", "changed": false, "item": 1} ok: [ansible] => (item=2) => {"ansible_facts": {"_raw_params": "my_ip = \"[u'172.31.39.107']\""}, "ansible_loop_var": "item", "changed": false, "item": 2} ok: [s2] => (item=1) => {"ansible_facts": {"_raw_params": "my_ip = \"[u'172.31.37.172']\""}, "ansible_loop_var": "item", "changed": false, "item": 1} ok: [s2] => (item=2) => {"ansible_facts": {"_raw_params": "my_ip = \"[u'172.31.37.172']\""}, "ansible_loop_var": "item", "changed": false, "item": 2}
I think you may not fully understand how Ansible works. When your play starts with this: - hosts: all This means that Ansible will run the tasks in your play on each of the hosts in your inventory. So if you have, say, five hosts in your inventory, then you're running these tasks... - name: command: hostname -i register: out - set_fact: my_ip = "{{out.stdout_lines}}" with_items: [1,2] when: item <= 2 ...five times (so that second task will actually execute 10 times...five hosts, and for each a host a loop with two items). Furthermore, it's not clear what you're trying to accomplish with that second task. Given your loop (with_items: [1,2]), your conditional (when: item <= 2) will always be true, so it's not serving any purpose. And you're not use the value of item in the task. If you want the hostnames of the first two hosts in your inventory, you could write: - hosts: all[0:1] gather_facts: false tasks: - command: echo {{ inventory_hostname }} register: out - debug: msg: "{{ out.stdout }}" This would run those two tasks on the first two hosts in your inventory. Given an inventory that look like this: host1 ansible_host=localhost host2 ansible_host=localhost host3 ansible_host=localhost host4 ansible_host=localhost The above playboook would produce: PLAY [all[0:1]] ****************************************************************************** TASK [command] ******************************************************************************* changed: [host1] changed: [host2] TASK [debug] ********************************************************************************* ok: [host1] => { "msg": "host1" } ok: [host2] => { "msg": "host2" } PLAY RECAP *********************************************************************************** host1 : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 host2 : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0