def _deploy_server(source, cp, server, version=None, build_only=False, check_deps=False): ''' Detail deploy actions to a single server. ''' setup_host(cp, server) roles_repr = cp.get(server, 'roles') print 'Server : %s, Source : %s, Roles : %s' % (server, source, roles_repr) roles = normalize_roles(roles_repr.split(',')) _deploy_role(source, cp, server, roles, version, build_only=build_only, check_deps=check_deps)
def deploy_role(source, confset, servers, roles, version=None, build_only=False, check_deps=False): ''' Deploy a single role to a single role. ''' cp, source, version, roles = perpare_args(source, confset, version=version, roles=roles) if not servers: servers = cp.sections() for server in servers: roles_repr = cp.get(server, 'roles') server_roles = normalize_roles(roles_repr.split(',')) target_roles = server_roles & roles if roles else server_roles if not target_roles: continue setup_host(cp, server) print 'Deploying roles:%s to server:%s...' % (",".join(target_roles), server) _deploy_role(source, cp, server, target_roles, version, build_only=False, check_deps=check_deps)