redhat-cop / aap_configuration_template

Ansible Automation Platform Configuration as Code examples template
MIT License
53 stars 31 forks source link

ah_token not assigned #39

Closed laurent-indermuehle closed 9 months ago

laurent-indermuehle commented 9 months ago

I want to configure my Public Automation Hub token and add it to an organization. For this, the file group_vars/all/credentials.yml seems a good candidate. I didn't find where to set the ah_token variable. Is it an omission?

I found in vaults/dev.yml the variable offline_token with the cryptic comment "this is the one linked below about api token". This offline_token variable in only used inside group_vars/all/aap_install.yml to fill the variable aap_setup_down_offline_token which serve to download aap here. So it doesn't seem to be the token I'm looking for. And it is not explained how to generate such token.

Also in vaults/dev.yml there is the cloud_token, which is used in group_vars/all/ah_repositories.yml to configure ah_collection_remotes. So this seems to be a better candidate. But the comment says: 'this is the one from console.redhat.com'. A better comment would have been: "To generate an AH token, got to the url: https://console.redhat.com/ansible/automation-hub/token and click on «Load Token» in the "Offline token" chapter".

But wait, I have to load an «offline token» to generate my cloud_token. But then, what's the purpose/difference with offline_token from above`?

Is ah_token and cloud_token the same?

djdanielsson commented 9 months ago

offline_token is for API call to download AAP cloud_token is to sync certified and validated collections from console.redhat.com ah_token is the PAH token. how do you set it in code if you have not deployed AAP yet? it is something that is generated not something you set, thus if you look at the install configure, I have a when statement that says if you do not have ah_token defined it will try and do the tasks to generate it. if you do generate it and it is post install config then you can set the var ah_token and it will use what you provide. It is probably best to do this so it does not constantly regenerate the token but I didn't know how else to do it fully automated without forcing manual steps, if you can come up with better ideas let me know.