Help with Bolt Puppet DSL example

20 views
Skip to first unread message

Sandra Schlichting

unread,
Nov 17, 2021, 3:42:45 PM11/17/21
to Puppet Users

Dear all =)

I would like to learn Bolt with Puppet DSL, so I was wondering if someone could get me started with an example that:

* logs into a Linux host
* touch new_file_as_user
* sudo
* touch file_as_root

That would be very much appreciated =)

Hugs,
Sandra =)


Martin Alfke

unread,
Nov 18, 2021, 6:59:19 AM11/18/21
to puppet...@googlegroups.com
Hi Sandra,

Bolt has two options: tasks and plans.
Tasks consist of a Script (Shell, Powershell, Python, Ruby) and a .json file.
Plans are written in Puppet DSL.

Main difference:
Tasks run workflow actions like stop a service, do something and restart the service.
Plans are used to control tasks over a number of nodes.

In you case I would head to a task.
When using pdf, you can run pdf new task within a module.

You can then use bolt to execute a task:

bolt task run <task name> —nodes <comma separated node list>

The task istself:
#modules/demo/tasks/test.sh
#!/bin/bash
touch <file>
sudo touch <file>

Hth,
Martin

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/4b32d706-6be7-4adf-8703-e7f5174720a7n%40googlegroups.com.

Sandra Schlichting

unread,
Nov 19, 2021, 7:59:37 AM11/19/21
to Puppet Users
Dear Martin,

It sure did. Thanks a lot =)

Hugs,
Sandra =)
Reply all
Reply to author
Forward
0 new messages