ansible——限制期权继承

ansible——限制期权继承,ansible,limit,Ansible,Limit,我在Ansible中应用剧本时遇到问题 这是我的库存文件/etc/ansible/development: [vm] [...] host1.example.com iplan=10.0.220.37 host2.example.com iplan=10.0.220.38 [...] 我想应用这样的配置: $ ansible-playbook /etc/ansible/playbooks/developpement.yml --inventory-file=/etc/ansible/devel

我在Ansible中应用剧本时遇到问题

这是我的库存文件/etc/ansible/development:

[vm]
[...]
host1.example.com iplan=10.0.220.37
host2.example.com iplan=10.0.220.38
[...]
我想应用这样的配置:

$ ansible-playbook /etc/ansible/playbooks/developpement.yml --inventory-file=/etc/ansible/developpement --diff --check --tags php5.6-fpm --limit host1.example.com
[...]
 pm = ondemand
-pm.max_children = 599
+pm.max_children = 600
 pm.start_servers = 50
 pm.min_spare_servers = 32
 pm.max_spare_servers = 150
[...]

changed: [host1.example.net]
只更新了一台主机,这是正常行为

现在,我正在尝试对第二台主机应用相同的配置:

$ ansible-playbook /etc/ansible/playbooks/developpement.yml --inventory-file=/etc/ansible/developpement --diff --check --tags php5.6-fpm --limit host2.example.com
[...]
-env[DEVELOPER] = variable linked to host 1
+env[DEVELOPER] = host2
[...]
-env[DEVELOPER_EMAIL] = email linked to host 1
+env[DEVELOPER_EMAIL] = host2@example.net
[...]



 pm.status_path = /status
 ; host-specific php ini settings here

changed: [host1.bazarchic.com]
ansible playbook将主机1变量放入第二个请求的结果中,我不明白为什么

我试着在没有检查的情况下尝试,链接到host1的变量被设置为第二个主机

我对Ansible的2.2版本没有问题

版本:ansible 2.6.0

Distributor ID: Ubuntu
Description:    Ubuntu 16.04.3 LTS
Release:    16.04
Codename:   xenial
文件:/etc/ansible/ansible.cfg

[defaults]
inventory      = /etc/ansible/hosts
host_key_checking = True
gather_timeout = 30
timeout = 20
log_path = /var/log/ansible.log
system_warnings = True
 deprecation_warnings = True
retry_files_enabled = False
[privilege_escalation]
[paramiko_connection]
[ssh_connection]
ssh_args = -o ControlMaster=auto -o ControlPersist=60s -o ForwardAgent=yes -o ConnectTimeout=30 -o StrictHostKeyChecking=no -o ControlPath=/dev/shm/cp%%h-%%p-%%r
[accelerate]
[selinux]
[colors]
我发现了问题

在ansible.cfg中,这是我的SSH选项连接:

ssh_args = -o ControlMaster=auto -o ControlPersist=60s -o ForwardAgent=yes -o ConnectTimeout=30 -o StrictHostKeyChecking=no -o ControlPath=/dev/shm/cp%%h-%%p-%%r
我删除了“ControlPath”选项,它可以正常工作


在我看来,这个选项对于ansible 2.3是没有用的,不确定它是否太重要,但如果它提供了一个问题,那么您的拼写是错误的
developpement
-->
development
是的,你说得对,developpement是法语单词啊,我明白了,我想拼写上的差异也可能是个问题。mb@nicolas