geni.rspec.emulab.ansible¶
-
class
Collection
(name, source=None, requirements=None, requirements_txt=None)[source]¶ Declares an Ansible collection that should be installed as part of the bootstrap process. name must be the fully-qualified name of the collection (namespace.name). source may be any valid source argument to ansible-galaxy collection install; if left None or “”, the name will be used as the source (e.g., if the collection is present in the Ansible Galaxy). requirements determines if the collection’s requirements are installed after installing the collection. (If set to None or True, the bootstrap process will look for a requirements.yml file in the installed collection, and install it via ansible-galaxy collection install -r requirements.yml. If set to a file path string that exists (local paths interpreted relative to the profile checkout directory in /local/repository), that path will be used instead. Finally, if set to False, no collection dependencies will be installed.) requirements_txt determines if the collection’s Python dependencies are installed via pip, or not, in the same way, by default from a requirements.txt file in the collection. If you elect to use the system Ansible binaries (e.g. from distro packages) instead of the default virtualenv approach, this is not likely to work.
-
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). Typically, these top-level playbooks include one or more “plays” that associate a role with a host group. Often, the group name is the same as the role name.
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).