I'm developing a smoke test playbook which simply goes through and ensures that I get a HTTP 200 out of all of our servers.
I was originally doing this:
---
- hosts: prod
gather_facts: no
tasks:
- name: smoke test
uri: url=http://{{ inventory_hostname }}/ status_code=200
The problem here is that these servers apparently don't have httplib2 installed on them, so the URI command fails.
Is there a way for me to run the uri module on my local machine to the remote machines to just run through all of them and curl each one? I'd like to use a module if possible, because it's easier to check that the return code is exactly what I want.
Simply run: $ npx [options] <command>[@version] [command-arg]... By default, npx will check whether <command> exists in $PATH , or in the local project binaries, and execute that.
Local Modules: (Custom or User Defined Modules) Local modules are mainly used for some specific purpose in projects and locally available in separate files or folders within project.
You can delegate any task to localhost or another remote host with delegate_to
:
- name: smoke test
uri: url=http://{{ inventory_hostname }}/ status_code=200
delegate_to: localhost
Also, there is the local_action
module, but I prefer the delegate_to
way.
- name: smoke test
local_action: uri url=http://{{ inventory_hostname }}/ status_code=200
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With