- set_fact: role_name=blockchain-worker

- name: install nodejs
  when: blockchain_vote
  include: ../../../tasks/install_node.yml

- name: create role directory
  when: blockchain_vote
  file: path={{ project_dir}}/{{ role_name }} state=directory

- file: path={{ project_dir }}/{{ role_name }}/node_modules state=directory recurse=yes
  when: blockchain_vote
- file: src={{ project_dir }}/{{ role_name }}/node_modules dest=/vagrant/{{ role_name }}/node_modules state=link
  when: blockchain_vote

- name: install npm modules
  when: blockchain_vote
  npm: path=/vagrant/blockchain-worker

- name: install leader upstrart script
  template: src={{ role_name }}.upstart.conf.j2 dest=/etc/init/{{ project_name }}-{{ role_name }}.conf

- name: install follower upstart scripts
  template: src={{ role_name }}-{{ item }}.upstart.conf.j2 dest=/etc/init/{{ project_name }}-{{ role_name }}-{{ item }}.conf
  with_items:
    - ballot
    - vote

- name: start the worker services
  when: blockchain_vote
  service: name=cocorico-blockchain-worker state=started

- name: stop the worker services
  when: not blockchain_vote
  service: name=cocorico-blockchain-worker state=stopped

- set_fact: role_name=blockchain-worker

- name: install nodejs
  when: blockchain_vote
  include: ../../../tasks/install_node.yml

- name: create role directory
  when: blockchain_vote
  file: path={{ project_dir}}/{{ role_name }} state=directory

- file: path={{ project_dir }}/{{ role_name }}/node_modules state=directory recurse=yes
  when: blockchain_vote
- file: src={{ project_dir }}/{{ role_name }}/node_modules dest=/vagrant/{{ role_name }}/node_modules state=link
  when: blockchain_vote

- name: install npm modules
  when: blockchain_vote
  npm: path=/vagrant/blockchain-worker

- name: install leader upstart script
  template: src={{ role_name }}.upstart.conf.j2 dest=/etc/init/{{ project_name }}-{{ role_name }}.conf

- name: install follower upstart scripts
  template: src={{ role_name }}-{{ item }}.upstart.conf.j2 dest=/etc/init/{{ project_name }}-{{ role_name }}-{{ item }}.conf
  with_items:
    - ballot
    - vote

- name: start the worker services
  when: blockchain_vote
  service: name=cocorico-blockchain-worker state=started

- name: stop the worker services
  when: not blockchain_vote
  service: name=cocorico-blockchain-worker state=stopped

Fix typo in the blockchain-worker role.
Fix typo in the blockchain-worker role.
