1 #####################################
2 ### someone"s ansible provisioner ###
3 #####################################
4 # Part of: https://git.somenet.org/root/pub/somesible.git
5 # 2017-2025 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.service to /etc/systemd/system/
96 dest: "/etc/systemd/system/munin-node.service"
101 - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/munin-node.service"
102 - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/munin-node.service"
103 - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/munin-node.service"
104 - "default/munin-node.service"
105 when: munin_node_setup | bool
106 notify: restart munin-node.service and munin-async.service
109 - name: create munin-async home and fix ownership
111 path: "/var/lib/munin-async/"
116 when: munin_node_setup | bool
119 - name: create .ssh-dir
121 path: "/var/lib/munin-async/.ssh"
126 when: munin_node_setup | bool
129 - name: copy authorized_keys to /var/lib/munin-async/.ssh/authorized_keys
132 dest: "/var/lib/munin-async/.ssh/authorized_keys"
137 - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/authorized_keys"
138 - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/authorized_keys"
139 - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/authorized_keys"
140 - "default/authorized_keys"
141 when: munin_node_setup | bool
144 - name: copy munin-async.service to /etc/systemd/system/
147 dest: "/etc/systemd/system/munin-async.service"
152 - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/munin-async.service"
153 - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/munin-async.service"
154 - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/munin-async.service"
155 - "default/munin-async.service"
156 when: munin_node_setup | bool
157 notify: restart munin-node.service and munin-async.service
160 - name: enable and start munin-node.service
161 include_role: name="base/systemd/enable-and-start"
163 service_name: munin-node.service
164 when: munin_node_setup | bool
167 - name: enable and start munin-async.service
168 include_role: name="base/systemd/enable-and-start"
170 service_name: munin-async.service
171 when: munin_node_setup | bool