Webhook Api load docker-compose yml as POST data

4 views
Skip to first unread message

fawad....@nordcloud.com

unread,
Jun 29, 2018, 4:36:07 PM6/29/18
to Salt-users
I have a pretty simple scenario, but unfortunately it appears not be so. I want to post a valid yaml to the salt-api and let the reactor take care of the rest. My yaml is basically a text from docker-compose.yml file. So when I do this

curl -sSi localhost:8000/hook/docker-services -H 'Content-type: application/x-yaml'  \
-d '
target: my_minion
compose:
   version: "3"
   services: 
     mongodb: 
      image: "mongo:3.6.1"
      restart: always
      ports:
        - 27017:27017
      command: mongod --smallfiles --logpath=/dev/null  
'

I get this error 

SaltRenderError: found unexpected ':'

It cannot parse : after mongo. What is the best way the go about it? Same is the case with ports.

My motivation is to run docker containers on minions and manage them by passing docker-compose.yml using salt-api. 

Is there a better way to do it? I would really appreciate if I could get some help. Thank you!


Fawad 
Reply all
Reply to author
Forward
0 new messages