Debian Codegraph @

ansible_collections/cisco/ucs/README.md

raw
1 # Ansible Collection - cisco.ucs
2
3 Ansible collection for managing and automing Cisco UCS Manager envrionments. Modules and roles are provided for common Cisco UCS Manager tasks.
4
5 * Note: This collection is not compatible with versions of Ansible before v2.8.
6
7 ## Requirements
8
9 - Ansible v2.8 or newer
10 - UCSM Python SDK (ucsmsdk)
11
12 ## Install
13 - ansible must be installed
14 ```
15 sudo pip install ansible
16 ```
17 - ucsmsdk must be installed
18 ```
19 sudo pip install ucsmsdk
20 ```
21 We recommend verifying the ucsmsdk can connect to the domains you want to manage with Ansible. Here is an example connection test using python:
22 ```
23 # python
24 Python 2.7.14 (default, Apr 27 2018, 14:31:56)
25 [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2
26 Type "help", "copyright", "credits" or "license" for more information.
27 >>> from ucsmsdk import ucshandle
28 >>> handle = ucshandle.UcsHandle(ip='172.22.250.236', username='admin', password='password')
29 >>> handle.login()
30 True
31 ```
32
33 ## Usage
34 Once Ansible is installed you can create inventory files and playbooks to manage your UCS domains. Each module supports ansible-doc which includes example usage:
35 ```
36 # ansible-doc cisco.ucs.ucs_vlans
37 <snip>
38 EXAMPLES:
39 - name: Configure VLAN
40 cisco.ucs.ucs_vlans:
41 hostname: 172.16.143.150
42 username: admin
43 password: password
44 name: vlan2
45 id: '2'
46 native: 'yes'
47 ```
48 This repository includes a playbooks directory with examples including an inventory file that can be edited with information for the UCSM domain you want to configure:
49 ```
50 # vi inventory
51 [ucs]
52 13.58.22.56
53
54 [ucs:vars]
55 username=admin
56 password=password
57 ```
58 An example_playbook.yml playbook is included to test VLAN configuration on the UCSM domain given in the inventory file:
59 ```
60 # vi example_playbook.yml
61
62 ---
63 # Example Playbook: VLAN configuration using the [ucs] hosts group
64 - hosts: ucs
65 connection: local
66 collections:
67 - cisco.ucs
68 gather_facts: false
69 tasks:
70 - name: Configure VLAN
71 ucs_vlans:
72 hostname: "{{ inventory_hostname }}"
73 username: "{{ username | default(omit) }}"
74 password: "{{ password }}"
75 state: "{{ state | default(omit) }}"
76 name: vlan2
77 id: '2'
78 native: 'no'
79 delegate_to: localhost
80 ```
81 Ansible will use data from the inventory file for the hostname and other variables above. Multiple UCSM domains can be listed in the inventory file and Ansible will configure all the listed domains in parallel using host specific data.
82
83 The ansible-playbook command can be used to run the above playbook and inventory file:
84 ```
85 # ansible-playbook -i inventory example_playbook.yml
86
87 PLAY [ucs] *********************************************************************
88
89 TASK [Configure VLAN] **********************************************************
90 ok: [13.58.22.56 -> localhost]
91
92 PLAY RECAP *********************************************************************
93 13.58.22.56 : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
94 ```
95
96 A more detailed configuration example is provided in the server_deploy.yml playbook.
97
98 # Support:
99
100 Please file Issues in this repository for any defects, feature requests, or questions on usage.