Add Valkey tasks and templates

This commit is contained in:
Andrew Ying 2024-11-17 09:44:50 +00:00
parent 6889fdc5f2
commit 8d24559170
Signed by: andrew
SSH key fingerprint: SHA256:6goOJXI6ckOipdsJS6oj5gbQYaRmCe37r7bSBnyQLyE
3 changed files with 81 additions and 0 deletions

View file

@ -0,0 +1,49 @@
---
valkey_version: 8.0.1
valkey_user: valkey
valkey_group: valkey
# NETWORK
valkey_protected_mode: true
valkey_port: 6379
valkey_tcp_backlog: 511
valkey_timeout: 0
valkey_tcp_keepalive: 300
# TLS/SSL
valkey_tls_protocols: TLSv1.2 TLSv1.3
# GENERAL
valkey_pid_file: /run/valkey.pid
valkey_log_config:
level: notice
format: legacy
timestamp_format: legacy
valkey_log_file: /var/log/valkey.log
valkey_syslog:
enabled: false
valkey_databases: 16
valkey_locale_collate: ""
# SNAPSHOTTING
valkey_save: 3600 1 300 100 60 10000
valkey_rdbcompression: true
valkey_rdbchecksum: true
valkey_dbfilename: dump.rdb
valkey_rdb_del_sync_files: false
valkey_dir: /var/lib/valkey
# SECURITY
valkey_acllog_max_len: 128
valkey_acl-pubsub-default: resetchannels
# CLIENTS
valkey_maxclients: 10000
# MEMORY MANAGEMENT
valkey_maxmemory_policy: noeviction
valkey_maxmemory_samples: 5
valkey_maxmemory_eviction_tenacity: 10
# APPEND ONLY MODE
valkey_appendonly: false

View file

@ -0,0 +1,7 @@
---
- name: Restart Valkey service
ansible.builtin.systemd_service:
name: valkey
daemon_reload: true
enabled: true
state: restarted

View file

@ -0,0 +1,25 @@
# {{ ansible_managed }}
[Unit]
Description=Valkey data structure server
Documentation=https://github.com/valkey-io/valkey-doc
AssertPathExists={{ valkey_dir }}
Wants=network-online.target
After=network-online.target
[Service]
ExecStart=/usr/local/bin/valkey-server /etc/valkey/valkey.conf
LimitNOFILE=10032
NoNewPrivileges=yes
#OOMScoreAdjust=-900
#PrivateTmp=yes
Type=notify
TimeoutStartSec=infinity
TimeoutStopSec=infinity
UMask=0077
User={{ valkey_user }}
Group={{ valkey_group }}
WorkingDirectory={{ valkey_dir }}
[Install]
WantedBy=multi-user.target