{"id":15151617,"url":"https://github.com/hellothisisflo/ansible-droplet","last_synced_at":"2025-10-24T07:31:17.626Z","repository":{"id":57410515,"uuid":"112956616","full_name":"HelloThisIsFlo/ansible-droplet","owner":"HelloThisIsFlo","description":"Create and Destroy DigitalOcean droplets. Backed by Ansible","archived":false,"fork":false,"pushed_at":"2019-01-13T17:02:29.000Z","size":67,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-03T09:56:32.003Z","etag":null,"topics":["ansible","devops","devops-tools","digital-ocean","digitalocean"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HelloThisIsFlo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-03T19:25:44.000Z","updated_at":"2025-01-21T04:05:20.000Z","dependencies_parsed_at":"2022-08-27T22:02:38.022Z","dependency_job_id":null,"html_url":"https://github.com/HelloThisIsFlo/ansible-droplet","commit_stats":null,"previous_names":["floriankempenich/ansible-droplet"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HelloThisIsFlo%2Fansible-droplet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HelloThisIsFlo%2Fansible-droplet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HelloThisIsFlo%2Fansible-droplet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HelloThisIsFlo%2Fansible-droplet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HelloThisIsFlo","download_url":"https://codeload.github.com/HelloThisIsFlo/ansible-droplet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237932070,"owners_count":19389560,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","devops","devops-tools","digital-ocean","digitalocean"],"created_at":"2024-09-26T15:04:35.279Z","updated_at":"2025-10-24T07:31:12.179Z","avatar_url":"https://github.com/HelloThisIsFlo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ansible Droplet\n[![Travis](https://img.shields.io/travis/FlorianKempenich/ansible-droplet.svg)](https://travis-ci.org/FlorianKempenich/ansible-droplet) [![PyPI](https://img.shields.io/pypi/v/ansible-droplet.svg)](https://pypi.org/project/ansible-droplet/)\n\n`ansible-droplet` is a cli tool to easily create _ready-to-use_ droplets on Digital Ocean.\n\n* Create **ready-to-use** Ubuntu Droplet on Digital Ocean\n* One **simple** command: `ansible-droplet create my_droplet`\n* Access it directly via its **name**:\n  * SSH: `ssh my_droplet`\n  * Ansible: `- hosts: my_droplet`\n* And more:\n  * New sudo user automatically created\n  * Swap added (configurable)\n  * DigitalOcean advanced metrics enabled\n  * `glances` server running to monitor the Droplet from outside\n  \n\n## Installation\n**Important Note:** For now only `python 2` is supported\n\n```\npip install ansible-droplet\n```\n\u003e Use a `virtualenv` or install with `pip install ansible-droplet --user`  \n\n--- \n\n## Usage\n### One time setup\nBefore using the tool, a simple _one-time-setup_ must be done.\n\n1. Make sure you have a **`ssh` public key**, or [generate one](https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/#generating-a-new-ssh-key)\n1. Make sure you have a **Digital Ocean API token**, or [generate one](https://www.digitalocean.com/community/tutorials/how-to-use-the-digitalocean-api-v2)\n1. **Store in a file** the Digital Ocean API token in clear\u003csup\u003e[1](#f1)\u003c/sup\u003e\n1. Note down:\n   * _Path_ to your **ssh public key**\n   * _Path_ to the file containing the **Digital Ocean API token**\n1. Run `ansible-droplet config` see below for more detail on the config parameters\n\n\n### Create \n```\nansible-droplet create my_droplet\n```\n##### Creation process\n* **Create a new Droplet** on your Ditigal Ocean Account\n* **Set it up** with: Swap, new sudo user, glances server\n* **Create a SSH entry** in your `~/.ssh/config` to be able to ssh directly with its name: `ssh my_droplet`\n* **Create a ansible inventory entry** in `~/.ansible-droplet-inventory`\n\n\n### Destroy\n```\nansible-droplet destroy my_droplet\n```\n##### Destruction process\n* **Destroy the Droplet** from your Ditigal Ocean Account\n* **Remove the SSH entry** from your `~/.ssh/config` to be able to ssh directly with its name: `ssh my_droplet`\n* **Remove the ansible inventory entry** from `~/.ansible-droplet-inventory`\n\n\n## Advanced Usage\n### Config parameters\nWhen running `ansible-droplet config` a couple of parameters must be provided:  \n\n* **Path to SSH key**:  \n    No brainer, the path to your SSH public key.  \n    _Default: `~/.ssh/id_rsa.pub`_\n\n* **Name of SSH key on Digital Ocean**:  \n    To prevent uploading the public keys each time, Digital Ocean offers to store them under a name. It can be anything.  \n    _Default: `Main SSH Key`_\n\n* **Path to Ditigal Ocean token**:  \n    The path to the file containing your Digital Ocean token in plain text.  \n    _No defaults_\n\n* **User on Droplet - Username:**  \n    Username for the sudo user being created on the Droplet.  \n    _No defaults_\n\n* **User on Droplet - Default Password:**\n    Default password for the sudo user being created on the Droplet.  \n    _No defaults_  \n    _Do not forget to change it after the first login!_  \n\n\n### Droplet specs\nYou can specify the droplet size and specs when creating a new droplet.  \nSimply list it after the droplet name:  \n```\nansible-droplet create my_droplet SPEC_NAME\n```\n\nFor now, only 3 specs are supported\u003csup\u003e[2](#f2)\u003c/sup\u003e:\n* **Micro**\n  * size: \"512mb\"\n  * region: \"fra1\"\n  * image: \"ubuntu-16-04-x64\"\n  * swap: \"4GiB\"\n* **Mini**\n  * size: \"1gb\"\n  * region: \"fra1\"\n  * image: \"ubuntu-16-04-x64\"\n  * swap: \"4GiB\"\n* **Power**\n  * size: \"4gb\"\n  * region: \"fra1\"\n  * image: \"ubuntu-16-04-x64\"\n  * swap: \"4GiB\"\n\nThe list of specification are stored on the repository: [Droplet Specs](https://github.com/FlorianKempenich/ansible-droplet/tree/master/ansible_droplet/ansible/droplet_specs)\n\n\n\n\n### Ansible Droplet Inventory\nIt is possible to access the Droplet from any other ansible playbook via its **name**:  \n\n    - hosts: my_droplet\n\nFor that purpose the file `~/.ansible-droplet-inventory` is created.  \n`~/.ansible-droplet-inventory` contains ansible inventory entries for each Droplet created with the `ansible-droplet` tool.\n\nTo use the droplet in a playbook, either:\n* Point your _inventory_  to the `~/.ansible-droplet-inventory` file\n* Point your _inventory_  to a directory containing a symlink to the `~/.ansible-droplet-inventory` file\n\nFrom there you can reference the Droplet directly by name.\n\n\n### Multiple configuration - Multiple Digital Ocean accounts\n\nYou can use multiple configurations to support:\n* Multiple **DigitalOcean accounts**\n* Multiple **SHH Keys**\n* Multiple **default user/password**\n\nThe configuration generated by `ansible-droplet config` is kept in the installation directory.\n\nTo allow multiple configs, simply **install multiple versions of `ansible-droplet` in different _virtualenvs_**\u003csup\u003e[3](#f3)\u003c/sup\u003e\n\n\n---\n1. \u003cspan id=\"f1\"\u003e\u003c/span\u003eYes, this is a security concern. Feel free to open a pull request.\n2. \u003cspan id=\"f2\"\u003e\u003c/span\u003eFor now, the addition of new droplet specs is not supported. Again, pull requests are welcome :)\n3. \u003cspan id=\"f3\"\u003e\u003c/span\u003eThis is not optimal... You know what to do ;)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhellothisisflo%2Fansible-droplet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhellothisisflo%2Fansible-droplet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhellothisisflo%2Fansible-droplet/lists"}