Last active
June 12, 2022 14:49
-
-
Save andypost/413f7d0d70c249c511ae to your computer and use it in GitHub Desktop.
Ansible playbook to bootstrap python for coreOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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