Hi All, Using Ansible how to connect Oracle DB on Linux & run command "show pdb" to display oracle pluggable DB, "shutdown immediate" to stop DB and start DB <https://stackoverflow.com/questions/76742454/using-ansible-how-to-connect-oracle-db-on-linux-run-command-show-pdb-to-disp> .
Code: - name: Run show pdbs shell: | {{ oracle_home }}/bin/sqlplus / as sysdba <<EOF show pdbs; exit EOF register: query_output - name: Display query output debug: msg: "{{ query_output.stdout_lines }}" Its getting failed with below error: fatal: [10.192.90.43]: FAILED! => {"changed": true, "cmd": "\"{'stderr_lines': [], u'changed': True, u'end': u'2023-07-22 15:05:49.418929', 'failed': False, u'stdout': u'/u01/app/oracle/product/19.3.0.0/db_1', u'cmd': u\"cat /etc/oratab | egrep -v '^#|^$' | grep -v ASM | cut -d ':' -f2\", u'rc': 0, u'start': u'2023-07-22 15:05:49.413535', u'stderr': u'', u'delta': u'0:00:00.005394', 'stdout_lines': [u'/u01/app/oracle/product/19.3.0.0/db_1']}/bin/sqlplus / as sysdba <<EOF\nshow pdbs;\nexit\nEOF\"\n", "delta": "0:00:00.005358", "end": "2023-07-22 15:05:52.954037", "msg": "non-zero return code", "rc": 1, "start": "2023-07-22 15:05:52.948679", "stderr": "/bin/sh: {'stderr_lines': [], u'changed': True, u'end': u'2023-07-22 15:05:49.418929', 'failed': False, u'stdout': u'/u01/app/oracle/product/19.3.0.0/db_1', u'cmd': ucat: No such file or directory\ncut: fields are numbered from 1\nTry 'cut --help' for more information.", "stderr_lines": ["/bin/sh: {'stderr_lines': [], u'changed': True, u'end': u'2023-07-22 15:05:49.418929', 'failed': False, u'stdout': u'/u01/app/oracle/product/19.3.0.0/db_1', u'cmd': ucat: No such file or directory", "cut: fields are numbered from 1", "Try 'cut --help' for more information."], "stdout": "", "stdout_lines": []} -- You received this message because you are subscribed to the Google Groups "Ansible Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-devel/906cb641-729e-43b1-a734-a67781796bc0n%40googlegroups.com.