ansible-dev is a tool that helps you to get started with best practices of ansible with a few simple commands. It manages ansible inside a virtualenv. You can create different virtualenv with different ansible-versions(called workspace hereafter). Once a workspace is created, you can add playbooks or download roles from galaxy or can create your own roles template using single cli command.
Following script will install latest version of ansible-dev tool. It will also install dependancies i.e. python, pip and virtualenv if not already installed
curl https://raw.githubusercontent.com/gdpak/ansible-dev/master/install.sh > install.sh
chmod 764 install.sh
sudo ./install.sh
Please follow below links as per your OS
- Start an environment with ansible branch stable-2.6(default)
ansible-dev init <path>
- Start another environment with ansible branch stable-2.7 and default python version
ansible-dev init -ver stable-2.7 <path>
- Look at all the workspace created
ansible-dev ls
- Look at details of one workspace
ansible-dev ls -l <path>
- Change current workspace to work-on
ansible-dev workon <path>
- Install a galaxy role in current workspace
ansible-dev update -r <galaxy_role_name>
e.g ansible-dev update -r ansible-network.cisco_ios
- Install a role from github in current workspace
ansible-dev update -gr <github-repo-path>
e.g. ansible-dev update -gr https://github.com/gdpak/cisco_ios
- Update existing role to latest released version
ansible-dev update -r ansible-network.cisco_ios --force
- Create a playbook directory with all essential templates (inventory/vars etc)
ansible-dev create playbook foo
- Create a role with all template direcory and files
ansible-dev create role foo_role
bash-3.2$ ansible-dev --help
Usage: ansible-dev [OPTIONS] COMMAND [ARGS]...
ansible-dev is a command line tool for getting started with ansible. It
does all prerequisite for running ansible and starts initial template for
plalybook and roles
See 'ansible-dev <command> --help' for more information on a specific
command
Options:
-v, --verbose Enables verbose mode
--help Show this message and exit.
Commands:
create Create playbook/roles and other vars file to...
init Initialize the environment for ansible in a...
ls show details of ansible envionments
update Update existing workspace
workon set ansible workspace to work on Usage:...
This tool does not have any OS specific code but there might be some pip, python related dependacies based on OS. It has been tested with automated scripts on below platforms
- CentOS/RHEL, 7.4
- Ubuntu, 16.04
- MacOSx, 10.13.6(High Sierra)