-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
grafana.ini yaml syntax #232
Conversation
49d5f29
to
31e23c1
Compare
cc @gardar |
I reviewed all vars to discover which are not used in role and can be descoped/deferred to grafana docs. Vars used in role:
Vars not used in role - removed from README.md and defaults/main.yaml in 2nd commit
Removed hardcoded sections in grafana.ini.j2 (could submit these as a separate PR, everything else is intertwined)
|
31e23c1
to
c4354a1
Compare
This is superb! Thanks @intermittentnrg LGTM, ill wait for sometime if @gardar want to review it and then merge |
c4354a1
to
3851f43
Compare
Finally got around to testing this. The dict grafana_ini gets overwritten and not inherited from defaults/main.yaml. ansible.builtin.set_fact:
grafana_ini: "{{ grafana_ini_default | ansible.builtin.combine(grafana_ini, recursive=true) }}" Also this line no longer works as it refers to itself. So just set this explictly. grafana_ini:
server:
root_url: "http://{{ grafana_ini.server.http_addr }}:{{ grafana_ini.server.http_port }}" I rebased and force pushed to fix conflicts. |
my bad, can you rebase, The changes are good to me! |
Awesome, thanks! I'm not sure how to run tests/molecule and just made the same changes that made sense elsewhere. If someone can confirm they're good or point me to how they are run. Also some announcement in addition to the major or minor version bump. |
3851f43
to
1499341
Compare
1499341
to
fc1d4dd
Compare
I rebased and force pushed. How do I bump major/minor version and where do I add upgrade notes? Seems changelog is updated automatically from commit messages? |
Hmm I'm considering forking and publishing to ansible-galaxy as this PR is not receiving feedback or getting merged fast. Then I can use it properly for my own purposes. Btw upgrade is fairly safe as preflight fails on all deprecated role variables that have to be updated. But do need to put some simple upgrade notes somewhere. README? |
All good in the PR Ill be making a release for this |
Awesome! I realized this command installs collection from my git without publishing to ansible galaxy
Also I was trying to make a preflight check for nested dicts. grafana_ini:
auth:
anonymous:
enabled: true Good example: grafana_ini:
auth.anonymous:
enabled: true It's a struggle looping over nested dicts in ansible but I came up with this: - name: No nested mappings
set_fact:
grafana_ini_check: |-
{% for section, items in grafana_ini.items() %}
{% if items is mapping %}
{% for k,v in items.items() %}
{% if v is mapping %}
grafana_ini.{{section}}.{{k}} can't be a dict!!
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
- name: No nested mappings
ansible.builtin.assert:
that: grafana_ini_check | length == 0
fail_msg: "{{ grafana_ini_check }}" Not sure this preflight check is necessary, but I just made above error and only noticed when I checked /etc/grafana/grafana.ini on target host. |
Untested draft for early feedback of #210.
I've done search&replace to use new convention for
grafana_ini:
var.I did not expect there to be 19 changed files, but there were many references for example to
grafana_url
which is nowgrafana_ini.server.root_url
and similar.I kept all entries in README and defaults/main.yaml, but I think most should be deleted. Repeating grafana documentation and default values doesn't make sense. The default grafana.ini is empty/everything commented out, we should let grafana handle defaults.