From 5f17cadcb5284452f98f4f5ea6d046ef81bf12fa Mon Sep 17 00:00:00 2001 From: Evgeniy L Date: Thu, 29 Oct 2015 18:20:10 +0300 Subject: [PATCH 1/3] Add workaround for bareon-api installation since pbr does not work with git sources --- bootstrap/playbooks/pxe.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bootstrap/playbooks/pxe.yaml b/bootstrap/playbooks/pxe.yaml index 001a0270..6cfbbea4 100644 --- a/bootstrap/playbooks/pxe.yaml +++ b/bootstrap/playbooks/pxe.yaml @@ -57,5 +57,7 @@ - shell: 'discovery-scan --ssh_key {{insecure_pub_key_path}} &' # Install bareon-api + # Workaround is required because pbr does not handle git-eggs correctly and fails to install fuel-agent + - shell: 'pip install git+git://github.com/prmtl/fuel-agent.git@detach_from_nailgun#egg=fuel_agent' - shell: pip install git+https://github.com/Mirantis/bareon-api.git - shell: 'bareon-api &' From 55ca3434cf44ccb08b34e82fa852495a48894aaa Mon Sep 17 00:00:00 2001 From: Evgeniy L Date: Thu, 29 Oct 2015 18:20:50 +0300 Subject: [PATCH 2/3] Add nat rules for solar-dev to provide internet connectivity for slaves --- bootstrap/playbooks/pxe.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bootstrap/playbooks/pxe.yaml b/bootstrap/playbooks/pxe.yaml index 6cfbbea4..f810d52a 100644 --- a/bootstrap/playbooks/pxe.yaml +++ b/bootstrap/playbooks/pxe.yaml @@ -61,3 +61,6 @@ - shell: 'pip install git+git://github.com/prmtl/fuel-agent.git@detach_from_nailgun#egg=fuel_agent' - shell: pip install git+https://github.com/Mirantis/bareon-api.git - shell: 'bareon-api &' + + # Add nat rules so slaves have internet access via solar-dev + - shell: iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -o eth0 -j MASQUERADE From 9f37e610fd30dbe28c40d65fa7b1e7ca9facc3b4 Mon Sep 17 00:00:00 2001 From: Evgeniy L Date: Thu, 29 Oct 2015 20:19:53 +0300 Subject: [PATCH 3/3] Run services under supervisor --- bootstrap/playbooks/files/supervisor.conf | 4 ++++ bootstrap/playbooks/pxe.yaml | 18 +++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 bootstrap/playbooks/files/supervisor.conf diff --git a/bootstrap/playbooks/files/supervisor.conf b/bootstrap/playbooks/files/supervisor.conf new file mode 100644 index 00000000..b30f0944 --- /dev/null +++ b/bootstrap/playbooks/files/supervisor.conf @@ -0,0 +1,4 @@ +[program:{{name}}] +command={{cmd}} +redirect_stderr=true +stdout_logfile=/var/log/{{name}}.log diff --git a/bootstrap/playbooks/pxe.yaml b/bootstrap/playbooks/pxe.yaml index f810d52a..b8ffe395 100644 --- a/bootstrap/playbooks/pxe.yaml +++ b/bootstrap/playbooks/pxe.yaml @@ -15,6 +15,7 @@ image_builder_path: /tmp/image_builder http_ip: 10.0.0.2 http_port: 8000 + supervisor_dir: /etc/supervisor/conf.d/ tasks: # Istall and configure dnsmasq @@ -53,14 +54,25 @@ # Install discovery service - shell: pip install git+https://github.com/rustyrobot/discovery.git - - shell: 'discovery &' - - shell: 'discovery-scan --ssh_key {{insecure_pub_key_path}} &' # Install bareon-api # Workaround is required because pbr does not handle git-eggs correctly and fails to install fuel-agent - shell: 'pip install git+git://github.com/prmtl/fuel-agent.git@detach_from_nailgun#egg=fuel_agent' - shell: pip install git+https://github.com/Mirantis/bareon-api.git - - shell: 'bareon-api &' + + # Install and configure supervisor + - apt: name=supervisor state=present + + - set_fact: {'name': 'discovery', 'cmd': 'discovery'} + - template: src=files/supervisor.conf dest={{supervisor_dir}}/discovery.conf + + - set_fact: {'name': 'discovery-scan', 'cmd': 'discovery-scan --ssh_key /vagrant/tmp/keys/ssh_private'} + - template: src=files/supervisor.conf dest={{supervisor_dir}}/discovery-scan.conf + + - set_fact: {'name': 'bareon-api', 'cmd': 'bareon-api'} + - template: src=files/supervisor.conf dest={{supervisor_dir}}/bareon-api.conf + + - service: name=supervisor state=restarted # Add nat rules so slaves have internet access via solar-dev - shell: iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -o eth0 -j MASQUERADE