1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 19:52:06 +00:00
iiab/roles/network/tasks/avahi.yml

54 lines
1.7 KiB
YAML
Raw Normal View History

2018-10-08 22:09:49 +00:00
- name: Create a user for avahi (debuntu)
user:
name: avahi
createhome: no
shell: /bin/false
2019-05-24 07:06:43 +00:00
when: is_debuntu | bool
2017-05-27 18:09:50 +00:00
2018-10-08 22:09:49 +00:00
- name: Install avahi announce config file /etc/avahi/services/schoolserver.service
template:
src: avahi/schoolserver.service
dest: /etc/avahi/services/schoolserver.service
owner: avahi
group: avahi
mode: 0640
#when: 'gui_wan == True'
when: ports_externally_visible|int >= 2
# Where "2" means "ssh + http-or-https (for Admin Console's box.lan/admin too)"
# SEE ~18 line explanation in box near:
2019-05-23 23:42:40 +00:00
# https://github.com/iiab/iiab/blob/master/roles/network/templates/gateway/iiab-gen-iptables#L3-L20
# IF >= 2, Admin Console $gui_port from 0-init determines which port (http-or-https) is opened here:
2019-05-23 23:42:40 +00:00
# https://github.com/iiab/iiab/blob/master/roles/network/templates/gateway/iiab-gen-iptables#L133-L138
2017-05-27 18:09:50 +00:00
2018-10-08 22:09:49 +00:00
- name: Find avahi_ver for clean copy of ssh.service (not debuntu)
shell: "ls /usr/share/doc/ | grep avahi | head -n1"
2017-05-27 18:09:50 +00:00
register: avahi_ver
ignore_errors: True
changed_when: False
2018-10-08 23:14:10 +00:00
# when: not is_debuntu # would cause failures 6 lines below
2018-10-08 22:09:49 +00:00
- name: Grab a clean copy of ssh.service (not debuntu)
copy:
src: '/usr/share/doc/{{ avahi_ver.stdout }}/ssh.service'
dest: /etc/avahi/services/
2017-05-27 23:10:45 +00:00
when: avahi_ver.stdout != "" and not is_debuntu
2017-05-27 18:09:50 +00:00
2018-10-08 22:09:49 +00:00
- name: Grab a clean copy of ssh.service (debuntu)
copy:
src: /usr/share/doc/avahi-daemon/examples/ssh.service
dest: /etc/avahi/services/
2019-05-24 07:06:43 +00:00
when: is_debuntu | bool
2017-05-27 18:09:50 +00:00
2017-10-27 16:12:05 +00:00
- name: Set ssh port for avahi
2018-10-08 22:09:49 +00:00
lineinfile:
dest: /etc/avahi/services/ssh.service
regexp: '</port>$'
line: ' <port>{{ sshd_port }}</port>'
2018-10-08 22:09:49 +00:00
state: present
backrefs: yes
2017-05-27 18:09:50 +00:00
- name: Enable avahi service
2018-10-08 22:09:49 +00:00
service:
name: avahi-daemon
enabled: yes