filmov
tv
Using Ansible to Interact with Web Endpoints

Показать описание
We often think of Ansible as a useful tool for automating configuration management and system administration tasks. But did you know that Ansible has powerful, built-in capabilities to interact with web endpoints and APIs? While Ansible may not always be your tool of choice for these types of applications, it can be very useful to quickly interact with a web API without shelling out to an external script or utility.
In this video, we work through a concrete example of using Ansible's URI module to accomplish a common systems task: creating, silencing, and enabling a monitoring alert for a system during an upgrade. The example starts off simple, but we quickly add advanced functionality such as error handling, response body processing, and request data submission. Calling an API endpoint with Ansible is a fast and powerful way to add additional functionality to your playbooks.
VIDEO CHAPTERS
00:00 - Intro
00:14 - Overview and Background
01:16 - Environment Setup
01:55 - Scenario
02:56 - Demo Playbook and Inventory Setup
04:55 - Adding an API Interaction with the URI Module
10:05 - The Importance of delegate_to
11:10 - Finishing and Running the Example
12:16 - The Importance of Error Handling
14:15 - Using Ansible Blocks to Handle Errors
17:55 - Extending the Scenario
19:42 - Inspecting a JSON Response Body
21:13 - The JSON query filter
25:08 - Sending a POST request with a JSON Body
30:17 - Putting it All Together
33:09 - Conclusion and Outro
In this video, we work through a concrete example of using Ansible's URI module to accomplish a common systems task: creating, silencing, and enabling a monitoring alert for a system during an upgrade. The example starts off simple, but we quickly add advanced functionality such as error handling, response body processing, and request data submission. Calling an API endpoint with Ansible is a fast and powerful way to add additional functionality to your playbooks.
VIDEO CHAPTERS
00:00 - Intro
00:14 - Overview and Background
01:16 - Environment Setup
01:55 - Scenario
02:56 - Demo Playbook and Inventory Setup
04:55 - Adding an API Interaction with the URI Module
10:05 - The Importance of delegate_to
11:10 - Finishing and Running the Example
12:16 - The Importance of Error Handling
14:15 - Using Ansible Blocks to Handle Errors
17:55 - Extending the Scenario
19:42 - Inspecting a JSON Response Body
21:13 - The JSON query filter
25:08 - Sending a POST request with a JSON Body
30:17 - Putting it All Together
33:09 - Conclusion and Outro
Комментарии