itamae-plugin-recipe-consul 0.1.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cf6668ddb6110c3d51b955f3826e1b6a06d35929
4
+ data.tar.gz: dca2477ed81f92ad162395dddae1c8268edc12dd
5
+ SHA512:
6
+ metadata.gz: 8c786cfcc1dc058983904442e8ec23e64597b2305b8fb9877206c1b31ebee98d881ba9073c4bdd689b57a62f3eacf8b67e4d9876d5bdfef3d0e352fbc175ba56
7
+ data.tar.gz: 7803b99b34b2e1dc54d7c1911b4b7a312dab0efe1432ed3d6fb75c2fc8051f6e60c85ff3725cf396546a113da97fb4a54249678ca79bc40191d8c4683d10a9f3
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ .vagrant/
data/.paraduct.yml ADDED
@@ -0,0 +1,10 @@
1
+ script: |-
2
+ ./ci/build.sh ${HOST}
3
+ after_script: |-
4
+ vagrant destroy -f $HOST
5
+ variables:
6
+ HOST:
7
+ - centos65
8
+ - centos70
9
+ - debian8
10
+ max_threads: 4
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --format documentation
3
+ --require spec_helper
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in itamae-plugin-recipe-consul.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 sue445
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,91 @@
1
+ # Itamae::Plugin::Recipe::Consul
2
+
3
+ Itamae plugin to install [Consul](https://www.consul.io/) with init scripts
4
+
5
+ [![Dependency Status](https://gemnasium.com/badges/github.com/sue445/itamae-plugin-recipe-consul.svg)](https://gemnasium.com/github.com/sue445/itamae-plugin-recipe-consul)
6
+
7
+ [![wercker status](https://app.wercker.com/status/1d28d36364b4f79161fc248c6c934072/m/master "wercker status")](https://app.wercker.com/project/bykey/1d28d36364b4f79161fc248c6c934072)
8
+
9
+ ## Supported
10
+ * CentOS 6 (init.d)
11
+ * CentOS 7+ (systemd)
12
+ * Debian 8+ (systemd)
13
+
14
+ ## Installation
15
+
16
+ Add this line to your application's Gemfile:
17
+
18
+ ```ruby
19
+ gem 'itamae-plugin-recipe-consul'
20
+ ```
21
+
22
+ And then execute:
23
+
24
+ $ bundle
25
+
26
+ Or install it yourself as:
27
+
28
+ $ gem install itamae-plugin-recipe-consul
29
+
30
+ ## Usage
31
+
32
+ ### Recipe
33
+
34
+ ```ruby
35
+ # recipe.rb
36
+ include_recipe "consul"
37
+ ```
38
+
39
+ install Consul executable file and init scritps (systemd or init.d)
40
+
41
+ ### Node
42
+
43
+ ```yml
44
+ # node.yml
45
+ consul:
46
+ # install consul version (required)
47
+ version: "0.6.4"
48
+
49
+ # path to downloaded zip file (default: "/usr/local/src")
50
+ src_dir: "/usr/local/src"
51
+
52
+ # path to consul executable file (default: "/usr/local/src")
53
+ bin_dir: "/usr/local/bin"
54
+
55
+ # consul agent -data-dir option (default: "/tmp/consul")
56
+ data_dir: "/tmp/consul"
57
+
58
+ # consul agent other options (default: none)
59
+ options: "-server -bootstrap-expect 1"
60
+
61
+ gomaxprocs: 2
62
+ ```
63
+
64
+ ## Development
65
+
66
+ 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.
67
+
68
+ 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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
69
+
70
+ ## Testing
71
+ requirements [Vagrant](https://www.vagrantup.com/)
72
+
73
+ e.g) test on CentOS 7.0
74
+
75
+ ```sh
76
+ vagrant up centos70
77
+ bundle exec rake itamae:centos70
78
+ bundle exec rake spec:centos70
79
+ ```
80
+
81
+ see [Vagrantfile](Vagrantfile) and [Rakefile](Rakefile)
82
+
83
+ ## Contributing
84
+
85
+ Bug reports and pull requests are welcome on GitHub at https://github.com/sue445/itamae-plugin-recipe-consul.
86
+
87
+
88
+ ## License
89
+
90
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
91
+
data/Rakefile ADDED
@@ -0,0 +1,29 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ task :spec => "spec:all"
5
+
6
+ HOSTS = %w(centos65 centos70 debian8)
7
+
8
+ namespace :spec do
9
+ task :all => HOSTS
10
+
11
+ HOSTS.each do |host|
12
+ RSpec::Core::RakeTask.new(host.to_sym) do |t|
13
+ puts "Running tests to #{host} ..."
14
+ ENV["TARGET_HOST"] = host
15
+ t.pattern = "spec/*_spec.rb"
16
+ end
17
+ end
18
+ end
19
+
20
+ namespace :itamae do
21
+ task :all => HOSTS
22
+
23
+ HOSTS.each do |host|
24
+ desc "Running itamae to #{host}"
25
+ task host do
26
+ sh "bundle exec itamae ssh --host=#{host} --vagrant --node-yaml=recipes/node.yml recipes/install.rb"
27
+ end
28
+ end
29
+ end
data/Vagrantfile ADDED
@@ -0,0 +1,114 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ # All Vagrant configuration is done below. The "2" in Vagrant.configure
5
+ # configures the configuration version (we support older styles for
6
+ # backwards compatibility). Please don't change it unless you know what
7
+ # you're doing.
8
+ Vagrant.configure(2) do |config|
9
+ config.vm.provider :digital_ocean do |provider, override|
10
+ override.vm.box = "digital_ocean"
11
+ override.vm.box_url = "https://github.com/smdahlen/vagrant-digitalocean/raw/master/box/digital_ocean.box"
12
+ provider.token = ENV["DIGITALOCEAN_ACCESS_TOKEN"]
13
+ provider.region = "nyc3"
14
+ provider.size = "512MB"
15
+
16
+ if ENV["WERCKER"] == "true"
17
+ provider.ssh_key_name = "wercker-#{ENV['WERCKER_GIT_REPOSITORY']}"
18
+ override.ssh.private_key_path = "~/.ssh/id_rsa.vagrant"
19
+ else
20
+ provider.ssh_key_name = "local"
21
+ override.ssh.private_key_path = "~/.ssh/id_rsa"
22
+ end
23
+ end
24
+
25
+ config.vm.define :centos65 do |c|
26
+ c.vm.box = "puphpet/centos65-x64"
27
+ c.vm.provider :digital_ocean do |provider, override|
28
+ provider.image = "centos-6-5-x64"
29
+ end
30
+ c.vm.hostname = 'itamae-centos65'
31
+ c.vm.hostname += "-#{ENV['WERCKER_BUILD_ID']}" if ENV['WERCKER_BUILD_ID']
32
+ end
33
+
34
+ config.vm.define :centos70 do |c|
35
+ c.vm.box = "centos/7"
36
+ c.vm.provider :digital_ocean do |provider, override|
37
+ provider.image = "centos-7-0-x64"
38
+ end
39
+ c.vm.hostname = 'itamae-centos70'
40
+ c.vm.hostname += "-#{ENV['WERCKER_BUILD_ID']}" if ENV['WERCKER_BUILD_ID']
41
+ end
42
+
43
+ config.vm.define :debian8 do |c|
44
+ c.vm.box = "debian/jessie64"
45
+ c.vm.provider :digital_ocean do |provider, override|
46
+ provider.image = "debian-8-x64"
47
+ end
48
+ c.vm.hostname = 'itamae-debian8'
49
+ c.vm.hostname += "-#{ENV['WERCKER_BUILD_ID']}" if ENV['WERCKER_BUILD_ID']
50
+ end
51
+
52
+ # The most common configuration options are documented and commented below.
53
+ # For a complete reference, please see the online documentation at
54
+ # https://docs.vagrantup.com.
55
+
56
+ # Every Vagrant development environment requires a box. You can search for
57
+ # boxes at https://atlas.hashicorp.com/search.
58
+ # config.vm.box = "base"
59
+
60
+ # Disable automatic box update checking. If you disable this, then
61
+ # boxes will only be checked for updates when the user runs
62
+ # `vagrant box outdated`. This is not recommended.
63
+ # config.vm.box_check_update = false
64
+
65
+ # Create a forwarded port mapping which allows access to a specific port
66
+ # within the machine from a port on the host machine. In the example below,
67
+ # accessing "localhost:8080" will access port 80 on the guest machine.
68
+ # config.vm.network "forwarded_port", guest: 80, host: 8080
69
+
70
+ # Create a private network, which allows host-only access to the machine
71
+ # using a specific IP.
72
+ # config.vm.network "private_network", ip: "192.168.33.10"
73
+
74
+ # Create a public network, which generally matched to bridged network.
75
+ # Bridged networks make the machine appear as another physical device on
76
+ # your network.
77
+ # config.vm.network "public_network"
78
+
79
+ # Share an additional folder to the guest VM. The first argument is
80
+ # the path on the host to the actual folder. The second argument is
81
+ # the path on the guest to mount the folder. And the optional third
82
+ # argument is a set of non-required options.
83
+ # config.vm.synced_folder "../data", "/vagrant_data"
84
+
85
+ # Provider-specific configuration so you can fine-tune various
86
+ # backing providers for Vagrant. These expose provider-specific options.
87
+ # Example for VirtualBox:
88
+ #
89
+ # config.vm.provider "virtualbox" do |vb|
90
+ # # Display the VirtualBox GUI when booting the machine
91
+ # vb.gui = true
92
+ #
93
+ # # Customize the amount of memory on the VM:
94
+ # vb.memory = "1024"
95
+ # end
96
+ #
97
+ # View the documentation for the provider you are using for more
98
+ # information on available options.
99
+
100
+ # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
101
+ # such as FTP and Heroku are also available. See the documentation at
102
+ # https://docs.vagrantup.com/v2/push/atlas.html for more information.
103
+ # config.push.define "atlas" do |push|
104
+ # push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
105
+ # end
106
+
107
+ # Enable provisioning with a shell script. Additional provisioners such as
108
+ # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
109
+ # documentation for more information about their specific syntax and use.
110
+ # config.vm.provision "shell", inline: <<-SHELL
111
+ # sudo apt-get update
112
+ # sudo apt-get install -y apache2
113
+ # SHELL
114
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "itamae/plugin/recipe/consul"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/ci/build.sh ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash -xe
2
+
3
+ readonly HOST=$1
4
+
5
+ vagrant up $HOST --provider=digital_ocean
6
+ bundle exec rake itamae:$HOST
7
+ bundle exec rake spec:$HOST
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'itamae/plugin/recipe/consul/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "itamae-plugin-recipe-consul"
8
+ spec.version = Itamae::Plugin::Recipe::Consul::VERSION
9
+ spec.authors = ["sue445"]
10
+ spec.email = ["sue445@sue445.net"]
11
+
12
+ spec.summary = %q{Itamae plugin to install Consul with init scripts}
13
+ spec.description = %q{Itamae plugin to install Consul with init scripts}
14
+ spec.homepage = "https://github.com/sue445/itamae-plugin-recipe-consul"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_dependency "itamae"
23
+
24
+ spec.add_development_dependency "bundler"
25
+ spec.add_development_dependency "paraduct"
26
+ spec.add_development_dependency "rake", "~> 10.0"
27
+ spec.add_development_dependency "serverspec"
28
+ end
@@ -0,0 +1,19 @@
1
+ node.validate! do
2
+ {
3
+ consul: {
4
+ version: string,
5
+ },
6
+ }
7
+ end
8
+
9
+ node.reverse_merge!(
10
+ consul: {
11
+ src_dir: "/usr/local/src",
12
+ bin_dir: "/usr/local/bin",
13
+ data_dir: "/tmp/consul",
14
+ gomaxprocs: 2,
15
+ },
16
+ )
17
+
18
+ include_recipe "./download"
19
+ include_recipe "./service"
@@ -0,0 +1,11 @@
1
+ package "unzip"
2
+
3
+ zip_name = "consul_#{node[:consul][:version]}_linux_amd64.zip"
4
+
5
+ http_request "#{node[:consul][:src_dir]}/#{zip_name}" do
6
+ url "https://releases.hashicorp.com/consul/#{node[:consul][:version]}/#{zip_name}"
7
+ end
8
+
9
+ execute "unzip #{node[:consul][:src_dir]}/#{zip_name} -d #{node[:consul][:bin_dir]}" do
10
+ not_if "#{node[:consul][:bin_dir]}/consul --version | grep #{node[:consul][:version]}"
11
+ end
@@ -0,0 +1,78 @@
1
+ # ref. http://qiita.com/yunano/items/7ef5fa5670721de55627
2
+ directory "/etc/consul.d"
3
+
4
+ # Set systemd script
5
+ define :consul_systemd_script do
6
+ environment_file = params[:name]
7
+
8
+ template "/etc/systemd/system/consul.service" do
9
+ variables(
10
+ environment_file: environment_file,
11
+ bin_path: "#{node[:consul][:bin_dir]}/consul",
12
+ data_dir: node[:consul][:data_dir],
13
+ )
14
+
15
+ notifies :run, "execute[systemctl daemon-reload]"
16
+ notifies :restart, "service[consul]"
17
+ end
18
+
19
+ execute "systemctl daemon-reload" do
20
+ action :nothing
21
+ end
22
+ end
23
+
24
+ # Set init.d script
25
+ define :consul_initd_script do
26
+ environment_file = params[:name]
27
+
28
+ template "/etc/init.d/consul" do
29
+ mode "755"
30
+ variables(
31
+ environment_file: environment_file,
32
+ bin_path: "#{node[:consul][:bin_dir]}/consul",
33
+ data_dir: node[:consul][:data_dir],
34
+ )
35
+
36
+ notifies :restart, "service[consul]"
37
+ end
38
+ end
39
+
40
+ case node[:platform]
41
+ when "debian"
42
+ environment_file = "/etc/default/consul"
43
+
44
+ template environment_file do
45
+ variables(
46
+ gomaxprocs: node[:consul][:gomaxprocs],
47
+ options: node[:consul][:options],
48
+ )
49
+ end
50
+
51
+ if node[:platform_version].to_i >= 8
52
+ consul_systemd_script environment_file
53
+
54
+ service "consul" do
55
+ action [:enable, :start]
56
+ end
57
+ end
58
+
59
+ when "redhat"
60
+ environment_file = "/etc/sysconfig/consul"
61
+
62
+ template environment_file do
63
+ variables(
64
+ gomaxprocs: node[:consul][:gomaxprocs],
65
+ options: node[:consul][:options],
66
+ )
67
+ end
68
+
69
+ if node[:platform_version].to_i >= 7
70
+ consul_systemd_script environment_file
71
+ else
72
+ consul_initd_script environment_file
73
+ end
74
+
75
+ service "consul" do
76
+ action [:enable, :start]
77
+ end
78
+ end
@@ -0,0 +1,2 @@
1
+ GOMAXPROCS=<%= @gomaxprocs %>
2
+ OPTIONS="<%= @options %>"
@@ -0,0 +1,131 @@
1
+ #!/bin/sh
2
+ #
3
+ # consul - this script manages the consul agent
4
+ #
5
+ # chkconfig: 345 95 05
6
+ # processname: consul
7
+
8
+ ### BEGIN INIT INFO
9
+ # Provides: consul
10
+ # Required-Start: $local_fs $network
11
+ # Required-Stop: $local_fs $network
12
+ # Default-Start: 3 4 5
13
+ # Default-Stop: 0 1 2 6
14
+ # Short-Description: Manage the consul agent
15
+ ### END INIT INFO
16
+
17
+ # Source function library.
18
+ . /etc/rc.d/init.d/functions
19
+
20
+ # Source networking configuration.
21
+ . /etc/sysconfig/network
22
+
23
+ # Check that networking is up.
24
+ [ "$NETWORKING" = "no" ] && exit 0
25
+
26
+ exec="<%= @bin_path %>"
27
+ prog=${exec##*/}
28
+
29
+ lockfile="/var/lock/subsys/$prog"
30
+ pidfile="/var/run/${prog}.pid"
31
+ logfile="/var/log/${prog}.log"
32
+ sysconfig="/etc/sysconfig/$prog"
33
+ confdir="/etc/${prog}.d"
34
+ datadir="<%= @data_dir %>"
35
+
36
+ [ -f $sysconfig ] && . $sysconfig
37
+
38
+ export GOMAXPROCS=${GOMAXPROCS:-2}
39
+
40
+ start() {
41
+ [ -x $exec ] || exit 5
42
+ [ -d $confdir ] || exit 6
43
+
44
+ echo -n $"Starting $prog: "
45
+ touch $logfile $pidfile
46
+ daemon "{ $exec agent $OPTIONS -config-dir=$confdir -data-dir=$datadir &>> $logfile & }; echo \$! >| $pidfile"
47
+
48
+ RETVAL=$?
49
+ [ $RETVAL -eq 0 ] && touch $lockfile
50
+
51
+ # wait daemon starting
52
+ sleep 1
53
+
54
+ echo
55
+ return $RETVAL
56
+ }
57
+
58
+ stop() {
59
+ echo -n $"Stopping $prog: "
60
+ killproc -p $pidfile $exec -INT 2>> $logfile
61
+ RETVAL=$?
62
+ [ $RETVAL -eq 0 ] && rm -f $pidfile $lockfile
63
+ echo
64
+ return $RETVAL
65
+ }
66
+
67
+ restart() {
68
+ stop
69
+ while :
70
+ do
71
+ ss -pl | fgrep "((\"$prog\"," > /dev/null
72
+ [ $? -ne 0 ] && break
73
+ sleep 0.1
74
+ done
75
+ start
76
+ }
77
+
78
+ reload() {
79
+ echo -n $"Reloading $prog: "
80
+ killproc -p $pidfile $exec -HUP
81
+ echo
82
+ }
83
+
84
+ force_reload() {
85
+ restart
86
+ }
87
+
88
+ configtest() {
89
+ $exec configtest -config-dir=$confdir -data-dir=$datadir
90
+ }
91
+
92
+ rh_status() {
93
+ status $prog
94
+ }
95
+
96
+ rh_status_q() {
97
+ rh_status >/dev/null 2>&1
98
+ }
99
+
100
+ case "$1" in
101
+ start)
102
+ rh_status_q && exit 0
103
+ $1
104
+ ;;
105
+ stop)
106
+ rh_status_q || exit 0
107
+ $1
108
+ ;;
109
+ restart)
110
+ $1
111
+ ;;
112
+ reload|force-reload)
113
+ rh_status_q || exit 7
114
+ $1
115
+ ;;
116
+ status)
117
+ rh_status
118
+ ;;
119
+ condrestart|try-restart)
120
+ rh_status_q || exit 7
121
+ restart
122
+ ;;
123
+ configtest)
124
+ $1
125
+ ;;
126
+ *)
127
+ echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
128
+ exit 2
129
+ esac
130
+
131
+ exit $?
@@ -0,0 +1,2 @@
1
+ GOMAXPROCS=<%= @gomaxprocs %>
2
+ OPTIONS="<%= @options %>"
@@ -0,0 +1,15 @@
1
+ [Unit]
2
+ Description=consul agent
3
+ Requires=network-online.target
4
+ After=network-online.target
5
+
6
+ [Service]
7
+ EnvironmentFile=-<%= @environment_file %>
8
+ Environment=GOMAXPROCS=2
9
+ Restart=on-failure
10
+ ExecStart=<%= @bin_path %> agent $OPTIONS -config-dir=/etc/consul.d -data-dir=<%= @data_dir %>
11
+ ExecReload=/bin/kill -HUP $MAINPID
12
+ KillSignal=SIGINT
13
+
14
+ [Install]
15
+ WantedBy=multi-user.target
@@ -0,0 +1,9 @@
1
+ module Itamae
2
+ module Plugin
3
+ module Recipe
4
+ module Consul
5
+ VERSION = "0.1.0.beta1"
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ require "itamae/plugin/recipe/consul/version"
2
+
3
+ module Itamae
4
+ module Plugin
5
+ module Recipe
6
+ module Consul
7
+ # Your code goes here...
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1 @@
1
+ include_recipe "consul"
data/recipes/node.yml ADDED
@@ -0,0 +1,7 @@
1
+ consul:
2
+ version: "0.6.4"
3
+ src_dir: "/usr/local/src"
4
+ bin_dir: "/usr/local/bin"
5
+ data_dir: "/tmp/consul"
6
+ gomaxprocs: 2
7
+ options: "-server -bootstrap-expect 1"
data/wercker.yml ADDED
@@ -0,0 +1,70 @@
1
+ # This references the default Ruby container from
2
+ # the Docker Hub.
3
+ # https://registry.hub.docker.com/_/ruby/
4
+ # If you want to use a specific version you would use a tag:
5
+ # ruby:2.2.2
6
+ box: sue445/rvm-vagrant-digitalocean@1.0.0
7
+ # You can also use services such as databases. Read more on our dev center:
8
+ # http://devcenter.wercker.com/docs/services/index.html
9
+ # services:
10
+ # - postgres
11
+ # http://devcenter.wercker.com/docs/services/postgresql.html
12
+
13
+ # - mongodb
14
+ # http://devcenter.wercker.com/docs/services/mongodb.html
15
+
16
+ # This is the build pipeline. Pipelines are the core of wercker
17
+ # Read more about pipelines on our dev center
18
+ # http://devcenter.wercker.com/docs/pipelines/index.html
19
+ build:
20
+ # Steps make up the actions in your pipeline
21
+ # Read more about steps on our dev center:
22
+ # http://devcenter.wercker.com/docs/steps/index.html
23
+ steps:
24
+ - rvm-use:
25
+ version: 2.3.0
26
+
27
+ - script:
28
+ name: install bundler
29
+ code: gem install bundler -v 1.10.6 --no-document
30
+
31
+ - bundle-install:
32
+ jobs: 4
33
+
34
+ - script:
35
+ name: echo ruby information
36
+ code: |
37
+ echo "ruby version $(ruby --version) running"
38
+ echo "from location $(which ruby)"
39
+ echo -p "gem list: $(gem list)"
40
+
41
+ - script:
42
+ name: create .ssh directory
43
+ code: mkdir -m 700 -p $HOME/.ssh
44
+
45
+ - create-file:
46
+ name: put private key
47
+ filename: $HOME/.ssh/id_rsa.vagrant
48
+ overwrite: true
49
+ hide-from-log: true
50
+ content: $DIGITALOCEAN_KEY_PRIVATE
51
+
52
+ - create-file:
53
+ name: put public key
54
+ filename: $HOME/.ssh/id_rsa.vagrant.pub
55
+ overwrite: true
56
+ hide-from-log: true
57
+ content: $DIGITALOCEAN_KEY_PUBLIC
58
+
59
+ - script:
60
+ name: chmod 600 id_rsa
61
+ code: chmod 600 $HOME/.ssh/id_rsa.vagrant
62
+
63
+ - script:
64
+ name: paraduct test
65
+ code: bundle exec paraduct test
66
+
67
+ after-steps:
68
+ - wantedly/pretty-slack-notify:
69
+ webhook_url: $SLACK_WEBHOOK_URL
70
+ username: wercker_build
metadata ADDED
@@ -0,0 +1,138 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: itamae-plugin-recipe-consul
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0.beta1
5
+ platform: ruby
6
+ authors:
7
+ - sue445
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-05-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: itamae
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: paraduct
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: serverspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Itamae plugin to install Consul with init scripts
84
+ email:
85
+ - sue445@sue445.net
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - ".paraduct.yml"
92
+ - ".rspec"
93
+ - Gemfile
94
+ - LICENSE.txt
95
+ - README.md
96
+ - Rakefile
97
+ - Vagrantfile
98
+ - bin/console
99
+ - bin/setup
100
+ - ci/build.sh
101
+ - itamae-plugin-recipe-consul.gemspec
102
+ - lib/itamae/plugin/recipe/consul.rb
103
+ - lib/itamae/plugin/recipe/consul/default.rb
104
+ - lib/itamae/plugin/recipe/consul/download.rb
105
+ - lib/itamae/plugin/recipe/consul/service.rb
106
+ - lib/itamae/plugin/recipe/consul/templates/etc/default/consul.erb
107
+ - lib/itamae/plugin/recipe/consul/templates/etc/init.d/consul.erb
108
+ - lib/itamae/plugin/recipe/consul/templates/etc/sysconfig/consul.erb
109
+ - lib/itamae/plugin/recipe/consul/templates/etc/systemd/system/consul.service.erb
110
+ - lib/itamae/plugin/recipe/consul/version.rb
111
+ - recipes/install.rb
112
+ - recipes/node.yml
113
+ - wercker.yml
114
+ homepage: https://github.com/sue445/itamae-plugin-recipe-consul
115
+ licenses:
116
+ - MIT
117
+ metadata: {}
118
+ post_install_message:
119
+ rdoc_options: []
120
+ require_paths:
121
+ - lib
122
+ required_ruby_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ required_rubygems_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">"
130
+ - !ruby/object:Gem::Version
131
+ version: 1.3.1
132
+ requirements: []
133
+ rubyforge_project:
134
+ rubygems_version: 2.5.1
135
+ signing_key:
136
+ specification_version: 4
137
+ summary: Itamae plugin to install Consul with init scripts
138
+ test_files: []