Change location and organization of proxy

Hello,

During the installation of the smart-proxy plugin, I need to choose all location and organization but i want to add the proxy directly to Default location and organization without going through the web interface.

It’s possible ?

azer

aer

AFAIK , it’ not possible except UI to assign the default organization/location during installation.

So, is it possible to put the proxy directly in default location and organization ?

because i need to modify every time i install foreman the proxy to put him in default location and organisation

You can automate it using the api or hammer by specifying the location_ids and organization_ids parameters.

1 Like

Below is API could use …

PUT /api/smart_proxies/:id

ok ok, but i don’t know how to use it… What are there step to achieve this ?

I have find with the next command :
hammer proxy update --id 1 --location “Default Location” --organization “Default Organization”

Thank you :grinning:

oops… Mistake

We should use the next command :

hammer location add-smart-proxy --id 1 --smart-proxy-id 1

But an error appear

Could not associate the smart proxy:
  Environments expecting environments used by hosts or inherited (check mismatches report).
  Domains expecting domains used by hosts or inherited (check mismatches report).

are you getting any issue while running above ?

No, but it was not the solution. i had already put the proxy in Default organization and location from the foreman interface

When i use the following command, an error appear :

hammer location add-smart-proxy --id 1 --smart-proxy-id 1

Could not associate the smart proxy:
  Environments expecting environments used by hosts or inherited (check mismatches report).
  Domains expecting domains used by hosts or inherited (check mismatches report).

on Foreman interface :

When i use the following command, an error appear :

hammer proxy update --id 1 --location-ids 1 --organization-ids 1

Could not update the proxy:
  PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint "taxable_index"
  DETAIL:  Key (taxable_type, taxable_id, taxonomy_id)=(Audited::Audit, 20, 1) already exists.
  : INSERT INTO "taxable_taxonomies" ("taxonomy_id", "taxable_id", "taxable_type", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id"

but just with location :
hammer proxy update --id 1 --location-ids 1

Smart proxy updated.

and on foreman interface :