Develop automation content in your workspace
The Ansible development tools are installed as part of the Ansible extension in the Ansible development workspace. You can use Ansible development tools to scaffold directories for automation content in your repository.
Using the Ansible extension ensures that best practices for directory structure are met.
Red Hat recommends that you create only one collection per repository, so that each collection has a clear, specific purpose. This approach promotes reusability, as each collection is a self-contained unit of content. A one-to-one relationship between a collection and its repository also improves manageability by simplifying dependency management, maintenance, and release cycles.
Create collections and playbooks in your Ansible development workspace
Use the Ansible extension in VS Code to use Ansible development tools to scaffold directories and files for your automation content. You can use Red Hat Ansible Lightspeed with IBM watsonx Code Assistant to help you write playbooks, and ansible-lint to debug them.
About this task
Procedure
Edit and debug automation content in your Ansible development workspace
You can continue to work in an existing workspace. Workspaces that are inactive might be paused due to an administrator-set timeout to free up resources. However, they will automatically relaunch when you select them from the OpenShift Dev Spaces dashboard.
About this task
Procedure
Execute playbooks in your Ansible development workspace
Execute your playbooks using the integrated Ansible extension or ansible-navigator within the VS Code environment of your workspace.
About this task
With the introduction of full container-in-container support, you can seamlessly use execution environments within Ansible development workspaces. Tools such as ansible-navigator and ansible-builder are fully supported for executing playbooks and building custom execution environments directly from your browser-based workspace.
Procedure
Configure ansible-navigator for execution environments
Customize ansible-navigator settings in your Ansible development workspace to configure execution environment options, logging, and output format.
About this task
The ansible-navigator tool uses a YAML configuration file to define settings for execution environments, container engines, and output behavior. An example ansible-navigator.yaml file is available in the Content from github.com is not included.Ansible Development Workspace Sample repository.
Procedure
Share your work
Share your automation content and collaborate with colleagues by working together from a single shared Git repository and submitting pull requests.
About this task
Procedure
- To contribute to a colleague's project, request the URL for the Git repository that corresponds to your colleague's Ansible development workspace.
- Launch a workspace using the repository URL that your colleague shared.
- Work within a new git branch and contribute to your colleague's repository by creating a merge or pull request.