|
1 | 1 | Vagrant.configure("2") do |config| |
2 | 2 |
|
3 | | - # Define first Kafka node |
4 | | - config.vm.define "kafka_node_01" do |kafka_node_01| |
| 3 | + # Define first Kafka broker node |
| 4 | + config.vm.define "kafka_broker_01" do |kafka_broker_01| |
5 | 5 | # synced_folder only used in ansible_local setting |
6 | | - # kafka_node_01.vm.synced_folder "./vagrant", "/vagrant" |
7 | | - kafka_node_01.vm.box = "ol7-latest" |
8 | | - kafka_node_01.vm.hostname = 'kafka-node-01' |
9 | | - kafka_node_01.vm.box_url = "https://yum.oracle.com/boxes/oraclelinux/latest/ol7-latest.box" |
10 | | - kafka_node_01.vm.network :"private_network", type: "dhcp" |
11 | | - kafka_node_01.vm.network "forwarded_port", guest: 9092, host: 9092, protocol: "tcp" |
12 | | - kafka_node_01.vm.network "forwarded_port", guest: 9021, host: 9021, protocol: "tcp" |
13 | | - kafka_node_01.vm.network "forwarded_port", guest: 8083, host: 8083, protocol: "tcp" |
14 | | - kafka_node_01.vm.network "forwarded_port", guest: 8082, host: 8082, protocol: "tcp" |
15 | | - kafka_node_01.vm.network "forwarded_port", guest: 8081, host: 8081, protocol: "tcp" |
16 | | - kafka_node_01.vm.network "forwarded_port", guest: 2181, host: 2181, protocol: "tcp" |
17 | | - kafka_node_01.vm.provider :virtualbox do |v| |
| 6 | + # kafka_broker_01.vm.synced_folder "./vagrant", "/vagrant" |
| 7 | + kafka_broker_01.vm.box = "ol7-latest" |
| 8 | + kafka_broker_01.vm.hostname = 'kafka-broker-01' |
| 9 | + kafka_broker_01.vm.box_url = "https://yum.oracle.com/boxes/oraclelinux/latest/ol7-latest.box" |
| 10 | + kafka_broker_01.vm.network :"private_network", type: "dhcp" |
| 11 | + kafka_broker_01.vm.network "forwarded_port", guest: 9092, host: 9092, protocol: "tcp" |
| 12 | + kafka_broker_01.vm.network "forwarded_port", guest: 9021, host: 9021, protocol: "tcp" |
| 13 | + kafka_broker_01.vm.network "forwarded_port", guest: 8083, host: 8083, protocol: "tcp" |
| 14 | + kafka_broker_01.vm.network "forwarded_port", guest: 8082, host: 8082, protocol: "tcp" |
| 15 | + kafka_broker_01.vm.network "forwarded_port", guest: 8081, host: 8081, protocol: "tcp" |
| 16 | + kafka_broker_01.vm.network "forwarded_port", guest: 2181, host: 2181, protocol: "tcp" |
| 17 | + kafka_broker_01.vm.provider :virtualbox do |v| |
18 | 18 | v.customize ["modifyvm", :id, "--memory", 1024] |
19 | 19 | v.customize ["modifyvm", :id, "--cpus", "2"] |
20 | 20 | v.customize ["modifyvm", :id, "--cpuexecutioncap", "50"] |
21 | 21 | v.customize ["modifyvm", :id, "--usb", "off"] |
22 | 22 | v.customize ["modifyvm", :id, "--audio", "none"] |
23 | | - v.customize ["modifyvm", :id, "--name", "kafka_node_01"] |
24 | | - end # End of "kafka_node_01.vm.provider" |
25 | | - end # End of config.vm.define "kafka_node_01" |
| 23 | + v.customize ["modifyvm", :id, "--name", "kafka_broker_01"] |
| 24 | + end # End of "kafka_broker_01.vm.provider" |
| 25 | + end # End of config.vm.define "kafka_broker_01" |
26 | 26 |
|
27 | 27 |
|
| 28 | + # Define second Kafka broker node |
| 29 | + config.vm.define "kafka_broker_02" do |kafka_broker_02| |
| 30 | + # synced_folder only used in ansible_local setting |
| 31 | + # kafka_broker_02.vm.synced_folder "./vagrant", "/vagrant" |
| 32 | + kafka_broker_02.vm.box = "ol7-latest" |
| 33 | + kafka_broker_02.vm.hostname = 'kafka-broker-02' |
| 34 | + kafka_broker_02.vm.box_url = "https://yum.oracle.com/boxes/oraclelinux/latest/ol7-latest.box" |
| 35 | + kafka_broker_02.vm.network :"private_network", type: "dhcp" |
| 36 | + kafka_broker_02.vm.network "forwarded_port", guest: 9092, host: 29092, protocol: "tcp" |
| 37 | + kafka_broker_02.vm.network "forwarded_port", guest: 9021, host: 29021, protocol: "tcp" |
| 38 | + kafka_broker_02.vm.network "forwarded_port", guest: 8083, host: 28083, protocol: "tcp" |
| 39 | + kafka_broker_02.vm.network "forwarded_port", guest: 8082, host: 28082, protocol: "tcp" |
| 40 | + kafka_broker_02.vm.network "forwarded_port", guest: 8081, host: 28081, protocol: "tcp" |
| 41 | + kafka_broker_02.vm.network "forwarded_port", guest: 2181, host: 22181, protocol: "tcp" |
| 42 | + kafka_broker_02.vm.provider :virtualbox do |v| |
| 43 | + v.customize ["modifyvm", :id, "--memory", 1024] |
| 44 | + v.customize ["modifyvm", :id, "--cpus", "2"] |
| 45 | + v.customize ["modifyvm", :id, "--cpuexecutioncap", "50"] |
| 46 | + v.customize ["modifyvm", :id, "--usb", "off"] |
| 47 | + v.customize ["modifyvm", :id, "--audio", "none"] |
| 48 | + v.customize ["modifyvm", :id, "--name", "kafka_broker_02"] |
| 49 | + end # End of "kafka_broker_02.vm.provider" |
| 50 | + end # End of config.vm.define "kafka_broker_02" |
| 51 | + |
28 | 52 |
|
29 | 53 | # Define Kafka worker node |
30 | 54 | config.vm.define "kafka_workernode_01" do |kafka_workernode_01| |
@@ -54,10 +78,13 @@ Vagrant.configure("2") do |config| |
54 | 78 | ansible.playbook = "vagrant/ansible-playbook.yml" |
55 | 79 | ansible.limit = "all" |
56 | 80 | ansible.groups = { |
57 | | - "all" => ["kafka_node_01", "kafka_workernode_01"], |
58 | | - "kafkabrokers" => ["kafka_node_01", "kafka_workernode_01"], |
59 | | - "kafkabrokers:vars" => {"variable1" => "example1", |
60 | | - "variable2" => "example2"} |
| 81 | + "kafka_all" => ["kafka_broker_01", "kafka_broker_02", "kafka_workernode_01"], |
| 82 | + "kafka_brokers" => ["kafka_broker_01", "kafka_broker_02"], |
| 83 | + "kafka_brokers:vars" => {"variable1" => "example1", |
| 84 | + "variable2" => "example2"}, |
| 85 | + "kafka_worker_nodes" => ["kafka_workernode_01"], |
| 86 | + "kafka_worker_nodes:vars" => {"variable1" => "example1", |
| 87 | + "variable2" => "example2"} |
61 | 88 | } |
62 | 89 | end # End of "config.vm.provision" |
63 | 90 |
|
|
0 commit comments