Remove the double-quotes from
shell:
cmd: |
{{ env_orahome }}/bin/rman << EOF
"{{ script_path_tmp.stdout_lines }}"
EOF
On Tuesday, August 15, 2023 at 1:57:14 PM UTC-4 Luiz Gustavo wrote:
> Hey guys.
>
> I'm passing commands to rman through a variable created by the shell
> module.
>
> Where am I going wrong?
>
> ...
>
> - name: Creates purge script from the original script
> shell: egrep -i 'connect|delete' "{{ script_path }}" | sed
> '/^#/d;/delete/I s/[0-9]\{1,\}/1/'
> register: script_path_tmp
>
> - name: Print var
> debug:
> msg: "{{ script_path_tmp.stdout_lines }}"
>
> - name: Runs RMAN archivelog purge script
> shell:
> cmd: |
> {{ env_orahome }}/bin/rman << EOF
> "{{ script_path_tmp.stdout_lines }}"
> EOF
> environment:
> ORACLE_HOME: "{{ env_orahome }}"
> register: rman_out
>
> # Result of execution:
>
> TASK [Print var]
> ******************************************************************************************************************
> ok: [hostname] => {
> "msg": [
> "CONNECT TARGET \"USER/pass@service as sysbackup\"",
> "DELETE NOPROMPT ARCHIVELOG ALL BACKED UP 1 TIMES TO DEVICE TYPE
> sbt;"
> ]
> }
>
> TASK [Runs RMAN archivelog purge script]
> ***********************************************************************************************
> fatal: [hostname]: FAILED! => {"changed": true, "cmd":
> "/u01/app/oracle/product/19.0.0.0/dbhome_1/bin/rman << EOF\n
> \"[u'CONNECT TARGET \"USER/pass@service as sysbackup\"', u'DELETE NOPROMPT
> ARCHIVELOG ALL BACKED UP 1 TIMES TO DEVICE TYPE sbt;']\"\nEOF\n", "delta":
> "0:00:00.552187", "end": "2023-08-11 10:22:21.657952", "msg": "non-zero
> return code", "rc": 1, "start": "2023-08-11 10:22:21.105765", "stderr": "",
> "stderr_lines": [], "stdout": "\nRecovery Manager: Release 19.0.0.0.0 -
> Production on Fri Aug 11 10:22:21 2023\nVersion 19.16.0.0.0\n\nCopyright
> (c) 1982, 2019, Oracle and/or its affiliates. All rights
> reserved.\n\nRMAN> \nRMAN-00571:
> ===========================================================\nRMAN-00569:
> =============== ERROR MESSAGE STACK FOLLOWS ===============\nRMAN-00571:
> ===========================================================\nRMAN-00558:
> error encountered while parsing input commands\nRMAN-01009: syntax error:
> found \"double-quoted-string\": expecting one of: \"advise, allocate,
> alter, analyze, associate statistics, audit, backup, begin, @, call,
> catalog, change, comment, commit, configure, connect, convert, copy,
> create, create catalog, create global, create or replace global, create or
> replace script, create script, crosscheck, declare, delete, delete from,
> describe, describe catalog, disassociate statistics, drop, drop catalog,
> drop database, duplicate, exit, explain plan, flashback, flashback table,
> grant, grant catalog, grant register, host, import, insert, list, lock,
> merge, mount, noaudit, open, print, purge, quit, recover, register,
> release\"\nRMAN-01007: at line 1 column 3 file: standard input\n\nRMAN>
> \n\nRecovery Manager complete.", "stdout_lines": ["", "Recovery Manager:
> Release 19.0.0.0.0 - Production on Fri Aug 11 10:22:21 2023", "Version
> 19.16.0.0.0", "", "Copyright (c) 1982, 2019, Oracle and/or its affiliates.
> All rights reserved.", "", "RMAN> ", "RMAN-00571:
> ===========================================================", "RMAN-00569:
> =============== ERROR MESSAGE STACK FOLLOWS ===============", "RMAN-00571:
> ===========================================================", "RMAN-00558:
> error encountered while parsing input commands", "RMAN-01009: syntax error:
> found \"double-quoted-string\": expecting one of: \"advise, allocate,
> alter, analyze, associate statistics, audit, backup, begin, @, call,
> catalog, change, comment, commit, configure, connect, convert, copy,
> create, create catalog, create global, create or replace global, create or
> replace script, create script, crosscheck, declare, delete, delete from,
> describe, describe catalog, disassociate statistics, drop, drop catalog,
> drop database, duplicate, exit, explain plan, flashback, flashback table,
> grant, grant catalog, grant register, host, import, insert, list, lock,
> merge, mount, noaudit, open, print, purge, quit, recover, register,
> release\"", "RMAN-01007: at line 1 column 3 file: standard input", "",
> "RMAN> ", "", "Recovery Manager complete."]}
>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/9dce5b91-5a09-48d9-920b-f11bdb36342fn%40googlegroups.com.