I have a HAProxy server setup in Azure Linux Machine. How can I run a HAProxy start/stop command from Jenkins to multiple Linux server?

1 Answer 1


If you have ssh access from the Jenkins machine to the HAProxy machine, you could run an Ansible task:

ansible -i ha-inventory.ini ha-servers -m service -a name=haproxy state=restarted

Of course you could also have Jenkins do a simple ssh :

for server in ${server_list} ; do ssh server 'sudo service haproxy restart' ; done

For both of these, you would need

  • ssh keys set up between Jenkins and the HAProxy servers
  • sudo rights for restarting the service (at least) for the connecting user (probably jenkins)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.