brpm_module_ansible 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,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NWNkYzZjMmM0MGExM2FjNWZlYmU0ZTc5YTFjYjE0ZDNlYzUzNTc4Ng==
5
+ data.tar.gz: !binary |-
6
+ MzU0MTQ5YjRmY2ExMjExOGUyNzg0OTNkZjVmMzhiNjYyY2Y0Nzk5Yw==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ OTVjZjBjNThkNDgwOTk5ODUzMjhjYTVmMzQzNDEyNjE0MWE5OTIzMDg5MWFh
10
+ YzM4MTE3ZTA5YmRkMWUxNjM1NTQxNDA5NmI1NDExNjhiZjgwNjY1MDI0MjE5
11
+ YzVmZTgwMzU4ZTNlNWEyMDk1ZGU5MWViY2E0MTdiZjVhZDlmZjM=
12
+ data.tar.gz: !binary |-
13
+ MGYxNGM1NTQ3NzExYjAxOTU3YjlhNjhhZDZmNDA0ZGUyNzIwNDY5MGFiNmJh
14
+ ZWNkMTI2NDViNzIwNWU4MjhlYmQyZGY2MWFhOWRiMTlhYTJlMGU2ZmFlOWZk
15
+ YjM5OTlkM2QwNjM4OGZhZDg2NTg2NDQ5YTEzM2YzZGViYTM3YjY=
data/.gitignore ADDED
@@ -0,0 +1,37 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /test/tmp/
9
+ /test/version_tmp/
10
+ /tmp/
11
+
12
+ ## Specific to RubyMotion:
13
+ .dat*
14
+ .repl_history
15
+ build/
16
+
17
+ ## Documentation cache and generated files:
18
+ /.yardoc/
19
+ /_yardoc/
20
+ /doc/
21
+ /rdoc/
22
+
23
+ ## Environment normalisation:
24
+ /.bundle/
25
+ /lib/bundler/man/
26
+
27
+ # for a library or gem, you might want to ignore these files since the code is
28
+ # intended to run in multiple environments; otherwise, check them in:
29
+ Gemfile.lock
30
+ .ruby-gemset
31
+
32
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
33
+ .rvmrc
34
+
35
+ .DS_Store
36
+
37
+ .idea
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ brpm_content
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 1.9.3-p392
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 BMC
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 all
13
+ 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 THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1 @@
1
+ # brpm_module_ansible
data/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ require 'rspec/core/rake_task'
4
+
5
+ # Immediately sync all stdout so that tools like buildbot can
6
+ # immediately load in the output.
7
+ $stdout.sync = true
8
+ $stderr.sync = true
9
+
10
+ # Change to the directory of this file.
11
+ Dir.chdir(File.expand_path("../", __FILE__))
12
+
13
+ # This installs the tasks that help with gem creation and
14
+ # publishing.
15
+ Bundler::GemHelper.install_tasks
16
+
17
+ # Install the `spec` task so that we can run tests.
18
+ RSpec::Core::RakeTask.new do |task|
19
+ task.pattern = "tests/**/*_spec.rb"
20
+ end
21
+
22
+ # Default task is to run the unit tests
23
+ task :default => "spec"
@@ -0,0 +1,3 @@
1
+ server_group = get_server_group_from_step_id(BrpmAuto.params.step_id)
2
+
3
+ execute_ansible_role(BrpmAuto.params["role"], server_group)
@@ -0,0 +1,7 @@
1
+ params:
2
+ role:
3
+ name: role
4
+ position: A1:C1
5
+ required: yes
6
+ type: in-list-single
7
+ list_pairs: 1,common|2,db|3,haproxy|4,nagios|5,web|6,base-apache|7,web_rolling_update
data/config.yml ADDED
@@ -0,0 +1,11 @@
1
+ dependencies:
2
+ - brpm_module_brpm
3
+
4
+ version: 0.0.1
5
+
6
+ author: Niek Bartholomeus
7
+ email: niek.bartholomeus@gmail.com
8
+ homepage: https://github.com/BMC-RLM/brpm_module_ansible
9
+ license: MIT
10
+ summary: Ansible module
11
+ description: Ansible module
data/lib/ansible.rb ADDED
@@ -0,0 +1,41 @@
1
+ def execute_ansible_role(role, server_group, ignore_error=false)
2
+ playbook_file_path = "/home/ansib/playbook_#{server_group}_#{role}_#{Time.now.strftime("%Y%m%d%H%M%S")}.yml"
3
+ playbook_content = <<EOF
4
+ ---
5
+ # Make sure the facts of all servers are available for the role to be applied
6
+ - hosts: all
7
+ tasks: []
8
+
9
+ - hosts: #{server_group}
10
+ user: root
11
+ roles:
12
+ - #{role}
13
+ EOF
14
+
15
+ Logger.log "Creating playbook.yml..."
16
+ file = File.open(playbook_file_path, 'w') {|f| f.write(playbook_content) }
17
+
18
+ complete_command = "su ansib -c \"ansible-playbook #{playbook_file_path}\" 2>&1"
19
+
20
+ Logger.log complete_command
21
+ output = `#{complete_command}`
22
+ Logger.log "\toutput: #{output}"
23
+
24
+ File.delete(playbook_file_path)
25
+
26
+ exit_status = $?.exitstatus
27
+ unless exit_status == 0
28
+ message = "The command exited with #{exit_status}."
29
+ if ignore_error
30
+ Logger.log "\t#{message}"
31
+ else
32
+ raise(message)
33
+ end
34
+ end
35
+
36
+ output
37
+ end
38
+
39
+ def execute_ansible_role_and_ignore_error(command)
40
+ execute_ansible_role(command, true)
41
+ end
data/module.gemspec ADDED
@@ -0,0 +1,36 @@
1
+ require "yaml"
2
+
3
+ config = YAML.load_file(File.join(File.dirname(__FILE__), "config.yml"))
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = File.basename(File.expand_path(File.dirname(__FILE__))).sub("-#{config["version"]}", "")
7
+ spec.version = config["version"]
8
+ spec.platform = Gem::Platform::RUBY
9
+ spec.license = config["license"]
10
+ spec.authors = [config["author"]]
11
+ spec.email = config["email"]
12
+ spec.homepage = config["homepage"]
13
+ spec.summary = config["summary"]
14
+ spec.description = config["description"]
15
+
16
+ spec.add_runtime_dependency "brpm_content_framework", ">=0.2.11"
17
+
18
+ if config["dependencies"]
19
+ config["dependencies"].each do |dependency|
20
+ if dependency.is_a?(Hash)
21
+ modul = dependency.keys[0]
22
+ options = dependency.values[0]
23
+ else
24
+ modul = dependency
25
+ options = {}
26
+ end
27
+ spec.add_runtime_dependency modul, options["version"]
28
+ end
29
+ end
30
+
31
+ spec.add_development_dependency "rake"
32
+ spec.add_development_dependency "rspec"
33
+
34
+ spec.files = `git ls-files`.split("\n")
35
+ spec.executables = spec.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
36
+ end
metadata ADDED
@@ -0,0 +1,111 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: brpm_module_ansible
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Niek Bartholomeus
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-10-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: brpm_content_framework
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.2.11
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.2.11
27
+ - !ruby/object:Gem::Dependency
28
+ name: brpm_module_brpm
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
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: rake
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: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Ansible module
70
+ email: niek.bartholomeus@gmail.com
71
+ executables: []
72
+ extensions: []
73
+ extra_rdoc_files: []
74
+ files:
75
+ - .gitignore
76
+ - .ruby-gemset
77
+ - .ruby-version
78
+ - Gemfile
79
+ - LICENSE
80
+ - README.md
81
+ - Rakefile
82
+ - automations/execute_role.rb
83
+ - automations/execute_role.yml
84
+ - config.yml
85
+ - lib/ansible.rb
86
+ - module.gemspec
87
+ homepage: https://github.com/BMC-RLM/brpm_module_ansible
88
+ licenses:
89
+ - MIT
90
+ metadata: {}
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ! '>='
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ! '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubyforge_project:
107
+ rubygems_version: 2.1.9
108
+ signing_key:
109
+ specification_version: 4
110
+ summary: Ansible module
111
+ test_files: []