vagrant-ssh-config 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 0de6235193c92ee7a7687bece682c30b5a4699d6c7ee4fa3f1c6c0ed94a139a5
4
+ data.tar.gz: '059c582ac5395997e0026154a3b0c8d2cd8f2bb9ceb68b97fbcdf1a1fdf4eac5'
5
+ SHA512:
6
+ metadata.gz: 5a05492b1a352a8c97f66f2d19b5bedb2fb6549be79efabc2f394fa4b1e10c9621c2c34f50b26e04ffdcc6eb87326783c026c4e915aead98dbfb0975fa723816
7
+ data.tar.gz: b0be9a90752757ef1f1aa691edc30a904d83046813e352480890297b5f4c94438b4ee7869f8d67d66a130bccf2c55dd000c334d005db0bb6fd43b4a8f6bacf51
data/.envrc ADDED
@@ -0,0 +1,11 @@
1
+ #!/bin/sh
2
+ # See https://direnv.net/
3
+
4
+ direnv_version 2.26.0
5
+
6
+ dotenv_if_exists .env
7
+
8
+ VAGRANT_SSH_ALIAS=${VAGRANT_SSH_ALIAS:-"$(basename "${PWD}")"}
9
+ export VAGRANT_SSH_ALIAS
10
+
11
+ export DOCKER_HOST=ssh://${VAGRANT_SSH_ALIAS}
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source "https://rubygems.org"
2
+
3
+ group :development do
4
+ gem "vagrant", git: "https://github.com/hashicorp/vagrant.git"
5
+ end
6
+
7
+ group :plugins do
8
+ gemspec
9
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,111 @@
1
+ GIT
2
+ remote: https://github.com/hashicorp/vagrant.git
3
+ revision: 2eb4406e2ea0bfb562fd9d608c075d74e175c647
4
+ specs:
5
+ vagrant (2.2.19.dev)
6
+ bcrypt_pbkdf (~> 1.1)
7
+ childprocess (~> 4.1.0)
8
+ ed25519 (~> 1.2.4)
9
+ erubi
10
+ hashicorp-checkpoint (~> 0.1.5)
11
+ i18n (~> 1.8)
12
+ listen (~> 3.5)
13
+ log4r (~> 1.1.9, < 1.1.11)
14
+ mime-types (~> 3.3)
15
+ net-scp (~> 3.0.0)
16
+ net-sftp (~> 3.0)
17
+ net-ssh (>= 6.1.0, < 6.2)
18
+ rb-kqueue (~> 0.2.0)
19
+ rexml (~> 3.2)
20
+ rubyzip (~> 2.0)
21
+ vagrant_cloud (~> 3.0.5)
22
+ wdm (~> 0.1.0)
23
+ winrm (>= 2.3.4, < 3.0)
24
+ winrm-elevated (>= 1.2.1, < 2.0)
25
+ winrm-fs (>= 1.3.4, < 2.0)
26
+
27
+ PATH
28
+ remote: .
29
+ specs:
30
+ vagrant-ssh-config (0.0.1)
31
+
32
+ GEM
33
+ remote: https://rubygems.org/
34
+ specs:
35
+ bcrypt_pbkdf (1.1.0)
36
+ builder (3.2.4)
37
+ childprocess (4.1.0)
38
+ concurrent-ruby (1.1.9)
39
+ ed25519 (1.2.4)
40
+ erubi (1.10.0)
41
+ excon (0.87.0)
42
+ ffi (1.15.4)
43
+ gssapi (1.3.1)
44
+ ffi (>= 1.0.1)
45
+ gyoku (1.3.1)
46
+ builder (>= 2.1.2)
47
+ hashicorp-checkpoint (0.1.5)
48
+ httpclient (2.8.3)
49
+ i18n (1.8.10)
50
+ concurrent-ruby (~> 1.0)
51
+ listen (3.7.0)
52
+ rb-fsevent (~> 0.10, >= 0.10.3)
53
+ rb-inotify (~> 0.9, >= 0.9.10)
54
+ little-plugger (1.1.4)
55
+ log4r (1.1.10)
56
+ logging (2.3.0)
57
+ little-plugger (~> 1.1)
58
+ multi_json (~> 1.14)
59
+ mime-types (3.3.1)
60
+ mime-types-data (~> 3.2015)
61
+ mime-types-data (3.2021.0901)
62
+ multi_json (1.15.0)
63
+ net-scp (3.0.0)
64
+ net-ssh (>= 2.6.5, < 7.0.0)
65
+ net-sftp (3.0.0)
66
+ net-ssh (>= 5.0.0, < 7.0.0)
67
+ net-ssh (6.1.0)
68
+ nori (2.6.0)
69
+ rake (13.0.6)
70
+ rb-fsevent (0.11.0)
71
+ rb-inotify (0.10.1)
72
+ ffi (~> 1.0)
73
+ rb-kqueue (0.2.7)
74
+ ffi (>= 0.5.0)
75
+ rexml (3.2.5)
76
+ rubyntlm (0.6.3)
77
+ rubyzip (2.3.2)
78
+ vagrant_cloud (3.0.5)
79
+ excon (~> 0.73)
80
+ log4r (~> 1.1.10)
81
+ rexml (~> 3.2.5)
82
+ wdm (0.1.1)
83
+ winrm (2.3.6)
84
+ builder (>= 2.1.2)
85
+ erubi (~> 1.8)
86
+ gssapi (~> 1.2)
87
+ gyoku (~> 1.0)
88
+ httpclient (~> 2.2, >= 2.2.0.2)
89
+ logging (>= 1.6.1, < 3.0)
90
+ nori (~> 2.0)
91
+ rubyntlm (~> 0.6.0, >= 0.6.3)
92
+ winrm-elevated (1.2.3)
93
+ erubi (~> 1.8)
94
+ winrm (~> 2.0)
95
+ winrm-fs (~> 1.0)
96
+ winrm-fs (1.3.5)
97
+ erubi (~> 1.8)
98
+ logging (>= 1.6.1, < 3.0)
99
+ rubyzip (~> 2.0)
100
+ winrm (~> 2.0)
101
+
102
+ PLATFORMS
103
+ x86_64-darwin-20
104
+
105
+ DEPENDENCIES
106
+ rake
107
+ vagrant!
108
+ vagrant-ssh-config!
109
+
110
+ BUNDLED WITH
111
+ 2.2.29
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Arlo O'Keeffe
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Vagrant::My::Plugin
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/vagrant/my/plugin`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'vagrant-my-plugin'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install vagrant-my-plugin
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/vagrant-my-plugin.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,3 @@
1
+ require "rubygems"
2
+ require "bundler/setup"
3
+ Bundler::GemHelper.install_tasks
data/Vagrantfile ADDED
@@ -0,0 +1,34 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ Vagrant.configure("2") do |config|
5
+
6
+ config.vm.box = "ubuntu/focal64"
7
+
8
+ config.vm.provider "virtualbox" do |vb|
9
+ vb.linked_clone = true
10
+ end
11
+
12
+ config.vm.network "forwarded_port", guest: 62225, host: 62225
13
+
14
+ config.vm.provision "docker" do |d|
15
+ d.post_install_provision "shell", inline: $dockerOpenTcpPortScript
16
+ end
17
+
18
+ config.vagrant.plugins = "vagrant-ssh-config"
19
+
20
+ end
21
+
22
+ $dockerOpenTcpPortScript = <<-'SCRIPT'
23
+ set -o errexit
24
+ set -o nounset
25
+ set -o xtrace
26
+
27
+ mkdir -p /etc/systemd/system/docker.service.d
28
+ echo '[Service]' > /etc/systemd/system/docker.service.d/override.conf
29
+ echo 'ExecStart=' >> /etc/systemd/system/docker.service.d/override.conf
30
+ echo 'ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:62225 --containerd=/run/containerd/containerd.sock' >> /etc/systemd/system/docker.service.d/override.conf
31
+ systemctl daemon-reload
32
+ systemctl stop docker.service
33
+ systemctl start docker.service
34
+ SCRIPT
@@ -0,0 +1,12 @@
1
+ version: "3.9"
2
+ services:
3
+ mysql:
4
+ image: mysql:5.7
5
+ labels:
6
+ lagoon.type: mysql
7
+ restart: always
8
+ environment:
9
+ MYSQL_ROOT_PASSWORD: pass
10
+ MYSQL_DATABASE: drupal
11
+ MYSQL_USER: drupal
12
+ MYSQL_PASSWORD: drupal
@@ -0,0 +1,12 @@
1
+ sync:
2
+ vagrant-docker-test-stuff:
3
+ mode: two-way-resolved
4
+ ignore:
5
+ paths:
6
+ - "mutagen.yml.lock"
7
+ alpha: "."
8
+ beta: "vagrant-docker-test-stuff:/vagrant-mutagen"
9
+ forward:
10
+ vagrant-docker-test-stuff:
11
+ source: "tcp:localhost:3306"
12
+ destination: docker://vagrant-docker-test-stuff_mysql_1:tcp::3306
@@ -0,0 +1,9 @@
1
+ #!/bin/sh
2
+
3
+ set -o errexit
4
+ set -o nounset
5
+ set -o xtrace
6
+
7
+ docker compose up --detach
8
+
9
+ mutagen project start
@@ -0,0 +1,7 @@
1
+ #!/bin/sh
2
+
3
+ set -o errexit
4
+ set -o nounset
5
+ set -o xtrace
6
+
7
+ mutagen project terminate || true
@@ -0,0 +1,30 @@
1
+ module VagrantPlugins
2
+ module SshConfig
3
+ module Action
4
+ class UpdateConfig
5
+
6
+ def initialize(app, env)
7
+ @app = app
8
+ @env = env
9
+ end
10
+
11
+ def call(env)
12
+ @app.call(env)
13
+ @env[:ui].info "[vagrant-ssh-config] Updating SSH config..."
14
+ config = `vagrant ssh-config #{@env[:machine].name} --host #{ENV["VAGRANT_SSH_ALIAS"]}`
15
+ File.write("#{@env[:env].local_data_path}/ssh-config", config)
16
+ line = "Include #{@env[:env].local_data_path}/ssh-config"
17
+ file = "#{@env[:env].home_path}/ssh-configs"
18
+ if File.exist?(file)
19
+ if ! File.foreach(file).grep(/#{line}/).any?
20
+ File.open(file, "a+") { |f| f.puts(line) }
21
+ end
22
+ else
23
+ File.write(file, line)
24
+ end
25
+ end
26
+
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,27 @@
1
+ require "vagrant-ssh-config/Action/UpdateConfig"
2
+
3
+ module VagrantPlugins
4
+ module SshConfig
5
+ class Plugin < Vagrant.plugin('2')
6
+
7
+ name 'SshConfig'
8
+
9
+ description <<-DESC
10
+ This plugin does stuff.
11
+ DESC
12
+
13
+ action_hook(:ssh, :machine_action_up) do |hook|
14
+ hook.after(Vagrant::Action::Builtin::WaitForCommunicator, Action::UpdateConfig)
15
+ end
16
+
17
+ action_hook(:ssh, :machine_action_reload) do |hook|
18
+ hook.after(Vagrant::Action::Builtin::WaitForCommunicator, Action::UpdateConfig)
19
+ end
20
+
21
+ action_hook(:ssh, :machine_action_resume) do |hook|
22
+ hook.after(Vagrant::Action::Builtin::WaitForCommunicator, Action::UpdateConfig)
23
+ end
24
+
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module VagrantPlugins
4
+ module SshConfig
5
+ VERSION = '0.0.1'
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ require "vagrant-ssh-config/plugin"
2
+
3
+ module VagrantPlugins
4
+ module SshConfig
5
+ def self.source_root
6
+ @source_root ||= Pathname.new(File.expand_path('../../', __FILE__))
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/vagrant-ssh-config/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "vagrant-ssh-config"
7
+ spec.version = VagrantPlugins::SshConfig::VERSION
8
+ spec.authors = ["Arlo O'Keeffe"]
9
+ spec.email = ["tiger@k5d.de"]
10
+
11
+ spec.summary = %q{Enables Vagrant to write a global ssh config}
12
+ spec.description = spec.summary
13
+ spec.homepage = "https://github.com/ArloL/vagrant-ssh-config"
14
+ spec.license = "MIT"
15
+
16
+ # Specify which files should be added to the gem when it is released.
17
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
18
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
19
+ `git ls-files -z`.split("\x0").reject do |f|
20
+ (f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
21
+ end
22
+ end
23
+ spec.bindir = "exe"
24
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
25
+ spec.require_paths = ["lib"]
26
+
27
+ spec.add_development_dependency 'rake'
28
+ end
metadata ADDED
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-ssh-config
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Arlo O'Keeffe
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-10-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: Enables Vagrant to write a global ssh config
28
+ email:
29
+ - tiger@k5d.de
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".envrc"
35
+ - Gemfile
36
+ - Gemfile.lock
37
+ - LICENSE.txt
38
+ - README.md
39
+ - Rakefile
40
+ - Vagrantfile
41
+ - docker-sample/docker-compose.yml
42
+ - docker-sample/mutagen.yml
43
+ - docker-sample/project-start.sh
44
+ - docker-sample/project-stop.sh
45
+ - lib/vagrant-ssh-config.rb
46
+ - lib/vagrant-ssh-config/Action/UpdateConfig.rb
47
+ - lib/vagrant-ssh-config/plugin.rb
48
+ - lib/vagrant-ssh-config/version.rb
49
+ - vagrant-ssh-config.gemspec
50
+ homepage: https://github.com/ArloL/vagrant-ssh-config
51
+ licenses:
52
+ - MIT
53
+ metadata: {}
54
+ post_install_message:
55
+ rdoc_options: []
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ requirements: []
69
+ rubygems_version: 3.2.3
70
+ signing_key:
71
+ specification_version: 4
72
+ summary: Enables Vagrant to write a global ssh config
73
+ test_files: []