--- - hosts: all gather_facts: true vars: username: semaphore homedir: /opt/semaphore logdir: /var/log/semaphore sudo: true tasks: - user: name={{ username }} - apt_repository: repo='ppa:ansible/ansible' - name: install required packages apt: name={{ item }} state=present update_cache=yes with_items: - git - nodejs - npm - mongodb-server - redis-server - ansible - runit - npm: name={{ item }} global=yes with_items: - bower # source is copied using ansible. #- git: repo=https://github.com/CastawayLabs/semaphore dest={{ homedir }} - file: src=/usr/bin/nodejs dest=/usr/bin/node state=link - shell: bower install --allow-root && npm install > {{ homedir }}/somelog.txt args: chdir: "{{ homedir }}" creates: "{{ homedir }}/somelog.txt" - shell: chown -R {{ username }} {{ homedir }} # copy over the example credentials - shell: cp -p {{ homedir }}/lib/credentials.default.json {{ homedir }}/lib/credentials.json # Setup runit and logging to /var/log/runit_semaphore - file: path={{ homedir }}/runit_semaphore/log state=directory - file: path={{ logdir }} state=directory owner={{ username }} - copy: src=run_semaphore dest={{ homedir }}/runit_semaphore/run mode=0755 - template: src=run_semaphore_log.j2 dest={{ homedir }}/runit_semaphore/log/run mode=0755 - file: src={{ homedir }}/runit_semaphore dest=/etc/service/runit_semaphore state=link