Skip to content
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 role - check mode broken when grafana_dashboards is used #245

Open
tivoscappini opened this issue Jul 15, 2024 · 0 comments
Open

Comments

@tivoscappini
Copy link

When grafana_dashboards is non-empty, applying the Grafana role in check mode fails with an error:

TASK [grafana.grafana.grafana : Create local grafana dashboard directory] ******                                                                                                                                                              
skipping: [test-deployment-monitoring-0] => {                                                                                                                                                                                                 
    "changed": false,                                                                                                                                                                                                                         
    "invocation": {                                                                                                                                                                                                                           
        "module_args": {                                                                                                                                                                                                                      
            "path": null,                                                                                                                                                                                                                     
            "prefix": "ansible.",                                                                                                                                                                                                             
            "state": "directory",                                                                                                                                                                                                             
            "suffix": ""                                                                                                                                                                                                                      
        }                                                                                                                                                                                                                                     
    },                                                                                                                                                                                                                                        
    "msg": "remote module (ansible.builtin.tempfile) does not support check mode"                                                                                                                                                             
}
TASK [grafana.grafana.grafana : Download grafana dashboard from grafana.net to local directory] ***                                                                                                                                           
fatal: [test-deployment-monitoring-0 -> localhost]: FAILED! => {                                                                                                                                                                              
    "msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'path'\n\nThe error appears to be in '/opt/ansible/collections/ansible_collections/grafana/grafana/roles/grafana/
tasks/dashboards.yml': line 17, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n  block:\n    - name: \"Download grafana dashboard from grafana.net to local direct
ory\"\n      ^ here\n"                                                                                                                                                                                                                        
}

The ansible.builtin.tempfile module used by the task "Create local grafana dashboard directory" does not support check mode and thus skips itself. The consequence is that its output __tmp_dashboards is not registered, so when the following task ("Download grafana dashboard from grafana.net to local directory") tries to reference this registered variable to configure its ansible.builtin.get_url module, Ansible cannot resolve the reference and the task fails with an error.

It looks like a similar problem was solved in #125 for provisioned dashboards, but the problem remains for grafana.net dashboards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant