notification/tasks/build-python.yml
2023-12-24 22:51:07 +03:00

51 lines
1.7 KiB
YAML

---
- name: check sys python version
shell: "python3 -V | awk '{print $2}'"
register: sys_python_version
- name: check opt python exists
stat:
path: /usr/local/opt/python-3.9/bin/python3.9
register: opt_python
when: sys_python_version.stdout is version('3.9.0', '<')
- name: print python info
debug:
msg:
- "Python sys version: {{ sys_python_version.stdout }}"
- "Python opt version doesn't exist"
- "Python opt version will build"
when: sys_python_version.stdout is version('3.9.0', '<') and opt_python.stat.exists == False
- name: build python opt version
shell: |
wget https://git.hmp.today/pavel.muhortov/utils/raw/branch/master/build-python.sh
chmod u+x ./build-python.sh
./build-python.sh qn 3.9.5
rm ./build-python.sh
when: sys_python_version.stdout is version('3.9.0', '<') and opt_python.stat.exists == False
args:
warn: false
- name: check that the sendmail-reboot.sh exists
stat:
path: /etc/init.d/sendmail-reboot.sh
register: sendmail_reboot
- name: replace python interpriter, if sendmail-reboot.sh exist
shell: sed -i "s,python3,\/usr\/local\/opt\/python-3.9\/bin\/python3.9," /etc/init.d/sendmail-reboot.sh
when: sendmail_reboot.stat.exists and sys_python_version.stdout is version('3.9.0', '<')
args:
warn: false
- name: check that the sendmail-login.sh exists
stat:
path: /etc/profile.d/sendmail-login.sh
register: sendmail_login
- name: replace python interpriter, if sendmail-login.sh exist
shell: sed -i "s,python3,\/usr\/local\/opt\/python-3.9\/bin\/python3.9," /etc/profile.d/sendmail-login.sh
when: sendmail_login.stat.exists and sys_python_version.stdout is version('3.9.0', '<')
args:
warn: false