Page MenuHomeSealhub

No OneTemporary

Authored By
Unknown
Size
4 KB
Referenced Files
None
Subscribers
None
diff --git a/tasks/main.yml b/tasks/main.yml
index 047426c..6f93ae8 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -1,135 +1,135 @@
- 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
- redis-server
state: present
update_cache: yes
- name: Bind Redis to localhost
ansible.builtin.lineinfile:
path: /etc/redis/redis.conf
regexp: '^#?\s*bind\s+'
line: "bind 127.0.0.1 ::1"
backup: true
notify: Restart Redis
- name: Enable Redis protected mode
ansible.builtin.lineinfile:
path: /etc/redis/redis.conf
regexp: '^#?\s*protected-mode\s+'
line: "protected-mode yes"
backup: true
notify: Restart Redis
- name: Set Redis password
ansible.builtin.lineinfile:
path: /etc/redis/redis.conf
regexp: '^#?\s*requirepass\s+'
line: "requirepass {{ juice_redis_redis_password }}"
mode: "0600"
notify: Restart Redis
- name: Disable Redis eviction
ansible.builtin.lineinfile:
path: /etc/redis/redis.conf
regexp: '^#?\s*maxmemory-policy\s+'
line: "maxmemory-policy noeviction"
notify: Restart Redis
- name: Enable Redis AOF
ansible.builtin.lineinfile:
path: /etc/redis/redis.conf
regexp: '^#?\s*appendonly\s+'
line: "appendonly yes"
notify: Restart Redis
- name: Configure Redis AOF fsync
ansible.builtin.lineinfile:
path: /etc/redis/redis.conf
regexp: '^#?\s*appendfsync\s+'
line: "appendfsync everysec"
notify: Restart Redis
- name: Configure JuiceFS secret key
ansible.builtin.command:
cmd: juicefs config {{juice_redis_meta_url}} --secret-key "{{ juice_redis_s3_secret_key }}"
- name: Check if JuiceFS is already formatted
stat:
path: "/var/lib/juicefs/config.toml"
register: juicefs_config
-# - name: Format JuiceFS if not configured
-# when: not juicefs_config.stat.exists
-# command: >
-# juicefs format
-# --storage s3
-# --bucket "{{ juice_redis_s3_endpoint }}/{{ juice_redis_bucket_name }}"
-# --access-key "{{ juice_redis_s3_access_key }}"
-# --secret-key "{{ juice_redis_s3_secret_key }}"
-# "{{ juice_redis_meta_url }}"
-# "{{ juice_redis_fs_name }}"
-# args:
-# creates: "/var/lib/juicefs/config.toml"
+- name: Format JuiceFS if not configured
+ when: not juicefs_config.stat.exists
+ command: >
+ juicefs format
+ --storage s3
+ --bucket "{{ juice_redis_s3_endpoint }}/{{ juice_redis_bucket_name }}"
+ --access-key "{{ juice_redis_s3_access_key }}"
+ --secret-key "{{ juice_redis_s3_secret_key }}"
+ "{{ juice_redis_meta_url }}"
+ "{{ juice_redis_fs_name }}"
+ args:
+ creates: "/var/lib/juicefs/config.toml"
- file:
path: "/backup-dirs"
state: touch
- ansible.builtin.lineinfile:
path: "/backup-dirs"
line: "/var/lib/redis"
#
# 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_redis_meta_url }}
# {{ juice_redis_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_redis_fs_mountpoint }}"
src: "{{ juice_redis_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.after=redis-server.service,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_redis_fs_mountpoint.lstrip('/') | replace('/', '-') }}.mount
Requires={{ juice_redis_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
Fri, Nov 27, 18:10 (1 d, 8 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1224667
Default Alt Text
(4 KB)

Event Timeline