This knowledge base has moved to the documentation site. Please visit the knowledge base here for the most up to date content. This site is no longer maintained.

[DEPRECATED]: Ansible: Utilizing Cumulus Linux Ansible Modules


DeprecatedThis article has been deprecated, and replaced with Automation for Network Engineers

This article outlines the process for utilizing Cumulus Linux modules for Ansible playbooks. The advantages of the modules are:

  • Reduced complexity of playbooks
  • No need for Jinja templates
  • Simple software upgrades and licensing


Utilizing Cumulus Linux Modules

To utilize Cumulus Linux modules with your Ansible playbook, do the following:

  1. Install the Ansible role. Install the cumulus.CumulusLinux role, which contains the Cumulus Linux modules, from Ansible Galaxy. Use the ansible-galaxy install cumulus.CumulusLinux command:
    cumulus@switch:~$ sudo ansible-galaxy install cumulus.CumulusLinux
     downloading role 'CumulusLinux', owned by cumulus
     no version specified, installing master
     - downloading role from
     - extracting cumulus.CumulusLinux to /etc/ansible/roles/cumulus.CumulusLinux
    cumulus.CumulusLinux was installed successfully
  2. Set up the Ansible libraries. In some environments, multiple people use the same Debian host to run Ansible playbooks. Normally the ansible.cfg is found at /etc/ansible/ansible.cfg. However, a playbook will first check the local directory for an ansible.cfg. This allows for multiple ansible.cfg files without affecting another user's playbooks by changes made to the ansible.cfg file. Here is the configuration of an ansible.cfg located at ~/playbook/:
    cumulus@switch:~$ cat ansible.cfg
    hostfile = ansible.hosts
    What do these three lines mean?
    • library = /etc/ansible/roles/cumulus.CumulusLinux/library/:/usr/share/ansible
      When you installed the cumulus.CumulusLinux role, it placed the Cumulus Linux modules at /etc/ansible/roles/cumulus.CumulusLinux/library/; the colon (:) is equivalent to AND in this case and the /usr/share/ansible is the default installation area for Ansible's built-in modules. This line specifies that the custom Cumulus Linux Modules AND the normal built-in modules will be used.
    • host_key_checking=False
      SSH key checking is enabled by default. In some environments, this can slow you down if you are doing something as simple as testing with plain-text passwords.
    • hostfile = ansible.hosts
      Instead of looking at /etc/ansible/hosts, use a local file called ansible.hosts in the same directory.
  3. Create a playbook. Make a really simple playbook that calls the new module cl_license, one of the numerous modules included with this installation.
    1. To see all the modules, run ls /etc/ansible/roles/cumulus.CumulusLinux/library/ or visit the Cumulus Networks GitHub.
    2. Create the task file under ~/playbook/roles/license/tasks/main.yml.
      cumulus@switch:~$ cat ~/playbook/roles/license/tasks/main.yml
      - name: install license using http url
        cl_license: src=''
    3. Create your playbook file under ~/playbook/license.yml
      cumulus@switch:~$ cat license.yml
        - hosts: switches
          user: root
            - license
    4. Show the ansible.hosts file, mentioned earlier, located at ~/playbook/ansible.hosts.
      cumulus@switch:~$ cat ansible.hosts
  4. Run the playbook. Run ansible-playbook playbookname -k, where -k enables the use of a text password instead of an SSH key:
    ansible-playbook license.yml -k
    SSH password:
    PLAY [switches] ***************************************************************
    GATHERING FACTS ***************************************************************
    ok: [sw1]
    TASK: [license | install license using http url] ******************************
    changed: [sw1]
    PLAY RECAP ********************************************************************
    sw1                        : ok=2    changed=1    unreachable=0    failed=0
  5. The Cumulus Linux modules now work with Ansible! Check out all the modules on GitHub at

See Also


This support portal has moved

Cumulus Networks is now part of the NVIDIA Networking Business Unit! The NVIDIA Cumulus Global Support Services (GSS) team has merged its operations with the NVIDIA Mellanox support services team.

You can access NVIDIA Cumulus support content from the Mellanox support portal.

You open and update new cases on the Mellanox support portal. Any previous cases that have been closed have been migrated to the Mellanox support portal.

Cases that are still open on the Cumulus portal will continue to be managed on the Cumulus portal. Once these cases close, they will be moved to the Mellanox support portal.

Powered by Zendesk