- name: Check directory is specified assert: that: create_venv_path is defined # Xenial's default pip will try to pull in packages that # aren't compatible with 3.5. Cap them - name: Setup bionic era venv when: ansible_distribution_version is version('16.04', '==') pip: name: - pip<21 - setuptools<51 state: latest virtualenv: '{{ create_venv_path }}' virtualenv_command: '/usr/bin/python3 -m venv' # Bionic's default pip will try to pull in packages that # aren't compatible with 3.6. Cap them - name: Setup bionic era venv when: ansible_distribution_version is version('18.04', '==') pip: name: - pip<22 - setuptools<60 state: latest virtualenv: '{{ create_venv_path }}' virtualenv_command: '/usr/bin/python3 -m venv' - name: Setup later era venv when: ansible_distribution_version is version('20.04', '>=') pip: name: - pip - setuptools state: latest virtualenv: '{{ create_venv_path }}' virtualenv_command: '/usr/bin/python3 -m venv'