Skip to main content

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

VSCode Workspace

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

Tmuxp Workspace

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

ansible_workspace-1.0.9.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

ansible_workspace-1.0.9-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file ansible_workspace-1.0.9.tar.gz.

File metadata

  • Download URL: ansible_workspace-1.0.9.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for ansible_workspace-1.0.9.tar.gz
Algorithm Hash digest
SHA256 69530f413ede0a108bfa6ef5b17541572adff8c0e5670029e6f5736ef250c56f
MD5 c030621c762cda37f5a4be5b2b5d0eef
BLAKE2b-256 11fde53765f219fbc6b1478e9e72fc39e4402a05329d9651d2f3e6639a230921

See more details on using hashes here.

File details

Details for the file ansible_workspace-1.0.9-py3-none-any.whl.

File metadata

File hashes

Hashes for ansible_workspace-1.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 b7f3b8fdee2f296ac49b5f76a83fb61107c3ecbf02095372d7b345a4e948af5f
MD5 bb63cf18384b0747c8e93090331c617f
BLAKE2b-256 fff9511b69148d7524b0795fddb86d9ea4861d43b54df3c3aeb6dac7af576681

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page