Cisco UCS Manager Ansible Module Overview
Cisco has published Ansible modules for UCS Manager that provide Configuration Management of UCS Unified Fabric including network, server, and storage resources. Ansible provides a rich framework for configuration management of software and hardware infrastructure. For example, when configuring UCS Manager boot policies with Ansible, the user can simply specify the desired settings for the boot policy and Ansible will take care of the programming steps:
- name: create boot policy
cisco_ucs_boot_policy:
name: AnsibleBootPol
ucs_ip: "{{ucs_ip}}"
ucs_username: "{{ucs_username}}"
ucs_password: "{{ucs_password}}"
- name: set boot order
cisco_ucs_boot_order:
name: AnsibleBootPol
devices:
- {"device_order":"1", "device_name":"lan", "vnic_name":"eth0"}
- {"device_order":"2", "device_name":"local_lun"}
ucs_ip: "{{ucs_ip}}"
ucs_username: "{{ucs_username}}"
ucs_password: "{{ucs_password}}"
Additional examples are provided on GitHub and in the video demo also linked below. The Cisco UCS Ansible modules are built on the Cisco UCSM Python SDK, so the wide range of configuration options supported from the Python SDK are possible through Ansible.
Module Development with the Python SDK
The basic process for developing modules is the following:
- Read the module development guide from Ansible: Developing Modules — Ansible Documentation
- Fork the ucsm-ansible GitHub repository and create new modules: GitHub - CiscoUcs/ucsm-ansible: Ansible Modules for Cisco Ucs Managed Blade and Rack servers.
- The Python SDK can help generate Python code for you. Check out the Cisco UCS Programmability Lab for instructions on using the Pythong SDK and generating code.
- Once the module is tested and working, you can submit pull requests back to the CiscoUcs repository on GitHub.
View the video overview of developing modules for UCS Manager for more information.
Ansible Installation and Command Line Usage Instructions
Because the UCS Manager Ansible modules connect to UCS Manager, it is possible to use the modules without physical hardware by using the UCS Platform Emulator. If you can deploy a Virtual Machine, you can run the UCS Platform Emulator and try out the UCSM Ansible modules. Cisco's demo Cloud (dCloud) is also available and the Cisco UCS Programmability Lab Environment can be used to step through the attached Ansible lab guide.
Usage with dCloud's Physical UCS Lab Environment
For configuration of Hardware including the ability to install a variety of Operating Systems, Cisco's demo Cloud (dCloud) also provides a physical UCS environment. The physical UCS environment includes preconfigured Linux servers and tools to automate all aspects of UCS configuration, OS installation, and ongoing configuration management. Read more on the Cisco Unified Computing System 3.1 Lab Environment
Ansible can be used to deploy several UCS environments and you can read more at GitHub - dsoper2/ucsm-ansible: Ansible Modules for Cisco Ucs Managed Blade and Rack servers. As described in the GitHub pages, Ansible can be installed and used to deploy UCS infrastructure for a Docker Datacenter cluster with the following steps:
- Start a dCloud Lab session and connect to one of the provided Linux VMs.
- Install needed packages and Ansible as described in the attached Lab Guide.
- Clone the GitHub repo and install: git clone https://github.com/dsoper2/ucsm-ansible; cd ucsm-ansible; python install.py
- Run the Docker Datacenter playbook: ansible-playbook -i inventory/docker_ucspe dockerdc.yml
For More Information Including Installation and Usage Instructions