Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rwxd/ansible-workspace
Create a workspace for multiple tools to easier develop ansible playbooks with roles.
https://github.com/rwxd/ansible-workspace
ansible ansible-roles tmuxp vscode workspace
Last synced: about 1 month ago
JSON representation
Create a workspace for multiple tools to easier develop ansible playbooks with roles.
- Host: GitHub
- URL: https://github.com/rwxd/ansible-workspace
- Owner: rwxd
- License: mit
- Created: 2022-12-28T17:00:33.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-22T22:23:50.000Z (about 2 months ago)
- Last Synced: 2024-09-30T17:42:03.869Z (about 2 months ago)
- Topics: ansible, ansible-roles, tmuxp, vscode, workspace
- Language: Python
- Homepage: https://rwxd.github.io/ansible_workspace/
- Size: 325 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ansible-workspace
Create a workspace for multiple tools to easier develop ansible playbooks with roles.
Roles with a reference to a git repository will be cloned, checked out and added to the workspace.
The `.gitignore` will be configured to ignore the role repositories or symlinks.
## Install
```bash
pip install -U ansible-workspace
```or with [pipx](https://github.com/pypa/pipx)
```bash
pipx install ansible-workspace
```## Workspaces
```bash
ansible-workspace --help
```### General
#### Symlinks
If you want your roles in e.g. `~/ansible-roles` but want to symlink them to `./roles` use the following command:
```bash
ansible-workspace --roles-path ~/ansible-roles --symlink-path roles/
```### [VSCode](https://code.visualstudio.com/)
The workspace consists of:
- A folder for the playbook directory
- A folder for each role defined in the requirements```bash
ansible-workspace vscode
```![VSCode Workspace](./docs/vscode-example.png)
```bash
code ~/workspaces/example-project.code-workspace
```### [tmuxp](https://github.com/tmux-python/tmuxp)
The workspace consists of:
- A window for the playbook directory
- A window to execute ansible commands
- A window for each role defined in the requirements```bash
ansible-workspace tmuxp
``````bash
tmuxp load -y ~/workspaces/example-project.tmuxp-workspace.yml
```![Tmuxp Workspace](./docs/tmuxp-example.png)
## Examples
The following roles are defined under `roles/requirements.yml`:
```yaml
---
roles:
- name: role1
version: v1.0.3
src: [email protected]:rwxd/ansible-role-subuid_subgid.git
scm: git- name: role2
version: v1.0.2
src: [email protected]:rwxd/ansible-role-subuid_subgid.git
scm: git- name: role3
version: master
src: [email protected]:rwxd/ansible-role-subuid_subgid.git
scm: git
``````bash
❯ ansible-workspace vscode
Cloning "[email protected]:rwxd/ansible-role-subuid_subgid.git" to "/tmp/test_repo/roles/role1"
Checking out "v1.0.3" on "[email protected]:rwxd/ansible-role-subuid_subgid.git"
Cloning "[email protected]:rwxd/ansible-role-subuid_subgid.git" to "/tmp/test_repo/roles/role2"
Checking out "v1.0.2" on "[email protected]:rwxd/ansible-role-subuid_subgid.git"
Cloning "[email protected]:rwxd/ansible-role-subuid_subgid.git" to "/tmp/test_repo/roles/role3"
Adding "roles/role1" to .gitignore
Adding "roles/role2" to .gitignore
Adding "roles/role3" to .gitignore
Created workspace config at "/home//workspaces/test_repo.code-workspace"
```The workspace can now be opened with `code ~/workspaces/test_repo.code-workspace`.