0

We have a react app deployed in AWS which allows us to store specific device information, and we also have created an ec2 instance which takes that data and allows us to configure the device it was based on. We are trying to create a way to run the playbook within the EC2 using a button on the web app, however currently drawing a blank on how to do so.

We used to use a application named Morpheus but ran into all sorts of issues. We are now trying to keep everything from within AWS.

Any suggestions are helpful.



So I have tried to make use of the SSM Document and it has begun to confuse me. I attempted to make use of the script to try navigate to my folder and then run the playbook. However my method is not working at all.

    {
  "schemaVersion": "2.2",
  "description": "Command Document Example JSON Template",
  "parameters": {
    "Message": {
      "type": "String",
      "description": "Example",
      "default": "Hello World"
    }
  },
  "mainSteps": [
    {
      "action": "aws:runPowerShellScript",
      "name": "navigate to file",
      "inputs": {
        "runCommand": [ "cd /echo_configure/Config" ]
      }
    },
    {
      "action": "aws:runPowerShellScript",
      "name": "execute file",
      "inputs": {
        "runCommand": [ "ansible-playbook apply.yml" ]
      }
    }
  ]

}

Could I get some help to push me in the right direction

IAmTazlan
  • 43
  • 10
  • Well, just a system call with the ansible command: https://stackoverflow.com/questions/55651665/running-shell-command-through-reactjs-code – β.εηοιτ.βε Jan 19 '23 at 11:29
  • @β.εηοιτ.βε Will that allow us to trigger the ansible script from a specific folder in the EC2? – IAmTazlan Jan 19 '23 at 11:30
  • @IAmTazlan, yes, from any folder you want. I'd suggest to create an SSM document that can be executed on the EC2 instance by the SSM agent (already installed with EC2). From you Web App, create a trigger to run SSM document. – brushtakopo Jan 19 '23 at 13:05
  • @β.εηοιτ.βε alright I'll try figure that out. I'm new to this so trying to get to grips with it – IAmTazlan Jan 19 '23 at 14:43
  • @β.εηοιτ.βε I've tried to follow your instructions and I'm stuck could I please get some pointers – IAmTazlan Jan 24 '23 at 10:16

0 Answers0