---
- name: Create virtualenv scripts from templates
  ansible.builtin.template:
    src: "{{ item.name }}"
    dest: "{{ build_dir }}/scripts/{{ item.target }}"
    mode: "755"
    force: true
  loop:
    - { name: 'init_venv.sh.j2', target: 'init_venv.sh' }
    - { name: 'install_venv.sh.j2', target: 'install_venv.sh' }

- name: Create python-{{ python_version }} venv
  community.docker.docker_container_exec:
    container: "tf-text-multipython"
    command: /bin/bash -c /tmp/workspace/scripts/init_venv.sh

- name: Populate python-{{ python_version }} venv
  community.docker.docker_container_exec:
    container: "tf-text-multipython"
    command: /bin/bash -c /tmp/workspace/scripts/install_venv.sh
