Compare commits
	
		
			2 Commits
		
	
	
		
			37da57bfcc
			...
			ab84a6b1e7
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| ab84a6b1e7 | |||
| f552945eb8 | 
							
								
								
									
										50
									
								
								tasks/build-python.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								tasks/build-python.yml
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,50 @@ | ||||||
|  | --- | ||||||
|  | - 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 | ||||||
|  | @ -18,25 +18,3 @@ | ||||||
| - name: install Telegram init script link | - name: install Telegram init script link | ||||||
|   shell: |   shell: | ||||||
|     cmd: "chkconfig --add /etc/init.d/sendtelegram-reboot.sh" |     cmd: "chkconfig --add /etc/init.d/sendtelegram-reboot.sh" | ||||||
| 
 |  | ||||||
| - name: check that the sendmail-reboot.sh exists |  | ||||||
|   stat: |  | ||||||
|     path: /etc/init.d/sendmail-reboot.sh |  | ||||||
|   register: stat_result |  | ||||||
| 
 |  | ||||||
| - name: replace python interpriter, if sendmail-reboot.sh exist |  | ||||||
|   shell: sed -i "s/python3/\/usr\/local\/bin\/python3.9/" /etc/init.d/sendmail-reboot.sh |  | ||||||
|   when: stat_result.stat.exists |  | ||||||
|   args: |  | ||||||
|     warn: false |  | ||||||
| 
 |  | ||||||
| - name: check that the sendtelegram-login.sh exists |  | ||||||
|   stat: |  | ||||||
|     path: /etc/profile.d/sendtelegram-login.sh |  | ||||||
|   register: stat_result |  | ||||||
| 
 |  | ||||||
| - name: replace python interpriter, if sendtelegram-login.sh exist |  | ||||||
|   shell: sed -i "s/python3/\/usr\/local\/bin\/python3.9/" /etc/profile.d/sendtelegram-login.sh |  | ||||||
|   when: stat_result.stat.exists |  | ||||||
|   args: |  | ||||||
|     warn: false |  | ||||||
|  | @ -11,4 +11,6 @@ | ||||||
| - include_tasks: debian_units.yml | - include_tasks: debian_units.yml | ||||||
|   when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' |   when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' | ||||||
| 
 | 
 | ||||||
| - include_tasks: configs-and-scripts.yml | - include_tasks: configs-and-scripts.yml | ||||||
|  | 
 | ||||||
|  | - include_tasks: build-python.yml | ||||||
|  | @ -61,7 +61,7 @@ fi | ||||||
| MEM=$(grep /proc/meminfo \ | MEM=$(grep /proc/meminfo \ | ||||||
|     -e 'MemTotal' -e 'MemAvailable' -e 'MemFree' \ |     -e 'MemTotal' -e 'MemAvailable' -e 'MemFree' \ | ||||||
|     -e 'SwapTotal' -e 'SwapFree' \ |     -e 'SwapTotal' -e 'SwapFree' \ | ||||||
|     | numfmt --field 2 --from-unit=Ki --to=iec | sed 's/ kB//g') |     | numfmt --field 2 --to=iec | sed 's/M/G/g' | sed 's/ kB//g') | ||||||
| if [ -n "${MEM}" ]; then | if [ -n "${MEM}" ]; then | ||||||
| TXT_MSG=$(cat <<-END | TXT_MSG=$(cat <<-END | ||||||
| ${TXT_MSG} | ${TXT_MSG} | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user