First draft of Moe provisioning with ansible

pull/747/head
Kieran R. Prasch 2019-02-12 13:27:18 -07:00
parent 357d773c5e
commit ad5da13cd9
2 changed files with 73 additions and 3 deletions

View File

@ -0,0 +1,72 @@
- 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') }}"
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
teacher: "{{ hostvars[groups['tag_Role_' + lookup('env', 'NUCYPHER_NETWORK_NAME') + '_ursulas'][1]] }}"
- 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') }}"
- name: "Enable and Start Ursula Service"
become: yes
become_flags: "-H -S"
systemd:
daemon_reload: yes
no_block: yes
enabled: yes
state: restarted
name: "ursula_node"

View File

@ -1,11 +1,9 @@
import time
import pytest_twisted as pt
import requests
from twisted.internet import threads
from nucypher.cli.main import nucypher_cli
from nucypher.config.node import NodeConfiguration
from nucypher.network.nodes import Learner
from nucypher.utilities.sandbox.constants import MOCK_URSULA_STARTING_PORT, select_test_port
from nucypher.utilities.sandbox.ursula import start_pytest_ursula_services