2018-09-11 14:20:44 +02:00
|
|
|
---
|
2018-09-14 12:58:44 +02:00
|
|
|
- name: set facts about Yanic
|
|
|
|
set_fact:
|
|
|
|
yanic_present: yes
|
|
|
|
|
2018-09-11 14:20:44 +02:00
|
|
|
- name: create Yanic system user
|
|
|
|
user:
|
|
|
|
name: "{{ yanic_user }}"
|
|
|
|
home: "{{ yanic_home }}"
|
|
|
|
shell: /bin/false
|
|
|
|
|
|
|
|
- name: create data dir
|
|
|
|
file:
|
|
|
|
path: "{{ yanic_home }}/data"
|
|
|
|
state: directory
|
|
|
|
owner: yanic
|
|
|
|
group: yanic
|
|
|
|
mode: 0755
|
|
|
|
|
|
|
|
- name: create database
|
|
|
|
influxdb_database:
|
|
|
|
database_name: "{{ yanic_database }}"
|
|
|
|
|
|
|
|
- name: write Yanic config
|
|
|
|
template:
|
|
|
|
src: "yanic.conf.j2"
|
|
|
|
dest: "{{ yanic_config }}"
|
|
|
|
notify: restart yanic
|
|
|
|
|
|
|
|
- name: create systemd unit for Yanic
|
|
|
|
template:
|
|
|
|
src: "yanic.service.j2"
|
|
|
|
dest: "/etc/systemd/system/yanic.service"
|
|
|
|
notify: reload systemd
|
|
|
|
|
2019-01-14 22:24:20 +01:00
|
|
|
- name: create Yanic source directory
|
|
|
|
file:
|
|
|
|
path: "{{ gopath }}/src/{{ yanic_src }}"
|
|
|
|
state: directory
|
|
|
|
|
|
|
|
- name: clone Yanic repository
|
|
|
|
git:
|
|
|
|
repo: "https://{{ yanic_src }}"
|
|
|
|
dest: "{{ gopath }}/src/{{ yanic_src }}"
|
|
|
|
force: true
|
|
|
|
|
|
|
|
- name: get required library versions
|
2019-03-14 15:35:47 +01:00
|
|
|
shell: "cd {{ gopath }}/src/{{ yanic_src }} && {{ gopath }}/bin/dep ensure"
|
|
|
|
environment:
|
|
|
|
GOPATH: "{{ gopath }}"
|
2019-01-14 22:24:20 +01:00
|
|
|
|
2018-09-11 14:20:44 +02:00
|
|
|
- name: build Yanic binary
|
2019-03-14 15:35:47 +01:00
|
|
|
shell: 'go install {{ gopath }}/src/{{ yanic_src }}'
|
|
|
|
environment:
|
|
|
|
GOPATH: "{{ gopath }}"
|
2018-09-11 14:20:44 +02:00
|
|
|
notify: restart yanic
|
|
|
|
|
|
|
|
- name: configure Yanic systemd unit
|
|
|
|
systemd:
|
|
|
|
name: "yanic.service"
|
|
|
|
enabled: yes
|
|
|
|
state: started
|