1 #####################################
2 ### someone"s ansible provisioner ###
3 #####################################
4 # Part of: https://git.somenet.org/root/pub/somesible.git
5 # 2017-2026 by someone <someone@somenet.org>
7 # Install munin-node and munin-async.
18 when: munin_node_setup | bool
22 - name: create munin-plugins dir
24 path: "/opt/somesible/munin-plugins"
29 when: munin_node_setup | bool
32 - name: copy custom plugins
35 dest: "/opt/somesible/munin-plugins/{{item.path}}"
40 - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/plugins.somesible/"
41 - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/plugins.somesible/"
42 - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/plugins.somesible/"
43 - "default/plugins.somesible/"
44 when: munin_node_setup | bool and item.state == "file"
45 notify: restart munin-node.service and munin-async.service
48 - name: list files in /etc/munin/plugins
49 shell: "ls -1 /etc/munin/plugins"
51 when: munin_node_setup | bool
55 - name: remove unmanaged files in /etc/munin/plugins
57 path: "/etc/munin/plugins/{{item}}"
59 with_items: "{{contents.stdout_lines}}"
60 when: munin_node_setup | bool and item not in munin_node_plugins.keys() | list and item not in munin_node_plugins_extra.keys() | list
61 notify: restart munin-node.service and munin-async.service
64 - name: symlink new files into /etc/munin/plugins
66 dest: "/etc/munin/plugins/{{item.key}}"
72 loop: "{{ lookup('dict', munin_node_plugins|combine(munin_node_plugins_extra)) }}"
73 when: munin_node_setup | bool
74 notify: restart munin-node.service and munin-async.service
77 - name: copy plugin-conf.d/munin-node
80 dest: "/etc/munin/plugin-conf.d/munin-node"
85 - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/plugin-confd.munin-node.conf"
86 - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/plugin-confd.munin-node.conf"
87 - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/plugin-confd.munin-node.conf"
88 - "default/plugin-confd.munin-node.conf"
89 when: munin_node_setup | bool
90 notify: restart munin-node.service and munin-async.service
93 - name: copy munin-node.conf
96 dest: "/etc/munin/munin-node.conf"
101 - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/munin-node.conf"
102 - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/munin-node.conf"
103 - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}munin-node.conf"
104 - "default/munin-node.conf"
105 when: munin_node_setup | bool
106 notify: restart munin-node.service and munin-async.service
109 - name: copy munin-node.service to /etc/systemd/system/
112 dest: "/etc/systemd/system/munin-node.service"
117 - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/munin-node.service"
118 - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/munin-node.service"
119 - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/munin-node.service"
120 - "default/munin-node.service"
121 when: munin_node_setup | bool
122 notify: restart munin-node.service and munin-async.service
125 - name: create munin-async home and fix ownership
127 path: "/var/lib/munin-async/"
132 when: munin_node_setup | bool
135 - name: create .ssh-dir
137 path: "/var/lib/munin-async/.ssh"
142 when: munin_node_setup | bool
145 - name: copy authorized_keys to /var/lib/munin-async/.ssh/authorized_keys
148 dest: "/var/lib/munin-async/.ssh/authorized_keys"
153 - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/authorized_keys"
154 - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/authorized_keys"
155 - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/authorized_keys"
156 - "default/authorized_keys"
157 when: munin_node_setup | bool
160 - name: copy munin-async.service to /etc/systemd/system/
163 dest: "/etc/systemd/system/munin-async.service"
168 - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/munin-async.service"
169 - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/munin-async.service"
170 - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/munin-async.service"
171 - "default/munin-async.service"
172 when: munin_node_setup | bool
173 notify: restart munin-node.service and munin-async.service
176 - name: enable and start munin-node.service
177 include_role: name="base/systemd/enable-and-start"
179 service_name: munin-node.service
180 when: munin_node_setup | bool
183 - name: enable and start munin-async.service
184 include_role: name="base/systemd/enable-and-start"
186 service_name: munin-async.service
187 when: munin_node_setup | bool