Answers: <p>This error is due to invalid value of <code>ansible_network_os:</code></p>
  <p>The playbook you try setup is meant for network devices.<br />
  And since centos is not a network device OS the playbook will fail.<br />
  Here you can find supported network OS.<br />
  <a href="https://docs.ansible.com/ansible/latest/network/user_guide/platform_index.html#settings-by-platform" rel="nofollow noreferrer">Ansible Documentation: ansible_network_os values</a></p>
  <p>If you don't have any device running a supported network OS I recommend you to follow the regular user guide.<br />
  <a href="https://docs.ansible.com/ansible/latest/user_guide/index.html" rel="nofollow noreferrer">Ansible User Guide</a></p>
  <p>My suggestion is to setup a easy playbook that will run on the environment you have.<br />
  Get the understanding of following concepts.<br />
  <code>Control node</code><br />
  <code>Managed nodes</code><br />
  <code>Inventory</code><br />
  <code>Modules</code><br />
  <code>Tasks</code><br />
  <code>Playbooks</code></p>
  <p>Here is a short example.<br />
  This will only execute <code>hostname</code> do confirm it execute on expected host.<br />
  Let's say <code>nicholas</code> is your control node and <code>rolly</code> is the managed node.</p>
  <p>On <code>nicholas</code>:<br />
  Create a inventory as before with your control node and managed node.<br />
  inventory.txt:</p>
  <pre class="lang-yaml prettyprint-override"><code>[local]
  localhost ansible_connection=local
  
  [managed_node]
  rolly ansible_host=&lt;rolly ip&gt; ansible_user=&lt;rolly user&gt; ansible_ssh_pass=&lt;rolly user password&gt;
  </code></pre>
  <p>myplaybook.yml:</p>
  <pre class="lang-yaml prettyprint-override"><code>---
  - name: This will get hostname localy on control node
    hosts: localhost
    tasks:
      - name: get hostname
        command: hostname
        register: result
  
      - name: print hostname
        debug:
            var: result
  
  - name: This will get hostname remote on manged node
    hosts: rolly
    tasks:
      - name: get hostname
        command: hostname
        register: result
  
      - name: print hostname
        debug:
            var: result
  </code></pre>
  <p>And then execute on the control node:<br />
  <code>ansible-playbook -i inventory.txt myplaybook.yml</code></p>
  
Answers: CC BY-SA 4.0
Answers: 2020-09-15T13:35:26.147Z
Answers: 2020-09-15T13:35:26.147Z
Answers: akane
Answers: <pre><code>nicholas $ 
  nicholas $ cat ansible.cfg 
  [defaults]
  inventory = hosts
  ask_vault_pass = True
  
  [privilege_escalation]
  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 $ 
  </code></pre>
  <p>As a <a href="https://devops.stackexchange.com/q/4365/23443">workaround to using</a> a remote, although it requires some additional configuration apparently.</p>
  
Answers: CC BY-SA 4.0
Answers: 2020-09-15T06:58:21.797Z
Answers: 2020-09-15T06:58:21.797Z
Answers: Nicholas Saunders
Body: <p>How do I get the <code>ansible</code> config for <code>rolly</code> below?</p>
  <p>remote:</p>
  <pre><code>[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]
                 pattern
  ansible: error: unrecognized arguments: config
  [nsaunders@rolly ~]$ 
  </code></pre>
  <p>local:</p>
  <pre><code>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
    tasks:
  
      - name: Get config for VyOS devices
        vyos_facts:
          gather_subset: all
  
      - name: Display the config
        debug:
          msg: &quot;The hostname is {{ ansible_net_hostname }} and the OS is {{ ansible_net_version }}&quot;
  nicholas $ 
  nicholas $ yamllint first_playbook.yml 
  first_playbook.yml
    15:81     error    line too long (97 &gt; 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! =&gt; {
      &quot;msg&quot;: &quot;network os centos is not supported&quot;
  }
  nicholas $ 
  </code></pre>
  <p>referencing:</p>
  <p><a href="https://www.ansible.com/blog/getting-started-writing-your-first-playbook" rel="nofollow noreferrer">https://www.ansible.com/blog/getting-started-writing-your-first-playbook</a></p>
  
Tags: <ansible><yaml><centos><ssh><ansible-inventory>
Title: network ansible command error: "msg": "network os centos is not supported"
UserDisplayName: Nicholas Saunders
ThreadText: # network ansible command error: "msg": "network os centos is not supported"
  
  (Asked by: username_0 on 2020-09-15)
  
  How do I get the `ansible` config for `rolly` below?
  
  remote:
  
  ```
  [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]
                 pattern
  ansible: error: unrecognized arguments: config
  [nsaunders@rolly ~]$ 
  
  ```
  
  local:
  
  ```
  username_0 $ 
  username_0 $ lsb_release -a
  No LSB modules are available.
  Distributor ID: Ubuntu
  Description:    Ubuntu 20.04 LTS
  Release:    20.04
  Codename:   focal
  username_0 $ 
  username_0 $ cat first_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 }}"
  username_0 $ 
  username_0 $ yamllint first_playbook.yml 
  first_playbook.yml
    15:81     error    line too long (97 > 80 characters)  (line-length)
  
  username_0 $ 
  username_0 $ 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"
  }
  username_0 $ 
  
  ```
  
  referencing:
  
  <https://www.ansible.com/blog/getting-started-writing-your-first-playbook>
  
  **Tags:** ansible, yaml, centos, ssh, ansible-inventory
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2020-09-15. Score: 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](https://docs.ansible.com/ansible/latest/network/user_guide/platform_index.html#settings-by-platform)
  
  If you don't have any device running a supported network OS I recommend you to follow the regular user guide.  
  [Ansible User Guide](https://docs.ansible.com/ansible/latest/user_guide/index.html)
  
  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`  
  `Inventory`  
  `Modules`  
  `Tasks`  
  `Playbooks`
  
  Here is a short example.  
  This will only execute `hostname` do confirm it execute on expected host.  
  Let's say `username_0` is your control node and `rolly` is the managed node.
  
  On `username_0`:  
  Create a inventory as before with your control node and managed node.  
  inventory.txt:
  
  ```yaml
  [local]
  localhost ansible_connection=local
  
  [managed_node]
  rolly ansible_host=<rolly ip> ansible_user=<rolly user> ansible_ssh_pass=<rolly user password>
  
  ```
  
  myplaybook.yml:
  
  ```yaml
  ---
  - name: This will get hostname localy on control node
    hosts: localhost
    tasks:
      - name: get hostname
        command: hostname
        register: result
  
      - name: print hostname
        debug:
            var: result
  
  - name: This will get hostname remote on manged node
    hosts: rolly
    tasks:
      - name: get hostname
        command: hostname
        register: result
  
      - name: print hostname
        debug:
            var: result
  
  ```
  
  And then execute on the control node:  
  `ansible-playbook -i inventory.txt myplaybook.yml`
  
  
  ---
  
  ### Answer by username_0 on 2020-09-15. Score: 0
  
  ```
  username_0 $ 
  username_0 $ cat ansible.cfg 
  [defaults]
  inventory = hosts
  ask_vault_pass = True
  
  [privilege_escalation]
  become_ask_pass = True
  
  username_0 $ 
  username_0 $ sudo ansible-playbook first_playbook.yml --connection=local
  BECOME password: 
  Vault password: 
  [WARNING]: Unable to parse /home/username_0/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 *************************************************************************************************************************
  
  username_0 $ 
  
  ```
  
  As a [workaround to using](https://devops.stackexchange.com/q/4365/23443) a remote, although it requires some additional configuration apparently.
  
  
  ---
  
  