geni.rspec.emulab.ansible¶
- class Override(name, value=None, source=None, source_name=None, on_empty=True)[source]¶
Override an Ansible variable, on a global or per-host basis. You can set either a (computed) raw value, or bind to a parameter name (source=”parameter”, source_name=”<param-fqn>”) or password (source=”password”, source_name=”<password-name>”) Currently, the definition of the parameter binding is made at experiment runtime on the client side; this is necessary for per-experiment encrypted value support, and may inspire other cases. :shrug:
- class Playbook(name, path=None, inventory_name=None, overrides_name=None, inventory_generator_path=None, overrides_generator_path=None, runner_path=None, pre_hook=None, post_hook=None, become=None)[source]¶
An ansible playbook lists tasks. Most commonly it is associated with a role or collection as a top-level method of pulling in per-role tasks; but it can also stand on its own as a task list.
Playbook runs typically require inventory and variable overrides for customization. If you are integrating a classic role (e.g. the emulab-docker role), you can use the default inventory, which places all hosts into the all group, and further adds hosts to groups named for the applied roles. If your role/playbook makes custom use of the all group, or otherwise cannot be part of global inventory/overrides files, you will need to set the inventory_name and/or overrides_name values so that our default generators create separate files, and our playbook runner uses them.
If you require additional custom control of inventory or overrides generation, you can specify paths to generator executables, whose stdout will be sent to the inventory_name or overrides_name files you define. Non-zero exit code will fail the playbook run and the entire experiment startup sequence.
If you require control of playbook run, you can provide a custom runner.
Note that all inventory/overrides/runner paths are relative to path, which itself is relative to the profile repository checkout dir.
If become is None, the Emulab user who created the experiment will be the “become” user. If you need root execution, set become to root, etc.
- class Role(name, path=None, source=None, source_type=None, group=None, auto=True, playbooks=[])[source]¶
An ansible role groups related tasks, files, vars, etc into a well-known directory structure (https://docs.ansible.com/ansible/latest/user_guide/playbooks_reuse_roles.html). It may have top-level playbooks that apply part or all of the overall role (e.g., modularized member roles).
The group parameter controls default inventory generation. If None, the name of the role will be used as the sole group; if non-empty, this value will be used to group the The empty string should not be used.
If source (a git clone value) is provided, that git repo will be cloned into the profile repository checkout dir in path. Otherwise, path should point to a canonical Ansible role dir structure (e.g. https://docs.ansible.com/ansible/latest/user_guide/playbooks_reuse_roles.html).