How To Manually Apply Roles On a Host Using API Calls

Problem

In normal scenarios, the roles are applied through the PCD UI. However, the following steps can be used to apply the roles manually using API calls.

Environment

  • Private Cloud Director Virtualization - v2026.1 and Higher

  • Self-Hosted Private Cloud Director Virtualization - v2026.1 and Higher

  • Component - Resource Manager

Procedure

1

Retrieve Token

Set necessary variables.

$ export OS_TOKEN=<GENERATED_FROM_ABOVE>
$ export DU=<DU_FQDN>
$ export HOST_ID=<HOST_UUID>
2

List the applied roles on the host. [If applicable]

Sample Output
$ curl -sS -H "x-auth-token: $OS_TOKEN" '$DU/resmgr/v1/hosts/$HOST_ID' | jq '{hostconfig_id, roles, role_status}'
{
  "hostconfig_id": "[HOSTCONFIG_UUID]",
  "roles": [
    "pf9-cindervolume-base",
    "pf9-cindervolume-config",
    "pf9-glance-role",
    "pf9-ha-slave",
    "pf9-neutron-base",
    "pf9-ostackhost-neutron",
    "pf9-support"
  ],
  "role_status": "ok"
}
3

APl call to apply the required role

  • Hypervisor Role

    $ curl -X PUT -H "x-auth-token: $OS_TOKEN" -H 'content-type: application/json' '$DU/resmgr/v1/hosts/$HOST_ID/roles/pf9-ostackhost-neutron
    
    $ curl -X PUT -H "x-auth-token: $OS_TOKEN" -H 'content-type: application/json' '$DU/resmgr/v1/hosts/$HOST_ID/roles/pf9-neutron-base
    
    $ curl -X PUT -H "x-auth-token: $OS_TOKEN" -H 'content-type: application/json' '$DU/resmgr/v1/hosts/$HOST_ID/roles/pf9-neutron-ovn-controller
    
    $ curl -X PUT -H "x-auth-token: $OS_TOKEN" -H 'content-type: application/json' '$DU/resmgr/v1/hosts/$HOST_ID/roles/pf9-neutron-ovn-metadata-agent
    
    $ curl -X PUT -H "x-auth-token: $OS_TOKEN" -H 'content-type: application/json' '$DU/resmgr/v1/hosts/$HOST_ID/roles/pf9-ip-discovery

  • Persistent Storage

    $ curl -X PUT -H "x-auth-token: $OS_TOKEN" -H 'content-type: application/json' '$DU/resmgr/v1/hosts/$HOST_ID/roles/pf9-cindervolume-base
    
    $ curl -X PUT -H "x-auth-token: $OS_TOKEN" -H 'content-type: application/json' '$DU/resmgr/v1/hosts/$HOST_ID/roles/pf9-cindervolume-config

  • Image Library

    $ curl -X PUT -H "x-auth-token: $OS_TOKEN" -H 'content-type: application/json' '$DU/resmgr/v1/hosts/$HOST_ID/roles/pf9-glance-role

  • Advanced Remote Support

    $ curl -X PUT -H "x-auth-token: $OS_TOKEN" -H 'content-type: application/json' '$DU/resmgr/v1/hosts/$HOST_ID/roles/pf9-support

  • High Availabilty

    $ curl -X PUT -H "x-auth-token: $OS_TOKEN" -H 'content-type: application/json' '$DU/resmgr/v1/hosts/$HOST_ID/roles/pf9-ha-slave
4

Observe installation progress

  • Observe the hostagent logs

    $ tail -f /var/log/pf9/hostagent.log
  • After applying a package wait for converge to complete before applying the next.

Validation

  • Check the packages that are installed on the host.

    $ dpkg -l | grep pf9
  • Check the roles applied using:

    $ curl -sS -H "x-auth-token: $OS_TOKEN" '$DU/resmgr/v1/hosts/$HOST_ID' | jq '{hostconfig_id, roles, role_status}'

Last updated