于志腾的技术专栏 PHP and Python and Vue Coder

Ansible之配置文件hosts

2019-07-05
YztSon

阅读:


ansible.cfg

Ansible 的配置目录

macbookpro@bogon  /etc/ansible  tree
.
├── ansible.cfg
├── hosts

hosts 是什么

hosts是ansible自动化任务中所有的主机组

hosts 几种不同的配置

1.密码登录

192.168.0.104:22 ansible_ssh_user=playcrab  ansible_ssh_pass='123456'
192.168.0.110:22 ansible_ssh_user=root  ansible_ssh_pass='123123'

2.公钥登录

192.168.0.104:22 ansible_ssh_user=playcrab  ansible_ssh_key_file=/Users/macbookpro/.ssh/id_rsa
192.168.0.110:22 ansible_ssh_user=root   ansible_ssh_key_file=/Users/macbookpro/.ssh/id_rsa

3.公钥配置在ansible.cfg

192.168.0.104:22 ansible_ssh_user=playcrab
192.168.0.110:22 ansible_ssh_user=root


Similar Posts

下一篇 Ansible之ad-hoc

Comments