--- /dev/null
+---
+- name: check for python
+ stat:
+ path: /usr/bin/python
+ ignore_errors: yes
+ register: systempython
+
+- name: install python for debian based systems
+ raw: apt-get -y install python-simplejson
+ ignore_errors: yes
+ when:
+ - systempython.stat is undefined or not systempython.stat.exists
+
+- name: install python for fedora
+ raw: dnf -y install python3; ln -sf /usr/bin/python3 /usr/bin/python creates=/usr/bin/python
+ ignore_errors: yes
+ when:
+ - systempython.stat is undefined or not systempython.stat.exists
+
+- name: install python for opensuse
+ raw: zypper -n install python-base creates=/usr/bin/python2.7
+ ignore_errors: yes
+ when:
+ - systempython.stat is undefined or not systempython.stat.exists
\ No newline at end of file
pre_tasks:
# If we can't get python2 installed before any module is used we will fail
# so just try what we can to get it installed
- - name: check for python2
- stat:
- path: /usr/bin/python
- ignore_errors: yes
- register: systempython2
-
- - name: install python2 for debian based systems
- raw: sudo apt-get -y install python-simplejson
- ignore_errors: yes
- when:
- - systempython2.stat is undefined or not systempython2.stat.exists
-
- - name: install python2 for fedora
- raw: sudo dnf -y install python creates=/usr/bin/python
- ignore_errors: yes
- when:
- - systempython2.stat is undefined or not systempython2.stat.exists
- - name: install python2 for opensuse
- raw: sudo zypper -n install python-base creates=/usr/bin/python2.7
- ignore_errors: yes
- when:
- - systempython2.stat is undefined or not systempython2.stat.exists
+ - import_tasks: raw_install_python.yml
- name: gather facts
setup: