How to Install Puppet Bolt to Automate Sysadmin tasks?

Putting in Puppet Bolt on Ubuntu…

Puppet Bolt is an open-source software extensively used to automate handbook work.

Bolt is predicated on Ruby and its command-line utility that enables scripting and command execution on a neighborhood and distant server through SSH and WinRM. It helps Sysadmin handle a number of servers in some ways.

  • Handle Updates
  • Software program set up
  • Learn logs
  • Cease or begin companies
  • Command execution

The excellent news is that you simply needn’t set up any brokers on the servers. It is agentless.

Situation

The next instance is on Ubuntu, so that you want an Ubuntu VM sudo entry to the basis.

Replace system

We strongly advocate that you simply improve all accessible repositories and packages earlier than putting in a brand new package deal on the system. Run the next command and it’ll do the job for you.

sudo apt-get replace

Set up Puppet Bolt

Since it’s agentless, you needn’t set up it on each server. As a substitute solely on one server which is able to act as grasp and can be utilized to hook up with distant servers. Bolt is a cross-platform software so you’ll be able to set up it in your most well-liked working system.

  • Home windows
  • macOS
  • RHEL
  • CentOS
  • fedora
  • Debian
  • ubuntu

Test the official web site for the most recent model accessible. Let’s set up this on Ubuntu.

Run the next command to get the package deal.

sudo wget https://apt.puppet.com/puppet6-release-bionic.deb

Then set up the package deal downloaded above utilizing the Debian Package deal Supervisor command.

sudo dpkg -i puppet6-release-bionic.deb

Replace the system once more with the next command.

sudo apt-get replace

Lastly, run the next command to put in the bolt.

sudo apt-get set up puppet-bolt

You have got efficiently put in puppet bolt in your server.

This ought to be performed on all servers you wish to handle via Bolt.

As talked about earlier, Bolt connects to a different server utilizing the SSH key, so I assume you have already exchanged a key between servers. If not, you’ll be able to confer with this information on tips on how to arrange SSH key alternate.

Let’s connect with distant servers and run latch instructions.

Use the next command to run a command on a single node.

bolt command run <COMMAND> --nodes <NODE>

Change COMMAND with the command you wish to run and NODE with the host identify or IP deal with of the distant server. Equally, you may as well run a command on a number of nodes.

bolt command run <COMMAND> -n <NODE1,NODE2,NODE3,NODE4>

If it’s worthwhile to add password verification to a command, you’ll be able to add it utilizing the flags.

bolt command run <COMMAND> -n <NODE1,NODE2> -u <USER> -p <PASSWORD>

Supposing you wish to see how lengthy the system has been up and operating, it’s best to use the `uptime` command as follows:

bolt command run uptime --nodes 35.185.68.71,35.231.9.135

You need to see the next output.

sajid@Sajid-PC:~$ bolt command run uptime --nodes 35.185.68.71,35.231.9.135
Began on 35.185.68.71...
Began on 35.231.9.135...
Completed on 35.231.9.135:
STDOUT:
04:57:48 up 7 min, 0 customers, load common: 0.00, 0.03, 0.02
Completed on 35.185.68.71:
STDOUT:
04:57:48 up 9 min, 0 customers, load common: 0.00, 0.00, 0.00
Profitable on 2 nodes: 35.185.68.71,35.231.9.135
Ran on 2 nodes in 5.96 seconds

It’s attainable that you simply wish to run a command that incorporates areas, so you could enclose the command in single quotes:

sajid@Sajid-PC:~$ bolt command run 'echo $HOME' --nodes 35.185.68.71,35.231.9.135
Began on 35.185.68.71...
Began on 35.231.9.135...
Completed on 35.231.9.135:
STDOUT:
/dwelling/sajid
Completed on 35.185.68.71:
STDOUT:
/dwelling/sajid
Profitable on 2 nodes: 35.185.68.71,35.231.9.135
Ran on 2 nodes in 6.11 seconds

Run scripts

All of us have a set of scripts that we use regularly.

Bolt makes it simple to reuse these scripts with none modification and run them concurrently on much more nodes. All it’s worthwhile to do is specify the identify and path of the script you wish to run.

bolt script run <PATH/TO/SCRIPT> --nodes <NODE1,NODE2,NODE3,NODE4>
bolt script run /dwelling/sajid/Desktop/samplescript.sh --nodes 35.185.68.71,35.231.9.135

You need to see the output one thing like this:

sajid@Sajid-PC:/$ bolt script run /dwelling/sajid/Desktop/samplescript.sh --nodes 35.185.68.71,35.231.9.135
Began on 35.185.68.71...
Began on 35.231.9.135...
Completed on 35.231.9.135:
STDOUT:
Hi there World
Completed on 35.185.68.71:
STDOUT:
Hi there World
Profitable on 2 nodes: 35.185.68.71,35.231.9.135
Ran on 2 nodes in 15.18 seconds

You possibly can run scripts in any language so long as the suitable interpreter is put in on the distant system.

Automation with process

The duty is a sequence of actions that you simply wish to carry out on distant machines.

Duties will be written in any language that runs on a distant node. Duties make it simple to reuse and share scripts and provide help to obtain automation. You possibly can obtain some current duties from Puppet Forge and add your duties there as wanted.

For instance, if you wish to test the standing of the vim package deal, you need to use the next command.

bolt process run package deal motion=standing identify=vim --nodes 35.185.68.71,35.231.9.135

You will notice the output that appears one thing like this:

sajid@Sajid-PC:~$ bolt process run package deal motion=standing identify=vim --nodes 35.185.68.71,35.231.9.135
Began on 35.185.68.71...
Began on 35.231.9.135...
Completed on 35.185.68.71:
{
"standing": "set up okay put in",
"model": "2:7.4.1689-3ubuntu1.3"
}
Completed on 35.231.9.135:
{
"standing": "set up okay put in",
"model": "2:7.4.1689-3ubuntu1.3"
}
Profitable on 2 nodes: 35.185.68.71,35.231.9.135
Ran on 2 nodes in 19.15 seconds

In case you discover the vim package deal not put in, you’ll be able to set up it utilizing the next command.

bolt process run package deal motion=set up identify=vim --nodes 35.185.68.71,35.231.9.135

You possibly can run a plan to arrange nodejs and join it to your load balancer. You are able to do this by combining Puppet Bolt with a goal node that already has the Bolt put in.

bolt plan run nodejs::myplan load_balancer=lb.myorg.com

You need to use the puppet bolt to repeat information on distant nodes. You possibly can simply add the file or folder to the distant node utilizing the `bolt file add` command. All it’s a must to do is specify the trail of the file on the native machine and the vacation spot on the distant node.

bolt file add <SOURCE> <DESTINATION> --nodes <NODE1>

To add a file concurrently on a number of distant nodes:

bolt file add sample_file.txt /tmp/remotesample_file.txt --nodes 35.185.68.71,35.231.9.135

Numerous choices as you’ll be able to see.

Create a list file

Bolt lets you create a list file that shops details about your nodes, duties, and configuration. You possibly can specify a number of nodes in a gaggle and the stock file is saved in stock.yaml within the mission folder by default. Here is an instance of tips on how to create a list file.

---
# Instance Stock file
teams:
- identify: Group of nodes
nodes:
- node1
- node2
- node3
config:
ssh:
host-key-check: false
ssl: false

You possibly can exchange this node1, node2, node3 together with your precise node area identify or the IP deal with of your nodes. Now you can add this stock file to the bolt instructions to run duties on the required nodes.

bolt command run <COMMAND> --inventoryfile ./stock.yaml

Conclusion

I hope by now you might have an thought of ​​what Bolt is and the way it might help you with the automation. You may additionally be eager about studying extra about Puppet.

Leave a Comment

porno izle altyazılı porno porno