disable gather facts and update playbook output (#46409) (#46418)

* disable facts gather and update playbook output

* fix output

(cherry picked from commit a1fae193c7)
This commit is contained in:
Sandra McCann 2018-10-02 17:23:10 -04:00 committed by Alicia Cozine
parent d81ed54ae6
commit a1d1276b6e
3 changed files with 12 additions and 21 deletions

View file

@ -2,7 +2,7 @@
Run Your First Command and Playbook
***************************************************
Put the concepts you learned to work with this quick tutorial. Install Ansible, execute a network configuration command manually, execute the same command with Ansible, then create a playbook so you can execute the command any time on multiple network devices.
Put the concepts you learned to work with this quick tutorial. Install Ansible, execute a network configuration command manually, execute the same command with Ansible, then create a playbook so you can execute the command any time on multiple network devices.
.. contents:: Topics
@ -86,22 +86,17 @@ The playbook contains one play with two tasks, and should generate output like t
.. code-block:: bash
$ ansible-playbook -i vyos.example.net, -u ansible -k -e ansible_network_os=vyos first_playbook.yml
PLAY [First Playbook]
***************************************************************************************************************************
TASK [Gathering Facts]
***************************************************************************************************************************
ok: [vyos.example.net]
TASK [Get config for VyOS devices]
***************************************************************************************************************************
ok: [vyos.example.net]
TASK [Display the config]
***************************************************************************************************************************
ok: [vyos.example.net] => {
"failed": false,
"msg": "The hostname is vyos and the OS is VyOS"
}
@ -114,15 +109,11 @@ The extended first playbook has four tasks in a single play. Run it with the sam
.. code-block:: bash
$ ansible-playbook -i vyos.example.net, -u ansible -k -e ansible_network_os=vyos first_playbook_ext.yml
$ ansible-playbook -i vyos.example.net, -u ansible -k -e ansible_network_os=vyos first_playbook_ext.yml
PLAY [First Playbook]
************************************************************************************************************************************
TASK [Gathering Facts]
***********************************************************************************************************************************
ok: [vyos.example.net]
TASK [Get config for VyOS devices]
**********************************************************************************************************************************
ok: [vyos.example.net]
@ -130,10 +121,9 @@ The extended first playbook has four tasks in a single play. Run it with the sam
TASK [Display the config]
*************************************************************************************************************************************
ok: [vyos.example.net] => {
"failed": false,
"msg": "The hostname is vyos and the OS is VyOS"
}
TASK [Update the hostname]
*************************************************************************************************************************************
changed: [vyos.example.net]
@ -141,17 +131,16 @@ The extended first playbook has four tasks in a single play. Run it with the sam
TASK [Get changed config for VyOS devices]
*************************************************************************************************************************************
ok: [vyos.example.net]
TASK [Display the changed config]
*************************************************************************************************************************************
ok: [vyos.example.net] => {
"failed": false,
"msg": "The hostname is vyos-changed and the OS is VyOS"
}
PLAY RECAP
************************************************************************************************************************************
vyos.example.net : ok=6 changed=1 unreachable=0 failed=0
vyos.example.net : ok=6 changed=1 unreachable=0 failed=0
This playbook is useful. However, running it still requires several command-line flags. Also, running a playbook against a single device is not a huge efficiency gain over making the same change manually. The next step to harnessing the full power of Ansible is to use an inventory file to organize your managed nodes into groups with information like the ``ansible_network_os`` and the SSH user.
This playbook is useful. However, running it still requires several command-line flags. Also, running a playbook against a single device is not a huge efficiency gain over making the same change manually. The next step to harnessing the full power of Ansible is to use an inventory file to organize your managed nodes into groups with information like the ``ansible_network_os`` and the SSH user.

View file

@ -2,6 +2,7 @@
- name: Network Getting Started First Playbook
connection: network_cli
gather_facts: false
hosts: all
tasks:

View file

@ -2,6 +2,7 @@
- name: Network Getting Started First Playbook Extended
connection: network_cli
gather_facts: false
hosts: all
tasks: