aboutsummaryrefslogtreecommitdiffstats
path: root/tasks
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2025-10-07 15:51:43 +0300
committerJan Tuomi <jan@jantuomi.fi>2025-10-07 15:51:43 +0300
commite037ecfa8cc0133a84fbed791b7658c474c3e748 (patch)
tree5305efc6c4b51caeeade79b172a1faab915a1d4e /tasks
parent1b9ed1426e93c335c3ffa7836813cb109b89ee22 (diff)
Add hommabot jail
Diffstat (limited to 'tasks')
-rw-r--r--tasks/jail_diddle.yml6
-rw-r--r--tasks/jail_hommabot.yml62
-rw-r--r--tasks/jail_ingress.yml2
3 files changed, 66 insertions, 4 deletions
diff --git a/tasks/jail_diddle.yml b/tasks/jail_diddle.yml
index ccc1c4b..73424f5 100644
--- a/tasks/jail_diddle.yml
+++ b/tasks/jail_diddle.yml
@@ -1,4 +1,4 @@
-- name: Install packages inside ingress jail
+- name: Install packages inside jail
loop:
- { jail: diddle, package: python311 }
- { jail: diddle, package: py311-sqlite3 }
@@ -7,14 +7,14 @@
- name: Install clone.sh
template:
- src: diddle/root_clone.sh
+ src: root_clone.sh
dest: /usr/local/jails/containers/diddle/root/clone.sh
owner: root
group: wheel
mode: "0755"
- name: Clone & update diddle
- shell: jexec diddle sh /root/clone.sh
+ shell: jexec diddle sh /root/clone.sh https://github.com/jantuomi/diddle.git /root/diddle
register: diddle_git
changed_when: diddle_git.rc == 100
failed_when: diddle_git.rc != 0 and diddle_git.rc != 100
diff --git a/tasks/jail_hommabot.yml b/tasks/jail_hommabot.yml
new file mode 100644
index 0000000..b86d5d6
--- /dev/null
+++ b/tasks/jail_hommabot.yml
@@ -0,0 +1,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
diff --git a/tasks/jail_ingress.yml b/tasks/jail_ingress.yml
index d5cb2e7..794c66a 100644
--- a/tasks/jail_ingress.yml
+++ b/tasks/jail_ingress.yml
@@ -1,4 +1,4 @@
-- name: Install packages inside ingress jail
+- name: Install packages inside jail
loop:
- { jail: ingress, package: nginx }
- { jail: ingress, package: py311-certbot }