当前位置:网站首页>使用Ansible编写playbook自动化安装php7.3.14
使用Ansible编写playbook自动化安装php7.3.14
2022-08-02 03:36:00 【hzsnone】
准备条件
- ansible centos自带,就不在赘述安装。
- 配置好ansible的host,这块自查搜索引擎;
- php包及libzip.tar.gz需要自己下载到指定文件夹;
以下是纯playbook
---
- hosts: web
tasks:
- name: "install php 依赖包"
yum:
name:
- epel-release
- cmake3
- cmake
- libxml2-devel
- bzip2-devel
- curl-devel
- libjpeg-devel
- libpng-devel
- freetype-devel
- libxslt-devel
- ncurses-devel
- make
- apr*
- autoconf
- automake
- curl
- curl-devel
- gcc
- gcc-c++
- zlib-devel
- openssl
- openssl-devel
- pcre-devel
- libicu-devel
state: latest
- name: "传输包php,解压"
unarchive: src=/usr/local/src/ansible_install_php/pkg/php-7.3.14.tar.gz dest=/usr/local/src/
- name: "传输libzip.tar.gz"
unarchive: src=/usr/local/src/ansible_install_php/pkg/libzip.tar.gz dest=/usr/local/src/
- name: "make && make install libzip"
shell: cd /usr/local/src/libzip-1.5.1 && mkdir build && cd build && cmake3 .. && make && make install
- name: "动态链接库生效"
shell: echo -e '/usr/local/lib64 \n/usr/local/lib \n/usr/lib \n/usr/lib64'>>/etc/ld.so.conf && ldconfig -v
- name: "生成Makefile"
shell: ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-fpm-user=www --with-fpm-group=www --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --with-pear --with-gettext --with-curl --with-xmlrpc --with-openssl --with-mhash --with-gd --enable-fpm --enable-mysqlnd --enable-mysqlnd-compression-support --enable-xml --enable-rpath --enable-bcmath --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-intl --enable-ftp --enable-gd-jis-conv --enable-pcntl --enable-sockets --enable-calendar --enable-zip --enable-soap --enable-fileinfo --enable-opcache --enable-maintainer-zts
args:
chdir: /usr/local/src/php-7.3.14
- name: "make && make install"
shell: make -j2 && make install
args:
chdir: /usr/local/src/php-7.3.14
- name: "配置文件cp"
copy: src=/usr/local/src/ansible_install_php/templates/php.ini dest=/usr/local/php/etc/
- name: "www.conf"
copy: src=/usr/local/src/ansible_install_php/templates/www.conf dest=/usr/local/php/etc/php-fpm.d
- name: "配置文件php-fpm.conf"
shell: cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
- name: "开机启动配置copy"
shell: cp sapi/fpm/php-fpm.service /usr/lib/systemd/system/
args:
chdir: /usr/local/src/php-7.3.14
- name: "用户创建"
user:
name: www
state: present
- name: "服务启动"
service:
name: php-fpm
enabled: yes
state: restarted
边栏推荐
猜你喜欢
随机推荐
倒排单词
js平层数组转树形结构(解决数据处理后源数据篡改)
STM32F4 CAN 配置注意的细节问题
网络安全nvr,用于对接电网B接口(国网B接口)视频监控系统B接口
剑指Offer 16.数值的整数次方 快速幂+ 递归
v-model修饰符
防抖和节流(实例讲解)
8款最佳实践,保护你的 IaC 安全!
rosdep update failure solution (pro-test effective)
字符串哈希
拦截器Sercurity权限管理和加密方式的登录认证使用
单 词替换
AD Actual Combat
剑指Offer 31.栈的压入、弹出
开箱即用的职场办公常用功能:全文检索、便签、云笔记
逆序对数量与归并排序
matlab作图显示中文正常,保存图片中文乱码
剑指Offer 04.二位数组中的查找 线性查找
【LeetCode】Sum
剑指Offer 47.礼物的最大值 动态规划