Skip to content

Commit 8b4f8ed

Browse files
committed
first
0 parents  commit 8b4f8ed

File tree

9 files changed

+198
-0
lines changed

9 files changed

+198
-0
lines changed

README.md

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
Ansible role: avahi
2+
=========
3+
4+
Install and configure avahi-daemon.
5+
6+
Requirements
7+
------------
8+
9+
Ansible `hash_behaviour` should be set to `merge`.
10+
11+
Role Variables
12+
--------------
13+
14+
15+
- `avahi__hostname`: (string)
16+
avahi hostname
17+
default: $ansible_nodename
18+
- `avahi__domain`: (string)
19+
avahi domain
20+
default: local
21+
- `avahi__useipv4`: (string)
22+
if avahi should bind to ipv4 address should be 'yes' of 'no' as **string**
23+
default: 'yes'
24+
- `avahi__useipv6`: (string)
25+
if avahi should bind to ipv4 address should be 'yes' of 'no' as **string**
26+
default: 'no'
27+
28+
Dependencies
29+
------------
30+
31+
None.
32+
33+
Example Playbook
34+
----------------
35+
36+
```yaml
37+
- hosts: all
38+
become: yes
39+
vars:
40+
hostname: login # hostname will be used by avahi role as $ansible_nodename
41+
avahi__domain: example.local # subdomain too! Yay!
42+
43+
pre_tasks:
44+
- name: set hostname
45+
hostname: name={{hostname}}
46+
47+
roles:
48+
- avahi
49+
```
50+
51+
License
52+
-------
53+
54+
MIT
55+
56+
Author Information
57+
------------------
58+
59+
Edoardo Tenani - [http://about.me/edoardo.tenani](http://about.me/edoardo.tenani)

defaults/main.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
3+
avahi__hostname: "{{ansible_nodename}}"
4+
avahi__domain: local
5+
avahi__useipv4: 'yes'
6+
avahi__useipv6: 'no'

handlers/main.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
3+
- name: restart avahi-daemon
4+
service: name=avahi-daemon state=restarted
5+
tags: ['avahi']

meta/main.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
galaxy_info:
3+
author: Edoardo Tenani
4+
description: Install and configure Avahi Daemon
5+
6+
# If the issue tracker for your role is not on github, uncomment the
7+
# next line and provide a value
8+
issue_tracker_url: https://github.com/endorama/ansible-avahi/issues
9+
10+
license: MIT
11+
12+
min_ansible_version: 2.0
13+
14+
platforms:
15+
- name: Ubuntu
16+
versions:
17+
- all
18+
- name: Debian
19+
versions:
20+
- all
21+
22+
galaxy_tags: []
23+
# List tags for your role here, one per line. A tag is
24+
# a keyword that describes and categorizes the role.
25+
# Users find roles by searching for tags. Be sure to
26+
# remove the '[]' above if you add tags to this list.
27+
#
28+
# NOTE: A tag is limited to a single word comprised of
29+
# alphanumeric characters. Maximum 20 tags per role.
30+
31+
dependencies: []

tasks/avahi.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
3+
- name: ensure avahi is installed
4+
apt: name={{item}} state=present
5+
with_items:
6+
- avahi-daemon
7+
- avahi-utils
8+
- avahi-dnsconfd
9+
- libavahi-core-dev
10+
11+
- name: update avahi config
12+
template:
13+
src: avahi-daemon.conf.j2
14+
dest: /etc/avahi/avahi-daemon.conf
15+
owner: root
16+
group: root
17+
mode: 0644
18+
notify:
19+
- restart avahi-daemon
20+
21+
- name: ensure avahi-daemon is running, and starts on boot
22+
service: name=avahi-daemon state=started enabled=yes

tasks/main.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
3+
- include: avahi.yml
4+
tags: ['avahi']

templates/avahi-daemon.conf.j2

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# {{ ansible_managed }}
2+
# Local modifications will be lost.
3+
4+
# This file is part of avahi__
5+
#
6+
# avahi is free software; you can redistribute it and/or modify it
7+
# under the terms of the GNU Lesser General Public License as
8+
# published by the Free Software Foundation; either version 2 of the
9+
# License, or (at your option) any later version.
10+
#
11+
# avahi is distributed in the hope that it will be useful, but WITHOUT
12+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13+
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14+
# License for more details.
15+
#
16+
# You should have received a copy of the GNU Lesser General Public
17+
# License along with avahi; if not, write to the Free Software
18+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19+
# USA.
20+
21+
# See avahi-daemon.conf(5) for more information on this configuration
22+
# file!
23+
24+
[server]
25+
host-name={{avahi__hostname}}
26+
domain-name={{avahi__domain}}
27+
#browse-domains=0pointer.de, zeroconf.org
28+
use-ipv4={{avahi__useipv4}}
29+
use-ipv6={{avahi__useipv6}}
30+
#allow-interfaces=eth0
31+
#deny-interfaces=eth1
32+
#check-response-ttl=no
33+
#use-iff-running=no
34+
#enable-dbus=yes
35+
#disallow-other-stacks=no
36+
#allow-point-to-point=no
37+
38+
[wide-area]
39+
enable-wide-area=yes
40+
41+
[publish]
42+
#disable-publishing=no
43+
#disable-user-service-publishing=no
44+
#add-service-cookie=no
45+
#publish-addresses=yes
46+
#publish-hinfo=yes
47+
#publish-workstation=yes
48+
#publish-domain=yes
49+
#publish-dns-servers=192.168.50.1, 192.168.50.2
50+
#publish-resolv-conf-dns-servers=yes
51+
#publish-aaaa-on-ipv4=yes
52+
#publish-a-on-ipv6=no
53+
54+
[reflector]
55+
#enable-reflector=no
56+
#reflect-ipv=no
57+
58+
[rlimits]
59+
#rlimit-as=
60+
rlimit-core=0
61+
rlimit-data=4194304
62+
rlimit-fsize=0
63+
rlimit-nofile=300
64+
rlimit-stack=4194304
65+
rlimit-nproc=3

tests/inventory

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
localhost

tests/test.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
- hosts: localhost
3+
remote_user: root
4+
roles:
5+
- avahi

0 commit comments

Comments
 (0)