New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Digital Ocean integration #40
Comments
Is there a branch I can follow for this? |
Not yet. The Ansible module requires dopy but that hasn't yet been updated for the v2 Digital Ocean API (issue here). I have been using the Digital Ocean Vagrant plugin instead, but haven't had the time to create a fully formed Vagrantfile. |
@Foxaii brilliant. Looking forward to seeing what you have! |
I should note that we don't want to use Vagrant to manage this. It should all be done through Ansible. |
If it is not possible to do with Ansible due to what @Foxaii mentioned, it my be a great time to try http://www.terraform.io/ |
@austinpray Have you played around with it at all? I haven't had time to! |
I have only used it to stand up multiple digital ocean servers kind of like AWS CloudFormation, not much else. The real value would be to be able to run "terraform apply" and then your ansible hosts file is updated with IP addresses or something. Or have ansible pull them dynamically from a manifest file. Haven't gotten that far as usually these wordpress sites are just 1 server. |
I'm okay with using something like Terraform since that its intended purpose if we can't use Ansible. Problem with Vagrant is its specifically meant for dev environments. |
See https://github.com/bandwidthcom/terraform-inventory edit: this isn't that great |
Until the DO ansible module is up to speed, using something like Terraform would be really helpful for my fork as well. |
Yeah looks like it's not working for DO either |
I've been cheking the issues the Ansible module has with Digital Ocean's new API. What is the suggested way to deploy to DO? Capistrano?
How would I go about using the Digital Ocean Vagrant plugin to deploy what I've created with Ansible-Bedrock since DO doesn't have an image quite like the bedrock setup? I'm new to automated deployments, the best way I figure is copying my local Wordpress folder to a previously created LEMP droplet on DO through SFTP. Any suggestions? |
@luandro I would recommend reading up a bit on how ansible and Capistrano works. This stack already works out of the box with digital ocean. currently you have to manually create a digital ocean droplet, then run ansible, then deploy with Capistrano. The scope of this issue is to automatically create the digital ocean droplet then automatically provision it. |
@austinpray Thanks for the heads up. I'll look into it. |
Just a note that dopy was updated to API v2 but Ansible still needs to be updated as well I believe. See ansible/ansible-modules-core#209 |
Ansible still hasn't updated their DO module :( See ansible/ansible-modules-core#998 for a new attempt |
Can we use this module now anyway? Might help them get it merged if we tested it. |
It has been merged... =) |
going to leave this here https://github.com/seven1m/do-install-button |
I think launching infrastructure and provisioning it are two different things. Terraform would be a better choice. Pass a local-exec command from terraform to provision with ansible. This would allow swapping out of whole server cluster and configuration files if you wanted master-->slave databases and whatever.... My two cents. |
@rossedman I agree that would probably be better but I'd rather keep this simple and within Ansible for now. We'll still keep it separate with an |
Is this in the works? Happy to test! |
@mAAdhaTTah the DO module in Ansible is broken since DO retired V1 of their API. DO finally upgrade the module to V2 but we've been waiting on their next release to include it. The actual work won't be difficult though. Just a simple playbook to create a droplet. |
@swalkinshaw I understand. I just deployed some test servers last night with Terraform and could see it working beautifully with Ansible because it keeps the concerns separated. Defining infrastructure vs Provisioning. Hopefully the DO module will update soon enough so you can do it all through Ansible. |
Has there been any movement on this/are we still waiting on a new Ansible release for this to work? |
Still waiting 😭 They haven't bumped the DO module version in forever so whenever 2.0 is released it will be included. |
We can finally start development on this now that Ansible 2.0 is released! |
The wait is over! |
Glad to hear |
Not exactly polished, but I thought I would take a swing at it. Here's a simple, working instance of creating a droplet and printing the IP address. 84221e0 With the Eventually I'd like to get it to where multiple DB, web, load balancers, etc. will all be configured. But for now, a single droplet will do. I'd like to hear what expectations on how you expect this to work and be configured. (IE: how do you want this simple demo to change in order to make it into master). This would be a great feature to have in the core. Please note, dopy 0.3.7 is broken right now. Install with 0.3.5 sudo pip install 'dopy=0.3.5' |
Thanks for sharing @nbyloff. I've done something pretty similar to this as well. My sticking point was trying to get dynamic inventories working but thinking about it again, I'm not sure it's needed. The typical/default setup is probably a single server so a dynamic inventory isn't really needed. It's just nice to have to skip manually editing your hosts file. |
@swalkinshaw what about using a template to accomplish writing to the hosts file? The most difficult part would be to make sure you read the hosts file correctly to capture any pre-configured servers. But you could:
That might require the default hosts file to look something like this:
But that will also leave the door open for updates in the future for simple configuration changes to create clusters like:
|
Having a hard time picturing it, but it seems pretty brittle. Parsing an existing file and checking if names match via the DO API does not sound like fun. |
Yes, while I have an idea how to keep the hosts files updated programmatically it's probably not necessary. Time could be better spent creating a playbook that builds a cluster of servers for a large website. The only other update I would make is notify a handler or something to provision the new droplet once created. The user could take the new IP address and paste it into their host file manually. |
Any update on this? Would be a cool feature. at the moment I'm doing this with terraform in the repo |
I am using terraform as well with the dynamic inventory in ansible; I think terraform would be great to be project. However it's possible to create the server and begin provisioning immediately strictly with ansible. This could work with a large amount of cloud providers, not just digital ocean. Here's the full list of dynamic inventory options that comes with ansible. Then for a pure ansible solution, you could do something like:
Then you can keep the single server setup or allow YAML configuration options that would build a private cloud with a LB, dedicated DB server, or however the user wants it. It also allows for things like tagging your droplets so we can grab servers by identifiers so you know what should be installed on each machine. |
I've had similar tasks in a local branch for a while, so thanks for sharing that. I guess the reason why this issue isn't done yet is the "integration" part. Meaning, is there a way to provide an optional DO playbook/inventory script which just works with the existing I guess these tasks are idempotent, could we just create a new playbook which runs those then imports |
Currently in my projects I modify the
Then in like
I added the A setup similar to his would allow for optional droplet creation and linking a server dynamically by a unique name vs. manually pasting the IP address in the hosts file. Also, In the OP of this issue, @swalkinshaw mentioned updating DNS entries, which would be huge. I had mentioned a few weeks ago about Lets Encrypt and DNS validation via API on the forums. You could go end to end without any manual intervention. Exciting options! |
Closing the oldest issue 🎉 trellis-cli has DO integration in one easy command: $ trellis droplet create |
Using Ansible's digital_ocean module we should be able to create a droplet and use dynamic inventory to run the playbook on it.
Would be a nice feature to also create DNS entries for a domain as an option using http://docs.ansible.com/digital_ocean_domain_module.html
The text was updated successfully, but these errors were encountered: