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

5
  • Well, just a system call with the ansible command: stackoverflow.com/questions/55651665/… Commented Jan 19, 2023 at 11:29
  • @β.εηοιτ.βε Will that allow us to trigger the ansible script from a specific folder in the EC2? Commented Jan 19, 2023 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. Commented Jan 19, 2023 at 13:05
  • @β.εηοιτ.βε alright I'll try figure that out. I'm new to this so trying to get to grips with it Commented Jan 19, 2023 at 14:43
  • @β.εηοιτ.βε I've tried to follow your instructions and I'm stuck could I please get some pointers Commented Jan 24, 2023 at 10:16

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.