File tree Expand file tree Collapse file tree 12 files changed +77
-11
lines changed
Expand file tree Collapse file tree 12 files changed +77
-11
lines changed Original file line number Diff line number Diff line change 8181 - elasticsearch_metrics_provider == 'pcp'
8282 - elasticsearch_export_metrics | d(false) | bool
8383
84+ - name : Determine if host is booted
85+ # noqa command-instead-of-module
86+ command : systemctl is-system-running
87+ register : __system_running
88+ changed_when : false
89+ check_mode : false
90+ failed_when : false
91+
8492- name : Ensure PCP Elasticsearch export is running and enabled on boot
8593 service :
8694 name : pcp2elasticsearch
87- state : started
95+ state : " {{ ' started' if __system_running.stdout != 'offline' else omit }} "
8896 enabled : true
8997 ignore_errors : true # noqa ignore-errors
9098 # Elasticsearch server may be running remotely or presently down
Original file line number Diff line number Diff line change 55 service :
66 name : grafana-server
77 state : restarted
8+ when : __grafana_is_booted | bool
Original file line number Diff line number Diff line change 2424 set_fact :
2525 __ansible_pcp_is_ostree : " {{ __ostree_booted_stat.stat.exists }}"
2626
27+ - name : Determine if host is booted
28+ # noqa command-instead-of-module
29+ command : systemctl is-system-running
30+ register : __is_system_running
31+ changed_when : false
32+ check_mode : false
33+ failed_when : false
34+
35+ - name : Set flag to indicate that systemd runtime operations are available
36+ set_fact :
37+ __grafana_is_booted : " {{ __is_system_running.stdout != 'offline' }}"
38+
2739- name : Install Grafana packages
2840 package :
2941 name : " {{ __grafana_packages + __grafana_packages_extra }}"
7284- name : Ensure graphing service is running and enabled on boot
7385 service :
7486 name : grafana-server
75- state : started
87+ state : " {{ ' started' if __grafana_is_booted else omit }} "
7688 enabled : true
7789
7890# yamllint disable rule:line-length
Original file line number Diff line number Diff line change 55 service :
66 name : " {{ __keyserver_name }}"
77 state : restarted
8+ when : __keyserver_is_booted | bool
Original file line number Diff line number Diff line change 2828 set_fact :
2929 __ansible_pcp_is_ostree : " {{ __ostree_booted_stat.stat.exists }}"
3030
31+ - name : Determine if host is booted
32+ # noqa command-instead-of-module
33+ command : systemctl is-system-running
34+ register : __is_system_running
35+ changed_when : false
36+ check_mode : false
37+ failed_when : false
38+
39+ - name : Set flag to indicate that systemd runtime operations are available
40+ set_fact :
41+ __keyserver_is_booted : " {{ __is_system_running.stdout != 'offline' }}"
42+
3143- name : Install key server packages
3244 package :
3345 name : " {{ __keyserver_packages + __keyserver_packages_extra }}"
6880- name : Ensure key server service is running and enabled on boot
6981 service :
7082 name : " {{ __keyserver_name }}"
71- state : started
83+ state : " {{ ' started' if __keyserver_is_booted else omit }} "
7284 enabled : true
Original file line number Diff line number Diff line change 55 service :
66 name : pmcd
77 state : restarted
8+ when : __pcp_is_booted | bool
89
910- name : Restart pmie
1011 service :
1112 name : pmie
1213 state : restarted
14+ when : __pcp_is_booted | bool
1315
1416- name : Restart pmproxy
1517 service :
1618 name : pmproxy
1719 state : restarted
20+ when : __pcp_is_booted | bool
1821
1922- name : Restart pmlogger
2023 service :
2124 name : pmlogger
2225 state : restarted
26+ when : __pcp_is_booted | bool
Original file line number Diff line number Diff line change 2424 set_fact :
2525 __ansible_pcp_is_ostree : " {{ __ostree_booted_stat.stat.exists }}"
2626
27+ - name : Determine if system is booted with systemd
28+ when : __pcp_is_booted is not defined
29+ block :
30+ - name : Run systemctl
31+ # noqa command-instead-of-module
32+ command : systemctl is-system-running
33+ register : __is_system_running
34+ changed_when : false
35+ check_mode : false
36+ failed_when : false
37+
38+ - name : Require installed systemd
39+ fail :
40+ msg : " Error: This role requires systemd to be installed."
41+ when : ' "No such file or directory" in __is_system_running.msg | d("")'
42+
43+ - name : Set flag to indicate that systemd runtime operations are available
44+ set_fact :
45+ __pcp_is_booted : " {{ __is_system_running.stdout != 'offline' }}"
46+
2747- name : Install Performance Co-Pilot packages
2848 package :
2949 name : " {{ __pcp_packages + __pcp_packages_extra + pcp_optional_packages }}"
Original file line number Diff line number Diff line change 116116- name : Ensure performance metric collector is running and enabled on boot
117117 service :
118118 name : pmcd
119- state : started
119+ state : " {{ ' started' if __pcp_is_booted else omit }} "
120120 enabled : true
121121 when : not __pcp_restart_pmcd | bool
122122
123123- name : Ensure performance metric collector is restarted and enabled on boot
124124 service :
125125 name : pmcd
126- state : restarted
126+ state : " {{ ' restarted' if __pcp_is_booted else omit }} "
127127 enabled : true
128128 when : __pcp_restart_pmcd | bool
Original file line number Diff line number Diff line change 127127- name : Ensure performance metric inference is running and enabled on boot
128128 service :
129129 name : pmie
130- state : started
130+ state : " {{ ' started' if __pcp_is_booted else omit }} "
131131 enabled : true
132132 when : not __pcp_restart_pmie | bool
133133
134134- name : Ensure performance metric inference is restarted and enabled on boot
135135 service :
136136 name : pmie
137- state : restarted
137+ state : " {{ ' restarted' if __pcp_is_booted else omit }} "
138138 enabled : true
139139 when : __pcp_restart_pmie | bool
Original file line number Diff line number Diff line change 5858- name : Ensure performance metric logging is running and enabled on boot
5959 service :
6060 name : pmlogger
61- state : started
61+ state : " {{ ' started' if __pcp_is_booted else omit }} "
6262 enabled : true
6363 when : not __pcp_restart_pmlogger | bool
6464
6565- name : Ensure performance metric logging is restarted and enabled on boot
6666 service :
6767 name : pmlogger
68- state : restarted
68+ state : " {{ ' restarted' if __pcp_is_booted else omit }} "
6969 enabled : true
7070 when : __pcp_restart_pmlogger | bool
You can’t perform that action at this time.
0 commit comments