python

string
http://thepythonguru.com/python-strings/
https://www.tutorialspoint.com/python/string_startswith.htm

if var1 != var2:

output to file

text_file = open("/tmp/debug", "w")
text_file.write("option1: %s\n" % option1)
text_file.write("value1: %s\n" % value1)
text_file.close()

PIP 2 under Ubuntu 20.04
https://linuxize.com/post/how-to-install-pip-on-ubuntu-20.04/

curl https://bootstrap.pypa.io/2.7/get-pip.py | sudo python2

pyenv
http://www.panticz.de/pyenv

Ansible

- name: Install Dependencies
  apt:
    name: ['python3-pip', 'python3-setuptools', 'python3.8', 'python3.8-venv']
    state: latest
    update_cache: yes
 
- name: Install AWSCLI
  pip:
    name: 'awscli'
    virtualenv_python: /usr/bin/python3

pyenv
https://github.com/pyenv/pyenv-virtualenv

cat ./roles/openstack-lab-kolla/meta/requirements.yml 
---
- src: avanov.pyenv
# ansible-galaxy install avanov.pyenv
 
- hosts: vm1
  roles:
    - role: avanov.pyenv
      pyenv_env: "user"
      pyenv_setting_path: "~/.bashrc"
      pyenv_path: "{{ ansible_env.HOME }}/.pyenv"
      pyenv_owner: "{{ ansible_env.USER }}"
      pyenv_update_git_install: no
      pyenv_enable_autocompletion: no
      pyenv_python_versions:
        - "3.5.10"
      pyenv_global: "3.5.10"
      pyenv_virtualenvs:
        - venv_name: "3.5.10"
          py_version: "3.5.10"
      tags: osc