1 #####################################
2 ### someone"s ansible provisioner ###
3 #####################################
4 # Part of: https://git.somenet.org/root/pub/somesible.git
5 # 2017-2024 by someone <someone@somenet.org>
7 # Install munin-node and munin-async.
17 when: munin_node_setup | bool
21 - name: create munin-plugins dir
23 path: "/opt/somesible/munin-plugins"
28 when: munin_node_setup | bool
31 - name: copy custom plugins
34 dest: "/opt/somesible/munin-plugins/{{item.path}}"
39 - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/plugins.somesible/"
40 - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/plugins.somesible/"
41 - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/plugins.somesible/"
42 - "default/plugins.somesible/"
43 when: munin_node_setup | bool and item.state == "file"
44 notify: restart munin-node.service and munin-async.service
47 - name: list files in /etc/munin/plugins
48 shell: "ls -1 /etc/munin/plugins"
50 when: munin_node_setup | bool
54 - name: remove unmanaged files in /etc/munin/plugins
56 path: "/etc/munin/plugins/{{item}}"
58 with_items: "{{contents.stdout_lines}}"
59 when: munin_node_setup | bool and item not in munin_node_plugins.keys() | list and item not in munin_node_plugins_extra.keys() | list
60 notify: restart munin-node.service and munin-async.service
63 - name: symlink new files into /etc/munin/plugins
65 dest: "/etc/munin/plugins/{{item.key}}"
71 loop: "{{ lookup('dict', munin_node_plugins|combine(munin_node_plugins_extra)) }}"
72 when: munin_node_setup | bool
73 notify: restart munin-node.service and munin-async.service
76 - name: copy plugin-conf.d/munin-node
79 dest: "/etc/munin/plugin-conf.d/munin-node"
84 - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/plugin-confd.munin-node.conf"
85 - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/plugin-confd.munin-node.conf"
86 - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/plugin-confd.munin-node.conf"
87 - "default/plugin-confd.munin-node.conf"
88 when: munin_node_setup | bool
89 notify: restart munin-node.service and munin-async.service
92 - name: copy munin-node.service to /etc/systemd/system/
95 dest: "/etc/systemd/system/munin-node.service"
100 - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/munin-node.service"
101 - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/munin-node.service"
102 - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/munin-node.service"
103 - "default/munin-node.service"
104 when: munin_node_setup | bool
105 notify: restart munin-node.service and munin-async.service
108 - name: create munin-async home and fix ownership
110 path: "/var/lib/munin-async/"
115 when: munin_node_setup | bool
118 - name: create .ssh-dir
120 path: "/var/lib/munin-async/.ssh"
125 when: munin_node_setup | bool
128 - name: copy authorized_keys to /var/lib/munin-async/.ssh/authorized_keys
131 dest: "/var/lib/munin-async/.ssh/authorized_keys"
136 - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/authorized_keys"
137 - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/authorized_keys"
138 - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/authorized_keys"
139 - "default/authorized_keys"
140 when: munin_node_setup | bool
143 - name: copy munin-async.service to /etc/systemd/system/
146 dest: "/etc/systemd/system/munin-async.service"
151 - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/munin-async.service"
152 - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/munin-async.service"
153 - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/munin-async.service"
154 - "default/munin-async.service"
155 when: munin_node_setup | bool
156 notify: restart munin-node.service and munin-async.service
159 - name: enable and start munin-node.service
160 include_role: name="base/systemd/enable-and-start"
162 service_name: munin-node.service
163 when: munin_node_setup | bool
166 - name: enable and start munin-async.service
167 include_role: name="base/systemd/enable-and-start"
169 service_name: munin-async.service
170 when: munin_node_setup | bool