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 - hosts: localhost
user: $MY_USER_NAME user: $MY_USER_NAME
roles: roles:
- { role: ansible-nodejs, node_version_family: "4.x", local_development: { user: "$MY_USER_NAME", enabled: true }, - { role: "ansible-nodejs",
globally_installed_tools: ["browserify", "coffeescript", "less"] 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`: Create local inventory `localhost_inventory`:

View File

@ -1,11 +1,18 @@
--- ---
- name: setup a user local node folder for development - 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 - 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 - name: install globally required tools
npm: name={{ item }} state=present registry=http://registry.npmjs.org/ path="{{ local_dev_setup.npm_home }}" npm: name={{ item }} state=present registry=http://registry.npmjs.org/
become_user: "{{ local_development.user }}" path="{{ local_dev_setup.npm_home }}" global=yes
with_items: globally_installed_tools 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: 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 }}" }