ansible 自动化部署之 ansible 配置

[size=x-large]
第一步 :管理节点上安装ansible环境 略
第二步 :管理节点上配置 hosts文件 /etc/ansible/hosts
testserver ansible_ssh_host=127.0.0.1 ansible_ssh_user=root
targetserver ansible_ssh_host=192.168.137.4 ansible_ssh_user=root
第三步 :管理节点上配置 ansible.cfg
touch /etc/ansible/ansible.cfg
[defaults]
inventory = /etc/ansible/hosts
library = /usr/share/ansible/
forks = 5
sudo_user = root
remote_port = 22
roles_path = /root/ansible_playbook/roles
host_key_checking = False
timeout = 20
log_path = /var/log/ansible.log
[privilege_escalation]
[paramiko_connection]
[ssh_connection]
[accelerate]
[selinux]
[colors]
deprecation_warnings=False
host_key_checking = False

第四步 : 管理节点生成pub-key
ssh-keygen

第五步 :copy 相关Key到目标节点
#ssh-copy-id root@目标节点IP

第六步 :test
ansible -m ping all


[img]http://dl2.iteye.com/upload/attachment/0130/1653/8c0a2031-a668-327f-a8cd-010ca7374737.png[/img]

[/size]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

annan211

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

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

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

打赏作者

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

抵扣说明:

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

余额充值