Skip to content

Instantly share code, notes, and snippets.

View zeitounator's full-sized avatar

Olivier Clavel zeitounator

View GitHub Profile
######################################
# Step 1: basic fix so it just works #
######################################
# In role
- name: Upload template.text
become: true
template:
src: templates/template.text
dest: /lib/template.text
vars:
17:28 $ docker run -it --rm python:latest bash
root@bae40b8ce004:/# python --version
Python 3.12.0
root@bae40b8ce004:/# pip install --upgrade pip
Requirement already satisfied: pip in /usr/local/lib/python3.12/site-packages (23.2.1)
Collecting pip
$ tree
.
├── su.example
└── test.yml
0 directories, 2 files
$ cat su.example
#%PAM-1.0
auth sufficient pam_rootok.so
$ ansible --version
ansible [core 2.15.2]
config file = None
configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/user/.local/lib/python3.10/site-packages/ansible
ansible collection location = /home/user/.ansible/collections:/usr/share/ansible/collections
executable location = /home/user/.local/bin/ansible
python version = 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] (/usr/bin/python)
jinja version = 3.1.2
libyaml = True
$ pyenv virtualenv 2.7.18 test_ansible_2.8
created virtual environment CPython2.7.18.final.0-64 in 116ms
creator CPython2Posix(dest=/home/user/.pyenv/versions/2.7.18/envs/test_ansible_2.8, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, wheel=bundle, setuptools=bundle, via=copy, app_data_dir=/home/user/.local/share/virtualenv)
added seed packages: pip==20.3.4, setuptools==44.1.1, wheel==0.37.1
activators NushellActivator,PythonActivator,FishActivator,CShellActivator,PowerShellActivator,BashActivator
Looking in links: /tmp/tmpzj_Ydz
Requirement already satisfied: setuptools in /home/user/.pyenv/versions/2.7.18/envs/test_ansible_2.8/lib/python2.7/site-packages (44.1.1)
Requirement already satisfied: pip in /home/user/.pyenv/versions/2.7.18/envs/test_ansible_2.8/lib/python2.7/site-packages (20.3.4)
$ tree
.
└── inventories
├── children.yml
├── host.yml
├── otherhosts.yml
└── shared.yml
1 directory, 4 files
$ docker run -it --rm ubuntu:22.04 bash -c "apt-get update && apt-get install -y lynx && apt-cache policy lynx"
Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Get:2 http://archive.ubuntu.com/ubuntu jammy InRelease [270 kB]
Get:3 http://security.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [631 kB]
Get:4 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [944 kB]
Get:5 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [683 kB]
Get:6 http://security.ubuntu.com/ubuntu jammy-security/multiverse amd64 Packages [43.2 kB]
Get:7 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
Get:8 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [108 kB]
Get:9 http://archive.ubuntu.com/ubuntu jammy/restricted amd64 Packages [164 kB]
$ docker run -it --rm python:3.10-alpine pip install alembic==1.11.1
Collecting alembic==1.11.1
Downloading alembic-1.11.1-py3-none-any.whl (224 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 224.5/224.5 kB 5.2 MB/s eta 0:00:00
Collecting Mako
Downloading Mako-1.2.4-py3-none-any.whl (78 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78.7/78.7 kB 15.2 MB/s eta 0:00:00
Collecting SQLAlchemy>=1.3.0
Downloading SQLAlchemy-2.0.16-cp310-cp310-musllinux_1_1_x86_64.whl (2.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.7/2.7 MB 20.1 MB/s eta 0:00:00
$ ansible --version
ansible [core 2.14.2]
config file = None
configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/user/.local/lib/python3.9/site-packages/ansible
ansible collection location = /home/user/.ansible/collections:/usr/share/ansible/collections
executable location = /home/user/.local/bin/ansible
python version = 3.9.5 (default, Nov 23 2021, 15:27:38) [GCC 9.3.0] (/usr/bin/python3.9)
jinja version = 3.1.2
libyaml = True
$ cat Dockerfile
FROM jupyter/scipy-notebook
RUN pip install mlflow
RUN pip install sklearn
USER root
RUN apt-get update && apt-get install -y curl
# Switch back to jovyan to avoid accidental container runs as root