ansible从入门到精通 从安装到使用

本文中引用的部分图片来自网络。

ansible官网地址
https://docs.ansible.com/
中文网(马哥教育)
http://www.ansible.com.cn/

有服务器两台
192.168.23.131
192.168.23.134

安装

rpm -Uvh http://mirrors.ustc.edu.cn/epel/epel-release-latest-7.noarch.rpm
yum install epel-release -y
yum install ansible

默认会在/etc/ansible/目录下

校验版本
ansible --version

使用

创建秘钥
ssh-keygen -t rsa
一路回车
ssh-copy-id -i /root/.ssh/id_rsa.pub [email protected]
用户权限部分
visudo
修改
%wheel这一行,然后把账户[testuser]添加到wheel组,aG保留原来组
这样使用sudo就不需要再输入密码
usermod -aG wheel testuser

本文选择创建/root/ansible目录
创建host文件和roles目录
编辑host
[group]
192.168.23.131

猜你喜欢

转载自blog.csdn.net/csd_nuser/article/details/113310593