ansible-base/roles/vavrusa.knot/tasks/from_source.yml
2020-08-15 12:00:29 +02:00

55 lines
1.6 KiB
YAML

---
# Fetch dependencies (platform-specific)
- name: install dependencies
apt: pkg={{ item }} update_cache=yes cache_valid_time=86400 state=present
loop:
- gcc
- make
- libc6-dev
- libtool
- autoconf
- liburcu-dev
- libgnutls28-dev
- libjansson-dev
when: ansible_os_family == "Debian"
- name: dependencies (FreeBSD)
pkgng: name={{ item }} state=present
loop:
- security/nettle
- security/gnutls
- devel/jansson
- sysutils/liburcu
- databases/lmdb
when: ansible_os_family == "FreeBSD"
# Clone and build from sources
- name: git clone
git: repo=http://gitlab.labs.nic.cz/labs/knot.git dest=/usr/local/src/knot version={{ knot_git_branch }} update=yes
- name: configure
shell: autoreconf -if && ./configure --prefix={{ knot_install_dir }} chdir=/usr/local/src/knot creates=/usr/local/src/knot/Makefile
- name: build
command: make -j{{ansible_processor_count}} chdir=/usr/local/src/knot creates=/usr/local/src/knot/src/knotd
- name: install
command: make install chdir=/usr/local/src/knot creates={{ knot_install_dir }}/sbin/knotd
# Post-installation
- name: add knot group
group:
name={{ knot_group }}
comment="Knot DNS"
- name: add knot user
user:
name={{ knot_user }}
comment="Knot DNS"
home={{ knot_install_dir }}
shell=/bin/false
groups={{knot_group}}
system=yes
- name: make sure directories are writeable
file: path={{ item }} state=directory owner={{ knot_user }}
with_items:
- "{{ knot_install_dir }}/etc/knot"
- "{{ knot_install_dir }}/var/lib/knot"
- "{{ knot_install_dir }}/var/run/lib/knot"