Created
June 26, 2018 17:45
-
-
Save trlinkin/eeeb3c9df05eb6f1e28431ad19c872f7 to your computer and use it in GitHub Desktop.
Example Puppet based Task
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://puppet.com/docs/bolt/0.x/writing_tasks.html#concept-4523 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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']]" | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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