ansible_utils 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +80 -0
  6. data/Rakefile +1 -0
  7. data/ansible_utils.gemspec +25 -0
  8. data/bin/playbook +10 -0
  9. data/lib/ansible_utils/cli.rb +23 -0
  10. data/lib/ansible_utils/templates/new/dbservers.yml +0 -0
  11. data/lib/ansible_utils/templates/new/group_vars/all +3 -0
  12. data/lib/ansible_utils/templates/new/group_vars/atlanta +4 -0
  13. data/lib/ansible_utils/templates/new/group_vars/webservers +3 -0
  14. data/lib/ansible_utils/templates/new/host_vars/db-bos-1.example.com +3 -0
  15. data/lib/ansible_utils/templates/new/production +34 -0
  16. data/lib/ansible_utils/templates/new/roles/app/files/bar.txt +0 -0
  17. data/lib/ansible_utils/templates/new/roles/app/handlers/main.yml +0 -0
  18. data/lib/ansible_utils/templates/new/roles/app/tasks/main.yml +0 -0
  19. data/lib/ansible_utils/templates/new/roles/app/templates/noop.conf.j2 +0 -0
  20. data/lib/ansible_utils/templates/new/roles/app/vars/main.yml +0 -0
  21. data/lib/ansible_utils/templates/new/roles/common/files/bar.txt +0 -0
  22. data/lib/ansible_utils/templates/new/roles/common/handlers/main.yml +3 -0
  23. data/lib/ansible_utils/templates/new/roles/common/tasks/main.yml +15 -0
  24. data/lib/ansible_utils/templates/new/roles/common/templates/noop.conf.j2 +0 -0
  25. data/lib/ansible_utils/templates/new/roles/common/vars/main.yml +3 -0
  26. data/lib/ansible_utils/templates/new/roles/monitoring/files/bar.txt +0 -0
  27. data/lib/ansible_utils/templates/new/roles/monitoring/handlers/main.yml +0 -0
  28. data/lib/ansible_utils/templates/new/roles/monitoring/tasks/main.yml +0 -0
  29. data/lib/ansible_utils/templates/new/roles/monitoring/templates/noop.conf.j2 +0 -0
  30. data/lib/ansible_utils/templates/new/roles/monitoring/vars/main.yml +0 -0
  31. data/lib/ansible_utils/templates/new/site.yml +3 -0
  32. data/lib/ansible_utils/templates/new/staging +7 -0
  33. data/lib/ansible_utils/templates/new/webservers.yml +5 -0
  34. data/lib/ansible_utils/version.rb +3 -0
  35. data/lib/ansible_utils.rb +4 -0
  36. metadata +121 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1de4275da5a9bca293a1a222575108928f0c041b
4
+ data.tar.gz: 30abe3d829428e55f16c8af626205006089c5778
5
+ SHA512:
6
+ metadata.gz: e6d2bdadfb2386a81e00dd9e1cd842e3839ec3e1252bd80674a2f947ec1f74165dda110811ac2babe9cbd025c3fc90667f97f92f384cd7603f39a4098cbe998f
7
+ data.tar.gz: 06f7dbd97e9912d47256e4969f763fb09049d63ac2bfb740aa4f9f6cd3038d3d11d1a05f8915b066f234817d00418bf87b6680829c533fc52e154b280a8af0b4
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in playbook.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Aaron Cruz
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,80 @@
1
+ # Ansible Utils
2
+
3
+ Scaffold generator for ansible playbooks
4
+
5
+ ## Installation
6
+
7
+ Install >= 1.9.2
8
+
9
+ $ gem install ansible_utils
10
+
11
+ if using rbenv, don't forget to
12
+
13
+ $ rbenv rehash
14
+
15
+ ## Usage
16
+
17
+ This will install a `playbook` executable to your path (if you have ruby or your ruby version manager set up correctly)
18
+
19
+ ### playbook new
20
+
21
+ create a new playbook in current, relative or absolute filepath
22
+
23
+ # new playbook in not yet created "foo" directory
24
+ $ playbook new foo
25
+
26
+ you should see the output
27
+
28
+ create foo
29
+ create foo/dbservers.yml
30
+ create foo/group_vars/all
31
+ create foo/group_vars/atlanta
32
+ create foo/group_vars/webservers
33
+ create foo/host_vars/db-bos-1.example.com
34
+ create foo/production
35
+ create foo/roles/app/files/bar.txt
36
+ create foo/roles/app/handlers/main.yml
37
+ create foo/roles/app/tasks/main.yml
38
+ create foo/roles/app/templates/noop.conf.j2
39
+ create foo/roles/app/vars/main.yml
40
+ create foo/roles/common/files/bar.txt
41
+ create foo/roles/common/handlers/main.yml
42
+ create foo/roles/common/tasks/main.yml
43
+ create foo/roles/common/templates/noop.conf.j2
44
+ create foo/roles/common/vars/main.yml
45
+ create foo/roles/monitoring/files/bar.txt
46
+ create foo/roles/monitoring/handlers/main.yml
47
+ create foo/roles/monitoring/tasks/main.yml
48
+ create foo/roles/monitoring/templates/noop.conf.j2
49
+ create foo/roles/monitoring/vars/main.yml
50
+ create foo/site.yml
51
+ create foo/staging
52
+ create foo/webservers.yml
53
+
54
+ peep around, some of the files are already filled out for n00bz
55
+
56
+ ### playbook role
57
+
58
+ create a new role scaffold in the current directory's playbook
59
+
60
+ # create an nginx role in the ./roles directory
61
+ $ playbook role nginx
62
+
63
+ you should see the output
64
+
65
+ create roles/nginx
66
+ create roles/nginx/files/bar.txt
67
+ create roles/nginx/handlers/main.yml
68
+ create roles/nginx/tasks/main.yml
69
+ create roles/nginx/templates/noop.conf.j2
70
+ create roles/nginx/vars/main.yml
71
+
72
+
73
+
74
+ ## Contributing
75
+
76
+ 1. Fork it
77
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
78
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
79
+ 4. Push to the branch (`git push origin my-new-feature`)
80
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'ansible_utils/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ansible_utils"
8
+ spec.version = AnsibleUtils::VERSION
9
+ spec.authors = ["Aaron Cruz"]
10
+ spec.email = ["aaron@aaroncruz.com"]
11
+ spec.description = %q{Ansible Generators}
12
+ spec.summary = %q{Ansible Generators}
13
+ spec.homepage = "http://aaroncruz.com"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler"
22
+ spec.add_development_dependency "rake"
23
+
24
+ spec.add_runtime_dependency "thor"
25
+ end
data/bin/playbook ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
4
+ Pathname.new(__FILE__).realpath)
5
+
6
+ require 'rubygems'
7
+ require 'bundler/setup'
8
+ require 'ansible_utils/cli'
9
+
10
+ AnsibleUtils::Cli.start
@@ -0,0 +1,23 @@
1
+ require 'ansible_utils'
2
+ require 'thor'
3
+
4
+ module AnsibleUtils
5
+ class Cli < Thor
6
+ include Thor::Actions
7
+
8
+ def self.source_root
9
+ File.dirname(__FILE__)
10
+ end
11
+
12
+ desc "new", "Create a new playbook"
13
+ def new destination=Dir.pwd
14
+ directory "templates/new", destination
15
+ end
16
+
17
+ desc "task NAME", "Add a new role to current playbook"
18
+ def role name
19
+ directory "templates/new/roles/common", "roles/#{name}"
20
+ end
21
+ end
22
+ end
23
+
File without changes
@@ -0,0 +1,3 @@
1
+ ---
2
+ ntp: ntp-boston.example.com
3
+ backup: backup-boston.example.com
@@ -0,0 +1,4 @@
1
+ ---
2
+ ntp: ntp-atlanta.example.com
3
+ backup: backup-atlanta.example.com
4
+
@@ -0,0 +1,3 @@
1
+ ---
2
+ apacheMaxRequestsPerChild: 3000
3
+ apacheMaxClients: 900
@@ -0,0 +1,3 @@
1
+ ---
2
+ foo_agent_port: 86
3
+ bar_agent_port: 99
@@ -0,0 +1,34 @@
1
+ [atlanta-webservers]
2
+ www-atl-1.example.com
3
+ www-atl-2.example.com
4
+
5
+ [boston-webservers]
6
+ www-bos-1.example.com
7
+ www-bos-2.example.com
8
+
9
+ [atlanta-dbservers]
10
+ db-atl-1.example.com
11
+ db-atl-2.example.com
12
+
13
+ [boston-dbservers]
14
+ db-bos-1.example.com
15
+
16
+ # webservers in all geos
17
+ [webservers:children]
18
+ atlanta-webservers
19
+ boston-webservers
20
+
21
+ # dbservers in all geos
22
+ [dbservers:children]
23
+ atlanta-dbservers
24
+ boston-dbservers
25
+
26
+ # everything in the atlanta geo
27
+ [atlanta:children]
28
+ atlanta-webservers
29
+ atlanta-dbservers
30
+
31
+ # everything in the boston geo
32
+ [boston:children]
33
+ boston-webservers
34
+ boston-dbservers
@@ -0,0 +1,3 @@
1
+ ---
2
+ - name: restart ntpd
3
+ service: name=ntpd state=restarted
@@ -0,0 +1,15 @@
1
+ ---
2
+
3
+ - name: be sure ntp is installed
4
+ apt: pkg=ntp state=installed
5
+ tags: ntp
6
+
7
+ - name: be sure ntp is configured
8
+ template: src=ntp.conf.j2 dest=/etc/ntp.conf
9
+ notify:
10
+ - restart ntpd
11
+ tags: ntp
12
+
13
+ - name: be sure ntpd is running and enabled
14
+ service: name=ntpd state=running enabled=yes
15
+ tags: ntp
@@ -0,0 +1,3 @@
1
+ ---
2
+ python_version: "2.7.5"
3
+ pip_version: "1.3.1"
@@ -0,0 +1,3 @@
1
+ ---
2
+ - include: webservers.yml
3
+ - include: dbservers.yml
@@ -0,0 +1,7 @@
1
+ [database]
2
+ foo.example.com
3
+ bar.examle.net
4
+
5
+ [application]
6
+ app.example.com
7
+
@@ -0,0 +1,5 @@
1
+ ---
2
+ - hosts: webservers
3
+ roles:
4
+ - common
5
+ - webtier
@@ -0,0 +1,3 @@
1
+ module AnsibleUtils
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,4 @@
1
+ require "ansible_utils/version"
2
+
3
+ module AnsibleUtils
4
+ end
metadata ADDED
@@ -0,0 +1,121 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ansible_utils
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Aaron Cruz
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-09-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
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
+ - !ruby/object:Gem::Dependency
28
+ name: rake
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: thor
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Ansible Generators
56
+ email:
57
+ - aaron@aaroncruz.com
58
+ executables:
59
+ - playbook
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - .gitignore
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - ansible_utils.gemspec
69
+ - bin/playbook
70
+ - lib/ansible_utils.rb
71
+ - lib/ansible_utils/cli.rb
72
+ - lib/ansible_utils/templates/new/dbservers.yml
73
+ - lib/ansible_utils/templates/new/group_vars/all
74
+ - lib/ansible_utils/templates/new/group_vars/atlanta
75
+ - lib/ansible_utils/templates/new/group_vars/webservers
76
+ - lib/ansible_utils/templates/new/host_vars/db-bos-1.example.com
77
+ - lib/ansible_utils/templates/new/production
78
+ - lib/ansible_utils/templates/new/roles/app/files/bar.txt
79
+ - lib/ansible_utils/templates/new/roles/app/handlers/main.yml
80
+ - lib/ansible_utils/templates/new/roles/app/tasks/main.yml
81
+ - lib/ansible_utils/templates/new/roles/app/templates/noop.conf.j2
82
+ - lib/ansible_utils/templates/new/roles/app/vars/main.yml
83
+ - lib/ansible_utils/templates/new/roles/common/files/bar.txt
84
+ - lib/ansible_utils/templates/new/roles/common/handlers/main.yml
85
+ - lib/ansible_utils/templates/new/roles/common/tasks/main.yml
86
+ - lib/ansible_utils/templates/new/roles/common/templates/noop.conf.j2
87
+ - lib/ansible_utils/templates/new/roles/common/vars/main.yml
88
+ - lib/ansible_utils/templates/new/roles/monitoring/files/bar.txt
89
+ - lib/ansible_utils/templates/new/roles/monitoring/handlers/main.yml
90
+ - lib/ansible_utils/templates/new/roles/monitoring/tasks/main.yml
91
+ - lib/ansible_utils/templates/new/roles/monitoring/templates/noop.conf.j2
92
+ - lib/ansible_utils/templates/new/roles/monitoring/vars/main.yml
93
+ - lib/ansible_utils/templates/new/site.yml
94
+ - lib/ansible_utils/templates/new/staging
95
+ - lib/ansible_utils/templates/new/webservers.yml
96
+ - lib/ansible_utils/version.rb
97
+ homepage: http://aaroncruz.com
98
+ licenses:
99
+ - MIT
100
+ metadata: {}
101
+ post_install_message:
102
+ rdoc_options: []
103
+ require_paths:
104
+ - lib
105
+ required_ruby_version: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ required_rubygems_version: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - '>='
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ requirements: []
116
+ rubyforge_project:
117
+ rubygems_version: 2.0.3
118
+ signing_key:
119
+ specification_version: 4
120
+ summary: Ansible Generators
121
+ test_files: []