synthesio/infra-ovh-ansible-module

Failed to call OVH API: Dedicated server interface is already on a private network

Closed this issue · 1 comments

Sometimes I get this error when I try to set the correct VRack for a server, the task is the following:

 - name: Ensure the server is on the correct vRACK
      synthesio.ovh.dedicated_server_vrack:
        service_name: "{{ ovh_service_name }}"
        vrack: "{{ ovh_vracks[_ovh_vrack].id }}"
        endpoint: "{{ ovh_api.endpoint }}"
        application_key : "{{ ovh_api.app_key }}"
        application_secret: "{{ ovh_api.secret }}"
        consumer_key: "{{ ovh_api.consumer }}"

The results is:

{
  "msg": "Failed to call OVH API: Dedicated server interface is already on a private network \nOVH-Query-ID: EU.ext-XXXXX",
  "invocation": {
    "module_args": {
      "service_name": "nsXXXXX.eu",
      "vrack": "pn-56004",
      "endpoint": "ovh-eu",
      "application_key": "XXXXXXXXXXXXXXXXXXXXX",
      "application_secret": "YYYYYYYYYYYYYYYYYYYYYYYYYYY",
      "consumer_key": "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ",
      "state": "present"
    }
  },
  "_ansible_no_log": false,
  "changed": false
}

You can't switch a server from a vrack to another. You need to first remove it from the previous vrack configuration (with the state: "absent" switch), maybe wait for the operation to terminate on ovh side, then add it to the new vrack.