Writing recipes
Refer to these guidelines when creating your recipes.
When using recipes, consider the following guidelines:
- Cloudbreak supports running bash and python scripts as recipes. We
recommend using scripts with Shebang character sequence, for
example:
#!/bin/sh #!/bin/bash #!/usr/bin/sh #!/usr/bin/bash #!/usr/bin/env sh #!/usr/bin/env bash #!/bin/sh -x #!/usr/bin/python #!/usr/bin/env python
- The scripts are executed as root. The recipe output is written to
/var/log/recipes
on each node on which it was executed. - Recipe logs could be found at
/var/log/recipes/${RECIPE_TYPE}/${RECIPE_NAME}.log
- The scripts are executed on all nodes of the host groups that you select (such as “master”, “worker”, “compute”).
- In order to be executed, your script must be in a network location which is accessible from the Cloudbreak and cluster instances VPC.
- Make sure to follow Linux best practices when creating your scripts. For example, don’t forget to script “Yes” auto-answers where needed.
- Do not execute
yum update –y
as it may update other components on the instances (such as salt) – which can create unintended or unstable behavior.
Example Python script
#!/usr/bin/python
print("An example of a python script")
import sys
print(sys.version_info)
Example bash script for yum proxy settings
#!/bin/bash
cat >> /etc/yum.conf
<<ENDOF
proxy=http://10.0.0.133:3128
ENDOF