avst-cloud 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +36 -0
- data/.travis.yml +16 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +191 -0
- data/README.md +201 -0
- data/Rakefile +4 -0
- data/avst-cloud.gemspec +28 -0
- data/bin/avst-cloud +99 -0
- data/bin/avst-cloud-puppet +173 -0
- data/bin/avst-cloud-rackspace +87 -0
- data/config/custom_system_config/hiera-configs/defaults/example.yaml +1 -0
- data/config/custom_system_config/hiera-configs/hostname1.yaml +12 -0
- data/config/custom_system_config/hiera-configs/hostname1_facts.yaml +53 -0
- data/config/custom_system_config/hiera-configs/templates/example.yaml +137 -0
- data/config/deploy.rb +79 -0
- data/config/deploy/production.rb +48 -0
- data/lib/avst-cloud.rb +28 -0
- data/lib/avst-cloud/aws_connection.rb +203 -0
- data/lib/avst-cloud/aws_server.rb +56 -0
- data/lib/avst-cloud/cloud_connection.rb +39 -0
- data/lib/avst-cloud/cloud_server.rb +89 -0
- data/lib/avst-cloud/logging.rb +36 -0
- data/lib/avst-cloud/rackspace_connection.rb +141 -0
- data/lib/avst-cloud/rackspace_server.rb +58 -0
- data/lib/avst-cloud/task.rb +288 -0
- data/lib/capistrano/tasks/prepare_puppet_and_execute.rake +90 -0
- metadata +188 -0
data/Rakefile
ADDED
data/avst-cloud.gemspec
ADDED
@@ -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
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "avst-cloud"
|
7
|
+
spec.version = '0.1.7'
|
8
|
+
spec.authors = ["Martin Brehovsky", "Jon Bevan", "Matthew Hope"]
|
9
|
+
spec.email = ["mbrehovsky@adaptavist.com", "jbevan@adaptavist.com", "mhope@adaptavist.com"]
|
10
|
+
spec.summary = %q{Automated creation, bootstrapping and provisioning of servers }
|
11
|
+
spec.description = %q{Currently supports AWS}
|
12
|
+
spec.homepage = "http://www.adaptavist.com"
|
13
|
+
|
14
|
+
spec.files = `git ls-files -z`.split("\x0")
|
15
|
+
spec.executables = ["avst-cloud", "avst-cloud-puppet", "avst-cloud-rackspace"]
|
16
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
17
|
+
spec.require_paths = ["lib"]
|
18
|
+
|
19
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
20
|
+
spec.add_development_dependency "rake"
|
21
|
+
spec.add_dependency "fog"
|
22
|
+
spec.add_dependency "capistrano", "3.2.1"
|
23
|
+
spec.add_dependency "capistrano-rvm"
|
24
|
+
spec.add_dependency "derelict"
|
25
|
+
spec.add_dependency "docopt", ">= 0.5.0"
|
26
|
+
spec.add_dependency "colorize", ">= 0.7.3"
|
27
|
+
end
|
28
|
+
|
data/bin/avst-cloud
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Copyright 2015 Adaptavist.com Ltd.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
require 'avst-cloud'
|
18
|
+
|
19
|
+
avst_cloud_base="#{File.expand_path("../../", __FILE__)}"
|
20
|
+
|
21
|
+
# FILL IN YOUR AWS ACCOUNT DETAILS (Access Key ID and Secret Access Key), GIT REPO AND MAKE SURE
|
22
|
+
# FILES IN files FOLDER HAS CORRECT CONTENT
|
23
|
+
provider_user=''
|
24
|
+
provider_pass=''
|
25
|
+
region='eu-west-1'
|
26
|
+
# Initiate connector object
|
27
|
+
conn = AvstCloud::AwsConnection.new(provider_user, provider_pass, region)
|
28
|
+
|
29
|
+
server_name = 'hostname1'
|
30
|
+
|
31
|
+
flavour = nil # defaults to t2.micro
|
32
|
+
hdd_device_path = nil # defaults to '/dev/sda1'
|
33
|
+
ami_image_id = "ami-f0b11187"
|
34
|
+
os = "ubuntu-14"
|
35
|
+
|
36
|
+
key_name = 'admin' # key name, e.g. admin
|
37
|
+
ssh_key = "path/to/your/admin.pem" # Full path to ssh key, e.g. /tmp/admin.pem
|
38
|
+
subnet_id = '' # Your subnet
|
39
|
+
security_group_ids = [''] # List of security groups
|
40
|
+
ebs_size = nil # In GB
|
41
|
+
availability_zone = 'eu-west-1c'
|
42
|
+
|
43
|
+
server = conn.create_server(server_name, flavour, os, key_name, ssh_key, subnet_id, security_group_ids, ebs_size, hdd_device_path, ami_image_id, availability_zone)
|
44
|
+
|
45
|
+
# server = conn.server(server_name, nil, ssh_key, os)
|
46
|
+
# server.destroy
|
47
|
+
# puts conn.server_status(server_name)
|
48
|
+
# exit
|
49
|
+
|
50
|
+
pre_upload_commands = [
|
51
|
+
"echo 'pre_upload_command was here' >> /tmp/pre_upload",
|
52
|
+
]
|
53
|
+
|
54
|
+
custom_file_uploads = {
|
55
|
+
"#{avst_cloud_base}/files/id_rsa" => "/tmp/.",
|
56
|
+
"#{avst_cloud_base}/files/known_hosts" => "/tmp/."
|
57
|
+
}
|
58
|
+
|
59
|
+
# Uploading ssh keys to access git repo in provisioning stage, make sure you provide correct keys
|
60
|
+
post_upload_commands = [
|
61
|
+
"mkdir /home/ubuntu/.ssh",
|
62
|
+
"mv /tmp/id_rsa /home/ubuntu/.ssh/.",
|
63
|
+
"mv /tmp/known_hosts /home/ubuntu/.ssh/.",
|
64
|
+
"chmod 0600 /home/ubuntu/.ssh/known_hosts",
|
65
|
+
"chmod 0600 /home/ubuntu/.ssh/id_rsa",
|
66
|
+
"mkdir /var/opt/puppet",
|
67
|
+
"chown ubuntu /var/opt/puppet",
|
68
|
+
"apt-get update && apt-get install -o Dpkg::Options::='--force-confold' -f -y git puppet-common puppet"
|
69
|
+
]
|
70
|
+
|
71
|
+
remote_server_debug = true
|
72
|
+
debug_structured_log = false
|
73
|
+
|
74
|
+
server.bootstrap(pre_upload_commands, custom_file_uploads, post_upload_commands, remote_server_debug, debug_structured_log)
|
75
|
+
|
76
|
+
git = "ssh://git@you_repo.git"
|
77
|
+
branch = "master"
|
78
|
+
reference = nil # Tag
|
79
|
+
# In this example we do not use puppet-runner, check doco
|
80
|
+
puppet_runner = nil
|
81
|
+
puppet_runner_prepare = nil
|
82
|
+
custom_provisioning_commands = ["echo 'done' >> /tmp/done", "echo 'done' >> /tmp/done1"]
|
83
|
+
server_tmp_folder="/tmp/avst_cloud_tmp_#{Time.now.to_i}"
|
84
|
+
|
85
|
+
destination_folder = nil # defaults to /var/opt/puppet
|
86
|
+
server.provision(git, branch, server_tmp_folder, reference, custom_provisioning_commands, puppet_runner, puppet_runner_prepare, destination_folder)
|
87
|
+
|
88
|
+
# puts conn.server_status(server_name)
|
89
|
+
# server.stop
|
90
|
+
|
91
|
+
# puts conn.server_status(server_name)
|
92
|
+
# server.start
|
93
|
+
|
94
|
+
# custom_commands=nil
|
95
|
+
# server_tmp_folder="/tmp/done"
|
96
|
+
# server.post_provisioning_cleanup(custom_commands, os, remote_server_debug, server_tmp_folder)
|
97
|
+
|
98
|
+
# server.destroy
|
99
|
+
# puts conn.server_status(server_name)
|
@@ -0,0 +1,173 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Copyright 2015 Adaptavist.com Ltd.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
require 'avst-cloud'
|
17
|
+
|
18
|
+
avst_cloud_base ="#{File.expand_path("../../", __FILE__)}"
|
19
|
+
|
20
|
+
start_time = Time.now
|
21
|
+
|
22
|
+
server_name = "hostname1"
|
23
|
+
|
24
|
+
# FILL IN YOUR AWS ACCOUNT DETAILS (Access Key ID and Secret Access Key), GIT REPO AND MAKE SURE
|
25
|
+
# FILES IN files FOLDER HAS CORRECT CONTENT
|
26
|
+
|
27
|
+
# Provide account specific values here
|
28
|
+
provider_user=''
|
29
|
+
provider_pass=''
|
30
|
+
|
31
|
+
key_name = 'admin' # key name, e.g. admin
|
32
|
+
ssh_key = "path/to/your/admin.pem" # Full path to ssh key, e.g. /tmp/admin.pem
|
33
|
+
subnet_id = '' # Your subnet
|
34
|
+
security_group_ids = [''] # List of security groups
|
35
|
+
|
36
|
+
region = "eu-west-1"
|
37
|
+
|
38
|
+
conn = AvstCloud::AwsConnection.new(provider_user, provider_pass, region)
|
39
|
+
|
40
|
+
ebs_size = 12
|
41
|
+
availability_zone = "eu-west-1c"
|
42
|
+
flavour = "t2.small"
|
43
|
+
|
44
|
+
# os specific, on aws ubuntu - '/dev/sda1', centos - '/dev/xvda'
|
45
|
+
# hdd_device_path = nil # defaults to '/dev/sda1'
|
46
|
+
# ami_image_id = "ami-f0b11187"
|
47
|
+
# os = "ubuntu-14"
|
48
|
+
# access_user = 'ubuntu'
|
49
|
+
|
50
|
+
hdd_device_path = '/dev/xvda' # defaults to '/dev/sda1'
|
51
|
+
ami_image_id = "ami-7a40920d"
|
52
|
+
os = "centos-7"
|
53
|
+
access_user = 'ec2-user'
|
54
|
+
|
55
|
+
puts "Starting server".green
|
56
|
+
|
57
|
+
server = conn.create_server(server_name, flavour, os, key_name, ssh_key, subnet_id, security_group_ids, ebs_size, hdd_device_path, ami_image_id, availability_zone)
|
58
|
+
# server = conn.server(server_name, nil, ssh_key, os)
|
59
|
+
# server.destroy
|
60
|
+
# exit
|
61
|
+
# # Ubuntu 14 pre upload commands
|
62
|
+
# pre_upload_commands = [
|
63
|
+
# "echo 'pre_upload_command was here' >> /tmp/pre_upload",
|
64
|
+
# "apt-get clean",
|
65
|
+
# "apt-get update",
|
66
|
+
# "apt-get upgrade -o Dpkg::Options::='--force-confold' --force-overwrite -f -y",
|
67
|
+
# "apt-get install -o Dpkg::Options::='--force-confold' --force-overwrite -f -y curl",
|
68
|
+
# "curl -sSL https://raw.github.com/adaptavist/rvm/adaptavist_rvm/binscripts/rvm-installer | bash -s -- --version 1.25.33",
|
69
|
+
# "source /usr/local/rvm/scripts/rvm; rvm install 2.0",
|
70
|
+
# "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc",
|
71
|
+
# "apt-get install -o Dpkg::Options::='--force-confold' -f -y git puppet-common puppet augeas-tools libaugeas-dev libaugeas-ruby unzip",
|
72
|
+
# "source /usr/local/rvm/scripts/rvm; gem install --no-ri --no-rdoc puppet -v 3.7.5",
|
73
|
+
# "source /usr/local/rvm/scripts/rvm; gem install --no-ri --no-rdoc r10k ruby-augeas hiera-eyaml hiera-fragment ruby-shadow",
|
74
|
+
# "echo #{server_name} > /etc/hostname; sed -i 's/ubuntu/#{server_name}/g' /etc/hosts; sed -i '/127.0.1.1/d' /etc/hosts; echo '127.0.1.1 #{server_name}' >> /etc/hosts; service hostname restart",
|
75
|
+
# "source /usr/local/rvm/scripts/rvm; gem install --no-ri --no-rdoc puppet-runner",
|
76
|
+
# "mkdir /home/#{access_user}/.ssh",
|
77
|
+
# "mkdir /var/opt/puppet/secrets/keys"
|
78
|
+
#]
|
79
|
+
|
80
|
+
# CentOS 7 pre upload commands
|
81
|
+
pre_upload_commands = [
|
82
|
+
# clean all the YUM metadata
|
83
|
+
"yum clean all",
|
84
|
+
# update all packages already installed
|
85
|
+
"yum -y update",
|
86
|
+
# install rvm
|
87
|
+
"curl -sSL https://raw.github.com/adaptavist/rvm/adaptavist_rvm/binscripts/rvm-installer | bash -s -- --version 1.25.33",
|
88
|
+
# install ruby 2.0 via rvm
|
89
|
+
"source /usr/local/rvm/scripts/rvm; rvm install 2.0",
|
90
|
+
# add defaults to ~/.gemrc
|
91
|
+
"echo 'gem: --no-ri --no-rdoc' > ~/.gemrc",
|
92
|
+
# install curl, git, puppet-common, puppet, augeas-devel, augeas and unzip
|
93
|
+
"yum install -y curl git puppet-common puppet augeas-devel augeas unzip",
|
94
|
+
# install puppet 3.7.5 gem
|
95
|
+
"source /usr/local/rvm/scripts/rvm; gem install --no-ri --no-rdoc puppet -v 3.7.5",
|
96
|
+
# install r10k, ruby-augeas, hiera-eyaml, hiera-fragment and ruby-shadow gem
|
97
|
+
"source /usr/local/rvm/scripts/rvm; gem install --no-ri --no-rdoc r10k ruby-augeas hiera-eyaml hiera-fragment ruby-shadow",
|
98
|
+
# set the servers hostname
|
99
|
+
"echo 'HOSTNAME=#{server_name}' >> /etc/sysconfig/network; sed -i '/127.0.1.1/d' /etc/hosts; echo '127.0.1.1 #{server_name}' >> /etc/hosts; hostname #{server_name};",
|
100
|
+
"if [ ! -f /usr/bin/hostnamectl ]; then /etc/init.d/network restart; else /usr/bin/hostnamectl set-hostname #{server_name}; fi",
|
101
|
+
# workaround for issues resizing the root flesystem if its xfs
|
102
|
+
"mount -t xfs | egrep ' / '.*.inode64 > /dev/null 2>&1 && (mount -o remount,inode32 /;mount -o remount,inode64 /)",
|
103
|
+
# download and install oracle java 7 and 8, alternatives will be configured by the oracle_java puppet module
|
104
|
+
"curl -L -b 'oraclelicense=a' http://download.oracle.com/otn-pub/java/jdk/8u65-b17/jdk-8u65-linux-x64.rpm -o /tmp/jdk-8u65-linux-x64.rpm",
|
105
|
+
"curl -L -b 'oraclelicense=a' http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.rpm -o /tmp/jdk-7u79-linux-x64.rpm",
|
106
|
+
"rpm -i /tmp/jdk-8u65-linux-x64.rpm",
|
107
|
+
"rpm -i /tmp/jdk-7u79-linux-x64.rpm",
|
108
|
+
# install puppet-runer gem
|
109
|
+
"source /usr/local/rvm/scripts/rvm; gem install --no-ri --no-rdoc puppet-runner",
|
110
|
+
# create the access users .ssh folder to allow the uploading of id_rsa and known_hosts
|
111
|
+
"mkdir /home/#{access_user}/.ssh",
|
112
|
+
# create the puppet secrets directory to allow the uploading of eyaml public and private keys
|
113
|
+
"mkdir -p /var/opt/puppet/secrets/keys",
|
114
|
+
# ensure the acces user owns the puppet directories
|
115
|
+
"chown -R #{access_user} /var/opt/puppet",
|
116
|
+
]
|
117
|
+
|
118
|
+
custom_file_uploads = {
|
119
|
+
"#{avst_cloud_base}/files/id_rsa" => "/home/#{access_user}/.ssh/.",
|
120
|
+
"#{avst_cloud_base}/files/known_hosts" => "/home/#{access_user}/.ssh/.",
|
121
|
+
"#{avst_cloud_base}/files/private_key.pkcs7.pem" => "/tmp/.",
|
122
|
+
"#{avst_cloud_base}/files/public_key.pkcs7.pem" => "/tmp/."
|
123
|
+
}
|
124
|
+
|
125
|
+
# Uploading ssh keys to access git repo in provisioning stage, make sure you provide correct keys
|
126
|
+
# # Ubuntu 14 post upload commands
|
127
|
+
# post_upload_commands = [
|
128
|
+
# "chmod 0600 /home/#{access_user}/.ssh/known_hosts",
|
129
|
+
# "chmod 0600 /home/#{access_user}/.ssh/id_rsa",
|
130
|
+
# "mkdir /var/opt/puppet",
|
131
|
+
# "chown ubuntu /var/opt/puppet",
|
132
|
+
# "apt-get update && apt-get install -o Dpkg::Options::='--force-confold' -f -y git puppet-common puppet"
|
133
|
+
# ]
|
134
|
+
|
135
|
+
# Centos 7 post upload commands
|
136
|
+
post_upload_commands = [
|
137
|
+
"mv /tmp/private_key.pkcs7.pem /var/opt/puppet/secrets/keys/.",
|
138
|
+
"mv /tmp/public_key.pkcs7.pem /var/opt/puppet/secrets/keys/.",
|
139
|
+
# download the mysql jdbc driver
|
140
|
+
"curl -L http://central.maven.org/maven2/mysql/mysql-connector-java/5.1.22/mysql-connector-java-5.1.22.jar -o /var/opt/puppet/mysql-connector-java-5.1.22.jar",
|
141
|
+
"chmod 0600 /home/#{access_user}.ssh/known_hosts",
|
142
|
+
"chmod 0600 /home/#{access_user}/.ssh/id_rsa",
|
143
|
+
# install the puppet and puppet-common packages via yum
|
144
|
+
"yum install -y git puppet-common puppet"
|
145
|
+
]
|
146
|
+
|
147
|
+
|
148
|
+
remote_server_debug = true
|
149
|
+
debug_structured_log = false
|
150
|
+
|
151
|
+
server.bootstrap(pre_upload_commands, custom_file_uploads, post_upload_commands, remote_server_debug, debug_structured_log)
|
152
|
+
|
153
|
+
server_tmp_folder = "/tmp/avst_cloud_tmp_#{Time.now.to_i}"
|
154
|
+
|
155
|
+
# url to git repo you want to upload to the server
|
156
|
+
git = "https://github.com/Adaptavist/base_puppet_templates.git" # url to git repo
|
157
|
+
branch = "master" # branch
|
158
|
+
reference = nil # tag
|
159
|
+
# In this example we are using puppet-runner to apply our puppet configs, check doco
|
160
|
+
puppet_runner = "puppet-runner start"
|
161
|
+
puppet_runner_prepare = "puppet-runner prepare -c ./hiera-configs -d ./hiera -f ./environments/production/modules/hosts/facts.d -t ./hiera-configs -r ./hiera-configs/puppetfile_dictionary.yaml -o ./Puppetfile -e /var/opt/puppet/secure/keys"
|
162
|
+
|
163
|
+
custom_provisioning_commands = ["echo 'done' >> /tmp/done"]
|
164
|
+
# defaults to /var/opt/puppet
|
165
|
+
destination_folder = nil
|
166
|
+
|
167
|
+
server.provision(git, branch, server_tmp_folder, reference, custom_provisioning_commands, puppet_runner, puppet_runner_prepare, destination_folder)
|
168
|
+
|
169
|
+
# Destroy server
|
170
|
+
# server.destroy
|
171
|
+
|
172
|
+
time_taken = ((Time.now - start_time) / 60).round(2)
|
173
|
+
puts "Finished in #{time_taken} minutes".green
|
@@ -0,0 +1,87 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Copyright 2015 Adaptavist.com Ltd.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
require 'avst-cloud'
|
18
|
+
|
19
|
+
avst_cloud_base="#{File.expand_path("../../", __FILE__)}"
|
20
|
+
|
21
|
+
# FILL IN YOUR Rackspace ACCOUNT DETAILS (Username and Secret Access Key), GIT REPO, image_id AND MAKE SURE
|
22
|
+
# FILES IN files FOLDER HAS CORRECT CONTENT
|
23
|
+
provider_user=''
|
24
|
+
provider_pass=''
|
25
|
+
region=:lon
|
26
|
+
# Initiate connector object
|
27
|
+
conn = AvstCloud::RackspaceConnection.new(provider_user, provider_pass, region)
|
28
|
+
|
29
|
+
server_name = 'hostname1'
|
30
|
+
|
31
|
+
flavour = '4'
|
32
|
+
image_id = '' # Please provide
|
33
|
+
server = conn.create_server(server_name, image_id)
|
34
|
+
|
35
|
+
puts conn.server_status(server_name)
|
36
|
+
# server = conn.server(server_name, 'root', pass)
|
37
|
+
|
38
|
+
pre_upload_commands = [
|
39
|
+
"echo 'pre_upload_command was here' >> /tmp/pre_upload",
|
40
|
+
]
|
41
|
+
|
42
|
+
custom_file_uploads = {
|
43
|
+
"#{avst_cloud_base}/files/id_rsa" => "/tmp/.",
|
44
|
+
"#{avst_cloud_base}/files/known_hosts" => "/tmp/."
|
45
|
+
}
|
46
|
+
|
47
|
+
# Uploading ssh keys to access git repo in provisioning stage, make sure you provide correct keys
|
48
|
+
post_upload_commands = [
|
49
|
+
"mkdir /root/.ssh",
|
50
|
+
"mv /tmp/id_rsa /root/.ssh/.",
|
51
|
+
"mv /tmp/known_hosts /root/.ssh/.",
|
52
|
+
"chmod 0600 /root/.ssh/known_hosts",
|
53
|
+
"chmod 0600 /root/.ssh/id_rsa",
|
54
|
+
"mkdir /var/opt/puppet",
|
55
|
+
"chown root /var/opt/puppet",
|
56
|
+
"apt-get update && apt-get install -o Dpkg::Options::='--force-confold' -f -y git puppet-common puppet"
|
57
|
+
]
|
58
|
+
|
59
|
+
remote_server_debug = true
|
60
|
+
debug_structured_log = false
|
61
|
+
|
62
|
+
server.bootstrap(pre_upload_commands, custom_file_uploads, post_upload_commands, remote_server_debug, debug_structured_log)
|
63
|
+
|
64
|
+
git = "ssh://git@you_repo.git"
|
65
|
+
branch = "master"
|
66
|
+
reference = nil # Tag
|
67
|
+
# In this example we do not use puppet-runner, check doco
|
68
|
+
puppet_runner = nil
|
69
|
+
puppet_runner_prepare = nil
|
70
|
+
custom_provisioning_commands = ["echo 'done' >> /tmp/done", "echo 'done' >> /tmp/done1"]
|
71
|
+
server_tmp_folder="/tmp/avst_cloud_tmp_#{Time.now.to_i}"
|
72
|
+
|
73
|
+
destination_folder = nil # defaults to /var/opt/puppet
|
74
|
+
server.provision(git, branch, server_tmp_folder, reference, custom_provisioning_commands, puppet_runner, puppet_runner_prepare, destination_folder)
|
75
|
+
|
76
|
+
# puts conn.server_status(server_name)
|
77
|
+
# server.stop
|
78
|
+
|
79
|
+
# puts conn.server_status(server_name)
|
80
|
+
# server.start
|
81
|
+
|
82
|
+
# custom_commands=nil
|
83
|
+
# server_tmp_folder="/tmp/done"
|
84
|
+
# server.post_provisioning_cleanup(custom_commands, os, remote_server_debug, server_tmp_folder)
|
85
|
+
|
86
|
+
# server.destroy
|
87
|
+
# puts conn.server_status(server_name)
|
@@ -0,0 +1 @@
|
|
1
|
+
---
|
@@ -0,0 +1,53 @@
|
|
1
|
+
---
|
2
|
+
|
3
|
+
# the jira version to install
|
4
|
+
atlassian_version: '6.4.11'
|
5
|
+
# the name of the jira instance, this will be the serice name and the installation will be in /opt/<INSTANCE_NAME>
|
6
|
+
atlassian_instance_name: 'example_jira'
|
7
|
+
# the jira administrator username
|
8
|
+
atlassian_admin_user: 'admin'
|
9
|
+
# the jira administrator password
|
10
|
+
atlassian_admin_pass: 'changeme'
|
11
|
+
# the name of the mysql database to use
|
12
|
+
atlassian_database_name: 'example_jira'
|
13
|
+
# the mysql user for jira to use
|
14
|
+
atlassian_database_user: 'example_jira'
|
15
|
+
# the mysql password for jira to use
|
16
|
+
atlassian_database_pass: 'changeme'
|
17
|
+
# the mysql root users password
|
18
|
+
atlassian_root_password: 'changeme'
|
19
|
+
# the service user for jira
|
20
|
+
atlassian_hosting_group: 'atlassian'
|
21
|
+
# the service group for jiral
|
22
|
+
atlassian_hosting_user: 'atlassian'
|
23
|
+
# the jira license, the one below is a 3 hour timebomb license, for details see
|
24
|
+
# https://developer.atlassian.com/market/add-on-licensing-for-developers/timebomb-licenses-for-testing
|
25
|
+
atlassian_license: |
|
26
|
+
AAABiQ0ODAoPeNp1kk9TwjAQxe/9FJnxXKYpeoCZHqCtgsqfgaIO4yWELURD0tm0KN/eWOjYdvD68
|
27
|
+
vbtb3dzM9GKTBgS2iOU9n3a7/pkHiXE96jvbNhho3XnWXBQBuKtyIVWQTxN4sV8MV7GTirMHk5QO
|
28
|
+
ZJTBsG91eITvPdJBEeQOgN0uNRHwIYtLKWGa1ocNoCzdGUATUA9h2uVdhjPxRGCHAtw5gXyPTMQs
|
29
|
+
RwCn1Lf9XzXv3NqwVN2gGCZDBYWstLj70zgqSyad0fVWPXgJaClGUfB8KGXuG+rl1v3ab0euUOPv
|
30
|
+
jofAlmD/XG8GJBY5YAZCtMa9Ze5MagVZAGKX/FVE4eyMDZtqrdgAq+19zJlWEr/Na0TXjkTx4KLj
|
31
|
+
WzeKbyIjaAJE7aDYpa2tTSO+mvbCrBKo/ryate4Up9KfylnhjumhGEl0SCXzBjB1B9Q/QYhQulrH
|
32
|
+
/fcue6svl1di8BwFFnZKAGTE3mGIalGksliJxTZVqTmvLF6fXxksjhzpkwaqP5s3fMDBMYhRDAtA
|
33
|
+
hUAhcR3uL05YCxbclq7h1dNa+Nc+j4CFBrdN005oVlMN9yBlWeM4TlnrOhqX02j3
|
34
|
+
# apache timeout for the proxy connection to jira, this is a large timeout as the setup wizard requires it
|
35
|
+
vhost_http_atlassian_proxy_connection_timeout: 150
|
36
|
+
vhost_http_atlassian_proxy_timeout: 300
|
37
|
+
# hostname used to pass the setup wizard, will also be set as the jira base url
|
38
|
+
atlassian_host_name: 'http://localhost'
|
39
|
+
#JVM minimum memory setup for the service
|
40
|
+
atlassian_jvm_minimum_memory: 256m
|
41
|
+
#JVM maximum memory setup for the service
|
42
|
+
atlassian_jvm_maximum_memory: 512m
|
43
|
+
#JVM max perm size setup for the service
|
44
|
+
atlassian_jvm_max_perm_size: 256m
|
45
|
+
#the location of the mysql datbaase driver, it is downloaded as part of the example bootstrap
|
46
|
+
atlassian_driver_location_path: '/var/opt/puppet/mysql-connector-java-5.1.22.jar'
|
47
|
+
# the apache servername to set in the vhost
|
48
|
+
vhost_http_atlassian_servername: 'hostname1'
|
49
|
+
# the apache serveralias to set in the vhost
|
50
|
+
vhost_http_atlassian_serveraliases: 'localhost'
|
51
|
+
# the tomcat port that jira is running on
|
52
|
+
connector_tomcat_port: '8081'
|
53
|
+
|