community.grafana icon indicating copy to clipboard operation
community.grafana copied to clipboard

grafana_datasource reports 'changed' for repeated runs

Open ecksun opened this issue 4 years ago • 3 comments

SUMMARY

grafana_datasource module reports 'changed' for each run even if nothing has been changed in datasoure.

I'm simply migrating this from https://github.com/ansible/ansible/issues/51068 which wasn't migrated automatically.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

grafana_datasource

ANSIBLE VERSION
ansible 2.7.5
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/amarao/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.15+ (default, Nov 28 2018, 16:27:22) [GCC 8.2.0]
CONFIGURATION
ANSIBLE_NOCOWS(/etc/ansible/ansible.cfg) = True
ANSIBLE_PIPELINING(/etc/ansible/ansible.cfg) = True
ANSIBLE_SSH_ARGS(/etc/ansible/ansible.cfg) = -C -o ControlMaster=auto -o ControlPersist=10s
ANSIBLE_SSH_CONTROL_PATH(/etc/ansible/ansible.cfg) = /tmp/%%h-%%r
DEFAULT_SUDO_FLAGS(/etc/ansible/ansible.cfg) = -H -S
DEFAULT_TIMEOUT(/etc/ansible/ansible.cfg) = 15
PERSISTENT_CONNECT_TIMEOUT(/etc/ansible/ansible.cfg) = 30
RETRY_FILES_ENABLED(/etc/ansible/ansible.cfg) = False
OS / ENVIRONMENT

local: Ubuntu 19.04 remote: Ubuntu 18.04, grafana 5.4.2

STEPS TO REPRODUCE
- hosts: localhost
  tasks:
   - name: Configure datasource
     grafana_datasource:
       name: influx
       access: proxy
       basic_auth_user: admin
       basic_auth_password: admin
       ds_type: influxdb
       database: '{{ torture_database }}'
       grafana_url: http://127.0.0.1:3000
       grafana_user: admin
       grafana_password: admin
       is_default: true
       tls_skip_verify: true
       url: http://127.0.0.1:8086
EXPECTED RESULTS

changed only on first run.

ACTUAL RESULTS
ansible-playbook test.yaml
changed=1

ansible-playbook test.yaml
changed=1

ecksun avatar Sep 08 '20 09:09 ecksun

Migrating this comment

I'm seeing the same thing, as additional information this is the output of the task:

{
    "foobar": {
        "after": {
            "access": "proxy",
            "basicAuth": false,
            "database": null,
            "id": 2,
            "isDefault": false,
            "jsonData": {
                "tlsAuth": false,
                "tlsAuthWithCACert": false
            },
            "name": "prometheus",
            "orgId": 1,
            "password": "",
            "type": "prometheus",
            "url": "http://localhost:9090",
            "user": "",
            "withCredentials": false
        },
        "before": {
            "access": "proxy",
            "basicAuth": false,
            "database": "",
            "id": 2,
            "isDefault": false,
            "jsonData": {
                "tlsAuth": false,
                "tlsAuthWithCACert": false
            },
            "name": "prometheus",
            "orgId": 1,
            "password": "",
            "readOnly": true,
            "type": "prometheus",
            "url": "http://localhost:9090",
            "user": "",
            "version": 1,
            "withCredentials": false
        },
        "changed": true,
        "failed": false,
        "id": 2,
        "msg": "Datasource prometheus updated Datasource updated",
        "name": "prometheus"
    }
}

ecksun avatar Sep 08 '20 09:09 ecksun

I'm still seeing this issue with ansible 2.9.13.

ecksun avatar Sep 08 '20 09:09 ecksun

I just opened a bug (autoclosed on main Ansible) :) https://github.com/ansible/ansible/issues/71724

Same issue.

mario-pranjic avatar Sep 11 '20 17:09 mario-pranjic