TransWikia.com

Run command from Jenkins to Linux Server

DevOps Asked by ankit thakkar on August 22, 2021

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?

One Answer

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)

Answered by Bruce Becker on August 22, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP