ansible安装基本使用
2024-05-16 08:29:23 阅读次数:20
ansible,安装
ansible安装基本使用
备注使用yum (centos7)
1. 安装
2. 免密登录(ssh,最好使用dns 解析)
// create ssh key
ssh-keygen
// copy ssh key to remote host
ssh-copy-id -i /root/.ssh/id_rsa.pub root@remotehost
// test whether is ok
ssh root@remotehost
备注(参考dns 配置)
nano /etc/hosts
ip dnsname
3. 配置ansible hosts
nano /etc/ansible/hosts
[web]
dalongapp.demo
4. 简单测试命令
// 检查ansible 安装环境
ansible all -m ping
返回结果
dalongapp.demo | SUCCESS => {
"changed": false,
"failed": false,
"ping": "pong"
}
备注:
all 代码所有主机
m 为使用的module
5. 帮助文档安装
可以通过安装ansible-doc
yum install -y ansible-doc
6. 几个常用命令
a 执行命令
copy 复制文件
yum 安装包
user 添加用户
git git 下载代码
service 启动服务
setup 查看远程主机信息
版权声明:本文内容来自第三方投稿或授权转载,原文地址:https://blog.51cto.com/rongfengliang/3120292,作者:rongfengliang,版权归原作者所有。本网站转在其作品的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如因作品内容、版权等问题需要同本网站联系,请发邮件至ctyunbbs@chinatelecom.cn沟通。
上一篇:Confluence 6 从 Jira Service Desk 中取消未许可用户的访问
下一篇:go中,io密集型的应用,比如有很多文件io,磁盘io,网络io,调大GOMAXPROCS,会不会对性能有帮助?为什么?