Debian Codegraph @

ansible_collections/cisco/intersight/README.md

raw
1 # cisco.intersight Ansible Collection
2
3 ## Description
4
5 Ansible collection for managing and automating Cisco Intersight environments. Modules and roles are provided for common Cisco Intersight tasks. Detailed installation and usage examples are included in a lab guide in the misc directory of this collection in the [Intersight Ansible Lab Guide](https://github.com/CiscoDevNet/intersight-ansible/blob/main/misc/CL2020%20EMEAR%20DEVWKS-1542%20Intersight%20Ansible%20Lab%20Guide.pdf).
6
7 ## Requirements
8
9 - ansible-core v2.16.0 or newer
10 - Python 3.12 or newer (Older Python versions are no longer supported with this collection)
11
12
13 ## Installation
14
15 Before using this collection, you need to install it with the Ansible Galaxy command-line tool:
16 ```
17 ansible-galaxy collection install cisco.intersight
18 ```
19
20 You can also include it in a requirements.yml file and install it with ansible-galaxy collection install -r requirements.yml, using the format:
21
22 ```yaml
23 collections:
24 - name: cisco.intersight
25 ```
26
27 Note that if you install any collections from Ansible Galaxy, they will not be upgraded automatically when you upgrade the Ansible package.
28 To upgrade the collection to the latest available version, run the following command:
29
30 ```
31 ansible-galaxy collection install cisco.intersight --upgrade
32 ```
33
34 You can also install a specific version of the collection, for example, if you need to downgrade when something is broken in the latest version (please report an issue in this repository). Use the following syntax to install version 1.0.0:
35
36 ```
37 ansible-galaxy collection install cisco.intersight:==1.0.0
38 ```
39
40 See [using Ansible collections](https://docs.ansible.com/ansible/devel/user_guide/collections_using.html) for more details.
41
42 ## Use Cases
43
44 Authentication with the Intersight API requires the use of API keys that should be generated within the Intersight UI. See [Intersight help center](https://intersight.com/help) or the [Cisco Intersight API Overview](https://communities.cisco.com/docs/DOC-76947) for more information on generating and using API keys.
45 If you do not have an Intersight account, Cisco's dCloud provides an Intersight demo that you can use [this link](https://dcloud2-rtp.cisco.com/content/instantdemo/cisco-intersight-infrastructure-services).
46 Minimal setup is required in playbooks or variables to access the API. By default modules use an api_uri for Intersight's US instance `https://intersight.com/api/v1`. If you need to use Intersight's EU instance you'll need to set `api_uri: https://eu-central-1.intersight.com/api/v1`. Here's an example playbook with other required API parameters:
47 ```
48 ---
49 - hosts: localhost
50 connection: local
51 gather_facts: false
52 tasks:
53 - name: Configure Boot Policy
54 cisco.intersight.intersight_rest_api:
55 api_private_key: <path to your private key>
56 api_key_id: <your public key id>
57 resource_path: /boot/PrecisionPolicies
58 api_body: {
59 ```
60
61 localhost (the Ansible controller) can be used without the need to specify any hosts or inventory. Hosts can be specified to perform parallel actions. An example of Server Firmware Update on multiple servers is provided by the server_firmware.yml playbook.
62
63 If you're using playbooks in this repo, you will need to provide your own inventory file and cusomtize any variables used in playbooks with settings for your environment. This repo includes an example_inventory file with host groups for HX Clusters (Intersight_HX) and Servers (Intersight_Servers) and API key variables shared for Intersight host groups:
64 ```
65 [Intersight_HX]
66 sjc07-r13-501
67 sjc07-r13-503
68
69 [Intersight_Servers]
70
71 [Intersight:children]
72 Intersight_HX
73 Intersight_Servers
74
75 [Intersight:vars]
76 api_private_key=~/Downloads/SecretKey.txt
77 api_key_id=...
78 ```
79 For demo purposes, you can copy the example_inventory file to a new file named inventory. Then, edit the inventory file to provide your own api_private_key location and api_key_id for use in playbooks. If you're are using the Intersight Virtual Appliance, your inventory file can also specify the appliance URI and use of local certificates:
80 ```
81 api_uri=https://tme-appliance2.intersightdemo.cisco.com/api/v1
82 validate_certs=false
83 ```
84
85 Once you've provided API key information, the inventory file can be automatically updated with data from your Intersight account using one of the following playbooks:
86 - update_all_inventory.yml (if you'd like all Servers in the inventory)
87 - update_standalone_inventory.yml (if you'd like only Standalone C-Series Servers that can be managed through Server Policies/Profiles)
88
89 Here are example command lines for creating your own inventory and running the update_standalone_inventory.yml playbook:
90 ```
91 cp example_inventory inventory
92 edit inventory with your api_private_key and api_key_id
93 ansible-playbook -i inventory update_standalone_inventory.yml
94 ```
95 With an inventory for your Intersight account, you can now run playbooks to configure profiles/policies, and perform other server actions in Intersight:
96 ```
97 ansible-playbook -i inventory cos_server_policies_and_profiles.yml --list-tasks --list-hosts (will show the tasks and their tags along with the hosts that will be configured)
98 ansible-playbook -i inventory cos_server_policies_and_profiles.yml (will configure policies and profiles in Intersight)
99 ansible-playbook -i inventory deploy_server_profiles.yml (note: this will deploy settings, run with --check to see what would change 1st)
100 ansible-playbook -i inventory server_actions.yml (note: by default this will PowerOn all servers, view the playbook to see other options)
101 ```
102
103 Here are example command lines for creating an inventory with all Servers:
104 ```
105 cp example_inventory inventory
106 edit inventory with your api_private_key and api_key_id
107 ansible-playbook -i inventory update_all_inventory.yml
108 ```
109
110 ## Testing
111
112 This collection is tested using the examples in the playbooks directory.
113
114 ## Contributing
115
116 To contribute to this collection, please see the [Development Guide](https://github.com/CiscoDevNet/intersight-ansible/blob/main/Development.md) for guidelines that describe the process.
117
118 ## Support
119
120 As Red Hat Ansible Certified Content, this collection is entitled to support through Ansible Automation Platform (AAP).
121 Use the **Create issue** button on the top right corner of the [Automation Hub Collection page](https://console.redhat.com/ansible/automation-hub/repo/published/cisco/intersight/) for any defects, feature requests, or questions on usage.
122
123 If a support case cannot be opened with Red Hat and the collection has been obtained either from Galaxy or GitHub, there may community help available on the [Ansible Forum](https://forum.ansible.com/).
124
125 ## Release Notes
126
127 See the [Changelog](https://github.com/CiscoDevNet/intersight-ansible/blob/main/CHANGELOG.md) for information on what's changed in each release of this collection.
128
129 ## Related Information
130
131 Cisco's DevNet includes a [Learning Lab on using this collection](https://developer.cisco.com/learning/labs/cisco-intersight-rest-api-ansible/).
132
133 ## License Information
134
135 Licensed under the [MIT License](https://github.com/CiscoDevNet/intersight-ansible/blob/main/LICENSE.txt).