Sample repository to deploy kafka with Confluent Platform
Use vagrant box to construct virtual environment.
In this case, select amazonlinux-2 as an example.
$ vagrant box add bento/amazonlinux-2 # only first time
Initialize virtualbox environment.
$ cp Vagrantfile into path/to/work/dir
$ cd path/to/work/dir
$ vagrant init bento/amazonlinux-2
Bootup guest OS and connect via ssh.
$ vagrant up
$ vagrant ssh
[vagrant@vagrant ~]$ uname -ar
Linux vagrant 4.14.154-128.181.amzn2.x86_64 #1 SMP Sat Nov 16 21:49:00 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
$ pip install ansible
hosts.yml has some configuration for vagrant. it can be set via environment variables.
$ export VAGRANT_PORT=2222
$ export VAGRANT_PRIVATE_KEY="path/to/.vagrant/machines/default/virtualbox/private_key"
Confirm ansible can connect via ssh.
$ ansible -i hosts.yml all -m ping
Update DEFAULT_HASH_BEHAVIOUR.
$ export ANSIBLE_HASH_BEHAVIOUR="merge"
$ cd cp-ansible
$ ansible-playbook -i ../hosts.yml all.yml
$ cd cp-ansible
$ ansible-playbook -i ../hosts.yml all.yml --tags zookeeper,kafka_broker