validations_libs.ansible module¶
- class validations_libs.ansible.Ansible(uuid=None)[source]¶
- Bases: - object- An Object for encapsulating an Ansible execution - run(playbook, inventory, workdir, playbook_dir=None, connection='smart', output_callback=None, base_dir='/usr/share/ansible', ssh_user=None, key=None, module_path=None, limit_hosts=None, tags=None, skip_tags=None, verbosity=0, quiet=False, extra_vars=None, gathering_policy='smart', extra_env_variables=None, parallel_run=False, callback_whitelist=None, ansible_cfg_file=None, ansible_timeout=30, ansible_artifact_path=None, log_path=None, run_async=False, python_interpreter=None, validation_cfg_file=None)[source]¶
- Execute one or multiple Ansible playbooks - Parameters
- playbook ( - string) – The Absolute path of the Ansible playbook
- inventory ( - string) – Either proper inventory file or a comma-separated list
- workdir ( - string) – The absolute path of the Ansible-runner artifacts directory
- playbook_dir ( - string) – The absolute path of the Validations playbooks directory
- connection (String) – Connection type (local, smart, etc). (efaults to ‘smart’) 
- output_callback ( - string) – Callback for output format. Defaults to ‘yaml’.
- base_dir ( - string) – The absolute path of the default validations base directory
- ssh_user ( - string) – User for the ssh connection (Defaults to ‘root’)
- key ( - string) – Private key to use for the ssh connection.
- module_path ( - string) – Location of the ansible module and library.
- limit_hosts ( - string) – Limit the execution to the hosts.
- tags ( - string) – Run specific tags.
- skip_tags ( - string) – Skip specific tags.
- verbosity ( - integer) – Verbosity level for Ansible execution.
- quiet ( - boolean) – Disable all output (Defaults to False)
- extra_vars (Either a Dict or the absolute path of JSON or YAML) – Set additional variables as a Dict or the absolute path of a JSON or YAML file type. 
- gathering_policy – This setting controls the default policy of fact gathering (‘smart’, ‘implicit’, ‘explicit’). (Defaults to ‘smart’) 
- extra_env_vars ( - dict) – Set additional ansible variables using an extravar dictionary.
- parallel_run ( - boolean) – Isolate playbook execution when playbooks are to be executed with multi-processing.
- callback_whitelist ( - listor- string) – Comma separated list of callback plugins. Custom output_callback is also whitelisted. (Defaults to- None)
- ansible_cfg_file ( - string) – Path to an ansible configuration file. One will be generated in the artifact path if this option is None.
- ansible_timeout ( - integer) – Timeout for ansible connections. (Defaults to- 30 minutes)
- ansible_artifact_path ( - string) – The Ansible artifact path
- log_path ( - string) – The absolute path of the validations logs directory
- run_async ( - boolean) – Enable the Ansible asynchronous mode (Defaults to ‘False’)
- python_interpreter ( - string) – Path to the Python interpreter to be used for module execution on remote targets, or an automatic discovery mode (- auto,- auto_silentor the default one- auto_legacy)
- validation_cfg_file ( - dict) – A dictionary of configuration for Validation loaded from an validation.cfg file.
 
- Returns
- A - tuplecontaining the the absolute path of the executed playbook, the return code and the status of the run
- Return type
- tuple
 
 
