homeserver/roles/mgrote.dnsmasq_adblocker/tasks/install.yml
mg 97bb9043a2 dnsmasq: logrotate file-owner auf root gesetzt (#306)
---
error: Ignoring /etc/logrotate.d/dnsmasq because the file owner is wrong
(should be root or user with uid 0).

Co-authored-by: Michael Grote <michael.grote@posteo.de>
Reviewed-on: mg/ansible#306
Co-authored-by: mg <michael.grote@posteo.de>
Co-committed-by: mg <michael.grote@posteo.de>
2022-01-16 10:30:20 +01:00

62 lines
1.4 KiB
YAML

---
- name: ensure packages are installed
become: yes
ansible.builtin.package:
name:
- dnsmasq
- wget
state: present
register: install
- name: stop dnsmasq (to prevent accidental DHCP-Server after installation)
become: yes
ansible.builtin.service:
name: dnsmasq
state: stopped
when: install.changed
- name: ensure group exists
become: true
ansible.builtin.group:
name: "{{ dnsmasq_user_group }}"
state: present
when:
- dnsmasq_user_group is defined
- name: ensure user exists
become: true
ansible.builtin.user:
name: "{{ dnsmasq_user }}"
group: "{{ dnsmasq_user_group }}"
shell: /usr/sbin/nologin
create_home: no
when:
- dnsmasq_user_group is defined
- dnsmasq_user is defined
- name: ensure needed directories exists
become: yes
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: "{{ dnsmasq_user }}"
group: "{{ dnsmasq_user_group }}"
loop:
- /etc/dnsmasq.d
- /etc/dnsmasq.d/blocklists
- name: clear default directories
become: yes
ansible.builtin.file:
path: "{{ item }}"
state: absent
loop:
- /etc/dnsmasq.d/README
- name: template logrotate config
become: yes
ansible.builtin.template:
src: logrotate.j2
dest: /etc/logrotate.d/dnsmasq
owner: root
group: root