Using Ansible's built-in functionality to do web requests
In previous chapters, we have seen how to use modules from the Python standard library within our Ansible module. But what about third-party packages such as the requests
package we used in Chapter 8, Configuring Devices Using RESTCONF and requests, and Chapter 9, Consuming Controllers and High-Level Networking APIs with requests, to make web requests? While we could import an external package, Ansible modules generally try to be as independent of third-party packages as possible. But this does not mean that we have to rebuild the entire functionality to make HyperText Transfer Protocol (HTTP) requests from scratch. Ansible comes pre-packaged with many built-in utility modules, one of which, the uri
module, can be used to make web requests.
In this recipe, we will see how you can use an Ansible module and built-in functionality to send an HTTP request to the Meraki application programming interface (API). We'll...