约 300 字 预计阅读 1 分钟
/etc/ansible/ansible.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
[defaults]
inventory = /home/mulinux/db/inventory/
remote_user = mulinux
private_key_file = /home/mulinux/.ssh/id_rsa
gathering = smart
fact_caching_timeout = 86400
fact_caching = jsonfile
fact_caching_connection = /home/mulinux/db/ansible_fact_cache
forks = 30
host_key_checking = False
timeout = 10
poll_interval = 15
[ssh_connection]
ssh_args = -o ControlMaster=auto -o ControlPersist=yes
control_path = /home/mulinux/.ssh/sockets/%%r@%%h-%%p
pipelining = False
#[accelerate]
#accelerate_connect_timeout = 1.0
|
~/.ansible.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
[defaults]
inventory = /home/mulinux/cfgcenter/inventory/sc/
remote_user = mulinux
private_key_file = /home/mulinux/.ssh/id_rsa
gathering = smart
fact_caching_timeout = 86400
fact_caching = jsonfile
fact_caching_connection = /home/mulinux/db/ansible_fact_cache
forks = 30
host_key_checking = False
timeout = 15
poll_interval = 15
[ssh_connection]
ssh_args = -o ControlMaster=auto -o ControlPersist=yes
control_path = /home/mulinux/.ssh/sockets/%%r@%%h-%%p
pipelining = False
#[accelerate]
#accelerate_connect_timeout = 1.0
|
~/.ssh/config
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
Host *
User mds
AddressFamily inet
Compression yes
Ciphers blowfish-cbc,aes256-ctr
ServerAliveInterval 30
ControlMaster no
ControlPath ~/.ssh/sockets/%r@%h-%p
ControlPersist yes
Host 192.??.*
Port 2222
Host 10.10.10.*
Port 2222
Host 172.*
Port 2345
# Private Host
Host 10.10.10.111 10.10.10.112
Port 2345
ForwardAgent yes
ProxyCommand ssh -p 2345 mds@192.168.16.111 -W %h:%p 2> /dev/null
|
Linux Hosts
1
2
3
4
5
6
7
8
9
|
[test:vars]
ansible_ssh_user = mulinux
ansible_ssh_port = 22
ansible_ssh_pass = password
ansible_become_pass = password
ansible_ssh_private_key_file = /home/mulinux/.ssh/id_rsa
#ansible_python_interpreter=/usr/bin/python2.6
[test]
192.168.1.111
|
Windows Hosts
1
2
3
4
5
6
7
8
9
10
|
[test:vars]
ansible_ssh_port = 2345
ansible_user = administrator
ansible_password = password
ansible_connection = winrm
ansible_port = 5985
ansible_winrm_scheme = http
ansible_winrm_server_cert_validation = ignore
[test]
192.168.1.113
|