I'm working wit uri module  with satellite.
I do one playbook for create a new host_collection and it works OK.


- name: CREATE HC 
    uri:
       url: "https://xxxxxx/katello/api/host_collections/";
       user: "{{user}}"
       password: "{{password}}"
       method: POST
       return_content: yes
       force_basic_auth: yes
       validate_certs: no
       body_format: json
       body: '{"name":"{{hc}}","organization_id":"1"}'
       status_code: [200,201,202]

But I want to do a playbook to add/remove host from a host collection, and 
the urls that appears in the api guides fails.

For api v1  the api guide indicates use PUT 
/katello/api/v2/host_collections/:id/add_systems

https://access.redhat.com/documentation/en-us/red_hat_satellite/6.0/html/api_guide/add_systems_to_the_host_collection



I did this playbooks and it fails:


- name: Assign sat server {{server}} to {{host_collection}}
    uri:
       url: 
"https://xxxx/katello/api/v2/host_collections/{{hc_id}}/add_systems/";
       user: "{{user}}"
       password: "{{password}}"
       method: PUT
       return_content: yes
       force_basic_auth: yes
       validate_certs: no
       body_format: json
       body: '{"system_ids":"[972,1280]"}'
       status_code: [200,201,202,204,301,401]

The message error is 404 error

The page you were looking for doesn't exist (404)
The page you were looking for doesn't exist

And the path https://xxxx/katello/api/v2/host_collections/{{hc_id}}/ works 
OK.




-- 
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/5ef25bde-28ed-4baf-a826-38b66f3cffde%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to