aboutsummaryrefslogtreecommitdiffstats
path: root/tasks/jail_hommabot.yml
blob: b86d5d657f1fd20380ccab9d013b174a2187a2e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
- name: Install packages inside jail
  loop:
    - { jail: hommabot, package: npm }
  include_tasks: pkg_jail_install.yml

- name: Build hommabot on this machine
  delegate_to: localhost
  shell: |
    cd ../hommabot2
    npm run build

- name: Create hommabot directory
  file:
    path: /usr/local/jails/containers/hommabot/root/hommabot
    state: directory
    owner: root
    group: wheel
    mode: "0755"

- name: Install index.js
  copy:
    src: "{{ item }}"
    dest: /usr/local/jails/containers/hommabot/root/hommabot/
    owner: root
    group: wheel
    mode: "0644"
  loop:
    - "../hommabot2/build/index.js"
    - "../hommabot2/package.json"
    - "../hommabot2/package-lock.json"

- name: Install hommabot env file
  template:
    src: hommabot/root_hommabot_env.j2
    dest: /usr/local/jails/containers/hommabot/root/hommabot/.env
    owner: root
    group: wheel
    mode: "0600"

- name: Install deps.sh
  copy:
    src: templates/hommabot/root_hommabot_deps.sh
    dest: /usr/local/jails/containers/hommabot/root/hommabot/deps.sh
    owner: root
    group: wheel
    mode: "0755"

- name: Install dependencies
  shell: jexec hommabot /root/hommabot/deps.sh

- name: Set up crontab
  template:
    src: hommabot/etc_crontab.j2
    dest: /usr/local/jails/containers/hommabot/etc/crontab
    owner: root
    group: wheel
    mode: "0644"
  register: jail_hommabot_etc_crontab

- name: Restart cron
  shell: jexec hommabot service cron restart
  when: jail_hommabot_etc_crontab.changed