ansible使用1-安装&配置

it2022-05-05  211

ansible使用1-安装&配置

参考文档

http://docs.ansible.com https://github.com/leucos/ansible-tuto

控制机安装

ansible控制机通过ssh控制远程主机,远程主机不需要安装任何agent.

git clone git://github.com/ansible/ansible.git cd ansible git submodule update --init --recursive make rpm #生成rpm rpm-build/ansible-1.9-0.git201412280112.el6.noarch.rpm yum -y install ansible-1.9-0.git201412280112.el6.noarch.rpm

验证

ansible --version

配置目录

/etc/ansible

配置文件

/etc/ansible/ansible.cfg # 禁用ssh key host检查,不会弹出known_hosts的提供语句 host_key_checking = False

inventory配置文件

/etc/ansible/hosts # 主机组test [test] # 主机组中主机, 如果使用非默认ssh端口,在ip地址后指定端口 192.168.48.81:29922  192.168.48.82:29922 192.168.48.83:29922 192.168.48.84:29922 192.168.48.85:29922 192.168.48.86:29922 192.168.48.87:29922

查看帮助

ansible-doc <内容> 内容可以是模块名,或者其他资源

配置SSH-agent(可以记录证书credentials)

ssh-agent bash ssh-add ~/.ssh/id_rsa # 使用key认证方式时,除此方法之外,还可使用ssh的password认证方式,参数-k(--ask-pass) posted on 2014-12-30 12:43 北京涛子 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/liujitao79/p/4193368.html


最新回复(0)