Workflow for deploying LAMP through Ansible.
{
"id":"ansible-workflow",
"name": "Workflow for deploying LAMP via Ansible",
"description":"Sample Workflow for deploying an entire LAMP stack via Ansible",
"version":"1.0",
"startStep":"step0",
"variables": [
{"name":"vnfId", "type": "string"}
],
"input": [
{"name": "ANSIBLE_HOST_IP", "description": "Ansible Host IP Address", "type": "string"},
{"name": "ANSIBLE_HOST_USER", "description": "Ansible Host Username", "type": "string"},
{"name": "ANSIBLE_HOST_PWD", "description": "Ansible Host Password", "type": "password"},
{"name": "WEBSERVER_IP", "description": "Web Server IP Address", "type": "string"},
{"name": "DBSERVER_IP", "description": "DB Server IP Address", "type": "string"}
],
"output": [
{"name":"COPY_RESULT", "description": "Copy Output", "type": "string"},
{"name":"SSH_OUTPUT", "description": "SSH Command Output", "type": "string"},
{"name":"ANSIBLE_OUTPUT", "description": "Ansible Command Output", "type": "string"}
],
"steps":[
{
"stepId":"step0",
"workflow":"COPY_FILE_TO_GUEST", "namespace": "nfv",
"type":"task",
"description": "Copy Ansible Scripts from CSAR",
"inBinding":[
{"name": "username", "type": "string", "exportName": "ANSIBLE_HOST_USER"}
,{"name": "password", "type": "password", "exportName": "ANSIBLE_HOST_PWD"}
,{"name": "ip", "type": "string", "exportName": "ANSIBLE_HOST_IP"}
,{"name": "inFile", "type": "file", "default": [{"name": "ansible-centos7-lamp-master.zip"}]}
,{"name": "workingDirectory", "type": "string", "default": "/opt/ansible"}
,{"name": "destinationFileName", "type": "string", "default": "ansible-centos7-lamp-master.zip"}
],
"outBinding": [
{"name": "result", "type": "string", "exportName": "COPY_RESULT"}
],
"nextStep": "step1"
},
{
"stepId":"step1",
"workflow":"VRO_CUSTOM_WORKFLOW",
"namespace": "nfv",
"type":"task",
"description": "Unzip Ansible Scripts",
"inBinding":[
{"name": "vroWorkflowName", "type": "string", "default": "Run SSH Command"},
{"name": "username", "type": "string", "exportName": "ANSIBLE_HOST_USER"},
{"name": "password", "type": "password", "exportName": "ANSIBLE_HOST_PWD"},
{"name": "port", "type": "number", "default": "22"},
{"name": "cmd", "type": "string", "default": "cd /opt/ansible; unzip ansible-centos7-lamp-master.zip; "},
{"name": "encoding", "type": "string", "default": " "},
{"name": "hostNameOrIP", "type": "string", "exportName": "ANSIBLE_HOST_IP"},
{"name": "passwordAuthentication", "type": "boolean", "default": "true"}
],
"outBinding": [
{"name": "result", "type": "string", "exportName": "SSH_OUTPUT"}
],
"nextStep":"step2"
},
{
"stepId":"step2",
"workflow":"VRO_CUSTOM_WORKFLOW",
"namespace": "nfv",
"type":"task",
"description": "Prepare Ansible Hosts file",
"inBinding":[
{"name": "vroWorkflowName", "type": "string", "default": "Run SSH Command"},
{"name": "username", "type": "string", "exportName": "ANSIBLE_HOST_USER"},
{"name": "password", "type": "password", "exportName": "ANSIBLE_HOST_PWD"},
{"name": "port", "type": "number", "default": "22"},
{"name": "cmd", "type": "string", "default": "cd /opt/ansible/ansible-centos7-lamp-master; sed -i -e 's/client1.example.com/{{WEBSERVER_IP}}/g' /opt/ansible/ansible-centos7-lamp-master/hosts; sed -i -e 's/client2.example.com/{{DBSERVER_IP}}/g' /opt/ansible/ansible-centos7-lamp-master/hosts"},
{"name": "encoding", "type": "string", "default": " "},
{"name": "hostNameOrIP", "type": "string", "exportName": "ANSIBLE_HOST_IP"},
{"name": "passwordAuthentication", "type": "boolean", "default": "true"}
],
"outBinding": [
{"name": "result", "type": "string", "exportName": "SSH_OUTPUT"}
],
"nextStep":"step3"
},
{
"stepId":"step3",
"workflow":"VRO_CUSTOM_WORKFLOW",
"namespace": "nfv",
"type":"task",
"description": "Execute Ansible Playbook",
"inBinding":[
{"name": "vroWorkflowName", "type": "string", "default": "Run SSH Command"},
{"name": "username", "type": "string", "exportName": "ANSIBLE_HOST_USER"},
{"name": "password", "type": "password", "exportName": "ANSIBLE_HOST_PWD"},
{"name": "port", "type": "number", "default": "22"},
{"name": "cmd", "type": "string", "default": "cd /opt/ansible/ansible-centos7-lamp-master; ansible-playbook -v -i hosts site.yml"},
{"name": "encoding", "type": "string", "default": " "},
{"name": "hostNameOrIP", "type": "string", "exportName": "ANSIBLE_HOST_IP"},
{"name": "passwordAuthentication", "type": "boolean", "default": "true"}
],
"outBinding": [
{"name": "result", "type": "string", "exportName": "ANSIBLE_OUTPUT"}
],
"nextStep":"END"
}
]
}