ibmi_copy – Copy a save file from local to a remote IBM i node
Synopsis
The
ibmi_copy
copies a save file from local to a remote IBM i node.ibmi_copy
will not restore save file on IBM i node.For non-IBMi native targets, use the copy module instead.
Parameters
- backup
If set force
true
and save file already exists on remote, rename the exists remote save file so you can get the original file back.The backup save file name will be the original file name+number[1:9]. For example, the origial file name is obja, then rename the original file to obja1. If obja1 already exists, then rename the original file to obja2… util obja9, then report error.
Only works when force is
True
.required: falsetype: bool- force
Influence whether the remote save file must always be replaced.
If
yes
, the remote save file will be replaced.If
no
, the save file will only be transferred if the destination does not exist.required: falsetype: bool- lib_name
Remote library where the save file should be copied to.
required: Truetype: str- src
Local path to a save file to copy to the remote server.
This can be absolute or relative.
required: Truetype: str
Examples
- name: Copy test.file on local to a remote IBM i.
ibm.power_ibmi.ibmi_copy:
src: '/backup/test.file'
lib_name: 'testlib'
force: True
backup: True
Notes
Note
ansible.cfg needs to specify interpreter_python=/QOpenSys/pkgs/bin/python3 under[defaults] section
See Also
See also
copy_module
Return Values
- delta
The copy execution delta time when file is renewed.returned: alwaystype: strsample: 0:00:00.307534- stdout
The copy standard output.returned: alwaystype: listsample:"File TEST in library TESTLIB already exists."
- stderr
The copy standard error.returned: alwaystype: listsample:["CPF5813: File TEST in library TESTLIB already exists.", "CPF7302: File TEST not created in library TESTLIB."]- src
Local absolute path to a save file to copy to the remote server.returned: alwaystype: strsample: /backup/test.file- msg
The fetch execution message.returned: alwaystype: strsample: File is successfully copied.- dest
Remote absolute path where the file is copied to.returned: alwaystype: strsample: /QSYS.LIB/TESTLIB.LIB/TEST.FILE- rc
The action return code. 0 means success.returned: alwaystype: intsample: 255- job_log
The IBM i job log of the task executed.returned: alwaystype: listsample:[{"FROM_INSTRUCTION": "149", "FROM_LIBRARY": "QSHELL", "FROM_MODULE": "QZSHRUNC", "FROM_PROCEDURE": "main", "FROM_PROGRAM": "QZSHRUNC", "FROM_USER": "TESTER", "MESSAGE_FILE": "QZSHMSGF", "MESSAGE_ID": "QSH0005", "MESSAGE_LIBRARY": "QSHELL", "MESSAGE_SECOND_LEVEL_TEXT": "", "MESSAGE_SUBTYPE": "", "MESSAGE_TEXT": "Command ended normally with exit status 0.", "MESSAGE_TIMESTAMP": "2020-05-25-13.06.35.019371", "MESSAGE_TYPE": "COMPLETION", "ORDINAL_POSITION": "12", "SEVERITY": "0", "TO_INSTRUCTION": "5829", "TO_LIBRARY": "QXMLSERV", "TO_MODULE": "PLUGILE", "TO_PROCEDURE": "ILECMDEXC", "TO_PROGRAM": "XMLSTOREDP"}]