DOConsole
is a command-line interface (CLI) tool that allows you to manage DigitalOcean droplets and run Ansible playbooks. The tool provides functionalities to set configurations, create and destroy droplets, add tags, run Ansible playbooks, and more.
- Manage Droplets: List, create, destroy, and tag DigitalOcean droplets.
- Run Ansible Playbooks: Execute Ansible playbooks on your droplets.
- SSH Access: SSH into your droplets directly from the console.
- Customizable Settings: Configure default region, size, and image for new droplets.
-
Clone the Repository:
git clone https://github.com/josephberger/doconsole.git cd doconsole
-
Install Dependencies:
pip install -r requirements.txt
-
Ensure Ansible is Installed:
sudo apt install ansible
-
Run the Console:
python doconsole.py --token YOUR_DO_TOKEN --ssh_key PATH_TO_YOUR_SSH_KEY
-
Commands Overview:
- Set Configurations:
set <droplet|playbook|token|ssh_key|reigon|size|image>
- Example:
set droplet 1
- Example:
- Show Information:
show <droplets|playbooks|tags|target|info>
- Example:
show droplets
- Example:
- Create Droplet:
create droplet <name>
- Example:
create droplet my-new-droplet
- Example:
- Add Tag:
add tag <tag_name>
- Example:
add tag production
- Example:
- Run Playbook:
run playbook <playbook_path>
- Example:
run playbook setup.yml
- Example:
- Destroy Droplet:
destroy
- Example:
destroy
- Example:
- SSH into Droplet:
ssh
- Example:
ssh
- Example:
- Set Configurations:
-
Initialize Console:
python doconsole.py --token YOUR_DO_TOKEN --ssh_key PATH_TO_YOUR_SSH_KEY --init
-
List Droplets and Playbooks on Startup:
python doconsole.py --token YOUR_DO_TOKEN --ssh_key PATH_TO_YOUR_SSH_KEY --init
-
Run a Playbook on a Droplet:
set droplet 1 set playbook 0 run playbook
-
set:
- Set various configurations such as the target droplet, active playbook, API token, SSH key, default region, size, and image.
-
show:
- Display information about droplets, playbooks, tags, target droplet, and console info.
-
create:
- Create a new droplet with the specified name using default or configured settings.
-
add:
- Add a tag to the selected droplet(s).
-
run:
- Run the specified Ansible playbook on the target droplet.
-
destroy:
- Destroy the selected droplet(s).
-
ssh:
- Start an SSH session to the target droplet.
- API Token: Your DigitalOcean API token. Required for all operations.
- SSH Key: Path to your SSH private key. Required for connecting to droplets and running playbooks.
- Ansible Playbooks Directory: Directory containing your Ansible playbooks. Defaults to
./playbooks
.
Feel free to submit issues or pull requests if you have any improvements or bug fixes.
This project is licensed under the MIT License.
Feel free to contribute to this project by reporting issues or submitting pull requests on GitHub.