Interview Prep/Ansible/Ad-hoc Commands, Modules and Idempotency

What is the difference between `get_url` and `uri`?

IntermediateConceptAd-hoc Commands, Modules and Idempotency
Answer

get_url downloads a file to the target, with optional checksum verification, and skips the download if the destination already matches. uri makes an HTTP request and returns the response, so it is for APIs, health checks and webhooks.

- ansible.builtin.get_url:
    url: https://example.com/app-1.4.2.tar.gz
    dest: /tmp/app.tar.gz
    checksum: sha256:3b1c...e9
- ansible.builtin.uri:
    url: http://localhost:8080/health
    status_code: 200
  register: health
  until: health.status == 200
  retries: 10
  delay: 3
All Ansible questions Roadmap: Ansible

More on Ad-hoc Commands, Modules and Idempotency