On 21.07.2016 22:44, GBANE FETIGUE wrote:
- action: shell curl --basic -u admin:admin -F
file=/etc/ansible/playbooks/ms3-samples.zip -F name=ms3-samples -F
version=2.0 --header "Content-Type:multipart/form-data"
"http://52.73.56.141:8080/mmc-console-3.6.2/api/repository";
  register: upload
- debug: var=upload

This task will run on the host and not the control machine.


After running here is the result:

TASK [debug]
*******************************************************************
ok: [ip-172-31-61-191.ec2.internal] => {
    "upload": {
        "changed": true,
        "cmd": "curl --basic -u admin:admin -F
file=/etc/ansible/playbooks/@ms3-samples.zip -F name=ms3-samples -F
version=2.0 --header \"Content-Type:multipart/form-data\"
\"http://52.73.56.141:8080/mmc-console-3.6.2/api/repository\"";,
        "delta": "0:00:00.088039",
        "end": "2016-07-21 20:38:47.715591",
        "rc": 0,
        "start": "2016-07-21 20:38:47.627552",
"stderr": " % Total % Received % Xferd Average Speed Time
Time     Time  Current\n                                 Dload  Upload
Total   Spent    Left  Speed\n\r  0     0    0     0    0     0      0
0 --:--:-- --:--:-- --:--:--     0\r100   411    0    30  100   381
362   4601 --:--:-- --:--:-- --:--:--  4646",
        "stdout": "Specify a valid file to upload",
        "stdout_lines": [
            "Specify a valid file to upload"
        ],
        "warnings": [
"Consider using get_url or uri module rather than running curl"
        ]
    }
}

So in your case the file need to be on the host ip-172-31-61-191.ec2.internal, I'm guessing that's not the case and the file is on you control machine.


It's telling me that Specify a valid file to upload" I don't know why the
file is ms3-sample.zip. any ideas.

If the file is on the control machine you'll need to run the task on the localhost,
two ways to achieve that depending on the coding style you like.

- local_action: shell curl --basic -u admin:admin -F file=/etc/ansible/playbooks/ms3-samples.zip -F name=ms3-samples -F version=2.0 --header "Content-Type:multipart/form-data" "http://52.73.56.141:8080/mmc-console-3.6.2/api/repository";
  register: upload

or

- shell: curl --basic -u admin:admin -F file=/etc/ansible/playbooks/ms3-samples.zip -F name=ms3-samples -F version=2.0 --header "Content-Type:multipart/form-data" "http://52.73.56.141:8080/mmc-console-3.6.2/api/repository";
  register: upload
  delegate_to: localhost

--
Kai Stian Olstad

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/7c048d9eceebf1877cb20e4a3278b4b2%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to