Created
March 29, 2015 17:53
-
-
Save jkeiser/60a158fc13adfb155790 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'chef/provisioning/docker_driver' | |
| # Create the hosts | |
| machine_batch 'docker hosts' do | |
| machine "dockerhost1" do | |
| recipe "docker" | |
| attribute %w(docker host), 'tcp://localhost:5555' | |
| end | |
| machine "dockerhost2" do | |
| recipe "docker" | |
| attribute %w(docker host), 'tcp://localhost:5555' | |
| end | |
| end | |
| at_converge_time "create docker containers" do | |
| machine_batch do | |
| with_docker_host 'dockerhost1' do |chef_server_url| | |
| with_machine_options( | |
| convergence_options: { extra_config: "chef_server_url #{chef_server_url.inspect}" }, | |
| image: 'ubuntu' | |
| ) | |
| machine 'web1' do | |
| recipe 'mywebapp' | |
| end | |
| machine 'web2' do | |
| recipe 'mywebapp' | |
| end | |
| end | |
| with_docker_host 'dockerhost2' do |chef_server_url| | |
| with_machine_options convergence_options: { extra_config: "chef_server_url #{chef_server_url.inspect}" } | |
| machine 'web3' do | |
| recipe 'mywebapp' | |
| end | |
| machine 'web4' do | |
| recipe 'mywebapp' | |
| end | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment