geerlingguy / ansible-role-gitlab

Ansible Role - GitLab

Home Page:https://galaxy.ansible.com/geerlingguy/gitlab/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Single quotes for `kv.value` can cause errors with certain values

BrutalBirdie opened this issue · comments

Line in question:

{{ setting }}['{{ kv.key }}'] = '{{ kv.value }}'

Example would be this setting:

gitlab_extra_settings:
  - gitlab_rails:
    - key: "registry_key_path"
      value: "/etc/gitlab/registry.key"
  - registry:
    - key: "internal_key"
      value: "{{ gitlab_registry_internal_secret }}"

Where gitlab_registry_internal_secret is a RSA key like described in the doc:
https://docs.gitlab.com/ee/administration/packages/container_registry.html#use-an-external-container-registry-with-gitlab-as-an-auth-endpoint

# registry['internal_key'] should contain the contents of the custom key
# file. Line breaks in the key file should be marked using `\n` character
# Example:
registry['internal_key'] = "---BEGIN RSA PRIVATE KEY---\nMIIEpQIBAA\n"

# Optionally define a custom file for Omnibus GitLab to write the contents
# of registry['internal_key'] to.
gitlab_rails['registry_key_path'] = "/custom/path/to/registry-key.key"

With single quotes the key will be placed literal with the \n as string and not as line break in the keyfile.
Which leads to auth erros with the registry.

commented

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

nope not stale.

commented

This issue is no longer marked for closure.

I have also issues when adding: value: "true" to the gitlab_extra_settings block. The value is added as value = 'true' (single quoted). And when I enter it as a boolean: value: true then the config files says: value = True
This won't work in the config since it wants a lowercase true value.

I have also issues when adding: value: "true" to the gitlab_extra_settings block. The value is added as value = 'true' (single quoted). And when I enter it as a boolean: value: true then the config files says: value = True This won't work in the config since it wants a lowercase true value.

@Paul-dH The notes in https://github.com/geerlingguy/ansible-role-gitlab/pull/206/files should help here, "For boolean values in the extra settings, quote them as strings and set type: plain to ensure they're properly set."

@JoeAlamo Nice one! This fixed my issue, thanks 🚀

commented

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

commented

This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.

not stale