Hello!
I switched from my test GitHub and created successfully a project, but i couldnt get the right playbook to copy a file from the new GitLab to a local host.
Only the auth via username and PAT is aviable.
I added the user and PAR as a custom Auth and added the env GITLAB_USER and GITLAB_TOKEN.
remote: HTTP Basic: Access denied. The provided password or token is incorrect or your account has 2FA enabled and you must use a personal access token instead of a password.
or:
git@git.gruen.net: Permission denied (publickey,password).\\r\\nfatal: Could not read from remote repository.\\n\\nPlease make sure you have the correct access rights\\nand the repository exists.\\n",
2FA is dsabled for this user and i created a user juist for this use.
The easiest way to deal with remote repo authentication with GitLab is to use a Personal Access Token - PAT.
If you really want to force it to work with username and password, update your credential type to sent your variables as extra_vars instead of env. Then, you can reference those credentials in the playbook as their variable names.
I aleready tried to use the PAT, but i think my problem is that somehow the variables i need for the authentication are empty somehow:
How do i use the extra vars - do i have to set something in the project at the field extra variables?
When i change the Variable to:
{{ EXAMPLE_VAR2 }}"
it states the variable is not initialized and if i keep the playbook the variables are still empty or rather undefined.
First to make clear that i am right how to use the env variables:
You make a custom credential and assign the fields to the required env variables in the input field.
then add a new credential with the new created credential type.
and lastly i can use these in my playbooks to get the variable contents:
{{ lookup('ansible.builtin.env', 'HOME') }}
Can i use multiple credentials for one custom credential type and how could i choose the right one?
okay in the video it seems i only needed to place the
{{ example_var1 }}
just like any other variable where i nedd ith in the playbook- ill try it tomorrow.
and how do i use the env?
then it doesnt seem to just could not use : {{ lookup('ansible.builtin.env', 'HOME') }}
but it seemed like this in the official guide.
Thank you!
I now have the solution:
I thought i just need to add the credential for the custom credential and its like a global strorage,
but i have to add the new credentials to the templates and now i can output he content of them.