|
9 | 9 | group: root |
10 | 10 | mode: 0755 |
11 | 11 | loop: "{{ __pcp_pmieconf_groups|default([]) }}" |
| 12 | + register: __pcp_register_changed_group_dir |
12 | 13 |
|
13 | 14 | - name: Ensure extra performance rule group link directories exist |
14 | 15 | file: |
|
18 | 19 | group: root |
19 | 20 | mode: 0755 |
20 | 21 | loop: "{{ __pcp_pmieconf_groups|default([]) }}" |
| 22 | + register: __pcp_register_changed_group_link_dir |
21 | 23 |
|
22 | 24 | - name: Ensure extra performance rules are installed for targeted hosts |
23 | 25 | copy: |
|
27 | 29 | group: root |
28 | 30 | mode: '0644' |
29 | 31 | loop: "{{ __pcp_pmieconf_rules|default([]) }}" |
| 32 | + register: __pcp_register_changed_rules_for_hosts |
30 | 33 |
|
31 | 34 | - name: Ensure extra rules symlinks have been created for targeted hosts |
32 | 35 | file: |
|
35 | 38 | state: link |
36 | 39 | force: yes |
37 | 40 | loop: "{{ __pcp_pmieconf_rules|default([]) }}" |
| 41 | + register: __pcp_register_changed_symlinks_for_hosts |
38 | 42 |
|
39 | 43 | - name: Enable performance metric inference for targeted hosts (with control.d) |
40 | 44 | template: |
41 | 45 | src: pmie.controld.j2 |
42 | 46 | dest: "{{ __pcp_pmie_control_d_path }}/{{ item }}" |
43 | 47 | mode: 0644 |
44 | 48 | loop: "{{ pcp_target_hosts|default([]) }}" |
45 | | - notify: restart pmie |
| 49 | + register: __pcp_register_changed_target_hosts_controld |
46 | 50 | when: |
47 | 51 | - not pcp_single_control|d(false)|bool |
48 | 52 | - pcp_target_hosts|d([]) |
|
52 | 56 | src: pmie.control.j2 |
53 | 57 | dest: "{{ __pcp_pmie_control_path }}" |
54 | 58 | mode: 0644 |
55 | | - notify: restart pmie |
| 59 | + register: __pcp_register_changed_target_hosts_single |
56 | 60 | when: |
57 | 61 | - pcp_single_control|d(true)|bool |
58 | 62 | - pcp_target_hosts|d([]) |
59 | 63 |
|
| 64 | +- name: Set variable to do pmie restart if needed |
| 65 | + set_fact: |
| 66 | + __pcp_restart_pmie: "{{ |
| 67 | + __pcp_register_changed_group_dir is changed or |
| 68 | + __pcp_register_changed_group_link_dir is changed or |
| 69 | + __pcp_register_changed_rules_for_hosts is changed or |
| 70 | + __pcp_register_changed_symlinks_for_hosts is changed or |
| 71 | + __pcp_register_changed_target_hosts_controld is changed or |
| 72 | + __pcp_register_changed_target_hosts_single is changed |
| 73 | + }}" |
| 74 | + |
60 | 75 | - name: Ensure performance metric inference is running and enabled on boot |
61 | 76 | service: |
62 | 77 | name: pmie |
63 | 78 | state: started |
64 | 79 | enabled: yes |
| 80 | + when: not __pcp_restart_pmie | bool |
| 81 | + |
| 82 | +- name: Ensure performance metric inference is restarted and enabled on boot |
| 83 | + service: |
| 84 | + name: pmie |
| 85 | + state: restarted |
| 86 | + enabled: yes |
| 87 | + when: __pcp_restart_pmie | bool |
0 commit comments