Skip to content

Instantly share code, notes, and snippets.

@trlinkin
Created June 26, 2018 17:45
Show Gist options
  • Save trlinkin/eeeb3c9df05eb6f1e28431ad19c872f7 to your computer and use it in GitHub Desktop.
Save trlinkin/eeeb3c9df05eb6f1e28431ad19c872f7 to your computer and use it in GitHub Desktop.
Example Puppet based Task
https://puppet.com/docs/bolt/0.x/writing_tasks.html#concept-4523
{
"description": "Allows you to control existance of a user or whatever",
"input_method": "stdin",
"parameters": {
"user": {
"description": "User to operate on",
"type": "String[1]"
},
"action": {
"description": "The action to take",
"type": "Optional[Enum['present','absent']]"
}
}
}
#!/bin/bash
user=$PT_user
if [ -z "$PT_action" ]
then
action="present"
else
action=$PT_action
fi
/opt/puppetlabs/bin/puppet resource user ${user} ensure=${action}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment