aboutsummaryrefslogtreecommitdiffstats
path: root/roles/space_server/tasks/avahi.yml
blob: ca0cf637b54123f7ed59fba44c6f53ceaaeadf4d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
---
- name: Configure avahi-daemon
  ini_file:
    path: '/etc/avahi/avahi-daemon.conf'
    no_extra_spaces: yes
    section: "{{ item.key.split('.',1)[0] }}"
    option:  "{{ item.key.split('.',1)[1] }}"
    value:   "{{ (item.value is string)|ternary(item.value,omit) }}"
    state:   "{{ (item.value is string)|ternary('present','absent') }}"
  with_dict:
    'server.host-name': '{{ hostname }}'
    'server.domain-name': 'local'
    'server.browse-domains': ''
    'server.use-ipv4': 'yes'
    'server.use-ipv6': 'yes'
    'server.allow-interfaces': 'lan11,lan12,lan14'
    'server.enable-dbus': 'yes'
    'server.disallow-other-stacks': 'yes'
    'wide-area.enable-wide-area': 'yes'
    'publish.disable-publishing': 'no'
    'publish.disable-user-service-publishing': 'no'
    'publish.publish-addresses': 'yes'
    'publish.publish-hinfo': 'yes'
    'publish.publish-workstation': 'no'
    'publish.publish-domain': 'yes'
    'publish.publish-dns-servers': '185.38.175.0,2a01:4262:1ab::'
    'publish.publish-resolv-conf-dns-servers': 'no'
    'reflector.enable-reflector': 'yes'
  notify:
  - restart avahi-daemon

- name: Configure hosts
  template:
    dest: '/etc/avahi/hosts'
    src: avahi-hosts.j2
    owner: root
    group: root
    mode: 0644
  notify:
  - restart avahi-daemon

- name: Enable avahi-daemon service
  systemd:
    name: avahi-daemon.service
    enabled: yes
    masked: no
    state: started
  when: not chroot
- name: '- when in chroot'
  command: systemctl enable avahi-daemon.service
  args:
    creates: '/etc/systemd/system/multi-user.target.wants/avahi-daemon.service'
  when: chroot

- name: Use nss-mdns
  lineinfile:
    path: '/etc/nsswitch.conf'
    regexp: '^hosts:'
    line: 'hosts:      files myhostname mdns_minimal [NOTFOUND=return] dns'

# vim: set ts=2 sw=2 et: