Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .codeboarding/Ansible_Base_Runner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
```mermaid

graph LR

AnsibleBaseRunner["AnsibleBaseRunner"]

Shell_Utility["Shell Utility"]

AnsibleBaseRunner -- "relies on" --> Shell_Utility

```



[![CodeBoarding](https://img.shields.io/badge/Generated%20by-CodeBoarding-9cf?style=flat-square)](https://github.com/CodeBoarding/GeneratedOnBoardings)[![Demo](https://img.shields.io/badge/Try%20our-Demo-blue?style=flat-square)](https://www.codeboarding.org/demo)[![Contact](https://img.shields.io/badge/Contact%20us%20-%20contact@codeboarding.org-lightgrey?style=flat-square)](mailto:contact@codeboarding.org)



## Details



The Ansible Base Runner subsystem is a foundational Python library designed to encapsulate the common logic required for executing various Ansible commands within a StackStorm environment. It promotes code reusability and consistency across different Ansible-related actions.



### AnsibleBaseRunner

This is the core abstract base class of the Ansible Base Runner subsystem. It provides the foundational logic for executing various Ansible commands. Its responsibilities include: Input Parameter Parsing: Specifically handles the transformation of --extra_vars arguments (_parse_extra_vars). Environment Management: Ensures correct Ansible execution by prepending the virtual environment path to the system's PATH (_prepend_venv_path). Command Construction: Dynamically builds the full command-line arguments for Ansible binaries (via the cmd property). Binary Resolution: Locates the correct Ansible binary within the environment (via the binary property). External Command Invocation: Executes the constructed command using subprocess.call and handles exit codes (via the execute method). It acts as an Adapter and Facade for Ansible's command-line interface, abstracting the underlying shell execution details for all specific Ansible actions that inherit from it.





**Related Classes/Methods**:



- <a href="https://github.com/recursionpharma/stackstorm_pack_ansible/blob/trunk/actions/lib/ansible_base.py#L14-L141" target="_blank" rel="noopener noreferrer">`ansible_base.AnsibleBaseRunner` (14:141)</a>

- <a href="https://github.com/recursionpharma/stackstorm_pack_ansible/blob/trunk/actions/lib/ansible_base.py#L30-L85" target="_blank" rel="noopener noreferrer">`ansible_base.AnsibleBaseRunner:_parse_extra_vars` (30:85)</a>

- <a href="https://github.com/recursionpharma/stackstorm_pack_ansible/blob/trunk/actions/lib/ansible_base.py#L88-L97" target="_blank" rel="noopener noreferrer">`ansible_base.AnsibleBaseRunner:_prepend_venv_path` (88:97)</a>

- <a href="https://github.com/recursionpharma/stackstorm_pack_ansible/blob/trunk/actions/lib/ansible_base.py#L112-L119" target="_blank" rel="noopener noreferrer">`ansible_base.AnsibleBaseRunner:cmd` (112:119)</a>

- <a href="https://github.com/recursionpharma/stackstorm_pack_ansible/blob/trunk/actions/lib/ansible_base.py#L122-L141" target="_blank" rel="noopener noreferrer">`ansible_base.AnsibleBaseRunner:binary` (122:141)</a>

- <a href="https://github.com/recursionpharma/stackstorm_pack_ansible/blob/trunk/actions/lib/ansible_base.py#L99-L108" target="_blank" rel="noopener noreferrer">`ansible_base.AnsibleBaseRunner:execute` (99:108)</a>





### Shell Utility

This component provides utility functions specifically designed for processing and manipulating shell command arguments. Its primary role is to assist the AnsibleBaseRunner by applying specific replacement rules to command arguments before they are executed, ensuring proper formatting and handling of shell-specific nuances.





**Related Classes/Methods**:



- <a href="https://github.com/recursionpharma/stackstorm_pack_ansible/blob/trunk/actions/lib/shell.py#L1-L1" target="_blank" rel="noopener noreferrer">`shell` (1:1)</a>

- <a href="https://github.com/recursionpharma/stackstorm_pack_ansible/blob/trunk/actions/lib/shell.py#L7-L29" target="_blank" rel="noopener noreferrer">`shell:replace_args` (7:29)</a>









### [FAQ](https://github.com/CodeBoarding/GeneratedOnBoardings/tree/main?tab=readme-ov-file#faq)
195 changes: 195 additions & 0 deletions .codeboarding/Specific_Ansible_Actions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
```mermaid

graph LR

AnsibleBaseRunner["AnsibleBaseRunner"]

AnsiblePlaybookAction["AnsiblePlaybookAction"]

AnsibleCommandAction["AnsibleCommandAction"]

AnsibleGalaxyAction["AnsibleGalaxyAction"]

AnsibleVaultAction["AnsibleVaultAction"]

Shell_Utility_Module["Shell Utility Module"]

YAML_Action_Definitions_Specific_Actions_["YAML Action Definitions (Specific Actions)"]

AnsiblePlaybookAction -- "inherits from" --> AnsibleBaseRunner

AnsibleCommandAction -- "inherits from" --> AnsibleBaseRunner

AnsibleGalaxyAction -- "inherits from" --> AnsibleBaseRunner

AnsibleVaultAction -- "inherits from" --> AnsibleBaseRunner

AnsibleBaseRunner -- "uses" --> Shell_Utility_Module

YAML_Action_Definitions_Specific_Actions_ -- "defines interface for" --> AnsiblePlaybookAction

YAML_Action_Definitions_Specific_Actions_ -- "defines interface for" --> AnsibleCommandAction

YAML_Action_Definitions_Specific_Actions_ -- "defines interface for" --> AnsibleGalaxyAction

YAML_Action_Definitions_Specific_Actions_ -- "defines interface for" --> AnsibleVaultAction

```



[![CodeBoarding](https://img.shields.io/badge/Generated%20by-CodeBoarding-9cf?style=flat-square)](https://github.com/CodeBoarding/GeneratedOnBoardings)[![Demo](https://img.shields.io/badge/Try%20our-Demo-blue?style=flat-square)](https://www.codeboarding.org/demo)[![Contact](https://img.shields.io/badge/Contact%20us%20-%20contact@codeboarding.org-lightgrey?style=flat-square)](mailto:contact@codeboarding.org)



## Details



The "Specific Ansible Actions" component is a critical part of the StackStorm Ansible Integration Pack, serving as the direct interface between StackStorm's orchestration capabilities and Ansible's configuration management tools. This subsystem is designed with a clear separation of concerns, leveraging inheritance and the Adapter pattern to provide a robust and extensible set of actions. The core of this subsystem revolves around a base runner that handles common Ansible execution logic, which is then extended by individual action classes tailored for specific Ansible binaries.



### AnsibleBaseRunner

This is the foundational abstract component providing the common execution framework for all Ansible-related StackStorm Python actions. It encapsulates logic for setting up the execution environment (e.g., prepending virtual environment paths), parsing and transforming complex `extra_vars` arguments, dynamically constructing the Ansible command line, and executing the command via a subprocess. It acts as an Adapter for the underlying shell execution of Ansible commands.





**Related Classes/Methods**:



- `AnsibleBaseRunner` (1:1)





### AnsiblePlaybookAction

This component is a concrete StackStorm Python action specifically designed to execute Ansible playbooks. It extends `AnsibleBaseRunner`, inheriting its core execution logic, and primarily defines the `ansible-playbook` binary name and any specific argument replacement rules unique to playbook execution.





**Related Classes/Methods**:



- `AnsiblePlaybookAction` (1:1)





### AnsibleCommandAction

This component is a concrete StackStorm Python action responsible for executing arbitrary Ansible ad-hoc commands. Like `AnsiblePlaybookAction`, it extends `AnsibleBaseRunner` and specifies the `ansible` binary name along with any ad-hoc command-specific argument handling.





**Related Classes/Methods**:



- `AnsibleCommandAction` (1:1)





### AnsibleGalaxyAction

This component is a concrete StackStorm Python action dedicated to managing Ansible Galaxy operations (e.g., installing or removing roles and collections). It extends `AnsibleBaseRunner` and configures the `ansible-galaxy` binary and its unique argument replacement rules.





**Related Classes/Methods**:



- `AnsibleGalaxyAction` (1:1)





### AnsibleVaultAction

This component is a concrete StackStorm Python action for handling Ansible Vault operations, such as encrypting or decrypting sensitive files. It extends `AnsibleBaseRunner` and defines the `ansible-vault` binary and its specific argument handling.





**Related Classes/Methods**:



- `AnsibleVaultAction` (1:1)





### Shell Utility Module

This is a utility module that provides helper functions, particularly a decorator (`replace_args`), used by `AnsibleBaseRunner` to dynamically modify command-line arguments before execution. It abstracts common shell-related operations.





**Related Classes/Methods**:



- <a href="https://github.com/recursionpharma/stackstorm_pack_ansible/blob/trunk/actions/lib/shell.py#L1-L1" target="_blank" rel="noopener noreferrer">`shell` (1:1)</a>





### YAML Action Definitions (Specific Actions)

These YAML files serve as the public interface for the Python actions within StackStorm. Each file defines a specific action's metadata, including its name, description, and crucially, its input parameters (with types, defaults, and descriptions). They map the StackStorm action invocation to the underlying Python script.





**Related Classes/Methods**:



- `playbook.yaml` (1:1)

- `command.yaml` (1:1)

- `galaxy.install.yaml` (1:1)

- `galaxy.list.yaml` (1:1)

- `galaxy.remove.yaml` (1:1)

- `vault.decrypt.yaml` (1:1)

- `vault.encrypt.yaml` (1:1)









### [FAQ](https://github.com/CodeBoarding/GeneratedOnBoardings/tree/main?tab=readme-ov-file#faq)
Loading