设为首页 加入收藏

TOP

ansible常用模块的介绍与使用(九)
2023-07-23 13:38:52 】 浏览:158
Tags:ansible 常用模
tadir=/opt/data/' 192.168.118.131 | CHANGED | rc=0 >> 2022-10-23T14:22:54.470416Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2022-10-23T14:22:54.624595Z 0 [Warning] InnoDB: New log files created, LSN=45790 2022-10-23T14:22:54.663264Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. 2022-10-23T14:22:54.728424Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 2f3fd8de-52de-11ed-b420-000c290801b6. 2022-10-23T14:22:54.728999Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2022-10-23T14:22:55.226089Z 0 [Warning] CA certificate ca.pem is self signed. 2022-10-23T14:22:55.289145Z 1 [Note] A temporary password is generated for root@localhost: #q3L>Ze<k((i //编写脚本添加mysql配置文件和mysql的service文件 [root@ansible ~]# vim /scripts/mysql.sh #!/bin/bash cat > /etc/my.cnf <<EOF [mysqld] basedir = /usr/local/mysql datadir = /opt/data socket = /tmp/mysql.sock port = 3306 pid-file = /opt/data/mysql.pid user = mysql skip-name-resolve EOF cat > /usr/lib/systemd/system/mysqld.service <<EOF [Unit] Description=mysql server daemon After=network.target sshd-keygen.target [Service] Type=forking ExecStart=/usr/local/mysql/support-files/mysql.server start ExecStop=/usr/local/mysql/support-files/mysql.server stop ExecReload=/bin/kill -HUP $MAINPID [Install] WantedBy=multi-user.target EOF [root@ansible ~]# ansible mysql -m script -a '/scripts/mysql.sh' [root@ansible ~]# ansible mysql -a 'systemctl daemon-reload' //开启服务并开机自启 [root@ansible ~]# ansible mysql -m service -a 'name=mysqld state=started enabled=yes' [root@ansible ~]# ansible mysql -a 'ss -anlt' 192.168.118.131 | CHANGED | rc=0 >> State Recv-Q Send-Q Local Address:Port Peer Address:PortProcess LISTEN 0 128 0.0.0.0:22 0.0.0.0:* LISTEN 0 80 *:3306 *:* LISTEN 0 128 [::]:22 [::]:*

受控主机php安装配置php

//安装依赖包
[root@ansible ~]# ansible php -m yum -a 'name=epel-release state=present'
[root@ansible ~]# ansible php -m yum -a 'name=libxml2,libxml2-devel,openssl,openssl-devel,bzip2,bzip2-devel,libcurl,libcurl-devel,libicu-devel,libjpeg,libjpeg-devel,libpng,libpng-devel,openldap-devel,pcre-devel,freetype,freetype-devel,gmp,gmp-devel,libmcrypt,libmcrypt-devel,readline,readline-devel,libxslt,libxslt-devel,mhash,mhash-devel,php-mysqlnd,libsqlite3x-devel,libzip-devel,wget,gcc,gcc-c++,make state=present'
[root@ansible ~]# ansible php -a 'yum -y install http://mirror.centos.org/centos/8-stream/PowerTools/x86_64/os/Packages/oniguruma-devel-6.8.2-2.el8.x86_64.rpm'

//下载PHP并解压
[root@ansible ~]# ansible php -a 'wget https://www.php.net/distributions/php-8.1.11.tar.gz'
[root@ansible ~]# ansible php -a 'tar xf php-8.1.11.tar.gz -C /usr/src'

//编译安装php
[root@ansible ~]# vim scripts/php.sh
#!/bin/bash

cd /usr/src/php-8.1.11/
./configure --prefix=/usr/local/php \
--with-config-file-path=/etc \
--enable-fpm \
--disable-debug \
--disable-rpath \
--enable-shared \
--enable-soap \
--with-openssl \
--enable-bcmath \
--with-iconv \
--with-bz2 \
--enable-calendar \
--with-curl \
首页 上一页 6 7 8 9 下一页 尾页 9/9/9
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Ansible部署LNMP 下一篇海思3516系列芯片SPI速率慢问题深..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目