1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: Apache-2.0
5 # install-test-env.yml - Ansible playbook to set up a host to run Arvados tests
7 # After you run this playbook on a host, you should be able to clone the
8 # Arvados git repository and run `build/run-tests.sh`.
9 # As of April 2025 this has been tested to work on Debian 12.
11 # In order to use this playbook, you must write an Arvados `config.yml` with
12 # PostgreSQL connection details for the `zzzzz` cluster.
13 # `files/default-test-config.yml` has the default credentials used by tests.
14 # You can copy that file and edit `dbname`, `user`, and `password` to taste.
15 # Pass the path of your file to `ansible-playbook` with
16 # `-e arvados_config_file=config.yml`.
18 - name: Load Arvados configuration
21 - name: Load Arvados configuration file
22 delegate_to: localhost
23 ansible.builtin.include_vars:
25 file: "{{ arvados_config_file }}"
26 - name: Load Arvados cluster configuration
27 ansible.builtin.set_fact:
28 arvados_cluster: "{{ arvados_config.Clusters.zzzzz }}"
29 failed_when: arvados_cluster is undefined
33 arvados_dev_user: "{{ ansible_user_id }}"
34 arvados_nodejs_version: "14.21.3"
35 arvados_nodejs_destdir: "/opt/node-v{{ arvados_nodejs_version }}-linux-x64"
38 - name: Bootstrap packages required for Ansible
40 ansible.builtin.raw: "apt-get -o DPkg::Lock::Timeout=300 -qy {{ item }}"
43 - install acl gnupg python3-apt python3-debian python3-psycopg2 xz-utils
44 - name: Install all required development packages
48 # Common build and test tools
65 - libcurl4-openssl-dev
70 # build/run-build-packages*.sh
80 - default-jdk-headless
107 # services/workbench2
108 # <https://docs.cypress.io/app/get-started/install-cypress#Linux-Prerequisites>
121 - ansible.builtin.include_role:
123 - ansible.builtin.include_role:
124 name: arvados_compute
126 arvados_compute_packages: []
127 arvados_compute_docker: true
128 arvados_compute_singularity: true
130 # RailsAPI tests depend on the en_US.UTF-8 locale.
131 # It must be generated before starting the PostgreSQL server.
132 - name: Configure en_US.UTF-8 locale
134 ansible.builtin.lineinfile:
135 path: /etc/locale.gen
136 regexp: "^[# ]*en_US.UTF-8 +UTF-8 *$"
137 line: en_US.UTF-8 UTF-8
139 - name: Run locale-gen
140 when: locale_gen.changed
142 ansible.builtin.command:
144 - ansible.builtin.include_role:
145 name: arvados_postgresql
147 arvados_postgresql_hba_sources:
151 # Workbench build dependencies
152 - name: Install Node.js
154 ansible.builtin.unarchive:
155 src: "https://nodejs.org/dist/v{{ arvados_nodejs_version }}/node-v{{ arvados_nodejs_version }}-linux-x64.tar.xz"
156 dest: "{{ arvados_nodejs_destdir|dirname }}"
158 creates: "{{ (arvados_nodejs_destdir, 'bin/node')|path_join }}"
161 ansible.builtin.command:
162 cmd: npm install -g yarn
163 creates: "{{ (arvados_nodejs_destdir, 'bin/yarn')|path_join }}"
165 PATH: "{{ (arvados_nodejs_destdir, 'bin')|path_join }}:{{ ansible_env.PATH }}"
166 - name: Add Node commands to PATH
168 ansible.builtin.file:
170 src: "{{ (arvados_nodejs_destdir, 'bin', item)|path_join }}"
171 dest: "{{ ('/usr/local/bin', item)|path_join }}"
177 # Configuration to run Workbench
178 - name: Check fs.inotify.max_user_watches sysctl value
179 ansible.builtin.command:
180 cmd: /sbin/sysctl --values fs.inotify.max_user_watches
181 register: max_user_watches_value
182 - name: Increase fs.inotify.max_user_watches
184 max_user_watches_wanted: 524288
185 when: "max_user_watches_value.stdout|int < max_user_watches_wanted"
187 ansible.builtin.command:
190 - "fs.inotify.max_user_watches={{ max_user_watches_wanted }}"
191 register: max_user_watches_set
192 - name: Set fs.inotify.max_user_watches permanently
193 when: max_user_watches_set.changed
195 ansible.builtin.copy:
197 ### This file is managed by Ansible
198 # React sets many inotify watchers and needs the limit increased.
199 {{ max_user_watches_set.stdout }}
200 dest: /etc/sysctl.d/arvados-workbench.conf
205 - ansible.builtin.include_role:
206 name: arvados_database
208 arvados_database_login_host: ""
209 # Let the test user drop and recreate the database wholesale
210 arvados_database_role_attr_flags: CREATEDB
212 - name: Set up Arvados development user
214 ansible.builtin.user:
215 name: "{{ arvados_dev_user }}"
220 - name: Set up .config/arvados
222 become_user: "{{ arvados_dev_user }}"
223 ansible.builtin.file:
224 path: "{{ (dev_user.home, item)|path_join }}"
229 - name: Write arvados/config.yml for testing
231 become_user: "{{ arvados_dev_user }}"
232 ansible.builtin.copy:
233 src: "{{ arvados_config_file }}"
234 dest: "{{ (dev_user.home, '.config/arvados/config.yml')|path_join }}"
236 - name: Add Arvados test configuration to profile.d
238 ansible.builtin.copy:
240 if [ -z "${CONFIGSRC:-}" ] && [ -e ~/.config/arvados/config.yml ]; then
241 export CONFIGSRC="$HOME/.config/arvados"
243 dest: /etc/profile.d/arvados-test.sh