ansible-for-nsxt
ansible-for-nsxt copied to clipboard
Principal Identity creation failing
The principal identity module has switch to use the api call /api/v1/trust-management/principal-identities/with-certificate, which has a description of "Create a Principal Identity with a new, unused, certificate."
This will add the certificate and create the principal identity in a single action. The issue is that the module is checking to see whether there is a pre-existing certificate with the name provided and fails if it already exists. The API does not take a certificate name anymore, so the check should be removed and the documentation updated.
The module is also not idempotent, so can only be run once successfully. It would be far better if the module checks to see of the object exists and is the same as what is being requested. It could then pass if no change and fail if a change is requested.
Internal bug created to track this.
any update on this? unable to create principal users still.
Closing as the following code works no problem.
- name: Register a TKGI Super User
vmware.ansible_for_nsxt.nsxt_principal_identities:
hostname: "{{ nsxt.manager.hostname }}"
username: "{{ nsxt.manager.username }}"
password: "{{ nsxt.manager.password }}"
validate_certs: false
display_name: "{{ item.display_name }}"
name: "{{ item.display_name }}"
node_id: "node-1"
role: "{{ item.role }}"
certificate_pem_file: "{{ tmp_dir }}/{{ item.display_name }}.pem"
state: "present"
register: pi_result
loop: "{{ nsxt.principal_identities }}"```