Skip to content

Instantly share code, notes, and snippets.

@andypost
Last active June 12, 2022 14:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andypost/413f7d0d70c249c511ae to your computer and use it in GitHub Desktop.
Save andypost/413f7d0d70c249c511ae to your computer and use it in GitHub Desktop.
Ansible playbook to bootstrap python for coreOS
- name: bootstrap python with toolbox
hosts: coreos
gather_facts: False
vars:
ansible_bin: /home/coreos/bin
ansible_python_interpreter: "{{ansible_bin}}/python"
python_shim: |
#!/bin/bash
toolbox -q --bind=/home:/home python "$@"
tasks:
- raw: '[ -d {{ansible_bin}} ]'
ignore_errors: True
register: has_bin
- raw: "mkdir {{ansible_bin}}"
when: has_bin|failed
- raw: '[ -e {{ansible_python_interpreter}} ]'
ignore_errors: True
register: has_python
- raw: echo '{{python_shim}}' > "{{ansible_python_interpreter}}" && chmod 755 "{{ansible_python_interpreter}}"
when: has_python|failed
- raw: "{{ansible_python_interpreter}} --version"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment