Skip to content
Snippets Groups Projects
Commit bba01d43 authored by erbel's avatar erbel
Browse files

Merge branch 'dev/live' into 'master'

Dev/live

See merge request !5
parents 1bd24a1a 91242cf8
Branches
Tags
1 merge request!5Dev/live
Pipeline #88316 passed
Showing
with 543 additions and 31 deletions
......@@ -11,6 +11,8 @@
package de.ugoe.cs.rwm.mocci;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.cmf.occi.core.impl.OCCIFactoryImpl;
import org.eclipse.cmf.occi.infrastructure.impl.InfrastructureFactoryImpl;
......@@ -21,6 +23,7 @@ import org.modmacao.placement.impl.PlacementFactoryImpl;
import de.ugoe.cs.rwm.docci.connector.Connector;
import monitoring.impl.MonitoringFactoryImpl;
import ossweruntime.impl.OssweruntimeFactoryImpl;
public abstract class AbsScaler {
protected InfrastructureFactoryImpl iFactory = new InfrastructureFactoryImpl();
......@@ -28,10 +31,21 @@ public abstract class AbsScaler {
protected MonitoringFactoryImpl mFactory = new MonitoringFactoryImpl();
protected PlatformFactoryImpl pFactory = new PlatformFactoryImpl();
protected PlacementFactoryImpl placeFactory = new PlacementFactoryImpl();
protected OssweruntimeFactoryImpl osFactory = new OssweruntimeFactoryImpl();
protected Resource runtimeModel;
protected Connector conn;
protected Path runtimePath;
static List<String> interfaces = new ArrayList<String>() {
{
add("10.254.1.12");
add("10.254.1.22");
add("10.254.1.32");
add("10.254.1.42");
add("10.254.1.52");
}
};
protected org.eclipse.cmf.occi.core.Resource getResourceById(EList<org.eclipse.cmf.occi.core.Resource> eList, String string) {
for(org.eclipse.cmf.occi.core.Resource res: eList ) {
......
......@@ -11,28 +11,45 @@
package de.ugoe.cs.rwm.mocci;
import java.nio.file.Path;
import java.util.List;
import org.eclipse.cmf.occi.core.Configuration;
import org.eclipse.cmf.occi.core.Link;
import org.eclipse.cmf.occi.core.MixinBase;
import org.eclipse.cmf.occi.infrastructure.Compute;
import org.eclipse.cmf.occi.infrastructure.Ipnetworkinterface;
import org.eclipse.cmf.occi.infrastructure.Networkinterface;
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.plugin.EcorePlugin;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.epsilon.emc.emf.CachedResourceSet;
import org.modmacao.occi.platform.Component;
import de.ugoe.cs.rwm.docci.ModelUtility;
import de.ugoe.cs.rwm.docci.connector.Connector;
import de.ugoe.cs.rwm.docci.executor.MartExecutor;
import monitoring.Datagatherer;
import monitoring.Dataprocessor;
import monitoring.Monitorableproperty;
public class DownScaler extends AbsScaler {
private List<Link> linksToDelete;
private List<org.eclipse.cmf.occi.core.Resource> resourcesToDelete;
public DownScaler(Connector conn, Path runtimePath) {
this.conn = conn;
this.runtimePath = runtimePath;
this.linksToDelete = new BasicEList<Link>();
this.resourcesToDelete = new BasicEList<org.eclipse.cmf.occi.core.Resource>();
}
public Resource downScaleNodes() {
CachedResourceSet.getCache().clear();
EList<EObject> toDelete = new BasicEList<EObject>();
runtimeModel = ModelUtility.loadOCCIintoEMFResource(conn.loadRuntimeModel(runtimePath));
Configuration config = ((Configuration) runtimeModel.getContents().get(0));
......@@ -46,8 +63,8 @@ public class DownScaler extends AbsScaler {
if(monProp != null && monProp.getMonitoringResult() != null) {
if(monProp.getMonitoringResult().equals("None")) {
System.out.println(" VM with None CPU utilization found: " + comp.getId());
toDelete.add(comp);
toDelete.addAll(linksAndComponents(comp));
addConnectedLinksAndComponents(comp);
resourcesToDelete.add(comp);
System.out.println(" Deleting Entities Around: " + comp.getTitle() +" ("+comp.getId()+")");
downScale = true;
break;
......@@ -60,19 +77,28 @@ public class DownScaler extends AbsScaler {
if(downScale == false) {
System.out.println(" Every Compute busy/Only one worker! Skipping downScale!");
}
for(Link link: linksToDelete) {
EcoreUtil.delete(link);
}
config.getResources().removeAll(resourcesToDelete);
runtimeModel.getContents().removeAll(toDelete);
return runtimeModel;
for(org.eclipse.cmf.occi.core.Resource res: resourcesToDelete) {
EcoreUtil.delete(res);
}
Resource rM = runtimeModel;
MAPE.newComp = null;
CachedResourceSet.getCache().clear();
return rM;
}
private Monitorableproperty getAttachedCPUMonProp(Compute comp) {
for(Link link: comp.getRlinks()) {
//System.out.println("LINK: " + link);
if(link instanceof Monitorableproperty) {
Monitorableproperty monProp = (Monitorableproperty) link;
//System.out.println("MonPROP: " + monProp);
//System.out.println("Prop: " + monProp.getMonitoringProperty());
if(monProp.getMonitoringProperty().equals("CPU")) {
return monProp;
}
......@@ -81,21 +107,34 @@ public class DownScaler extends AbsScaler {
return null;
}
private EList<EObject> linksAndComponents(Compute comp) {
EList<EObject> toDelete = new BasicEList<EObject>();
toDelete.addAll(comp.getLinks());
toDelete.addAll(comp.getRlinks());
private void addConnectedLinksAndComponents(Compute comp) {
linksToDelete.addAll(comp.getLinks());
linksToDelete.addAll(comp.getRlinks());
for(Link link: comp.getRlinks()) {
if(link.getSource() instanceof Component) {
toDelete.add(link.getSource());
resourcesToDelete.add(link.getSource());
linksToDelete.addAll(link.getSource().getLinks());
linksToDelete.addAll(link.getSource().getRlinks());
}
if(link instanceof Monitorableproperty) {
toDelete.add(link.getSource());
resourcesToDelete.add(link.getSource());
}
}
for(Link link: comp.getLinks()) {
if(link instanceof Networkinterface) {
Networkinterface nwi = (Networkinterface) link;
for(MixinBase mixB: nwi.getParts()) {
if(mixB instanceof Ipnetworkinterface) {
Ipnetworkinterface ipnwi = (Ipnetworkinterface) mixB;
if(ipnwi.getOcciNetworkinterfaceAddress().startsWith("100.254.1")) {
interfaces.add(ipnwi.getOcciNetworkinterfaceAddress());
}
}
}
}
}
return toDelete;
}
}
......@@ -24,6 +24,7 @@ import de.ugoe.cs.rwm.docci.MartDeployer;
import de.ugoe.cs.rwm.docci.ModelUtility;
import de.ugoe.cs.rwm.docci.connector.Connector;
import de.ugoe.cs.rwm.docci.connector.LocalhostConnector;
import de.ugoe.cs.rwm.docci.connector.MartConnector;
import de.ugoe.cs.rwm.docci.executor.MartExecutor;
import de.ugoe.cs.rwm.tocci.Transformator;
import de.ugoe.cs.rwm.tocci.TransformatorFactory;
......@@ -38,6 +39,7 @@ public class InitialDeployment {
public static void main (String args[]) {
Connector conn = new LocalhostConnector("localhost", 8080, "ubuntu");
//Connector conn = new MartConnector("192.168.35.45", 8080, "ubuntu", "~/key.pem");
RegistryAndLoggerSetup.setup();
deploy(conn);
}
......@@ -46,7 +48,6 @@ public class InitialDeployment {
System.out.println("Initial Deployment");
Path occiPath = getModelPath("de/ugoe/cs/rwm/mocci/occi/hadoopClusterNewExtWithMem.occic");
Resource model = ModelUtility.loadOCCIintoEMFResource(occiPath);
System.out.println(model.getResourceSet().getResources());
Transformator trans = TransformatorFactory.getTransformator("OCCI2OCCI");
trans.transform(model, occiPath);
......
......@@ -16,9 +16,11 @@ import org.eclipse.emf.ecore.resource.Resource;
import org.json.JSONArray;
import de.ugoe.cs.rwm.docci.MartDeployer;
import de.ugoe.cs.rwm.docci.ModelUtility;
import de.ugoe.cs.rwm.docci.connector.Connector;
import de.ugoe.cs.rwm.docci.connector.LocalhostConnector;
import de.ugoe.cs.rwm.docci.executor.MartExecutor;
import org.modmacao.occi.platform.Component;
/**Making javadoc happy.
* @author erbel
......@@ -30,6 +32,7 @@ public class MAPE {
static MartDeployer deployer = new MartDeployer(conn);
static MartExecutor executor = new MartExecutor(conn);
static Resource runtimeModel;
static Component newComp;
static int interval = 10000;
/**Making javadoc happy.
......@@ -96,6 +99,9 @@ public static void execute(Resource runtimeModel) {
System.out.println("Execute: Deploying adjusted Model");
deployer.deploy(runtimeModel);
if(newComp != null) {
executor.executeOperation("POST", newComp, ModelUtility.getAction(newComp, "start"));
}
}
......
......@@ -50,7 +50,7 @@ public class RegistryAndLoggerSetup {
Logger.getLogger(ModelRetriever.class.getName()).setLevel(Level.OFF);
Logger.getLogger(Comparator.class.getName()).setLevel(Level.OFF);
Logger.getLogger(Provisioner.class.getName()).setLevel(Level.OFF);
Logger.getLogger(Deployer.class.getName()).setLevel(Level.OFF);
Logger.getLogger(Deployer.class.getName()).setLevel(Level.INFO);
Logger.getLogger(Deprovisioner.class.getName()).setLevel(Level.OFF);
Logger.getLogger(Executor.class.getName()).setLevel(Level.INFO);
Logger.getLogger(MartAppDeployerSlave.class.getName()).setLevel(Level.OFF);
......
......@@ -11,11 +11,16 @@
package de.ugoe.cs.rwm.mocci;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.cmf.occi.core.AttributeState;
import org.eclipse.cmf.occi.core.Configuration;
import org.eclipse.cmf.occi.core.Mixin;
import org.eclipse.cmf.occi.core.MixinBase;
import org.eclipse.cmf.occi.infrastructure.Compute;
import org.eclipse.cmf.occi.infrastructure.ComputeStatus;
import org.eclipse.cmf.occi.infrastructure.Ipnetworkinterface;
import org.eclipse.cmf.occi.infrastructure.Networkinterface;
import org.eclipse.emf.ecore.resource.Resource;
import org.modmacao.occi.platform.Component;
......@@ -28,8 +33,10 @@ import de.ugoe.cs.rwm.docci.connector.Connector;
import monitoring.Datagatherer;
import monitoring.Dataprocessor;
import monitoring.Monitorableproperty;
import monitoring.Occiresultprovider;
import monitoring.Resultprovider;
import monitoring.Sensor;
import ossweruntime.Ubuntu_xenialxerus;
public class UpScaler extends AbsScaler {
......@@ -48,8 +55,8 @@ public class UpScaler extends AbsScaler {
Component worker = addWorkerComponent(config, comp);
Sensor sens = addSensor(config, comp);
Datagatherer dg = addDataGatherer(config, comp, sens);
Dataprocessor dp = addDataProcessor(config, monVM, sens, dg);
Resultprovider rp = addResultProvider(config, monVM, sens, dp);
Dataprocessor dp = addDataProcessor(config, comp, sens, dg);
Resultprovider rp = addResultProvider(config, comp, sens, dp);
return runtimeModel;
}
......@@ -57,18 +64,42 @@ public class UpScaler extends AbsScaler {
private Compute addCompute(Configuration config) {
System.out.println(" Adding Compute Node to Model");
Compute comp = iFactory.createCompute();
comp.setTitle("hadoop-worker-additional");
comp.setOcciComputeState(ComputeStatus.ACTIVE);
AttributeState attr = factory.createAttributeState();
attr.setName("occi.compute.state");
attr.setValue("active");
comp.getAttributes().add(attr);
AttributeState state = factory.createAttributeState();
state.setName("occi.compute.state");
state.setValue("active");
comp.getAttributes().add(state);
config.getResources().add(comp);
//executor.executeOperation("PUT", comp, null);
Ubuntu_xenialxerus mixOs = osFactory.createUbuntu_xenialxerus();
comp.getParts().add(mixOs);
Networkinterface nwi = iFactory.createNetworkinterface();
nwi.setTarget(getResourceById(config.getResources(), "urn:uuid:29d78078-fb4c-47aa-a9af-b8aaf3339591"));
nwi.setSource(comp);
Ipnetworkinterface mixB = iFactory.createIpnetworkinterface();
String ip = interfaces.get(0);
mixB.setOcciNetworkinterfaceAddress(ip);
nwi.getParts().add(mixB);
AttributeState ipAttr = factory.createAttributeState();
ipAttr.setName("occi.networkinterface.address");
ipAttr.setValue(ip);
nwi.getAttributes().add(ipAttr);
String ipadjusted = ip.replace(".", "-");
comp.setTitle("hadoop-worker-additional-" + ipadjusted);
AttributeState hostname = factory.createAttributeState();
hostname.setName("occi.compute.hostname");
hostname.setValue("hadoop-worker-additional-" + ipadjusted);
comp.getAttributes().add(hostname);
System.out.println(" Ip in Hadoop Network: " + interfaces.get(0));
interfaces.remove(0);
Networkinterface nwimon = iFactory.createNetworkinterface();
nwimon.setTarget(getResourceById(config.getResources(), "urn:uuid:7a9fca2c-24fb-473c-aa9c-8dc9e68a432a"));
......@@ -80,7 +111,7 @@ public class UpScaler extends AbsScaler {
System.out.println(" Adding Worker Component to Model");
Component worker = pFactory.createComponent();
worker.setTitle("worker-component");
worker.setOcciComponentState(Status.ACTIVE);
//worker.setOcciComponentState(Status.ACTIVE);
config.getResources().add(worker);
AttributeState attr = factory.createAttributeState();
......@@ -88,6 +119,10 @@ public class UpScaler extends AbsScaler {
attr.setValue(worker.getId());
worker.getAttributes().add(attr);
MixinBase mBase = factory.createMixinBase();
mBase.setMixin(getMixin("hworker", config));
worker.getParts().add(mBase);
Placementlink pLink = placeFactory.createPlacementlink();
pLink.setSource(worker);
pLink.setTarget(comp);
......@@ -95,15 +130,15 @@ public class UpScaler extends AbsScaler {
Componentlink compLink = pFactory.createComponentlink();
compLink.setSource(getResourceById(config.getResources(), "urn:uuid:a4888ba9-a0ea-48f2-a29e-901c876ab42d"));
compLink.setTarget(worker);
MAPE.newComp = worker;
return worker;
}
private Sensor addSensor(Configuration config, Compute comp) {
System.out.println(" Adding Sensor to Model");
Sensor sens = mFactory.createSensor();
sens.setTitle("CPUSensor");
config.getResources().add(sens);
//executor.executeOperation("PUT", sens, null);
AttributeState attr = factory.createAttributeState();
attr.setName("occi.core.id");
......@@ -119,7 +154,6 @@ public class UpScaler extends AbsScaler {
mp.getAttributes().add(attrProp);
mp.setSource(sens);
mp.setTarget(comp);
//executor.executeOperation("PUT", mp, null);
return sens;
}
......@@ -135,11 +169,13 @@ public class UpScaler extends AbsScaler {
attr.setValue(dg.getId());
dg.getAttributes().add(attr);
//executor.executeOperation("PUT", dg, null);
MixinBase mBase = factory.createMixinBase();
mBase.setMixin(getMixin("cpugatherer", config));
dg.getParts().add(mBase);
Componentlink c1 = pFactory.createComponentlink();
c1.setSource(sens);
c1.setTarget(dg);
//executor.executeOperation("PUT", c1, null);
Placementlink pl = placeFactory.createPlacementlink();
pl.setSource(dg);
......@@ -159,6 +195,10 @@ public class UpScaler extends AbsScaler {
attr.setValue(dp.getId());
dp.getAttributes().add(attr);
MixinBase mBase = factory.createMixinBase();
mBase.setMixin(getMixin("cpuprocessorlocal", config));
dp.getParts().add(mBase);
Componentlink c2 = pFactory.createComponentlink();
c2.setSource(sens);
c2.setTarget(dp);
......@@ -177,6 +217,19 @@ public class UpScaler extends AbsScaler {
rp.setTitle("CPUProvider");
config.getResources().add(rp);
Occiresultprovider orp = mFactory.createOcciresultprovider();
orp.setResultProviderEndpoint("192.168.35.45:8080");
AttributeState attrOP = factory.createAttributeState();
attrOP.setName("result.provider.endpoint");
attrOP.setValue("192.168.35.45:8080");
rp.getAttributes().add(attrOP);
rp.getParts().add(orp);
MixinBase mBase = factory.createMixinBase();
mBase.setMixin(getMixin("cpupublisher", config));
rp.getParts().add(mBase);
AttributeState attr = factory.createAttributeState();
attr.setName("occi.core.id");
attr.setValue(rp.getId());
......@@ -196,4 +249,13 @@ public class UpScaler extends AbsScaler {
return rp;
}
private Mixin getMixin(String string, Configuration config) {
for(Mixin mix: config.getMixins()) {
if(mix.getTerm().equals(string)) {
return mix;
}
}
return null;
}
}
File added
File added
File added
File added
......@@ -41,6 +41,9 @@
- service:
name: glances
state: started
- service:
name: glances
state: restarted
when: task == "START"
become_user: root
......
---
language: python
python: "2.7"
# Use the new container infrastructure
sudo: false
# Install ansible
addons:
apt:
packages:
- python-pip
install:
# Install ansible
- pip install ansible
# Check ansible version
- ansible --version
# Create ansible.cfg with correct roles_path
- printf '[defaults]\nroles_path=../' >ansible.cfg
script:
# Basic role syntax check
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
\ No newline at end of file
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
---
# defaults file for java
#! /bin/bash
avgCpu=0
slept=0
sequence=3
times=3
send=$(python -c "print $sequence*$times")
url=http://$1:61208/api/2/cpu/total
if [ -f ~/monitor.txt ]; then
echo "Removing previous monitoring data"
rm monitor.txt
fi
echo "Starting monitoring script"
echo "Requesting $url every $sequence seconds aggregating after $times times!"
while true; do
cpu=$(curl -s $url | awk '{print $2}')
cutcpu=$(echo "$cpu" | rev | cut -c 2- | rev)
sumCpu=$(python -c "print $sumCpu+$cutcpu")
echo "Current Cpu: $cutcpu"
sleep $sequence
slept=$(($slept+$sequence))
if [ "$slept" = $send ]; then
mid=$(python -c "print $sumCpu/$times")
echo "Aggregate Cpu: $mid"
echo $mid >> ~/monitor.txt
slept=0
sumCpu=0
fi
done
---
# handlers file for java
galaxy_info:
author: your name
description:
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Some suggested licenses:
# - BSD (default)
# - MIT
# - GPLv2
# - GPLv3
# - Apache
# - CC-BY
license: license (GPLv2, CC-BY, etc)
min_ansible_version: 1.2
# Optionally specify the branch Galaxy will use when accessing the GitHub
# repo for this role. During role install, if no tags are available,
# Galaxy will use this branch. During import Galaxy will access files on
# this branch. If travis integration is cofigured, only notification for this
# branch will be accepted. Otherwise, in all cases, the repo's default branch
# (usually master) will be used.
#github_branch:
#
# Below are all platforms currently available. Just uncomment
# the ones that apply to your role. If you don't see your
# platform on this list, let us know and we'll get it added!
#
#platforms:
#- name: OpenBSD
# versions:
# - all
# - 5.6
# - 5.7
# - 5.8
# - 5.9
# - 6.0
# - 6.1
# - 6.2
#- name: Fedora
# versions:
# - all
# - 16
# - 17
# - 18
# - 19
# - 20
# - 21
# - 22
# - 23
# - 24
# - 25
# - 26
# - 27
#- name: DellOS
# versions:
# - all
# - 10
# - 6
# - 9
#- name: MacOSX
# versions:
# - all
# - 10.10
# - 10.11
# - 10.12
# - 10.7
# - 10.8
# - 10.9
#- name: Synology
# versions:
# - all
# - any
#- name: Junos
# versions:
# - all
# - any
#- name: Cumulus
# versions:
# - all
# - 2.5
# - 3.0
# - 3.1
# - 3.2
# - 3.3
# - 3.4
# - 3.5
#- name: GenericBSD
# versions:
# - all
# - any
#- name: Void Linux
# versions:
# - all
# - any
#- name: GenericLinux
# versions:
# - all
# - any
#- name: NXOS
# versions:
# - all
# - any
#- name: macOS
# versions:
# - all
# - Sierra
#- name: IOS
# versions:
# - all
# - any
#- name: Amazon
# versions:
# - all
# - 2013.03
# - 2013.09
# - 2016.03
# - 2016.09
#- name: ArchLinux
# versions:
# - all
# - any
#- name: FreeBSD
# versions:
# - all
# - 10.0
# - 10.1
# - 10.2
# - 10.3
# - 10.4
# - 11.0
# - 11.1
# - 8.0
# - 8.1
# - 8.2
# - 8.3
# - 8.4
# - 9.0
# - 9.1
# - 9.1
# - 9.2
# - 9.3
#- name: Ubuntu
# versions:
# - all
# - artful
# - bionic
# - lucid
# - maverick
# - natty
# - oneiric
# - precise
# - quantal
# - raring
# - saucy
# - trusty
# - utopic
# - vivid
# - wily
# - xenial
# - yakkety
# - zesty
#- name: Debian
# versions:
# - all
# - buster
# - etch
# - jessie
# - lenny
# - sid
# - squeeze
# - stretch
# - wheezy
#- name: Alpine
# versions:
# - all
# - any
#- name: EL
# versions:
# - all
# - 5
# - 6
# - 7
#- name: Windows
# versions:
# - all
# - 2012R2
#- name: SmartOS
# versions:
# - all
# - any
#- name: opensuse
# versions:
# - all
# - 12.1
# - 12.2
# - 12.3
# - 13.1
# - 13.2
#- name: SLES
# versions:
# - all
# - 10SP3
# - 10SP4
# - 11
# - 11SP1
# - 11SP2
# - 11SP3
# - 11SP4
# - 12
# - 12SP1
#- name: GenericUNIX
# versions:
# - all
# - any
#- name: Solaris
# versions:
# - all
# - 10
# - 11.0
# - 11.1
# - 11.2
# - 11.3
#- name: eos
# versions:
# - all
# - Any
galaxy_tags: []
# List tags for your role here, one per line. A tag is
# a keyword that describes and categorizes the role.
# Users find roles by searching for tags. Be sure to
# remove the '[]' above if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of
# alphanumeric characters. Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line.
# Be sure to remove the '[]' above if you add dependencies
# to this list.
\ No newline at end of file
- name: Deploy CPUProcessor
block:
- name: Upload Processor Script
copy:
src: processor.sh
dest: /home/ubuntu/processor.sh
when: task == "DEPLOY"
become_user: root
- name: Configure CPUProcessor
block:
- name: Make script executable
file:
path: /home/ubuntu/processor.sh
mode: 0777
when: task == "CONFIGURE"
become_user: root
- name: Start CPUProcessor
block:
- name: Execute processor script
command: start-stop-daemon --start --startas /home/ubuntu/processor.sh 127.0.0.1 -m --pidfile /run/processor.pid -b
when: task == "START"
become_user: root
- name: Stop CPUProcessor
block:
- name: Stop processor script
command: start-stop-daemon --stop -m --pidfile /run/processor.pid
when: task == "STOP"
become_user: root
- name: Undeploy CPUProcessor
block:
- debug: msg="Operation undeploy not implemented."
when: task == "UNDEPLOY"
become_user: root
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment