pka*_*mol 5 provisioning vagrant ansible vagrantfile vagrant-provision
是否可以/有效地以下列形式为一个无业游民的预备供应商运行多个剧本:
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
Run Code Online (Sandbox Code Playgroud)
不,它将无效
如果要运行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
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2817 次 |
| 最近记录: |