Once presented both Ansible Roles, I’m going to explain how to automate the creation of several instances of Apache NiFi, secure and not secure. See image below:
We are going to create 5 NiFi instances, the first NiFi instance
nf1 will be a standalone instance running over HTTP.
The second instance will will be a customized instance running over HTTPS with Client Certificate authentication.
The third, fourth and fifth instances will run over HTTPS with Client Certificate authentication with configuration provided for NiFi TLS Toolkit. This configuration, key-pair, Java key stores and certificates will be generated in other VM instance provided for
chilcano.apache-nifi-toolkit Ansible Role. See the image below:
I’ve created an Ansible Playbook for you, you can download from this Git repository: https://github.com/chilcano/ansible-apache-nifi-multi-nodes
How to use it – steps
1. Clone the Ansible playbooks
$ git clone https://github.com/chilcano/ansible-apache-nifi-multi-nodes
chilcano.apache-nifi-toolkit Ansible Roles
$ cd ansible-apache-nifi-multi-nodes $ ansible-galaxy install -r playbooks/requirements.yml
3. Create all VMs with Vagrant
Create all 6 VMs by using Vagrant.
$ cd infra/Vagrant $ vagrant up
4. Ansible provisioning with Vagrant
Now, I’m going to provision (run Ansible Playbooks) through Vagrant. This step will install Apache NiFi TLS Toolkit in the
nftk1 VM, once provisioned, Vagrant will provision 5 VMs following the Ansible Playbook
It is very important to start the provision of all NiFi instances after provisioning
playbooks/main.yml you will see the
nftk1 is declared on top and after
nf1, nf2, nf3, nf4 and
$ vagrant provision $ vagrant status Current machine states: nftk1 running (virtualbox) nf5 running (virtualbox) nf4 running (virtualbox) nf3 running (virtualbox) nf2 running (virtualbox) nf1 running (virtualbox) This environment represents multiple VMs. The VMs are all listed above with their current state. For more information about a specific VM, run `vagrant status NAME`.
Now we can verify if all instances are running as expected, before we have to install the
Client Certificate (CN=chilcano_OU=INTIX.p12) generated in our browser.
Client Certificate only is required when connecting to
nf2, nf3, nf4 and
nf5 because these instances are running over HTTPS with Mutual SSL/TLS Authentication (based on Client Certificate).
Open the URL (http://nf1:8080/nifi, http://nf2:9443/nifi, http://nf3:9443/nifi, http://nf4:9443/nifi and http://nf5:9443/nifi) from Firefox. Instead of hostname you can use the IP address (see
- Improve the Ansible Role
chilcano.apache-nifito implement Cluster Status coordination through
- Improve the Ansible Role
chilcano.apache-nifi-toolkitto implement Client/Server mode.
- Deploy a sample DataFlow in NiFi.