openssl版本一鍵升級(需要修改tar包名稱和路徑)
---
- name: Install OpenSSLhosts: openssltasks:- name: Copy OpenSSL tar.gz to /tmpcopy:src: /root/shl/soft/openssl-1.1.1v.tar.gzdest: /tmp
# remote_src: yes # 如果源文件在控制主機上- name: Extract OpenSSL tar.gzcommand: tar -zxvf /tmp/openssl-1.1.1v.tar.gzargs:chdir: /tmpbecome: yes- name: Configure OpenSSLcommand: ./config --prefix=/usr/local/opensslargs:chdir: /tmp/openssl-1.1.1v#become: yes- name: Build and make OpenSSLcommand: make args:chdir: /tmp/openssl-1.1.1v#become: yes- name: Build and make install OpenSSLcommand: make installargs:chdir: /tmp/openssl-1.1.1v- name: Backup existing openssl binarycommand: mv /usr/bin/openssl /usr/bin/openssl.bak#become: yes- name: Create symlink to the new OpenSSLcommand: ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl#become: yes- name: Verify OpenSSL versioncommand: openssl versionregister: openssl_versionbecome: yes- name: Display OpenSSL versiondebug:var: openssl_version.stdout_lines
如果出現 openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory ,缺少相關庫依賴,檢查庫文件
解決辦法:
ln -s /usr/local/openssl/lib64/libssl.so.3 /usr/lib64/libssl.so.3
ln -s /usr/local/openssl/lib64/libcrypto.so.3 /usr/lib64/libcrypto.so.3
查看版本
openssl version