|
31 | 31 | loop: "{{ __pcp_pmieconf_rules | default([]) }}" |
32 | 32 | register: __pcp_register_changed_rules_for_hosts |
33 | 33 |
|
| 34 | +- name: Ensure performance rule actions are installed for targeted hosts |
| 35 | + set_fact: |
| 36 | + local_pmie: "default" |
| 37 | + |
| 38 | +- name: Check if global pmie webhook action is configured |
| 39 | + lineinfile: |
| 40 | + state: absent |
| 41 | + path: "{{ __pcp_pmie_config_path }}/config.{{ item }}" |
| 42 | + regexp: "//.*global webhook_action = yes" |
| 43 | + check_mode: true |
| 44 | + changed_when: false |
| 45 | + register: __pcp_global_webhook_action_status |
| 46 | + loop: "{{ pcp_target_hosts + [local_pmie] }}" |
| 47 | + when: |
| 48 | + - pcp_pmie_endpoint | length > 0 |
| 49 | + |
| 50 | +- name: Configure global webhook action |
| 51 | + # yamllint disable rule:line-length |
| 52 | + command: "pmieconf -f {{ __pcp_pmie_config_path }}/config.{{ item.item }} modify global webhook_action yes" |
| 53 | + loop: "{{ __pcp_global_webhook_action_status.results }}" |
| 54 | + changed_when: |
| 55 | + - pcp_pmie_endpoint | length > 0 |
| 56 | + - item.found == 0 |
| 57 | + when: |
| 58 | + - pcp_pmie_endpoint | length > 0 |
| 59 | + - item.found == 0 |
| 60 | + register: __pcp_register_changed_actions_for_hosts |
| 61 | + # yamllint enable rule:line-length |
| 62 | + |
| 63 | +- name: Check if global webhook endpoint is configured |
| 64 | + lineinfile: |
| 65 | + state: absent |
| 66 | + path: "{{ __pcp_pmie_config_path }}/config.{{ item }}" |
| 67 | + regexp: "//.*global webhook_endpoint = \"{{ pcp_pmie_endpoint }}\"" |
| 68 | + check_mode: true |
| 69 | + changed_when: false |
| 70 | + register: __pcp_global_webhook_endpoint_status |
| 71 | + loop: "{{ pcp_target_hosts + [local_pmie] }}" |
| 72 | + |
| 73 | +- name: Configure global webhook endpoint |
| 74 | + # yamllint disable rule:line-length |
| 75 | + command: "pmieconf -f {{ __pcp_pmie_config_path }}/config.{{ item.item }} modify global webhook_endpoint {{ pcp_pmie_endpoint }}" |
| 76 | + loop: "{{ __pcp_global_webhook_endpoint_status.results }}" |
| 77 | + changed_when: |
| 78 | + - pcp_pmie_endpoint | length > 0 |
| 79 | + - item.found == 0 |
| 80 | + when: |
| 81 | + - pcp_pmie_endpoint | length > 0 |
| 82 | + - item.found == 0 |
| 83 | + register: __pcp_register_changed_actions_for_hosts |
| 84 | + # yamllint enable rule:line-length |
| 85 | + |
34 | 86 | - name: Ensure extra rules symlinks have been created for targeted hosts |
35 | 87 | file: |
36 | 88 | src: "{{ __pcp_pmieconf_path }}/{{ item }}" |
|
67 | 119 | __pcp_register_changed_group_dir is changed or |
68 | 120 | __pcp_register_changed_group_link_dir is changed or |
69 | 121 | __pcp_register_changed_rules_for_hosts is changed or |
| 122 | + __pcp_register_changed_actions_for_hosts is changed or |
70 | 123 | __pcp_register_changed_symlinks_for_hosts is changed or |
71 | 124 | __pcp_register_changed_target_hosts_controld is changed or |
72 | 125 | __pcp_register_changed_target_hosts_single is changed }}" |
|
0 commit comments