-
-
Save riltsken/44103d0e495827758fbe to your computer and use it in GitHub Desktop.
post plugins ran after the node has been provisioned from its first chef solo run
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
from littlechef import runner as lc | |
from littlechef import chef | |
import os | |
def execute(node): | |
""" | |
Add the node's "real role" | |
""" | |
role = None | |
name = lc.env.host_string | |
if 'lb' in name: | |
if 'preview' in name: | |
role = 'reach_lb_preview' | |
else: | |
role = 'reach_lb' | |
elif 'web' in name: | |
if 'preview' in name: | |
role = 'reach_web_preview' | |
else: | |
role = 'reach_web' | |
elif 'prxy' in name: | |
role = 'reach_proxy' | |
elif 'sio' in name: | |
role = 'reach_sio' | |
if role: | |
node['run_list'] += ['role[{0}]'.format(role)] | |
os.remove(chef.save_config(node, force=True)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment