diff --git a/ansible_collections/nullified/infrastructure/roles/valkey/tasks/main.yml b/ansible_collections/nullified/infrastructure/roles/valkey/tasks/main.yml index 5011422..68f66bd 100644 --- a/ansible_collections/nullified/infrastructure/roles/valkey/tasks/main.yml +++ b/ansible_collections/nullified/infrastructure/roles/valkey/tasks/main.yml @@ -8,11 +8,15 @@ cache_valid_time: 3600 pkg: - build-essential + - dpkg-dev + - gcc - git + - libc6-dev - libjemalloc2 - libjemalloc-dev - libssl-dev - libsystemd-dev + - make - python3-cryptography - ssl-cert - name: gather facts @@ -40,13 +44,27 @@ version: "{{ valkey_version | default('latest') }}" github_token: "{{ valkey_github_token }}" repository: "valkey-io/valkey" - creates: "{{ valkey_binary_filepath | default('/usr/local/bin/valkey-server') }}" + creates: "{{ valkey_install_dir }}/src" cmds: - tar -zxf {asset_dirname}/{asset_filename} - - |- - cd $(find . -maxdepth 1 -name valkey-io-valkey\* -type d); - make -j $(nproc) BUILD_TLS=yes USE_SYSTEMD=yes && - make install + - 'mv $(find . -maxdepth 1 -name valkey-io-valkey\* -type d) {{ valkey_install_dir }}/src' +- name: compile Valkey (some tweaks taken from Valkey's Dockerfile + become: true + args: + chdir: '{{ valkey_install_dir }}/src' + ansible.builtin.shell: '{{ item }}' + loop: + - 'make distclean || true' + - |- + extraJemallocConfigureFlags="--build=$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; + case $(dpkg --print-architecture) in + amd64 | i386 | x32) extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-page=12" ;; + *) extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-page=16" ;; + esac; + extraJemallocConfigureFlags="$extraJemallocConfigureFlags --with-lg-hugepage=21"; + sed -ri 's!cd jemalloc && ./configure !&'"$extraJemallocConfigureFlags"' !' ./deps/Makefile; + - 'make -j $(nproc) BUILD_TLS=yes USE_SYSTEMD=yes' + - make install - name: create directories become: true ansible.builtin.file: