diff options
| author | Colin Wilk <colin.wilk@tum.de> | 2023-10-11 15:34:10 +0200 |
|---|---|---|
| committer | Colin Wilk <colin.wilk@tum.de> | 2023-10-11 15:49:45 +0200 |
| commit | c9c812343831be1bb56965b2aeff41eecdae0a11 (patch) | |
| tree | 4a5eec53821831cfc746788f631e8b283bfebe3b /defaults/main.yml | |
| parent | 6da60ee68e98d97f2c58ea7dca39d85c9b81370b (diff) | |
| download | ansible-role-prometheus-target-c9c812343831be1bb56965b2aeff41eecdae0a11.tar.gz ansible-role-prometheus-target-c9c812343831be1bb56965b2aeff41eecdae0a11.zip | |
Add run_once option for handlers
This adds the run_once option for the two handler types (shell and
command). The variables `prometheus_target_handler_command_run_once`
and `prometheus_target_handler_shell_run_once` are introduced to
control this behavior.
For this change a switch from the Ansible Handlers to regular tasks was
necessary to enforce run_once behavior with delegated hosts. If you
don't rely on handler specific features such as deferring, nothing
changes when using the role.
Signed-off-by: Colin Wilk <colin.wilk@tum.de>
Diffstat (limited to 'defaults/main.yml')
| -rw-r--r-- | defaults/main.yml | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/defaults/main.yml b/defaults/main.yml index 0a8e9ba..807f507 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -31,6 +31,14 @@ prometheus_target_handler_command_become: true # prometheus_target_handler_command_become_method: # prometheus_target_handler_command_become_user: +# By default the target handler will run for every host added on the delegated +# host. This means that if you add 20 hosts as your target, you will run the +# handler 20 times on your delegated host. This is useful if you need some host +# specific variables to run on the delegated host however often times, such as +# when using it to create a commit in a repository, you only need to do it once +# per run and not per host. +prometheus_target_handler_command_run_once: false + # This is the configuration for the command module. For documentation see: # https://docs.ansible.com/ansible/latest/collections/ansible/builtin/command_module.html # --- @@ -55,6 +63,10 @@ prometheus_target_handler_shell_become: true # prometheus_target_handler_shell_become_method: # prometheus_target_handler_shell_become_user: +# This will configure the shell handler to run once. +# See documentation for prometheus_target_handler_command_run_once above. +prometheus_target_handler_shell_run_once: false + # This is the configuration for the shell module. For documentation see: # https://docs.ansible.com/ansible/latest/collections/ansible/builtin/shell_module.html # --- |