diff options
| author | Colin Wilk <colin.wilk@tum.de> | 2023-05-30 17:04:33 +0200 |
|---|---|---|
| committer | Colin Wilk <colin.wilk@tum.de> | 2023-05-30 18:38:11 +0200 |
| commit | fcf5bf4d03c9a92f618c4ed2cb56484ed4ed4bb8 (patch) | |
| tree | e586141eaceaee9d12c94dfe79d22823f718c0e8 | |
| parent | 4565318b0f305a4872967672ab22426ac1c2bc44 (diff) | |
| download | ansible-role-prometheus-target-fcf5bf4d03c9a92f618c4ed2cb56484ed4ed4bb8.tar.gz ansible-role-prometheus-target-fcf5bf4d03c9a92f618c4ed2cb56484ed4ed4bb8.zip | |
Add become_user and become_method config variables to handlers
Signed-off-by: Colin Wilk <colin.wilk@tum.de>
| -rw-r--r-- | README.md | 8 | ||||
| -rw-r--r-- | defaults/main.yml | 4 | ||||
| -rw-r--r-- | handlers/main.yml | 4 |
3 files changed, 14 insertions, 2 deletions
@@ -117,8 +117,8 @@ changes via a hook. You can enable or disable the handlers via the `prometheus_target_handler_command_enabled`/ `prometheus_target_handler_shell_enabled` variables and configure become -behavior via `prometheus_target_handler_command_become`/ -`prometheus_target_handler_shell_become`. +behavior via `prometheus_target_handler_command_become*`/ +`prometheus_target_handler_shell_become*`. The `prometheus_target_handler_command` and `prometheus_target_handler_shell` variables map the options of their respective Ansible @@ -130,10 +130,14 @@ module. ```yaml prometheus_target_handler_command_enabled: false prometheus_target_handler_command_become: true +# prometheus_target_handler_command_become_method: +# prometheus_target_handler_command_become_user: prometheus_target_handler_command: {} prometheus_target_handler_shell_enabled: false prometheus_target_handler_shell_become: true +# prometheus_target_handler_shell_become_method: +# prometheus_target_handler_shell_become_user: prometheus_target_handler_shell: {} ``` diff --git a/defaults/main.yml b/defaults/main.yml index 58d6f4b..5589273 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -28,6 +28,8 @@ prometheus_target_handler_command_enabled: false # instance with a curl command, or ssh with the prometheus user, this may not be # necessary. prometheus_target_handler_command_become: true +# prometheus_target_handler_command_become_method: +# prometheus_target_handler_command_become_user: # This is the configuration for the command module. For documentation see: # https://docs.ansible.com/ansible/latest/collections/ansible/builtin/command_module.html @@ -50,6 +52,8 @@ prometheus_target_handler_shell_enabled: false # This will configure if the shell handler is run with root privileges or not. # See documentation for prometheus_target_handler_command_become above. prometheus_target_handler_shell_become: true +# prometheus_target_handler_shell_become_method: +# prometheus_target_handler_shell_become_user: # This is the configuration for the shell module. For documentation see: # https://docs.ansible.com/ansible/latest/collections/ansible/builtin/shell_module.html diff --git a/handlers/main.yml b/handlers/main.yml index f1db087..8b77084 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -10,6 +10,8 @@ stdin: '{{ prometheus_target_handler_command.stdin | default(omit) }}' stdin_add_newline: '{{ prometheus_target_handler_command.stdin_add_newline | default(omit) }}' become: '{{ prometheus_target_handler_command_become }}' + become_method: '{{ prometheus_target_handler_command_become_method | default(omit) }}' + become_user: '{{ prometheus_target_handler_command_become_user | default(omit) }}' delegate_to: '{{ prometheus_target_host }}' when: prometheus_target_handler_command_enabled @@ -24,5 +26,7 @@ stdin: '{{ prometheus_target_handler_shell.stdin | default(omit) }}' stdin_add_newline: '{{ prometheus_target_handler_shell.stdin_add_newline | default(omit) }}' become: '{{ prometheus_target_handler_shell_become }}' + become_method: '{{ prometheus_target_handler_shell_become_method | default(omit) }}' + become_user: '{{ prometheus_target_handler_shell_become_user | default(omit) }}' delegate_to: '{{ prometheus_target_host }}' when: prometheus_target_handler_shell_enabled |