Fix local dev setup and permissions.

Update documentation.
This commit is contained in:
Dorian 2016-03-15 11:07:13 -04:00
parent 9140776ea2
commit 3e48e33a82
3 changed files with 27 additions and 8 deletions

View File

@ -8,9 +8,21 @@ Create a local playbook `local_playbook.yml`:
- hosts: localhost
user: $MY_USER_NAME
roles:
- { role: ansible-nodejs, node_version_family: "4.x", local_development: { user: "$MY_USER_NAME", enabled: true },
globally_installed_tools: ["browserify", "coffeescript", "less"]
}
- { role: "ansible-nodejs",
node_version_family: "4.x",
local_development: {
user: "$MY_USER_NAME",
enabled: true
},
globally_installed_tools: [
"browserify",
"coffee-script",
"less",
"npmrc",
"grunt-cli",
"karma-cli"
]
}
```
Create local inventory `localhost_inventory`:

View File

@ -1,11 +1,18 @@
---
- name: setup a user local node folder for development
file: path="{{ local_dev_setup.user_home }}/.local/nodejs" state=directory owner={{ local_development.user }}
file: path="{{ local_dev_setup.npm_home }}" state=directory
owner={{ local_development.user }} group={{ local_development.user }}
- name: setup a npmrc setting for local development
template: src=npmrc.tmpl dest="{{ local_dev_setup.user_home }}/.npmrc" owner={{ local_development.user }}
template: src=npmrc.tmpl dest="{{ local_dev_setup.user_home }}/.npmrc"
owner={{ local_development.user }}
group={{ local_development.user }}
- name: install globally required tools
npm: name={{ item }} state=present registry=http://registry.npmjs.org/ path="{{ local_dev_setup.npm_home }}"
become_user: "{{ local_development.user }}"
npm: name={{ item }} state=present registry=http://registry.npmjs.org/
path="{{ local_dev_setup.npm_home }}" global=yes
with_items: globally_installed_tools
- name: add binaries to local path
lineinfile: state=present dest="{{ local_dev_setup.user_home }}/.bash_profile"
line="export PATH=$PATH:$HOME/.local/share/node_modules/bin:$HOME/.local/share/node_modules/.bin"

View File

@ -1,3 +1,3 @@
---
- { include: nodejs.yml, become_user: root, become_method: sudo }
- { include: development.yml, when: local_development.enabled == true }
- { include: development.yml, when: local_development.enabled == true, become_user: "{{ local_development.user }}" }