To use Ansible to start the Nifi service, you can use the Ansible service module. Here’s an example playbook that starts the Nifi service:
- name: Start Nifi service
hosts: nifi_server
become: true
tasks:
- name: Start Nifi service
service:
name: nifi
state: started
In this playbook, we use the
service
module to start the Nifi service. The
name
parameter specifies the name of the service, which is
nifi
in this case. The
state
parameter is set to
started
, which instructs Ansible to start the service if it is not already running.
You can save this playbook to a file, for example,
start_nifi.yml
, and run it with the following command:
ansible-playbook start_nifi.yml
Make sure to replace
nifi_server
with the hostname or IP address of the server where Nifi is installed. Also, ensure that Ansible is properly configured to connect to the server using SSH or another supported method.

