<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Ansible Logging Outout in Code Exchange</title>
    <link>https://community.cisco.com/t5/code-exchange/ansible-logging-outout/m-p/4921228#M10</link>
    <description>&lt;P&gt;Hi, the log_path directive is correct. See this basic example:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;ansible.cfg&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;[defaults]
log_path=./ansible.log&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;playbook (test.yml)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;- name: test logging
  hosts: localhost
  gather_facts: false
  tasks:
    - name: a test debug message
      ansible.builtin.debug:
        msg: "This is a debug ouput"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this will create a log file &lt;EM&gt;ansible.log&lt;/EM&gt; with the following content:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;maercu@CHLT303344:~/dev/tmp$ cat ansible.log 
2023-09-11 07:58:11,656 p=699 u=maercu n=ansible | [WARNING]: No inventory was parsed, only implicit localhost is available

2023-09-11 07:58:11,660 p=699 u=maercu n=ansible | [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

2023-09-11 07:58:11,765 p=699 u=maercu n=ansible | PLAY [test logging] ***************************************************************************************************************************************
2023-09-11 07:58:11,776 p=699 u=maercu n=ansible | TASK [a test debug message] *******************************************************************************************************************************
2023-09-11 07:58:11,789 p=699 u=maercu n=ansible | ok: [localhost] =&amp;gt; {
    "msg": "This is a debug ouput"
}
2023-09-11 07:58:11,796 p=699 u=maercu n=ansible | PLAY RECAP ************************************************************************************************************************************************
2023-09-11 07:58:11,796 p=699 u=maercu n=ansible | localhost                  : ok=1    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 11 Sep 2023 06:04:08 GMT</pubDate>
    <dc:creator>Marcel Zehnder</dc:creator>
    <dc:date>2023-09-11T06:04:08Z</dc:date>
    <item>
      <title>Ansible Logging Outout</title>
      <link>https://community.cisco.com/t5/code-exchange/ansible-logging-outout/m-p/4921168#M9</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;To my understanding, the output will be printed on the screen.&lt;/P&gt;&lt;P&gt;I would like save it under a log file.&lt;/P&gt;&lt;P&gt;I tried to add it to&amp;nbsp;ansible.cfg file, but still I am not able to see the log file:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;[default]&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;#some basic default values...&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;nocows=true&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;#log_path=/etc/ansible/logs/ansible_log.txt&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;log_path=./ansible_log.txt&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;callbacks_enabled=ansible.posix.profile_tasks&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;stdout_callback=ansible.posix.json&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;EM&gt;inventory &amp;nbsp; &amp;nbsp; &amp;nbsp;= $HOME/.ansible/hosts&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;remote_tmp &amp;nbsp; &amp;nbsp; = $HOME/.ansible/tmp&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;forks &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= 150&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;sudo_user &amp;nbsp; &amp;nbsp; &amp;nbsp;= root&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;transport &amp;nbsp; &amp;nbsp; &amp;nbsp;= smart&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;EM&gt;:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;host_key_checking = False&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;#&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Netmart&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2023 04:00:21 GMT</pubDate>
      <guid>https://community.cisco.com/t5/code-exchange/ansible-logging-outout/m-p/4921168#M9</guid>
      <dc:creator>Netmart</dc:creator>
      <dc:date>2023-09-11T04:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: Ansible Logging Outout</title>
      <link>https://community.cisco.com/t5/code-exchange/ansible-logging-outout/m-p/4921228#M10</link>
      <description>&lt;P&gt;Hi, the log_path directive is correct. See this basic example:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;ansible.cfg&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;[defaults]
log_path=./ansible.log&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;playbook (test.yml)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;- name: test logging
  hosts: localhost
  gather_facts: false
  tasks:
    - name: a test debug message
      ansible.builtin.debug:
        msg: "This is a debug ouput"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this will create a log file &lt;EM&gt;ansible.log&lt;/EM&gt; with the following content:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;maercu@CHLT303344:~/dev/tmp$ cat ansible.log 
2023-09-11 07:58:11,656 p=699 u=maercu n=ansible | [WARNING]: No inventory was parsed, only implicit localhost is available

2023-09-11 07:58:11,660 p=699 u=maercu n=ansible | [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

2023-09-11 07:58:11,765 p=699 u=maercu n=ansible | PLAY [test logging] ***************************************************************************************************************************************
2023-09-11 07:58:11,776 p=699 u=maercu n=ansible | TASK [a test debug message] *******************************************************************************************************************************
2023-09-11 07:58:11,789 p=699 u=maercu n=ansible | ok: [localhost] =&amp;gt; {
    "msg": "This is a debug ouput"
}
2023-09-11 07:58:11,796 p=699 u=maercu n=ansible | PLAY RECAP ************************************************************************************************************************************************
2023-09-11 07:58:11,796 p=699 u=maercu n=ansible | localhost                  : ok=1    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2023 06:04:08 GMT</pubDate>
      <guid>https://community.cisco.com/t5/code-exchange/ansible-logging-outout/m-p/4921228#M10</guid>
      <dc:creator>Marcel Zehnder</dc:creator>
      <dc:date>2023-09-11T06:04:08Z</dc:date>
    </item>
    <item>
      <title>Re: Ansible Logging Outout</title>
      <link>https://community.cisco.com/t5/code-exchange/ansible-logging-outout/m-p/4922205#M13</link>
      <description>&lt;P&gt;Thank you Marcel.&lt;/P&gt;&lt;P&gt;I tried and got the following in the logs:&lt;/P&gt;&lt;P&gt;$ &lt;STRONG&gt;cat ansible.log &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;2023-09-11 07:58:11,656 p=699 u=cisco n=ansible | [WARNING]: No inventory was parsed, only implicit localhost is available&lt;/P&gt;&lt;P&gt;2023-09-11 07:58:11,660 p=699 u=cisco n=ansible | [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'&lt;/P&gt;&lt;P&gt;2023-09-11 07:58:11,765 p=699 u=cisco n=ansible | PLAY [test logging] ***************************************************************************************************************************************&lt;/P&gt;&lt;P&gt;2023-09-11 07:58:11,776 p=699 u=cisco n=ansible | TASK [a test debug message] *******************************************************************************************************************************&lt;/P&gt;&lt;P&gt;2023-09-11 07:58:11,789 p=699 u=cisco n=ansible | ok: [localhost] =&amp;gt; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "msg": "This is a debug ouput"&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;2023-09-11 07:58:11,796 p=699 u=cisco n=ansible | PLAY RECAP ************************************************************************************************************************************************&lt;/P&gt;&lt;P&gt;2023-09-11 07:58:11,796 p=699 u=cisco n=ansible | localhost&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : ok=1&amp;nbsp;&amp;nbsp;&amp;nbsp; changed=0&amp;nbsp;&amp;nbsp;&amp;nbsp; unreachable=0&amp;nbsp;&amp;nbsp;&amp;nbsp; failed=0&amp;nbsp;&amp;nbsp;&amp;nbsp; skipped=0&amp;nbsp;&amp;nbsp;&amp;nbsp; rescued=0&amp;nbsp;&amp;nbsp;&amp;nbsp; ignored=0&lt;/P&gt;&lt;P&gt;My goal was to capture the show output of the following runbook. So not sure, if this does require a different type of logging:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;site.yml&lt;/STRONG&gt;&lt;STRONG&gt; file&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;---&lt;/P&gt;&lt;P&gt;- name: Test Ansible ios_command on Cisco IOS XE&lt;/P&gt;&lt;P&gt;&amp;nbsp; hosts: iosxe&lt;/P&gt;&lt;P&gt;&amp;nbsp; tasks:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - name: show version and ip interface brief&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ios_command:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; commands:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - show version&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - show ip interface brief&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would appreciate any advice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Netmart&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 17:26:24 GMT</pubDate>
      <guid>https://community.cisco.com/t5/code-exchange/ansible-logging-outout/m-p/4922205#M13</guid>
      <dc:creator>Netmart</dc:creator>
      <dc:date>2023-09-12T17:26:24Z</dc:date>
    </item>
    <item>
      <title>Re: Ansible Logging Outout</title>
      <link>https://community.cisco.com/t5/code-exchange/ansible-logging-outout/m-p/4922215#M15</link>
      <description>&lt;P&gt;In that case you need to register and print (debug) the result of your task - something like that:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;- name: Test Ansible ios_command on Cisco IOS XE
  hosts: iosxe
  tasks:
     - name: show version and ip interface brief
        ios_command:
          commands:
              - show version
              - show ip interface brief
        register: output 

     - name: print result
        debug:
          var: output.stdout&lt;/LI-CODE&gt;
&lt;P&gt;Doing so, you should see the output on screen as well as in your log file.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 17:38:01 GMT</pubDate>
      <guid>https://community.cisco.com/t5/code-exchange/ansible-logging-outout/m-p/4922215#M15</guid>
      <dc:creator>Marcel Zehnder</dc:creator>
      <dc:date>2023-09-12T17:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: Ansible Logging Outout</title>
      <link>https://community.cisco.com/t5/code-exchange/ansible-logging-outout/m-p/4925377#M17</link>
      <description>&lt;P&gt;Thank you Marcel.&lt;/P&gt;&lt;P&gt;Yes, it does print output on screen plus append it to ansible.log file&lt;/P&gt;&lt;P&gt;Is it possible to save the output as separated file as txt, yaml, or even json.&lt;/P&gt;&lt;P&gt;Also, when I tried to run "show license feature", it seems that the loaded ansible collect is not support it.&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;tasks&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;- &lt;/SPAN&gt;&lt;SPAN&gt;name&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;show license feature&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;ios_command&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;commands&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; - &lt;/SPAN&gt;&lt;SPAN&gt;show license feature&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;*fatal: [10.254.199.199]: FAILED! =&amp;gt; {"ansible_facts": {}, "changed": false, "failed_modules": {"ansible.legacy.ios_facts": {"failed": true, "invocation": {"module_args": {"available_network_resources": false, "gather_network_resources": null, "gather_subset": ["min"]}}, "msg": "ssh connection failed: Failed to authenticate public key: Socket error: disconnected"}}, "msg": "The following modules failed to execute: ansible.legacy.ios_facts\n"}&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2023 01:18:10 GMT</pubDate>
      <guid>https://community.cisco.com/t5/code-exchange/ansible-logging-outout/m-p/4925377#M17</guid>
      <dc:creator>Netmart</dc:creator>
      <dc:date>2023-09-19T01:18:10Z</dc:date>
    </item>
    <item>
      <title>Re: Ansible Logging Outout</title>
      <link>https://community.cisco.com/t5/code-exchange/ansible-logging-outout/m-p/4925510#M18</link>
      <description>&lt;P&gt;The error you receive is because of the host key checking (&lt;A href="https://docs.ansible.com/ansible/2.8/user_guide/intro_getting_started.html#host-key-checking)," target="_blank" rel="noopener"&gt;https://docs.ansible.com/ansible/2.8/user_guide/intro_getting_started.html#host-key-checking),&lt;/A&gt;&amp;nbsp;to disable it, disable host key checking in your ansible.cfg:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;[defaults]
log_path=./ansible.log
host_key_checking = False&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To collect json parsed output, I usually use the cli_parse module (&lt;A href="https://docs.ansible.com/ansible/latest/collections/ansible/utils/cli_parse_module.html)" target="_blank" rel="noopener"&gt;https://docs.ansible.com/ansible/latest/collections/ansible/utils/cli_parse_module.html)&lt;/A&gt;&amp;nbsp;with pyats/genie, to use it you may need to install the collection + libary:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;ansible-galaxy collection install ansible.utils
pip install pyats&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once done you can use it, here is an example:&lt;BR /&gt;&lt;STRONG&gt;inentory&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;all:
  hosts:
    sandbox-iosxe-latest-1.cisco.com:
  vars:
    ansible_user: admin
    ansible_password: C1sco12345
    ansible_network_os: cisco.ios.ios
    ansible_connection: ansible.netcommon.network_cli&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;playbook&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;- name: Log outputs to file
  hosts: sandbox-iosxe-latest-1.cisco.com
  gather_facts: false
  tasks:

    ### GET AND SAVE TXT OUTPUT #########################
    - name: Run command
      cisco.ios.ios_command:
        commands: 
          - show license usage
      register: output 

    - name: Print result as txt
      debug:
        var: output.stdout[0]

    - name: Save result as txt to file hostname_output.txt
      ansible.builtin.copy:
        content: "{{output.stdout[0]}}"
        dest: "{{inventory_hostname}}_output.txt"


    ### GET AND SAVE JSON OUTPUT ########################
    - name: Run command and parse with genie
      ansible.utils.cli_parse:
        command: show license usage
        parser:
          name: ansible.netcommon.pyats
      register: output

    - name: Print Result as json
      ansible.builtin.debug:
        var: output.parsed

    - name: Save result as json to file hostname_output.json
      ansible.builtin.copy:
        content: "{{output.parsed}}"
        dest: "{{inventory_hostname}}_output.json"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTH&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2023 06:51:13 GMT</pubDate>
      <guid>https://community.cisco.com/t5/code-exchange/ansible-logging-outout/m-p/4925510#M18</guid>
      <dc:creator>Marcel Zehnder</dc:creator>
      <dc:date>2023-09-19T06:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: Ansible Logging Outout</title>
      <link>https://community.cisco.com/t5/code-exchange/ansible-logging-outout/m-p/4932229#M20</link>
      <description>&lt;P&gt;Thank you Marcel.&lt;/P&gt;&lt;P&gt;Eventually I used:&lt;/P&gt;&lt;P&gt;&amp;nbsp; tasks:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;- name: show license all&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ios_command:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; commands:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; - terminal length 0&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; - terminal width 200&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; - show license status&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;become: true&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;register: output&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;- name: print result&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;debug:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var: output&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And directed the output to a text file:&lt;/P&gt;&lt;P&gt;ansible-playbook -i hosts site-iosxe-lic-enable-vault.yml -u cisco-k&amp;nbsp;&lt;STRONG&gt;&amp;gt; site-iosxe-lic.txt&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ass &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 05:09:26 GMT</pubDate>
      <guid>https://community.cisco.com/t5/code-exchange/ansible-logging-outout/m-p/4932229#M20</guid>
      <dc:creator>Netmart</dc:creator>
      <dc:date>2023-10-02T05:09:26Z</dc:date>
    </item>
  </channel>
</rss>

