Last active
September 20, 2015 07:52
-
-
Save fullyint/1214de193be90278d256 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Enable ssh_port option in vagrant-digitalocean | |
# Diff of /lib/vagrant-digitalocean/actions/create.rb | |
# wait for ssh to be ready | |
switch_user = @machine.provider_config.setup? | |
user = @machine.config.ssh.username | |
+ port = @machine.config.ssh.port | |
@machine.config.ssh.username = 'root' if switch_user | |
+ @machine.config.ssh.port = '22' if port | |
retryable(:tries => 120, :sleep => 10) do | |
next if env[:interrupted] | |
raise 'not ready' if !@machine.communicate.ready? | |
end | |
+ @machine.communicate.execute("sed -i 's/Port 22/Port #{port}/' /etc/ssh/sshd_config && service ssh restart") if port | |
@machine.config.ssh.username = user | |
+ @machine.config.ssh.port = port if port | |
@app.call(env) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For Ubuntu on Digital Ocean:
This is a diff of the vagrant-digitalocean plugin's create.rb file (as of Aug 7, 2014). It appears that the DO plugin must initiate the DO droplet using ssh port 22. These edits temporarily set the ssh port to 22 for droplet creation, then back to the port specified in the user's Vagrantfile.
Without these changes, if the user has set a non-default port for config.ssh.port in the Vagrantfile, the
vagrant up
droplet creation hangs forever due to the DO plugin's inability to connect via ssh.I'd love a more universal solution anyone may share.