Search code examples
web-servicessalt-project

SaltStack to trigger webservices


I'm currently trying SaltStack that seems to have some cool features. But I miss a module from Ansible :

In SaltStack what is the equivalent of the Ansible's module "uri" ?

Example in Ansible :

- name: using webservices
  uri:
    url: http://.../v1/method
    method: PUT
    body: {{ lookup('template', 'job.j2') }}
    body_format: json
    status_code: 201,409
    HEADER_Content-Type: "application/json"

Solution

  • You can use the http.query module.

    For example:

    http://example.com/restapi:
      http.query:
        - match: 'SUCCESS'
        - data_render: True
        - header_file: /tmp/headers.txt
        - header_render: True
        - cookies: True
        - persist_session: True