Create a workspace for multiple tools to easier develop ansible playbooks with roles.
Project description
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
pip install -U ansible-workspace
or with pipx
pipx install ansible-workspace
Workspaces
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:
ansible-workspace <tool> --roles-path ~/ansible-roles --symlink-path roles/
VSCode
The workspace consists of:
- A folder for the playbook directory
- A folder for each role defined in the requirements
ansible-workspace vscode
code ~/workspaces/example-project.code-workspace
tmuxp
The workspace consists of:
- A window for the playbook directory
- A window to exectute ansible commands
- A window for each role defined in the requirements
ansible-workspace tmuxp
tmuxp load -y ~/workspaces/example-project.tmuxp-workspace.yml
Examples
The following roles are defined under roles/requirements.yml
:
---
roles:
- name: role1
version: v1.0.3
src: git@github.com:rwxd/ansible-role-subuid_subgid.git
scm: git
- name: role2
version: v1.0.2
src: git@github.com:rwxd/ansible-role-subuid_subgid.git
scm: git
- name: role3
version: master
src: git@github.com:rwxd/ansible-role-subuid_subgid.git
scm: git
❯ ansible-workspace vscode
Cloning "git@github.com:rwxd/ansible-role-subuid_subgid.git" to "/tmp/test_repo/roles/role1"
Checking out "v1.0.3" on "git@github.com:rwxd/ansible-role-subuid_subgid.git"
Cloning "git@github.com:rwxd/ansible-role-subuid_subgid.git" to "/tmp/test_repo/roles/role2"
Checking out "v1.0.2" on "git@github.com:rwxd/ansible-role-subuid_subgid.git"
Cloning "git@github.com: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/<name>/workspaces/test_repo.code-workspace"
The workspace can now be opened with code ~/workspaces/test_repo.code-workspace
.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ansible_workspace-1.0.7.tar.gz
.
File metadata
- Download URL: ansible_workspace-1.0.7.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30814f1bb4b9932d612ce1c1b53959fd7969857131b191074c4934e1ac20c403 |
|
MD5 | 724462a6c974a81f9edc4f57b91230de |
|
BLAKE2b-256 | 7189de4d44c8438bd71dbd126169f31f14292a3a0495175e234c48954b474746 |
File details
Details for the file ansible_workspace-1.0.7-py3-none-any.whl
.
File metadata
- Download URL: ansible_workspace-1.0.7-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46fc8cece073d8321f39a698ca19aed8dd85f1deefb703b17233b12d0cefe293 |
|
MD5 | b7463e24ce1d51ff7872cf253a449467 |
|
BLAKE2b-256 | df0cb1a725a89ac7866c719f3bfd4592e6253d1f8f665d1e991f9ca5ab66606c |