Thanks for your answer, it opens my sight but I still do not copy content
to file on disk. I tried copy module again but it did not work. My playbook
and output are below.
---
- name: cp file
hosts: all
tasks:
- name: copying a file
slurp: #win_copy:
src: c:\test\b.txt #win_copy: #win_copy:
register: test #dest: /tmp # src: c:\test\a.txt
- name: dosya ici
debug:
msg: "{{ test['content'] | b64decode }}"
- local_action:
module: copy
content: "{{ test['content'] | b64decode }}"
dest: /tmp/ba.txt
/////////// debug output /////////////
{
"msg": "adfasdf", // contains of my file
"changed": false,
"_ansible_verbose_always": true,
"_ansible_no_log": false
}
//////////////// local_action output //////////////////////////
{
"changed": true,
"uid": 998,
"_ansible_delegated_vars": {
"ansible_host": "localhost"
},
"dest": "/tmp/ba.txt",
"owner": "awx",
"diff": [],
"size": 7,
"src":
"/var/lib/awx/.ansible/tmp/ansible-tmp-1624704662.69-19-50577674979617/source",
"group": "awx",
"_ansible_no_log": false,
"checksum": "f88f94f974393a32cedc172ea3f7f4affb82f4c2",
"md5sum": "b4206b74b7563ec684336f054582605b",
"state": "file",
"gid": 995,
"secontext": "system_u:object_r:tmp_t:s0",
"mode": "0644",
"invocation": {
"module_args": {
"directory_mode": null,
"force": true,
"remote_src": null,
"dest": "/tmp/ba.txt",
"selevel": null,
"_original_basename": "tmpl88RWo",
"delimiter": null,
"regexp": null,
"owner": null,
"follow": false,
"validate": null,
"local_follow": null,
"src":
"/var/lib/awx/.ansible/tmp/ansible-tmp-1624704662.69-19-50577674979617/source",
"group": null,
"unsafe_writes": null,
"checksum": "f88f94f974393a32cedc172ea3f7f4affb82f4c2",
"seuser": null,
"serole": null,
"content": null,
"setype": null,
"mode": null,
"attributes": null,
"backup": false
}
}
}
26 Haziran 2021 Cumartesi tarihinde saat 00:05:24 UTC+3 itibarıyla
[email protected] şunları yazdı:
>
> https://docs.ansible.com/ansible/latest/collections/ansible/builtin/slurp_module.html
>
> Get Outlook for iOS <https://aka.ms/o0ukef>
> ------------------------------
> *From:* Wei-Yen Tan <[email protected]>
> *Sent:* Saturday, June 26, 2021 9:02:14 AM
> *To:* [email protected] <[email protected]>
>
> *Subject:* Re: [ansible-project] How to copy a file from windows to linux
> That's not using the slurp module
>
> Get Outlook for iOS <https://aka.ms/o0ukef>
> ------------------------------
> *From:* [email protected] <[email protected]> on
> behalf of bulent senguler <[email protected]>
> *Sent:* Saturday, June 26, 2021 8:57:56 AM
> *To:* Ansible Project <[email protected]>
> *Subject:* Re: [ansible-project] How to copy a file from windows to linux
>
> - name: copy file from windows to tower
> copy_win:
> src : c:\tmp\b.txt
> dest: /tmp
> remote_src: yes
>
>
> output :
>
> {
> "src": "c:\\test\\b.txt",
> "_ansible_no_log": false,
> "dest": "/tmp",
> "checksum": "f88f94f974393a32cedc172ea3f7f4affb82f4c2",
> "changed": true,
> "original_basename": "b.txt",
> "operation": "file_copy",
> "size": 7
> }
>
> the job finished successfuly, the file does not exist in tmp directory
>
> 25 Haziran 2021 Cuma tarihinde saat 23:28:52 UTC+3 itibarıyla
> [email protected] şunları yazdı:
>
> What do yoy mean. Is it doing the same thing? Can you please share play
> book and task?
>
> Get Outlook for iOS <https://aka.ms/o0ukef>
> ------------------------------
> *From:* [email protected] <[email protected]> on
> behalf of bulent senguler <[email protected]>
> *Sent:* Saturday, June 26, 2021 8:25:00 AM
> *To:* Ansible Project <[email protected]>
> *Subject:* Re: [ansible-project] How to copy a file from windows to linux
>
> Actually, as a same result.
>
> 25 Haziran 2021 Cuma tarihinde saat 22:42:56 UTC+3 itibarıyla
> [email protected] şunları yazdı:
>
> Slurp to ansible controller then copy to linux
>
> Get Outlook for iOS <https://aka.ms/o0ukef>
> ------------------------------
> *From:* [email protected] <[email protected]> on
> behalf of bulent senguler <[email protected]>
> *Sent:* Saturday, June 26, 2021 7:41:26 AM
> *To:* Ansible Project <[email protected]>
> *Subject:* [ansible-project] How to copy a file from windows to linux
>
> Hi all,
> I want to copy a file from windows to linux but I cannot do that. I trıed
> win_copy module and remote_src=yes and job was success but the file did not
> exist on target machine. Where I am wrong. Thanks for helps.
>
> --
> 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/b724b3ea-8f0c-4a73-8f91-94530808a8ean%40googlegroups.com
>
> <https://groups.google.com/d/msgid/ansible-project/b724b3ea-8f0c-4a73-8f91-94530808a8ean%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> --
> 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/525a5a48-d588-4409-9c84-29a2b0d61695n%40googlegroups.com
>
> <https://groups.google.com/d/msgid/ansible-project/525a5a48-d588-4409-9c84-29a2b0d61695n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> --
> 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/a38d46e1-5581-4f49-94dc-5d0dae4c9e87n%40googlegroups.com
>
> <https://groups.google.com/d/msgid/ansible-project/a38d46e1-5581-4f49-94dc-5d0dae4c9e87n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
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/8884775c-59fd-4777-aaa4-dac55f9a5a07n%40googlegroups.com.