是否有可能/有效期为以下形式无业游民ansible供应方运行一个以上的剧本:
config.vm.define "repo", primary: true do |d|
d.vm.hostname = "some.hostname"
# Create a private network, which allows host-only access to the machine
# using a specific IP.
d.vm.network :private_network, ip: "10.10.2.90"
d.vm.provision 'ansible' do |ansible|
ansible.config_file = 'ansible/ansible.cfg'
ansible.playbook = 'ansible/playbook1.yml'
ansible.playbook = 'ansible/playbook2.yml'
ansible.sudo = true
ansible.inventory_path = 'ansible/inventory/site'
ansible.host_key_checking = false
end
end
没有也不会是有效的
如果要运行2剧本,你将需要运行两次ansible供应者,这可以像做
config.vm.define "repo", primary: true do |d|
d.vm.hostname = "some.hostname"
# Create a private network, which allows host-only access to the machine
# using a specific IP.
d.vm.network :private_network, ip: "10.10.2.90"
# First playbook
d.vm.provision "playbook1", type:'ansible' do |ansible|
ansible.config_file = 'ansible/ansible.cfg'
ansible.playbook = 'ansible/playbook1.yml'
ansible.sudo = true
ansible.inventory_path = 'ansible/inventory/site'
ansible.host_key_checking = false
end
# Second playbook
d.vm.provision "playbook2", type:'ansible' do |ansible|
ansible.config_file = 'ansible/ansible.cfg'
ansible.playbook = 'ansible/playbook2.yml'
ansible.sudo = true
ansible.inventory_path = 'ansible/inventory/site'
ansible.host_key_checking = false
end
end
你也可以使用一个角色,而不是剧本和角色包含指向其在角色子目录定义了多个剧本。例如playbook.yml包含
---
- name: BaseOS configuration
hosts: all
become: yes
roles:
- baseos
- users
无论BaseOS和用户角色子目录中,当playbook.yml被称为将按顺序执行。