ansible/roles/adam/tasks/main.yml

53 lines
1.4 KiB
YAML
Raw Normal View History

2020-06-09 01:13:19 -05:00
#!/usr/bin/ansible-playbook
# vim:ft=ansible:
- name: Set up Adam
block:
- name: Install Node
apt:
name:
- nodejs
- npm
- name: Create Adam user
user:
name: discord-adam
- name: Assure data directory
file:
path: "/var/adam"
mode: 0755
owner: root
group: root
- name: Create specific data directory
file:
path: "/var/adam/{{ adam_name }}"
state: directory
mode: 0755
owner: discord-adam
group: discord-adam
- name: Set up bot root
block:
- 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"
mode: "0700"
owner: discord-adam
group: discord-adam
- 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