mirror of https://github.com/nucypher/nucypher.git
76 lines
2.1 KiB
YAML
76 lines
2.1 KiB
YAML
- name: "Start Moes"
|
|
hosts: "{{ 'tag_Role_' + lookup('env', 'NUCYPHER_NETWORK_NAME') + '_moes' }}"
|
|
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
|
|
- include_vars: "{{ lookup('env', 'ANSIBLE_VARIABLES') }}"
|
|
|
|
vars:
|
|
networks_file: "{{ lookup('file', '../../networks.json') | from_json }}"
|
|
|
|
tasks:
|
|
- name: "Install System Dependencies"
|
|
become: yes
|
|
become_flags: "-H -S"
|
|
apt:
|
|
name: "{{ packages }}"
|
|
update_cache: yes
|
|
state: latest
|
|
vars:
|
|
packages:
|
|
- libffi-dev
|
|
- python3
|
|
- python3-pip
|
|
- python3-dev
|
|
- python3-setuptools
|
|
- python3-virtualenv
|
|
- virtualenv
|
|
|
|
- git:
|
|
repo: "{{ git_repo }}"
|
|
dest: ./code
|
|
version: "{{ git_version }}"
|
|
|
|
- pip:
|
|
chdir: ./code
|
|
name: '.'
|
|
editable: true
|
|
virtualenv: '/home/ubuntu/venv'
|
|
virtualenv_python: python3.6
|
|
virtualenv_site_packages: true
|
|
environment:
|
|
LC_ALL: en_US.UTF-8
|
|
LANG: en_US.UTF-8
|
|
|
|
- name: "Open Moe HTTP Port"
|
|
become: yes
|
|
become_flags: "-H -S"
|
|
shell: 'iptables -A INPUT -p tcp -m conntrack --dport {{ moe_http_port }} --ctstate NEW,ESTABLISHED -j ACCEPT'
|
|
vars:
|
|
moe_http_port: 12500
|
|
|
|
- name: "Render Moe's Node Service"
|
|
become: yes
|
|
become_flags: "-H -S"
|
|
template:
|
|
src: ../../services/moe_monitor.j2
|
|
dest: /etc/systemd/system/moe_monitor.service
|
|
mode: 0755
|
|
vars:
|
|
virtualenv_path: '/home/ubuntu/venv'
|
|
nucypher_network_domain: "{{ lookup('env', 'NUCYPHER_NETWORK_NAME') }}"
|
|
teacher_uri: "{{ networks_file[lookup('env', 'NUCYPHER_NETWORK_NAME')][0] }}"
|
|
|
|
- name: "Enable and Start Moes's Monitoring"
|
|
become: yes
|
|
become_flags: "-H -S"
|
|
systemd:
|
|
daemon_reload: yes
|
|
no_block: yes
|
|
enabled: yes
|
|
state: restarted
|
|
name: "moe_monitor"
|