Guys i need to store value of commands at remote servers.which i run with
shell module
but the value is not coming up.
it is coming line that
[root@station2 petch2]# cat prepatch.txt
[{"_ansible_parsed": true, "changed": true, "stdout": "Linux
station2.example.com 3.10.0-327.el7.x86_64 #1 SMP Thu Oct 29 17:29:29 EDT
2015 x86_64 x86_64 x86_64 GNU/Linux", "_ansible_item_result": true,
"warnings": [], "delta": "0:00:00.007163", "stdout_lines": ["Linux
station2.example.com 3.10.0-327.el7.x86_64 #1 SMP Thu Oct 29 17:29:29 EDT
2015 x86_64 x86_64 x86_64 GNU/Linux"], "end": "2018-08-27 13:44:59.407023",
"_ansible_no_log": false, "start": "2018-08-27 13:44:59.399860", "cmd":
"uname -a", "item": "uname -a", "stderr": "", "rc": 0, "invocation":
{"module_name": "command", "module_args": {"warn": true, "executable":
null, "_uses_shell": true, "_raw_params": "uname -a", "removes": null,
"creates": null, "chdir": null}}}, {"_ansible_parsed": true, "changed":
true, "stdout": "# Generated by NetworkManager\nsearch localdomain
example.com\nnameserver 192.168.1.2", "_ansible_item_result": true,
"warnings": [], "delta": "0:00:00.008031", "stdout_lines": ["# Generated by
NetworkManager", "search localdomain example.com", "nameserver
192.168.1.2"], "end": "2018-08-27 13:45:00.090280", "_ansible_no_log":
false, "start": "2018-08-27 13:45:00.082249", "cmd": "cat
/etc/resolv.conf", "item": "cat /etc/resolv.conf", "stderr": "", "rc": 0,
"invocation": {"module_name": "command", "module_args": {"warn": true,
"executable": null, "_uses_shell": true, "_raw_params": "cat
/etc/resolv.conf", "removes": null, "creates": null, "chdir":
null}}}][root@station2 petch2]#
On Mon, Aug 27, 2018 at 10:58 PM, Deepak Sharma <[email protected]>
wrote:
> Sort out, it's working now, Thanks Brian for your help.
>
> On Sunday, August 26, 2018 at 2:39:02 AM UTC+5:30, Deepak Sharma wrote:
>>
>> ---
>> - hosts: all
>> gather_facts: true
>> sudo: true
>> tasks:
>>
>> - name: capture linux_os
>> shell: "{{ item }}"
>> register: prepatch
>> with_items:
>> - 'uname -a'
>> - 'cat /etc/resolv.conf'
>> - name: create directory
>> file: path=/tmp/{{petch1}} state=directory
>>
>> - name: create backup
>> copy: {{ prepatch.stdout }} dest=/tmp/{{petch1}}-prepatch.txt
>> ignore_errors: True
>>
>> Unable to send to remote server
>>
> --
> 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 post to this group, send email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/7214cfee-4df2-412b-8b02-9ce13caa884c%40googlegroups.
> com
> <https://groups.google.com/d/msgid/ansible-project/7214cfee-4df2-412b-8b02-9ce13caa884c%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>
--
Regards:
*Deepak*
PaaS Engineering and Operation | OPTUM TECHNOLOGY
Mobile: +91-9811576630 | Noida
*REDUCE - REUSE - RECYCLE*
P
*Save Earth. Think about the Environment before printing this e-mail!!*
--
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CA%2BFVkN5r9abTJ%3Depkof4f3u-a7qpgDAat9mTCpCDQkLaDhNFhQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.