nucypher/deploy/ansible/eth_netstats/launch_eth_netstats.yml

77 lines
1.8 KiB
YAML

- name: "Launch ETH Netstats"
hosts: "{{ 'tag_Role_' + lookup('env', 'NUCYPHER_NETWORK_NAME') + '_eth_netstats' }}"
user: ubuntu
gather_facts: false
pre_tasks:
- name: "Install Python2.7 for Ansible Control"
raw: sudo apt -y update && sudo apt install -y python2.7-minimal python2.7-setuptools
tasks:
- name: "Install System Dependencies"
become: yes
become_flags: "-H -S"
apt:
name: "{{ packages }}"
update_cache: yes
vars:
packages:
- python-pip
- python3
- python3-pip
- python3-dev
- python3-setuptools
- libffi-dev
- nodejs
- npm
- grunt
- name: Install "grunt-cli" node.js package globally
become: yes
become_flags: "-H -S"
npm:
name: grunt-cli
global: yes
- git:
repo: "https://github.com/cubedro/eth-netstats"
dest: /home/ubuntu/code
version: "master"
- name: "Install JS Dependencies with NPM"
become: yes
become_flags: "-H -S"
shell: npm install
args:
chdir: /home/ubuntu/code
- name: "Build Application with Grunt"
become: yes
become_flags: "-H -S"
shell: grunt all
args:
chdir: ./code
- name: "Render ETH Netstats Service"
become: yes
become_flags: "-H -S"
template:
src: ../../services/eth_netstats.j2
dest: /etc/systemd/system/eth_netstats.service
mode: 0755
vars:
port: "3000"
secret: "{{ lookup('env', 'ETH_NETSTATS_SECRET') }}"
prefix: "/home/ubuntu/code"
- name: "Enable and Start ETH Netstats Service"
become: yes
become_flags: "-H -S"
systemd:
daemon_reload: yes
no_block: yes
enabled: yes
state: restarted
name: "eth_netstats"