2020-06-09 01:13:19 -05:00
|
|
|
#!/usr/bin/ansible-playbook
|
|
|
|
# vim:ft=ansible:
|
|
|
|
- name: Set up Adam
|
|
|
|
block:
|
2020-06-09 01:29:20 -05:00
|
|
|
- name: Install required packages
|
2020-06-09 01:13:19 -05:00
|
|
|
apt:
|
|
|
|
name:
|
2020-06-09 01:19:04 -05:00
|
|
|
- libopus0
|
2020-06-09 01:13:19 -05:00
|
|
|
- nodejs
|
|
|
|
- npm
|
|
|
|
- name: Create Adam user
|
|
|
|
user:
|
|
|
|
name: discord-adam
|
|
|
|
- name: Assure data directory
|
|
|
|
file:
|
|
|
|
path: "/var/adam"
|
2020-06-09 01:14:57 -05:00
|
|
|
state: directory
|
2020-06-09 01:29:20 -05:00
|
|
|
# Sticky, SetGID
|
|
|
|
mode: 3775
|
2020-06-09 01:13:19 -05:00
|
|
|
owner: root
|
|
|
|
group: discord-adam
|
|
|
|
- name: Set up bot root
|
|
|
|
block:
|
2020-06-09 01:29:20 -05:00
|
|
|
- name: Create specific data directory
|
|
|
|
file:
|
|
|
|
path: "/var/adam/{{ adam_name }}"
|
|
|
|
state: directory
|
|
|
|
mode: 0755
|
2020-06-09 01:13:19 -05:00
|
|
|
- name: Clone bot repo
|
|
|
|
git:
|
|
|
|
repo: "{{ adam_repo }}"
|
|
|
|
dest: "/var/adam/{{ adam_name }}"
|
|
|
|
- name: Initialize NPM modules
|
|
|
|
npm:
|
|
|
|
path: "/var/adam/{{ adam_name }}"
|
|
|
|
- name: Template out authentication token
|
|
|
|
template:
|
|
|
|
src: "auth.json"
|
|
|
|
dest: "/var/adam/{{ adam_name }}/auth.json"
|
2020-06-09 01:31:45 -05:00
|
|
|
mode: "0600"
|
2020-06-09 01:29:20 -05:00
|
|
|
become: yes
|
|
|
|
become_user: discord-adam
|
|
|
|
- name: Set up system configuration
|
|
|
|
block:
|
2020-06-09 01:13:19 -05:00
|
|
|
- name: Template out service
|
|
|
|
template:
|
|
|
|
src: "adam@.service"
|
|
|
|
dest: "/etc/systemd/system/adam@.service"
|
|
|
|
- name: Start and enable service
|
|
|
|
systemd:
|
|
|
|
daemon_reload: yes
|
|
|
|
name: "adam@{{ adam_name }}.service"
|
|
|
|
enabled: yes
|
|
|
|
state: started
|
|
|
|
become: yes
|