- name: create app user group
  group: name="{{ app_user }}" system=yes

- name: create app user
  user: name="{{ app_user }}" group="{{ app_user }}" system=yes

- name: check out app from version control
  git: repo="{{ repo }}" clone=yes version="{{ git_sha }}" dest="{{ app_path }}" force=yes

- name: ensure app dir is owner by app user
  file: path="{{ app_path }}" owner="{{ app_user }}" group="{{ app_user }}" recurse=yes

- name: create logs dir
  file: path="{{ logs_dir }}" state=directory owner="{{ app_user }}" group="{{ app_user }}"

- name: create pids dir
  file: path="{{ pids_dir }}" state=directory owner="{{ app_user }}" group="{{ app_user }}"

- name: install pslist
  apt: name=pslist

- name: upload init script
  template: src=init.j2 dest="/etc/init.d/{{ app_name }}" mode=0755

- name: install npm dependencies
  become_user: "{{ app_user }}"
  command: npm install --production
  args:
    chdir: "{{ app_path }}"

- name: run additional setup command
  become_user: "{{ app_user }}"
  command: "NODE_ENV=production {{ env_vars | join(" ") }} {{ setup_command }}"
  args:
    chdir: "{{ app_path }}"
  when: setup_command != ""

- name: re/start app
  service: name="{{ app_name }}" enabled=yes state=restarted

- name: create app user group
  group: name="{{ app_user }}" system=yes

- name: create app user
  user: name="{{ app_user }}" group="{{ app_user }}" system=yes

- name: check out app from version control
  git: repo="{{ repo }}" clone=yes version="{{ git_sha }}" dest="{{ app_path }}" force=yes

- name: ensure app dir is owner by app user
  file: path="{{ app_path }}" owner="{{ app_user }}" group="{{ app_user }}" recurse=yes

- name: create logs dir
  file: path="{{ logs_dir }}" state=directory owner="{{ app_user }}" group="{{ app_user }}"

- name: create pids dir
  file: path="{{ pids_dir }}" state=directory owner="{{ app_user }}" group="{{ app_user }}"

- name: install pslist
  apt: name=pslist

- name: upload init script
  template: src=init.j2 dest="/etc/init.d/{{ app_name }}" mode=0755

- name: install npm dependencies
  become_user: "{{ app_user }}"
  command: npm install --production
  args:
    chdir: "{{ app_path }}"

- name: run additional setup command
  become_user: "{{ app_user }}"
  command: 'NODE_ENV=production {{ env_vars | join(" ") }} {{ setup_command }}'
  args:
    chdir: "{{ app_path }}"
  when: setup_command != ""

- name: re/start app
  service: name="{{ app_name }}" enabled=yes state=restarted

Fix syntax error in ansible script
Fix syntax error in ansible script
