taperole 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5c92e2f69de1cdc3aa31ea5a4bdabd838d802545
4
- data.tar.gz: f1f8a6a57050a61717da15513bf56172bd2c3862
3
+ metadata.gz: 689921b058cbf9f55c561b863824f8a7b42fe7ae
4
+ data.tar.gz: 0e7d4eafffd9ff45f323f6e4e691ed82360e9958
5
5
  SHA512:
6
- metadata.gz: f64db7fa0456d4b6d7858ac125d1d15a1cfcee542e510f1431f18d46842dde9f83a8abd19ba2742933a5f64be329572a484b9a116712f333b3baa44002b4d6d0
7
- data.tar.gz: 7e861fbb2876b5593d880f401b6a4bb0460c97a96324ede5eb4e15104f1aff576a046f35d64c50a99991dc0721db4bfa125578857cf38661e3392f616917f0e6
6
+ metadata.gz: 272ebe1ee3076ace6b27bb3cd96cba2121baa22abbeee0a3f5e02cda1ae9bdedf48eb92513d560e61f99433b65d3ae09253f7b8eb054f05b7fa71c2d1f413079
7
+ data.tar.gz: 02401a7e31a12b240abbf60ea65c40805918c7eae5ab04fc660445016531ce6c0ec9a59123debb1be9e26f4a907bec4253c8e0cbb9413ccd0010b77482e68522
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ### 1.3.3
2
+ * Added slack notifications
3
+ * Added fe build command to tape_vars.yml template
4
+ * Fixed issues where test for bower.json was returning 1 exit code
5
+
1
6
  ### 1.3.2
2
7
  * Fixes ssh_args to actually enable agent forwarding for everyone
3
8
 
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  [![Stories in Ready](https://badge.waffle.io/smashingboxes/taperole.png?label=ready&title=Ready)](https://waffle.io/smashingboxes/tape)
2
2
  # Infrastructure Management
3
3
 
4
- [![Join the chat at https://gitter.im/smashingboxes/taperole](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/smashingboxes/taperole?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4
+ [![Slack Status](https://taperole-slack.herokuapp.com/badge.svg)](https://taperole-slack.herokuapp.com/)
5
5
 
6
6
  ## Deploying & provisioning with tape
7
- **Use Unbuntu precise64 (12.04 x64)**
7
+ **Use Unbuntu precise64 (14.04 x64)**
8
8
 
9
9
  **Enable ssh access via root user**
10
10
 
@@ -12,9 +12,9 @@
12
12
 
13
13
  **Install**
14
14
 
15
- * `$ gem install taperole` or `gem 'taperole'`
15
+ * `$ gem install taperole` or add `gem 'taperole', '~>1.3'` to your Gemfile
16
16
  * `$ brew install ansible`
17
- * Create a [Digital Ocean Droplet](https://www.digitalocean.com/)
17
+ * Create a [Digital Ocean Droplet](https://www.digitalocean.com/) (or any Ubuntu 14.04 system with ssh access)
18
18
  * Run `tape installer install` in project repo
19
19
  * Update your hosts file with the IP address of your server (this can be found in your Droplet). If you go down to "Multistage", you'll see an excellent example of what your hosts file should look like.
20
20
  * Fill in missing values in `tape_vars.yml`. Should look something like this:
@@ -22,47 +22,56 @@
22
22
  app_name: [app name]
23
23
 
24
24
  be_app_repo: [git repo]
25
-
26
- dev_key_files:
27
- - dev_keys/name1.pub
28
- - dev_keys/name2.pub
29
25
  ```
30
- * Copy all developers public keys into a new directory (dev_keys is a good example for the name of that directory). Then specify that dir inside `tape_vars.yml` (dev_key_files)
26
+ * Copy all developers public keys into a new directory (dev_keys is a good example for the name of that directory).
31
27
  * `$ tape ansible everything`
32
28
 
33
29
  **Upgrade**
34
30
 
31
+ **NOTE: Upgrading tape on a machine is only supported for patch versions (ie 1.3.0 to 1.3.1). For minor or major versions, it is advised that you stand up a new box, and start from stratch.
32
+
35
33
  ```
36
34
  bundle update taperole
37
35
  tape installer install
38
36
  ```
39
37
 
40
38
  ### Custom roles
41
- You can write app specific roles in the roles files stored in the `roles` directory
39
+ You can add app specific ansible roles to `<app_root>/roles`.
42
40
 
43
41
  You must then specify the roles you want to use in `omnibox.yml` or `deploy.yml`
44
42
 
45
43
  [Read the Ansible docs on playbook roles here](http://docs.ansible.com/playbooks_roles.html)
46
44
 
47
- ### Multistage
45
+ ### Multistage (environments)
48
46
  You can setup multistage by defining your hosts file as follows
49
47
 
50
48
  ```
51
49
  [production]
52
50
  0.0.0.0 be_app_env=production be_app_branch=SOME_BRANCH
51
+
53
52
  [staging]
54
53
  0.0.0.0 be_app_env=staging be_app_branch=SOME_BRANCH
54
+
55
55
  [omnibox:children]
56
56
  production
57
57
  staging
58
58
  ```
59
59
 
60
- Then use the `-l` option to specify the staging
60
+ Then use the `-l` option to specify the stage/environment
61
61
 
62
62
  ```sh
63
63
  tape ansible deploy -l staging
64
64
  ```
65
65
 
66
+ ### Additional Configs
67
+ #### Setup Server's Ruby Version
68
+ *taperole/tapevars.yml*
69
+
70
+ ```
71
+ rbenv:
72
+ ruby_version: 2.3.0
73
+ ```
74
+
66
75
  ## Testing
67
76
  ### With vagrant
68
77
 
@@ -88,3 +97,134 @@ git clone git@github.com:smashingboxes/tape.git
88
97
  cd tape
89
98
  ansible-galaxy install -r requirements.yml --force
90
99
  ```
100
+
101
+ ## 1.3 Documentation
102
+
103
+ ### Local System Requirements
104
+
105
+ We're assuming that you're starting with the following things installed and working on your local machine:
106
+ * unix based operating system
107
+ * ruby (version 1.9.3 or greater)
108
+ * Run `$ ruby --version`. You should see something like `ruby 2.2.3p173` in the output. If you see nothing or get an error, you need to install ruby. If you see something less than 1.9.3, you need to upgrade.
109
+ * an ssh key
110
+ * You'll need an ssh key to set up access to your server. GitHub has a [great tutorial](https://help.github.com/articles/generating-ssh-keys/) on this.
111
+ * git and GitHub (or another remote host for your code)
112
+ * Here's a good article on how to get going with git: https://help.github.com/articles/set-up-git/.
113
+ * ansible
114
+ * On a mac, we suggest using Homebrew to install ansible(`brew install ansible`). Otherwise, please refer to the ansible documentation: http://docs.ansible.com/ansible/intro_installation.html.
115
+
116
+ ### Rails Application Requirements
117
+
118
+ Your rails application must:
119
+ * use posgres as the database
120
+ * use unicorn as the app server
121
+ * have access to the taperole gem
122
+
123
+ Usually, your Gemfile will include something like:
124
+ ```
125
+ # Use postgresql as the database
126
+ gem 'pg'
127
+
128
+ # Use Unicorn as the app server
129
+ gem 'unicorn'
130
+
131
+ # Use taperole for deployment
132
+ gem 'taperole', '~>1.3'
133
+
134
+ ```
135
+ Note: You can also `$ gem install taperole` and not put Taperole in your Gemfile.
136
+
137
+ ### Your Host Server
138
+
139
+ Below are instructions for creating a digital ocean droplet to host your application.
140
+ This is not required, as long as you have root access via ssh to an Unbuntu precise64 (14.04 x64) server.
141
+
142
+ 1. Click "Create Droplet"
143
+ 2. Name your droplet. (For the purposes of this example, we'll be calling our droplet 'walkthrough'.)
144
+ 3. Select a size for your droplet. The smallest size is fine for our purposes, but if you're deploying a larger app, select whatever size is appropriate.
145
+ 4. Select a datacenter region.
146
+ 5. Choose Ubuntu 14.04.3 x64 as your image.
147
+ 6. Add your ssh key to the droplet.
148
+ 7. Create the droplet!
149
+
150
+ To ensure you have ssh access as root to your server:
151
+ `$ ssh root@0.0.0.0` should get you into the server.
152
+ `$ pwd` in the server and you should see `/root`.
153
+ `$ exit` to get close your session.
154
+
155
+ ### Provisioning/Deploying a Rails Application server with Taperole
156
+
157
+ 1. Confirm that `taperole`, `pg`, and `unicorn` are in your gemfile.
158
+ 2. `$ bundle`
159
+ 3. When asked `Are you going to use vagrant? (y/n):`, say `n`.
160
+ 4. Make your hosts file. Assuming you're going to have multiple environments, it should look something like this:
161
+ ```
162
+ [production]
163
+ 0.0.0.0 be_app_env=production be_app_branch=master
164
+
165
+ [omnibox:children]
166
+ production
167
+ ```
168
+ 5. Give yourself access to the server. This needs to be the same ssh key that you used on your digital ocean droplet. So create a file called <your_name>.pub in the dev_keys folder that was generated by tape installer install. `pbcopy < ~/.ssh/id_rsa.pub` in your terminal again, then paste the result into the file you just created.
169
+ 6. Update your tape_vars.yml file.
170
+ ```
171
+ app_name: walkthrough
172
+
173
+ be_app_repo: [git repo]
174
+
175
+ dev_key_files:
176
+ - dev_keys/your_name.pub
177
+ ```
178
+ 7. Copy all developers public keys into the `dev_keys` directory.
179
+ 8. Add this to your gitignore.
180
+ ```
181
+ # Ignore this stuff for Taperole
182
+ config/secrets.yml
183
+ config/database.yml
184
+ ```
185
+ 9. If it isn't automatically, comment out front end stuff:
186
+ * `# fe_deploy` in omnibox.yml
187
+ * `# - frontend_deploy` in deploy.yml
188
+
189
+ 10. git add and commit and push to master
190
+ 11. Run `$ tape ansible everything.` This will take a long time, so grab a sandwich or something.
191
+ 12. This should chug right along until it gets to
192
+ ```
193
+ TASK: [backend_config | Ask for secrets.yml] **********************************
194
+ ok: [159.203.126.223] => {
195
+ "msg": "You've got to upload secrets.yml to /home/deployer/kevinrkiley/config to continue"
196
+ }
197
+ ```
198
+ where it will hang. Don't cancel the deploy.
199
+ 13. Open a new terminal tab and generate a secret key by running `$ rake secret` from the root directory of your rails app. Don't lose this.
200
+ 14. Run `$ ssh deployer@<ip_to_server>`
201
+ 15. Once you're in the server, `$ cd walkthrough/config`. If you `$ ls`, you should see that there is no `secrets.yml` file. `$ vi secrets.yml` to create it.
202
+ 16. When you're done secrets.yml should look something like:
203
+ ```
204
+ production:
205
+ secret_key_base: thisisthesecretkeyyougeneratedinstep9
206
+ ```
207
+ 17. Your deployment should automatically continue.
208
+
209
+
210
+ ### Deploying your latest changes
211
+
212
+ To deploy your latest changes to your tape-provisioned server:
213
+
214
+ ```
215
+ tape ansible deploy
216
+ ```
217
+
218
+ This will git pull the latest changes from the tracking branch you specified and restart all services via monit.
219
+
220
+ This command runs all Ansible roles specified in the deploy.yml playbook.
221
+
222
+ ## Slack integration
223
+
224
+ Tape includes built-in support for posting messages to slack at the beginning and end of deployments.
225
+
226
+ Here are the steps needed to enable this functionality:
227
+
228
+ 1. Start by setting up [an incoming webhook integration](https://my.slack.com/services/new/incoming-webhook/)
229
+ 2. Add that URL to `tape_vars.yml` as `slack_webhook_url`
230
+ 3. Profit.
@@ -45,6 +45,7 @@ class AnsibleRunner < ExecutionModule
45
45
  "This does it all."
46
46
 
47
47
  def initialize(*args)
48
+ register_notifiers
48
49
  super
49
50
  end
50
51
 
@@ -88,7 +89,12 @@ class AnsibleRunner < ExecutionModule
88
89
  cmd += ' -vvvv' if opts.verbose
89
90
  cmd += " -t #{opts.tags}" if opts.tags
90
91
  STDERR.puts "Executing: #{cmd}" if opts.verbose
91
- Kernel.exec(cmd)
92
+ notify_observers(:start)
93
+ if Kernel.system(cmd)
94
+ notify_observers(:success)
95
+ else
96
+ notify_observers(:fail)
97
+ end
92
98
  end
93
99
 
94
100
  def enforce_roles_path!
@@ -0,0 +1,79 @@
1
+ require 'slack-notifier'
2
+
3
+ class SlackNotifier
4
+ def initialize(webhook_url, deploy_info)
5
+ @notifier = Slack::Notifier.new webhook_url
6
+ @notifier.username = 'Tape'
7
+ @deploy_info = deploy_info
8
+ end
9
+
10
+ def update(status)
11
+ @status = status
12
+ @notifier.ping(
13
+ "",
14
+ # TODO: Fill in real icon url
15
+ icon_url: 'https://image.freepik.com/free-icon/adhesive-tape_318-42276.png',
16
+ attachments: attachments
17
+ )
18
+ end
19
+
20
+ private
21
+
22
+ def attachments
23
+ a = {}
24
+ a[:text] = message
25
+ a[:color] = color
26
+ a[:fields] = fields unless @status == :start
27
+ [a]
28
+ end
29
+
30
+ def fields
31
+ [
32
+ {
33
+ title: "Project",
34
+ value: project_link,
35
+ short: true
36
+ },
37
+ {
38
+ title: "Hosts/Env",
39
+ value: @deploy_info[:hosts],
40
+ short: true
41
+ },
42
+ {
43
+ title: "Author",
44
+ value: @deploy_info[:user],
45
+ short: true
46
+ }
47
+ ]
48
+ end
49
+
50
+ def color
51
+ case @status
52
+ when :start then "#a9a9a9"
53
+ when :success then "good"
54
+ when :fail then "danger"
55
+ end
56
+ end
57
+
58
+ def gh_link_base
59
+ @deploy_info[:repo].sub(/^git@github.com:/, 'http://github.com/').sub(/.git$/, '')
60
+ end
61
+
62
+ def project_link
63
+ "<#{gh_link_base}|#{@deploy_info[:app_name]}>"
64
+ end
65
+
66
+ def message
67
+ case @status
68
+ when :start
69
+ user = @deploy_info[:user]
70
+ app = @deploy_info[:app_name]
71
+ hosts = @deploy_info[:hosts]
72
+ "#{user} started deploying #{app} to #{hosts}"
73
+ when :success
74
+ "The deploy was successful!"
75
+ when :fail
76
+ "The deploy failed!"
77
+ end
78
+ end
79
+ end
data/lib/tape.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  require 'erb'
2
2
  require 'fileutils'
3
+ require 'yaml'
4
+ require_relative 'tape/notifiers/slack.rb'
3
5
 
4
6
  module TapeBoxer
5
7
  class InvalidAction < StandardError; end
@@ -20,7 +22,7 @@ module TapeBoxer
20
22
  class ExecutionModule
21
23
  attr_reader :opts
22
24
  def initialize(opts)
23
- @opts = opts
25
+ @opts = opts || {}
24
26
  end
25
27
 
26
28
  def self.actions
@@ -62,6 +64,19 @@ module TapeBoxer
62
64
  self.instance_eval &actions[action].proc
63
65
  end
64
66
 
67
+ def config
68
+ @config ||= YAML.load_file("#{tapefiles_dir}/tape_vars.yml")
69
+ end
70
+
71
+ def deploy_info
72
+ {
73
+ app_name: config["app_name"],
74
+ user: `whoami`.chomp,
75
+ hosts: opts.host_pattern || 'default',
76
+ repo: config["be_app_repo"] || ''
77
+ }
78
+ end
79
+
65
80
  protected
66
81
 
67
82
  def require_opt(name)
@@ -71,6 +86,24 @@ module TapeBoxer
71
86
  end
72
87
 
73
88
  private
89
+
90
+ def register_notifiers
91
+ if config["slack_webhook_url"]
92
+ add_observer(::SlackNotifier.new(config["slack_webhook_url"], deploy_info))
93
+ end
94
+ end
95
+
96
+ def add_observer(observer)
97
+ @observers = [] unless @observers
98
+ @observers.push(observer)
99
+ end
100
+
101
+ def notify_observers(state)
102
+ @observers.each do |observer|
103
+ observer.update(state)
104
+ end
105
+ end
106
+
74
107
  def tape_dir
75
108
  File.realpath(File.join(__dir__, '../'))
76
109
  end
@@ -13,7 +13,7 @@
13
13
  remote_user: "{{ deployer_user.name }}"
14
14
  command: bash -lc
15
15
  command: chdir={{ fe_app_path }}
16
- bash -lc 'test -e package.json && npm install'
16
+ bash -lc 'test -e package.json && npm install ; return 0'
17
17
  tags: [fe_deploy]
18
18
 
19
19
  - name: Bower install
data/taperole.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "taperole"
3
- spec.version = '1.3.2'
3
+ spec.version = '1.3.3'
4
4
  spec.authors = ['Jack Forrest', 'Smashing Boxes', 'Brandon Mathis']
5
5
  spec.email = ['jack@smashingboxes.com', 'brandon@sbox.es']
6
6
  spec.summary = 'A tool for provisioning and deploying boxes for hosting Rails apps'
@@ -9,4 +9,5 @@ Gem::Specification.new do |spec|
9
9
 
10
10
  spec.files = `git ls-files`.split("\n")
11
11
  spec.executables = 'tape'
12
+ spec.add_runtime_dependency 'slack-notifier', '~> 1.5'
12
13
  end
@@ -7,3 +7,6 @@ be_app_repo:
7
7
  # Uncomment if you want to deploy a JS/HTML App
8
8
  # fe_app_repo:
9
9
  # fe_app_branch: master
10
+ # fe_build_command: gulp build
11
+
12
+ slack_webhook_url:
@@ -3,3 +3,4 @@ app_name:
3
3
  # App Configs
4
4
  fe_app_repo:
5
5
  fe_app_branch: master
6
+ fe_build_command: gulp build
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taperole
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jack Forrest
@@ -10,8 +10,22 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-12-23 00:00:00.000000000 Z
14
- dependencies: []
13
+ date: 2016-01-19 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: slack-notifier
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - "~>"
20
+ - !ruby/object:Gem::Version
21
+ version: '1.5'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - "~>"
27
+ - !ruby/object:Gem::Version
28
+ version: '1.5'
15
29
  description:
16
30
  email:
17
31
  - jack@smashingboxes.com
@@ -35,6 +49,7 @@ files:
35
49
  - lib/tape.rb
36
50
  - lib/tape/ansible_runner.rb
37
51
  - lib/tape/installer.rb
52
+ - lib/tape/notifiers/slack.rb
38
53
  - lib/tape/qemu_provisioner.rb
39
54
  - requirements.yml
40
55
  - roles/after_deploy/tasks/main.yml
@@ -152,19 +167,6 @@ files:
152
167
  - vendor/jnv.unattended-upgrades/templates/unattended-upgrades.j2
153
168
  - vendor/jnv.unattended-upgrades/vars/Debian.yml
154
169
  - vendor/jnv.unattended-upgrades/vars/Ubuntu.yml
155
- - vendor/leonelgalan.node/.gitignore
156
- - vendor/leonelgalan.node/.travis.yml
157
- - vendor/leonelgalan.node/LICENSE
158
- - vendor/leonelgalan.node/README.md
159
- - vendor/leonelgalan.node/Vagrantfile
160
- - vendor/leonelgalan.node/defaults/main.yml
161
- - vendor/leonelgalan.node/handlers/main.yml
162
- - vendor/leonelgalan.node/meta/.galaxy_install_info
163
- - vendor/leonelgalan.node/meta/main.yml
164
- - vendor/leonelgalan.node/requirements.yml
165
- - vendor/leonelgalan.node/site.yml
166
- - vendor/leonelgalan.node/tasks/main.yml
167
- - vendor/leonelgalan.node/vars/main.yml
168
170
  - vendor/lxhunter.apt/.gitignore
169
171
  - vendor/lxhunter.apt/.kitchen.yml
170
172
  - vendor/lxhunter.apt/README.md
@@ -266,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
266
268
  version: '0'
267
269
  requirements: []
268
270
  rubyforge_project:
269
- rubygems_version: 2.4.5
271
+ rubygems_version: 2.5.1
270
272
  signing_key:
271
273
  specification_version: 4
272
274
  summary: A tool for provisioning and deploying boxes for hosting Rails apps
@@ -1,2 +0,0 @@
1
- .vagrant/
2
- roles/
@@ -1,13 +0,0 @@
1
- ---
2
- language: python
3
- python: 2.7
4
- before_install:
5
- - sudo apt-get update -qq
6
- - sudo apt-get install -qq python-apt python-pycurl
7
- install:
8
- - pip install ansible
9
- script:
10
- - echo localhost > inventory
11
- - ansible-galaxy install --role-file=requirements.yml --roles-path=roles/ --force
12
- - ansible-playbook --syntax-check -i inventory site.yml
13
- - ansible-playbook -i inventory site.yml --connection=local --sudo
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2015 Leonel Galan
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.
@@ -1,50 +0,0 @@
1
- # leonelgalan.node [![Build Status](https://travis-ci.org/leonelgalan/ansible-node.svg)](https://travis-ci.org/leonelgalan/ansible-node)
2
-
3
- Installs **latest** nodejs, the **latest** npm, and desired packages. At the time of writing (January 26, 2015):
4
-
5
- * Node.js v0.10.36
6
- * npm 2.3.0
7
-
8
- # Role Variables
9
-
10
- Default variables are:
11
-
12
- ```yml
13
- ---
14
- npm_packages: []
15
- ```
16
-
17
- ## Dependencies
18
-
19
- * nodesource.node
20
-
21
- ```shell
22
- ansible-galaxy install --role-file=requirements.yml --force
23
- ```
24
-
25
- ## Example Playbook
26
- ```yml
27
- - hosts: all
28
-
29
- roles:
30
- - role: leonelgalan.node
31
- npm_packages:
32
- - name: gulp
33
- - name: bower
34
- version: 1.3.12
35
- - path: ../local/package
36
- ```
37
-
38
- ## Vagrant
39
-
40
- ```shell
41
- vagrant up
42
- ```
43
-
44
- ## License
45
-
46
- _leonelgalan.node_ is released under the [MIT License](http://opensource.org/licenses/MIT ).
47
-
48
- ## Author Information
49
-
50
- Leonel Galán (<leonel@smashingboxes.com>)
@@ -1,16 +0,0 @@
1
- # -*- mode: ruby -*-
2
- # vi: set ft=ruby :
3
-
4
- Vagrant.configure(2) do |config|
5
- config.vm.box = 'ubuntu/trusty64'
6
-
7
- config.vm.provision :ansible do |ansible|
8
- ansible.playbook = 'site.yml'
9
- ansible.extra_vars = {
10
- npm_packages: [
11
- {name: 'coffee-script'},
12
- {name: 'bower'}
13
- ]
14
- }
15
- end
16
- end
@@ -1,2 +0,0 @@
1
- ---
2
- npm_packages: []
@@ -1,2 +0,0 @@
1
- ---
2
- # handlers file for npm
@@ -1 +0,0 @@
1
- {install_date: 'Fri Mar 20 18:33:17 2015', version: '0.2'}
@@ -1,21 +0,0 @@
1
- ---
2
- galaxy_info:
3
- author: Leonel Galan
4
- description: "Installs **latest** nodejs and the **latest** npm (https://github.com/npm/npm#fancy-install-unix)"
5
- company: Smashing Boxes
6
- license: MIT
7
- min_ansible_version: 1.8
8
- version: 0.2
9
-
10
- platforms:
11
- - name: Ubuntu
12
- versions:
13
- - precise
14
- - trusty
15
-
16
- categories:
17
- - development
18
- - system
19
-
20
- dependencies:
21
- - role: nodesource.node
@@ -1,3 +0,0 @@
1
- ---
2
-
3
- - src: nodesource.node
@@ -1,8 +0,0 @@
1
- ---
2
-
3
- - hosts: all
4
-
5
- sudo: yes
6
-
7
- roles:
8
- - role: ..
@@ -1,35 +0,0 @@
1
- ---
2
- - name: Ensure the latest node is installed
3
- apt: name=nodejs state=latest
4
- tags:
5
- - node
6
-
7
- - name: Check if npm 2.x is installed on the system.
8
- shell: npm -v
9
- register: npm_version
10
- changed_when: false
11
- ignore_errors: yes
12
- tags:
13
- - node
14
- - npm
15
-
16
- - name: Install curl
17
- apt: name=curl state=present
18
- when: npm_version.stdout | version_compare('2', '<')
19
- tags:
20
- - node
21
- - npm
22
-
23
- - name: Install npm
24
- shell: $SHELL -lc "curl -L https://npmjs.com/install.sh | sh"
25
- when: npm_version.stdout | version_compare('2', '<')
26
- tags:
27
- - node
28
- - npm
29
-
30
- - name: Install global npm_packages
31
- npm: name={{ item.name | default(omit) }} path={{ item.path | default(omit) }} version={{ item.version | default(omit) }} global=yes state={{ item.state | default(omit) }}
32
- with_items: npm_packages
33
- tags:
34
- - node
35
- - npm
@@ -1,2 +0,0 @@
1
- ---
2
- # vars file for npm