Module Expr Str ImportFrom alias Import alias ImportFrom alias ImportFrom alias ImportFrom alias FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Return ListLoad Call AttributeLoad Str attr NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad body Expr Str If Call NameLoad NameLoad AttributeLoad NameLoad attr body Assign NameStore ListLoad NameLoad If NameLoad body Assign NameStore ListComp Call AttributeLoad Str attr NameLoad NameLoad comprehension NameStore NameLoad Return NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad body Expr Str Assign NameStore ListLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad Str If NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad NameLoad orelse Expr Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad body Expr Str Assign NameStore ListLoad Assign NameStore BoolOpOr AttributeLoad AttributeLoad NameLoad attr attr ListLoad Assign NameStore CompareIn NameLoad NameLoad If BoolOpAnd UnaryOpNot NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad orelse If BoolOpAnd NameLoad UnaryOpNot NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad Return NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad body Expr Str Assign NameStore ListLoad Assign NameStore BoolOpOr AttributeLoad AttributeLoad NameLoad attr attr Dict Assign NameStore Call AttributeLoad NameLoad attr NameLoad If CompareIs NameLoad NameLoad body Assign NameStore ListLoad If BoolOpAnd UnaryOpNot NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad Return NameLoad If BoolOpAnd NameLoad CompareIs NameLoad NameLoad body Assign NameStore ListLoad If NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr Call AttributeLoad Str attr NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr Call AttributeLoad Str attr NameLoad NameLoad orelse Assign NameStore ListLoad If BoolOpAnd NameLoad CompareNotEq SubscriptLoad NameLoad Index Str NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad If BoolOpAnd NameLoad CompareNotEq SubscriptLoad NameLoad Index Str NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad If BoolOpAnd NameLoad CompareNotEq SubscriptLoad NameLoad Index Str NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad If CompareNotEq Call NameLoad SubscriptLoad NameLoad Index Str Call NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr Call AttributeLoad Str attr NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr Call AttributeLoad Str attr NameLoad NameLoad If NameLoad body If NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad keyword NameLoad keyword NameLoad If CompareIsNot NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad NameLoad Call AttributeLoad Str attr NameLoad keyword NameLoad keyword NameLoad keyword Num Assign NameStore Call AttributeLoad Str attr NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad keyword NameLoad keyword NameLoad keyword Num For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad NameLoad Return NameLoad decorator_list NameLoad
N/A N/A 
The server module takes care of os-level state. Targets POSIX compatability, tested on
Linux/BSD.
 __future__ unicode_literals N/A six pyinfra.api operation N/A files util.files chmod wait N/A N/A state host port N/A None N/A N/A 
    Waits for a port to come active on the target machine. Requires netstat, checks every
    1s.

    + port: port number to wait for
     N/A N/A N/A N/A 
        while ! (netstat -an | grep LISTEN | grep -e "\.{0}" -e ":{0}"); do
            echo "waiting for port {0}..."
            sleep 1
        done
     format port N/A operation shell N/A N/A state host commands chdir N/A None N/A N/A 
    Run raw shell code.

    + commands: command or list of commands to execute on the remote server
    + chdir: directory to cd into before executing commands
     N/A N/A isinstance commands N/A six string_types N/A N/A commands N/A commands N/A chdir N/A N/A commands N/A N/A N/A cd {0} && ({1}) format chdir command N/A command commands N/A commands N/A operation script N/A N/A state host filename chdir N/A None N/A N/A 
    Upload and execute a local script on the remote host.

    + filename: local script filename to upload & execute
    + chdir: directory to cd into before executing the script
     N/A commands N/A N/A temp_file N/A N/A state get_temp_filename filename N/A N/A N/A commands extend N/A N/A files put state host filename temp_file N/A N/A N/A commands append N/A chmod temp_file +x N/A chdir N/A N/A N/A N/A commands append N/A N/A cd {0} && {1} format chdir temp_file N/A N/A N/A N/A commands append temp_file N/A commands N/A operation group N/A N/A state host name present N/A True N/A N/A 
    Manage system groups.

    + name: name of the group to ensure
    + present: whether the group should be present or not
     N/A commands N/A N/A groups N/A N/A N/A host fact groups N/A N/A is_present N/A name groups N/A N/A N/A present is_present N/A N/A N/A N/A commands append N/A N/A groupdel {0} format name N/A N/A N/A present N/A is_present N/A N/A N/A N/A commands append N/A N/A groupadd {0} format name N/A commands N/A operation user N/A N/A state host name present home shell group groups public_keys ensure_home N/A True None None None None None True N/A N/A 
    Manage system users & their ssh `authorized_keys`. Options:

    + name: name of the user to ensure
    + present: whether this user should exist
    + home: the users home directory
    + shell: the users shell
    + group: the users primary group
    + groups: the users secondary groups
    + public_keys: list of public keys to attach to this user, ``home`` must be specified
    + ensure_home: whether to ensure the ``home`` directory exists
     N/A commands N/A N/A users N/A N/A N/A host fact users N/A N/A user N/A N/A users get name N/A N/A groups None N/A N/A groups N/A N/A N/A N/A present user N/A N/A N/A N/A commands append N/A N/A userdel {0} format name N/A commands N/A N/A present N/A user None N/A N/A args N/A N/A home N/A N/A N/A N/A args append N/A N/A -d {0} format home N/A shell N/A N/A N/A N/A args append N/A N/A -s {0} format shell N/A group N/A N/A N/A N/A args append N/A N/A -g {0} format group N/A groups N/A N/A N/A N/A args append N/A N/A -G {0} format N/A N/A , join groups N/A N/A N/A commands append N/A N/A useradd {0} {1} format N/A N/A join args name N/A N/A args N/A N/A N/A home N/A N/A user N/A home home N/A N/A N/A N/A args append N/A N/A -d {0} format home N/A N/A shell N/A N/A user N/A shell shell N/A N/A N/A N/A args append N/A N/A -s {0} format shell N/A N/A group N/A N/A user N/A group group N/A N/A N/A N/A args append N/A N/A -g {0} format group N/A N/A N/A set N/A user N/A groups N/A set groups N/A N/A N/A N/A args append N/A N/A -G {0} format N/A N/A , join groups N/A args N/A N/A N/A N/A commands append N/A N/A usermod {0} {1} format N/A N/A join args name N/A home N/A N/A ensure_home N/A N/A N/A N/A commands extend N/A N/A files directory state host home user name group name N/A N/A public_keys None N/A N/A N/A N/A commands extend N/A N/A files directory state host N/A N/A {0}/.ssh format home user name group name mode 700 N/A filename N/A N/A {0}/.ssh/authorized_keys format home N/A N/A N/A commands extend N/A N/A files file state host filename user name group name mode 600 N/A key public_keys N/A N/A N/A N/A commands append N/A N/A cat {0} | grep "{1}" || echo "{1}" >> {0} format filename key N/A commands N/A operation