ansible源码安装nginx

ansible源码安装nginx
yum search ansible #检查ansible
yum -y install centos-release-ansible-29 #安装centos-release-ansible-29
安装ansible
yum –y install ansible #安装ansible
ansible --version #查看版本

密钥
ssh-keygen #生成密钥
ssh-copy-id root@192.168.126.141 #发送到被管理主机
ssh-copy-id root@192.168.126.137
配置ansible清单文件,添加主机
vim /etc/ansible/hosts #清单目录
[webservers] #写一个组组名随意
192.168.126.141 #除本机外另外多台的IP
192.168.126.137
测试被管理主机是否可达
ansible webservers –m ping #ansible [设置清单里面的组] -m [调用的模块]
(绿色通过无更改)
(红色警告)
(黄色通过有更改)
#安装编译环境
ansible webserver -m yum -a ‘name=gcc,pcre-devel,zlib-devel state=latest’
#分发并解压安装包
ansible webserver -m unarchive -a 'src=nginx-1.18.0.tar.gz dest=/root/’
#检查安装环境,编译安装,安装
ansible webserver -m shell -a ‘cd /root/nginx-1.18.0 && ./configure && make && make install’
#启动nginx
ansible webserver -m shell -a ‘/usr/local/nginx/sbin/nginx’

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

君夜-专注搞技术

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值