How do I get the ansible config for rolly below?


[nsaunders@rolly ~]$ 
[nsaunders@rolly ~]$ lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 8.2.2004 (Core) 
Release:    8.2.2004
Codename:   Core
[nsaunders@rolly ~]$ 
[nsaunders@rolly ~]$ ansible --version
ansible 2.9.13
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/nsaunders/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.8 (default, Apr 16 2020, 01:36:27) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
[nsaunders@rolly ~]$ 
[nsaunders@rolly ~]$ show config
bash: show: command not found...
[nsaunders@rolly ~]$ 
[nsaunders@rolly ~]$ ansible show config
usage: ansible [-h] [--version] [-v] [-b] [--become-method BECOME_METHOD]
               [--become-user BECOME_USER] [-K] [-i INVENTORY] [--list-hosts]
               [-l SUBSET] [-P POLL_INTERVAL] [-B SECONDS] [-o] [-t TREE] [-k]
               [--private-key PRIVATE_KEY_FILE] [-u REMOTE_USER]
               [-c CONNECTION] [-T TIMEOUT]
               [--ssh-common-args SSH_COMMON_ARGS]
               [--sftp-extra-args SFTP_EXTRA_ARGS]
               [--scp-extra-args SCP_EXTRA_ARGS]
               [--ssh-extra-args SSH_EXTRA_ARGS] [-C] [--syntax-check] [-D]
               [-e EXTRA_VARS] [--vault-id VAULT_IDS]
               [--ask-vault-pass | --vault-password-file VAULT_PASSWORD_FILES]
               [-f FORKS] [-M MODULE_PATH] [--playbook-dir BASEDIR]
               [-a MODULE_ARGS] [-m MODULE_NAME]
ansible: error: unrecognized arguments: config
[nsaunders@rolly ~]$ 


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 $ cat first_playbook.yml 

- name: Network Getting Started First Playbook
  connection: network_cli
  gather_facts: false
  hosts: all

    - name: Get config for VyOS devices
        gather_subset: all

    - name: Display the config
        msg: "The hostname is {{ ansible_net_hostname }} and the OS is {{ ansible_net_version }}"
nicholas $ 
nicholas $ yamllint first_playbook.yml 
  15:81     error    line too long (97 > 80 characters)  (line-length)

nicholas $ 
nicholas $ ansible all -i rolly.foo, -c network_cli -u nsaunders -k -m centos_facts -e ansible_network_os=centos
SSH password: 
rolly.foo | FAILED! => {
    "msg": "network os centos is not supported"
nicholas $ 



2 Answers 2


This error is due to invalid value of ansible_network_os:

The playbook you try setup is meant for network devices.
And since centos is not a network device OS the playbook will fail.
Here you can find supported network OS.
Ansible Documentation: ansible_network_os values

If you don't have any device running a supported network OS I recommend you to follow the regular user guide.
Ansible User Guide

My suggestion is to setup a easy playbook that will run on the environment you have.
Get the understanding of following concepts.
Control node
Managed nodes

Here is a short example.
This will only execute hostname do confirm it execute on expected host.
Let's say nicholas is your control node and rolly is the managed node.

On nicholas:
Create a inventory as before with your control node and managed node.

localhost ansible_connection=local

rolly ansible_host=<rolly ip> ansible_user=<rolly user> ansible_ssh_pass=<rolly user password>


- name: This will get hostname localy on control node
  hosts: localhost
    - name: get hostname
      command: hostname
      register: result

    - name: print hostname
          var: result

- name: This will get hostname remote on manged node
  hosts: rolly
    - name: get hostname
      command: hostname
      register: result

    - name: print hostname
          var: result

And then execute on the control node:
ansible-playbook -i inventory.txt myplaybook.yml

nicholas $ 
nicholas $ cat ansible.cfg 
inventory = hosts
ask_vault_pass = True

become_ask_pass = True

nicholas $ 
nicholas $ sudo ansible-playbook first_playbook.yml --connection=local
BECOME password: 
Vault password: 
[WARNING]: Unable to parse /home/nicholas/ansible/hosts as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
[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 $ 

As a workaround to using a remote, although it requires some additional configuration apparently.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.