Published:


ansible Permalink

Ansible is a powerful automation tool that allows you to manage and configure systems. While it is commonly used for configuration management and deployment tasks, Ansible can also be used to automate API interactions.

we will explore how to create a POST request using Ansible, enabling you to automate the process of sending data to an API endpoint.

vars_in_request:
  - var1=
  - var2=
- name: a post request example
  uri:
    url: "{{ your_site }}"
    method: POST
    body_format: raw
    body: "{{ vars_in_request | join('&') }}"
    status_code: 200
    headers:
      Content-Type: "application/x-www-form-urlencoded"