aboutsummaryrefslogtreecommitdiffstats
path: root/roles/space_server/tasks/avahi.yml
blob: db8a5ee952dbb101ae74b17bce6b337ba75e238b (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
---
- name: Install avahi and tools
  dnf:
    name: avahi-tools # pulls in avahi package
    state: latest
  notify:
    - restart avahi-daemon
  tags:
    - packages

- name: Install nss-mdns package
  dnf:
    name: nss-mdns
    state: latest
  tags:
    - packages

- name: Configure avahi-daemon
  ini_file:
    path: /etc/avahi/avahi-daemon.conf
    no_extra_spaces: yes
    section: '{{ item.section }}'
    option: '{{ item.option }}'
    value: '{{ item.value }}'
  with_items:
    - section: server
      option: 'host-name'
      value: '{{ hostname }}'
    - section: server
      option: 'domain-name'
      value: 'local'
    - section: server
      option: 'browse-domains'
      value: ''
    - section: server
      option: 'use-ipv4'
      value: 'yes'
    - section: server
      option: 'use-ipv6'
      value: 'yes'
    - section: server
      option: 'allow-interfaces'
      value: 'lan11,lan12,lan14'
    - section: server
      option: 'enable-dbus'
      value: 'yes'
    - section: server
      option: 'disallow-other-stacks'
      value: 'yes'
    - section: wide-area
      option: 'enable-wide-area'
      value: 'yes'
    - section: publish
      option: 'disable-publishing'
      value: 'no'
    - section: publish
      option: 'disable-user-service-publishing'
      value: 'no'
    - section: publish
      option: 'publish-addresses'
      value: 'yes'
    - section: publish
      option: 'publish-hinfo'
      value: 'yes'
    - section: publish
      option: 'publish-workstation'
      value: 'no'
    - section: publish
      option: 'publish-domain'
      value: 'yes'
    - section: publish
      option: 'publish-dns-servers'
      value: '185.38.175.0,2a01:4260:1ab::'
    - section: publish
      option: 'publish-resolv-conf-dns-servers'
      value: 'no'
    - section: reflector
      option: 'enable-reflector'
      value: 'yes'
  notify:
    - restart avahi-daemon

- name: Configure hosts
  template:
    src: avahi/hosts.j2
    dest: '/etc/avahi/hosts'
  notify:
    - restart avahi-daemon

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

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

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