I've tried a few variations on running ansible
locally as a test case:
nicholas $
nicholas $ ls
ansible.cfg ansible.cfg.orig first_playbook.yml inventory.txt playbook.yml
nicholas $
nicholas $ cat ansible.cfg
[defaults]
transport = local
nicholas $
nicholas $ cat playbook.yml
---
- name: Network Getting Started First Playbook
connection: network_cli
gather_facts: false
hosts: all
tasks:
- name: Get config for VyOS devices
vyos_facts:
gather_subset: all
- name: Display the config
debug:
msg: "The hostname is {{ ansible_net_hostname }} and the OS is {{ ansible_net_version }}"
nicholas $
nicholas $ ansible --version
ansible 2.9.6
config file = /home/nicholas/ansible/ansible.cfg
configured module search path = ['/home/nicholas/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 3.8.2 (default, Jul 16 2020, 14:00:26) [GCC 9.3.0]
nicholas $
nicholas $ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04 LTS
Release: 20.04
Codename: focal
nicholas $
nicholas $ ansible-playbook --connection=local playbook.yml
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
PLAY [Network Getting Started First Playbook] **************************************************************************************
skipping: no hosts matched
PLAY RECAP *************************************************************************************************************************
nicholas $
perhaps I need an additional configuration for the localhost loopback?
Although I can ping localhost as:
nicholas $
nicholas $ ansible localhost -m ping -u root
127.0.0.1 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": false,
"ping": "pong"
}
nicholas $