Add role for services
This commit is contained in:
parent
1191dd2534
commit
cdc9f519f0
9 changed files with 171 additions and 0 deletions
6
roles/services/tasks/main.yaml
Normal file
6
roles/services/tasks/main.yaml
Normal file
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
- tags: services_siahsd
|
||||
import_tasks: siahsd.yaml
|
||||
|
||||
- tags: services_spacestated
|
||||
import_tasks: spacestated.yaml
|
36
roles/services/tasks/siahsd.yaml
Normal file
36
roles/services/tasks/siahsd.yaml
Normal file
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
# TODO: Install and build
|
||||
|
||||
- name: Create log dir
|
||||
file:
|
||||
path: /var/log/siahsd
|
||||
state: directory
|
||||
owner: siahsd
|
||||
group: nogroup
|
||||
|
||||
- name: Install service file
|
||||
template:
|
||||
src: siahsd.service
|
||||
dest: /etc/systemd/system/siahsd.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
notify: restart siahsd
|
||||
|
||||
- name: Start siahsd
|
||||
systemd:
|
||||
name: siahsd
|
||||
state: started
|
||||
enabled: yes
|
||||
daemon_reload: true
|
||||
|
||||
- name: Allow siahsd traffic
|
||||
iptables:
|
||||
chain: INPUT
|
||||
protocol: udp
|
||||
destination_port: "4000"
|
||||
jump: ACCEPT
|
||||
ip_version: "{{ item }}"
|
||||
action: insert
|
||||
with_items: [ ipv4, ipv6 ]
|
||||
notify: persist iptables
|
30
roles/services/tasks/spacestated.yaml
Normal file
30
roles/services/tasks/spacestated.yaml
Normal file
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
- name: Install mqtt-simple
|
||||
command: cpan Net::MQTT::Simple
|
||||
|
||||
- name: Install dependencies
|
||||
apt:
|
||||
name: [ php-cli, php-snmp ]
|
||||
|
||||
- name: Add user
|
||||
user:
|
||||
name: spacestated
|
||||
home: /var/lib/spacestated
|
||||
generate_ssh_key: yes
|
||||
ssh_key_type: ed25519
|
||||
|
||||
- name: Clone source
|
||||
git:
|
||||
repo: https://github.com/bitlair/spacestated.git
|
||||
version: main
|
||||
dest: /var/lib/spacestated/spacestated
|
||||
accept_hostkey: yes
|
||||
|
||||
- name: Install service file
|
||||
template:
|
||||
src: spacestated.service
|
||||
dest: /etc/systemd/system/spacestated.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
notify: restart spacestated
|
Loading…
Add table
Add a link
Reference in a new issue