Page MenuHomeSealhub

No OneTemporary

Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None
diff --git a/tasks/backup.yml b/tasks/backup.yml
deleted file mode 100644
index aae7851..0000000
--- a/tasks/backup.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-- file:
- path: "/backup-dirs"
- state: touch
-
-- ansible.builtin.lineinfile:
- path: "/backup-dirs"
- line: "{{juice_sqlite_path}}"
diff --git a/tasks/main.yml b/tasks/main.yml
index bbd4a4e..919325f 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -1,83 +1,91 @@
- name: Download juicefs tarball
shell: "cd /tmp && wget https://github.com/juicedata/juicefs/releases/download/v1.3.0/juicefs-1.3.0-linux-amd64.tar.gz && tar -xzf juicefs-1.3.0-linux-amd64.tar.gz && install juicefs /usr/local/bin"
args:
creates: /usr/local/bin/juicefs
- name: Ensure dependencies are installed
apt:
name:
- curl
- jq
- python3-boto3
state: present
update_cache: yes
- name: Check if JuiceFS is already formatted
stat:
path: "/var/lib/juicefs/config.toml"
register: juicefs_config
- name: Ensure parent directories exist for a file
file:
path: "{{ juice_sqlite_path | dirname }}"
state: directory
mode: "0755"
- name: Format JuiceFS if not configured
when: not juicefs_config.stat.exists
command: >
juicefs format
--storage s3
--bucket "{{ juice_s3_endpoint }}/{{ juice_bucket_name }}"
--access-key "{{ juice_s3_access_key }}"
--secret-key "{{ juice_s3_secret_key }}"
"{{ juice_meta_url }}"
"{{ juice_fs_name }}"
args:
creates: "/var/lib/juicefs/config.toml"
+- file:
+ path: "/backup-dirs"
+ state: touch
+
+- ansible.builtin.lineinfile:
+ path: "/backup-dirs"
+ line: "{{juice_sqlite_path}}"
+
#
# commented out because of https://github.com/juicedata/juicefs/issues/6408
# - name: Mount JuiceFS
# command: >
# juicefs mount --update-fstab --attr-cache=1 --entry-cache=1 --dir-entry-cache=1 --negative-entry-cache=1 --buffer-size=1000 --prefetch=2 --writeback
# {{ juice_meta_url }}
# {{ juice_fs_mountpoint }}
# async: 10
# poll: 0
# when: not juicefs_config.stat.exists
# https://github.com/juicedata/juicefs/issues/4371
- name: symlink to juicefs binary for mount purposes
ansible.builtin.file:
src: /usr/local/bin/juicefs
dest: /sbin/mount.juicefs
state: link
- name: automount juicefs
ansible.posix.mount:
path: "{{ juice_fs_mountpoint }}"
src: "{{ juice_meta_url }}"
fstype: juicefs
# adding some docker options to the mount here to make docker wait for juice
opts: _netdev,attr-cache=600s,buffer-size=1000,dir-entry-cache=600s,entry-cache=600s,negative-entry-cache=600s,prefetch=2,writeback,x-systemd.before=docker.service
state: mounted
# to make sure docker loads after juicefs:
- name: Create systemd override directory for docker.service
file:
path: /etc/systemd/system/docker.service.d
state: directory
mode: "0755"
- name: Add systemd override for docker.service
copy:
dest: /etc/systemd/system/docker.service.d/override.conf
content: |
[Unit]
After={{ juice_fs_mountpoint.lstrip('/') | replace('/', '-') }}.mount
Requires={{ juice_fs_mountpoint.lstrip('/') | replace('/', '-') }}.mount
mode: "0644"
- name: Reload systemd to apply docker.service override
command: systemctl daemon-reload

File Metadata

Mime Type
text/x-diff
Expires
Sat, Nov 28, 03:13 (1 d, 15 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1224618
Default Alt Text
(3 KB)

Event Timeline