Ansible uri Module for REST API Calls to Catalyst Center

300-435 By islever Editorial Last updated

Short answer

A The Ansible uri module is used to make REST API calls to controllers such as Catalyst Center by sending HTTP or HTTPS requests.

Question

What is the Ansible 'uri' module used for?
  1. Makes REST API calls to controllers like Catalyst Center Correct Answer
  2. CLI config
  3. File transfer
  4. Pinging

Key Takeaways

The Ansible uri module is the built-in tool for sending HTTP and HTTPS requests to REST APIs. Option A is correct because it enables controller automation against platforms such as Catalyst Center, while CLI configuration, file transfer, and ping tests require other modules.

Expert Analysis

Ansible uri module sends HTTP requests to REST APIs for controller automation.

The deciding mechanism is the transport and verb model exposed by the module: uri issues HTTP or HTTPS requests to a target endpoint, accepts methods such as GET, POST, PUT, and DELETE, and can carry headers, query parameters, JSON bodies, and authentication values. That makes it the natural Ansible primitive for talking to a REST controller such as Catalyst Center, where automation is driven by documented API endpoints rather than by a command-line session. The correct option names that exact use case: making REST API calls to controllers like Catalyst Center.

For example, a Catalyst Center workflow can POST a JSON payload to an API path, then poll a returned task identifier with GET. The playbook acts on the JSON response, not on command output.

Other options describe different automation planes. CLI config depends on a device command interface, typically reached through SSH or a network-oriented module such as cli_command, ios_command, or a platform-specific netconf/restconf path. The uri module does not open a CLI session, parse device prompts, or send Cisco IOS-style configuration commands. It only sends an HTTP request and interprets the HTTP response. If the goal is to change a device configuration through a CLI, uri is the wrong tool because the controller’s REST API may be an abstraction over the device, but the module itself is not performing CLI configuration.

File transfer also fails because the module’s job is not to copy files between the Ansible control node and managed hosts. Ansible has dedicated modules for that behavior, such as copy, get_url, fetch, or synchronize. Although uri can download content from an HTTP endpoint by making a request, it is not the general file-transfer mechanism for automation playbooks. A task that says “copy this file to the host” or “retrieve this artifact from the controller” is not an uri task unless the underlying mechanism is explicitly an HTTP API call.

Pinging is another mismatch. Ansible’s ping module checks whether the Ansible connection plugin can reach and execute on the target, not whether ICMP echo requests succeed. A network reachability test using ICMP would use a different module or command. The uri module cannot be used to send ICMP pings because it operates at the HTTP/HTTPS request-response layer. It may test whether an HTTP endpoint responds, but that is an API availability check, not a ping.

One unstated rule that matters here is that uri success is judged by HTTP status semantics and response content, not by device command output. In a Catalyst Center workflow, the playbook sends a request to an API path, receives a JSON payload, and then uses that response to assert that the controller accepted the operation. The module can validate certificates, set return_content, inspect status_code, and pass JSON bodies, which are all characteristics of REST interaction. That response-driven model is why the option about REST API calls is the only one that matches the module’s actual interface.

Official Reference

https://docs.ansible.com/ansible/latest/collections/ansible/builtin/uri_module.html

This link opens the official vendor documentation in a new tab.

Exam Strategy

Map each Ansible module to the protocol or task it actually performs. When an option mentions REST API calls to Catalyst Center, select uri; when it mentions CLI configuration, reject it in favor of cli_command or platform command modules. For file movement, look for copy, get_url, fetch, or synchronize, and for reachability checks, distinguish Ansible ping from ICMP. This protocol-first filtering removes distractors quickly.

Practice All 300-435 Questions

Access 150 questions with complete answers and detailed explanations.

View Full 300-435 Practice Test →

← Back to 300-435 Study Guide