Two things:

   1. Try removing the trailing slash in the url.
   2. Try: url: https://xxxx/katello/api/v2/host_collections/{{ hc_id 
   }}/add_systems 
   <https://xxxx/katello/api/v2/host_collections/%7B%7Bhc_id%7D%7D/add_systems/>

Haven't attempted the api with satellite yet.  So, don't have any direct 
experience.

On Tuesday, October 23, 2018 at 4:34:44 AM UTC-4, Alberto Jimenez Lozano 
wrote:
>
> 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/743a9ac1-ff4d-4add-859a-469efc38ad80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to