设为首页 加入收藏

TOP

ansible常用模块的介绍与使用(三)
2023-07-23 13:38:52 】 浏览:160
Tags:ansible 常用模
--enable-exif \ --enable-ftp \ --enable-gd \ --with-jpeg \ --with-zlib-dir \ --with-freetype \ --with-gettext \ --enable-mbstring \ --enable-pdo \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --with-readline \ --enable-shmop \ --enable-simplexml \ --enable-sockets \ --with-zip \ --enable-mysqlnd-compression-support \ --with-pear \ --enable-pcntl \ --enable-posix [root@ansible ~]# ansible php -m script -a '/scripts/php.sh' [root@ansible ~]# ansible php -m shell -a 'cd /usr/src/php-8.1.11/ && make && make install' //配置文件 [root@ansible ~]# ansible php -a 'cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf' [root@ansible ~]# ansible php -a 'cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf' //头文件 [root@ansible ~]# ansible php -a 'ln -sv /usr/local/php /usr/include/php' //编写service文件 [root@ansible ~]# vim /scripts/phpservice #!/bin/bash cat > /usr/lib/systemd/system/php.service << EOF [Unit] Description=php server daemon After=network.target [Service] Type=forking ExecStart=/usr/local/php/sbin/php-fpm ExecStop=ps -ef |grep php |grep -v grep|awk '{print$2}'|xargs kill ExecReload=/bin/kill -HUP $MAINPID [Install] WantedBy=multi-user.target EOF [root@ansible ~]# ansible php -m script -a '/scripts/phpservice.sh' [root@ansible ~]# ansible php -a 'systemctl daemon-reload' //开启服务并开机自启 [root@ansible ~]# ansible php -m service -a 'name=php state=started enabled=yes' [root@ansible ~]# ansible php -a 'ss -antl' 192.168.118.132 | CHANGED | rc=0 >> State Recv-Q Send-Q Local Address:Port Peer Address:PortProcess LISTEN 0 128 127.0.0.1:9000 0.0.0.0:* LISTEN 0 128 0.0.0.0:22 0.0.0.0:* LISTEN 0 128 [::]:22 [::]:* //在php端上配置网站 [root@ansible ~]# vim /scripts/phpindex.sh [root@ansible ~]# cat /scripts/phpindex.sh #!/bin/bash mkdir -p /var/www/html cat > /var/www/html/index.php << EOF <?php phpinfo(); ?> EOF [root@ansible ~]# ansible php -m script -a '/scripts/phpindex.sh' //修改php/usr/local/php/etc/php-fpm.d/www.conf文件的clisten和clisten.allowed_clients指向 [root@ansible ~]# ansible php -a 'sed -i "36c listen = 192.168.118.132:9000" /usr/local/php/etc/php-fpm.d/www.conf' [root@ansible ~]# ansible php -a 'sed -i "63c listen.allowed_clients = 192.168.118.130" /usr/local/php/etc/php-fpm.d/www.conf' //重启nginx服务和php服务 [root@ansible ~]# ansible nginx -m service -a 'name=nginx state=restarted' [root@ansible ~]# ansible php -m service -a 'name=php state=restarted'

浏览器访问查看

image

首页 上一页 1 2 3 4 5 6 7 下一页 尾页 3/9/9
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Ansible部署LNMP 下一篇海思3516系列芯片SPI速率慢问题深..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目