def _node_runner(node_data=None): """This is only used by node so that we can execute in parallel""" env.host_string = lib.get_env_host_string() if node_data: node = node_data else: node = lib.get_node(env.host_string) _configure_fabric_for_platform(node.get("platform")) if node.get("gateway"): gateway = node.get("gateway") else: gateway = env.gateway if node.get("http_proxy"): http_proxy = node.get("http_proxy") else: http_proxy = env.http_proxy if node.get("https_proxy"): https_proxy = node.get("https_proxy") else: https_proxy = env.https_proxy with settings(https_proxy=https_proxy, http_proxy=http_proxy, gateway=gateway): if __testing__: print "TEST: would now configure {0}".format(env.host_string) else: lib.print_header("Configuring {0}".format(env.host_string)) if env.autodeploy_chef and not chef.chef_test(): deploy_chef(ask="no") chef.sync_node(node)
def _node_runner(): """This is only used by node so that we can execute in parallel""" env.host_string = lib.get_env_host_string() node = lib.get_node(env.host_string) _configure_fabric_for_platform(node.get("platform")) if __testing__: print "TEST: would now configure {0}".format(env.host_string) else: lib.print_header("Configuring {0}".format(env.host_string)) if env.autodeploy_chef and not chef.chef_test(): deploy_chef(method="omnibus") chef.sync_node(node)
def _node_runner(): """This is only used by node so that we can execute in parallel""" env.host_string = lib.get_env_host_string() node = lib.get_node(env.host_string) _configure_fabric_for_platform(node.get("platform")) if __testing__: print "TEST: would now configure {0}".format(env.host_string) else: lib.print_header("Configuring {0}".format(env.host_string)) if env.autodeploy_chef and not chef.chef_test(): deploy_chef(ask="no") chef.sync_node(node)
def role(role): """Apply the given role to a node Sets the run_list to the given role If no nodes/hostname.json file exists, it creates one """ env.host_string = lib.get_env_host_string() lib.print_header("Applying role '{0}' to {1}".format( role, env.host_string)) # Now create configuration and sync node data = lib.get_node(env.host_string) data["run_list"] = ["role[{0}]".format(role)] if not __testing__: if env.autodeploy_chef and not chef.chef_test(): deploy_chef(ask="no") chef.sync_node(data)
def role(role): """Apply the given role to a node Sets the run_list to the given role If no nodes/hostname.json file exists, it creates one """ env.host_string = lib.get_env_host_string() lib.print_header( "Applying role '{0}' to {1}".format(role, env.host_string)) # Now create configuration and sync node data = lib.get_node(env.host_string) data["run_list"] = ["role[{0}]".format(role)] if not __testing__: if env.autodeploy_chef and not chef.chef_test(): deploy_chef(ask="no") chef.sync_node(data)
def roles(*role_list, **kwargs): """Apply the given roles to a node Sets the run_list to the given roles If no nodes/hostname.json file exists, it creates one """ env.host_string = lib.get_env_host_string() lib.print_header( "Applying roles '{0}' to {1}".format(role_list, env.host_string)) override_data = kwargs.get('data', {}) on_sync = kwargs.get('on_sync', None) # Now create configuration and sync node data = lib.get_node(env.host_string) data.update(override_data) data["run_list"] = ["role[{0}]".format(x) for x in role_list] if not __testing__: if env.autodeploy_chef and not chef.chef_test(): deploy_chef(ask="no") chef.sync_node(data, on_sync)