linchpin.api module¶
This page contains the list of project’s modules
-
class
linchpin.api.
LinchpinAPI
(ctx)¶ -
bind_to_hook_state
(callback)¶ Function used by LinchpinHooksclass to add callbacks
Parameters: callback – callback function
-
find_topology
(topology)¶ Find the topology to be acted upon. This could be pulled from a registry.
Parameters: topology – name of topology from PinFile to be loaded
-
get_cfg
(section=None, key=None, default=None)¶ Get cfgs value(s) by section and/or key, or the whole cfgs object
Parameters: - section – section from ini-style config file
- key – key to get from config file, within section
- default – default value to return if nothing is found.
Does not apply if section is not provided.
-
get_evar
(key=None, default=None)¶ Get the current evars (extra_vars)
Parameters: - key – key to use
- default – default value to return if nothing is found (default: None)
-
hook_state
¶ getter function for hook_state property of the API object
-
lp_destroy
(pinfile, targets='all')¶ This function takes a list of targets, and performs a destructive teardown, including undefining nodes, according to the target.
See also
lp_down - currently unimplemented
Parameters: - pinfile – Provided PinFile, with available targets,
- targets – A tuple of targets to destroy.
-
lp_down
(pinfile, targets='all')¶ This function takes a list of targets, and performs a shutdown on nodes in the target’s topology. Only providers which support shutdown from their API (Ansible) will support this option.
CURRENTLY UNIMPLEMENTED
See also
lp_destroy
Parameters: - pinfile – Provided PinFile, with available targets,
- targets – A tuple of targets to provision.
-
lp_drop
(pinfile, targets)¶ DEPRECATED
An alias for lp_destroy. Used only for backward compatibility.
-
lp_rise
(pinfile, targets='all')¶ DEPRECATED
An alias for lp_up. Used only for backward compatibility.
-
lp_up
(pinfile, targets='all')¶ This function takes a list of targets, and provisions them according to their topology. If an layout argument is provided, an inventory will be generated for the provisioned nodes.
Parameters: - pinfile – Provided PinFile, with available targets,
- targets – A tuple of targets to provision.
-
run_playbook
(pinfile, targets='all', playbook='up')¶ This function takes a list of targets, and executes the given playbook (provison, destroy, etc.) for each provided target.
Parameters: - pinfile – Provided PinFile, with available targets,
- targets – A tuple of targets to run. (default: ‘all’)
-
set_cfg
(section, key, value)¶ Set a value in cfgs. Does not persist into a file, only during the current execution.
Parameters: - section – section within ini-style config file
- key – key to use
- value – value to set into section within config file
-
set_evar
(key, value)¶ Set a value into evars (extra_vars). Does not persist into a file, only during the current execution.
Parameters: - key – key to use
- value – value to set into evars
-
set_magic_vars
()¶ Function inbuilt to set magic vars for ansible context
-
-
linchpin.api.
suppress_stdout
(*args, **kwds)¶ This context manager provides tooling to make Ansible’s Display class not output anything when used