Code Monkey home page Code Monkey logo

ansible-workspace's Introduction

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/

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

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
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: [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
❯ 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/<name>/workspaces/test_repo.code-workspace"

The workspace can now be opened with code ~/workspaces/test_repo.code-workspace.

ansible-workspace's People

Contributors

renovate[bot] avatar rwxd avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.