# CRY setup in Ansible playbook - name: Install DNF dependencies for labs become: true when: ansible_facts['os_family'] == "RedHat" tags: s4,cry ansible.builtin.dnf: name: - openssl - podman - distrobox - name: Install APT dependencies for labs become: true when: ansible_facts['os_family'] == "Debian" tags: s4,cry ansible.builtin.apt: name: - openssl - podman - distrobox - name: Pull the Docker image sagemath/sagemath with podman - 3.13Gb - could be a few minutes tags: s4,cry command: "podman pull docker.io/sagemath/sagemath" - name: Create a distrobox box with this sagemath image - could be a few minutes # Create a distrobox box named sagebox mount ~/.local/sagebox_home of host on /home/sage under, mount the / of host in /run/host tags: s4,cry command: "distrobox create --name sagebox --image docker.io/sagemath/sagemath --home {{ ansible_env.HOME }}/.local/sagebox_home --yes --verbose" args: creates: "{{ ansible_env.HOME }}/.local/sagebox_home" - name: Run setup of sagebox by running s4/sage-distrobox-setup.sh inside sagebox tags: s4,cry # There is a bug in distrobox https://github.com/89luca89/distrobox/issues/1991 # # Starting container... [ OK ] # Installing basic packages... [ OK ] # Setting up devpts mounts... [ OK ] # Setting up read-only mounts... [ OK ] # Setting up read-write mounts... [ OK ] # Setting up host's sockets integration... [ OK ] # Integrating host's themes, icons, fonts... [ OK ] # Setting up distrobox profile... [ OK ] # Setting up sudo... [ OK ] # Setting up user groups... [ OK ] # Setting up user's group list... [ OK ] # Setting up existing user... Error: An error occurred # # Which requires to start the same command a second time. To find a workaround, we just run ls inside, then do the real work, # to simulate this restart. ansible.builtin.shell: distrobox enter sagebox -- ls &>/dev/null || echo Expected to fails...; sleep 15; distrobox enter sagebox -- sh s4/sage-distrobox-setup.sh - name: Add ~/.local/bin to fish PATH tags: s4,cry ansible.builtin.shell: fish -c "fish_add_path --append ~/.local/bin" || true # Testing import of pycryptodome and numpy - name: Try to run sage on /tmp/sage-imports-test.sage tags: s4,cry command: fish -c 'sage ./s4/sage-imports-test.sage'