There's nothing in the ansible CLI that supports explicitly dumping the
output to a file. You could just use a simple shell redirect.
$ ansible -i inventories/aws -m setup all > host-facts.yaml
It's worth noting that the CLI's output doesn't make a distinction between
failed plays or tasks in terms of shell standard in/standard out, all the
output goes to standard out (unless it's something to do with command line
parsing or something lower-level than play execution).
So for example if I remove a pubkey on a host and run the setup module to
gather facts, all the output goes to STDOUT:
xx.xx.xx.xx | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: [email protected]:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).\r\n",
"unreachable": true
}
yy.yy.yy.yy | SUCCESS => {
"ansible_facts": {
"ansible_all_ipv4_addresses": [
"aa.aa.aa.aa"
],
<snip>
On Wed, 13 Feb 2019 at 16:46, DM <[email protected]> wrote:
> Thanks I do have the "---" at the top
> When I run t he ansible-playbook how do get all that info to write to a
> file?
> It only shows up on the cli which I know I can copy and paste to a file,
> but would like to output to a file
>
> Thanks
>
>
>
> On Wednesday, February 13, 2019 at 8:45:06 AM UTC-5, DM wrote:
>>
>> How do you write to a file the output of a yaml?
>>
>> If possible, how do you only write to a file specific info if?
>>
>> Thanks
>>
>> --
> 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/35a3b1fc-da7b-4f4b-a2be-ebd9bf89c49b%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/35a3b1fc-da7b-4f4b-a2be-ebd9bf89c49b%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
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/CAKtKohTxSeFysALDr%3DjoKRHP_wmiowzB0Kty2oxhoD4%3DDZ%3DOSg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.