Repository: ansible/ansible

Issue:
grafana_annotations callback: cannot disable cert validation
##### SUMMARY
with `validate_grafana_certs = false` in ansible.cfg inside callback_grafana_annotations section, the validation is still performed.

##### ISSUE TYPE
 - Bug Report

##### COMPONENT NAME
grafana_annotations

##### ANSIBLE VERSION

```
ansible 2.6.0
  config file = /Users/remirey/dev/grtgas/avignon/ansible.cfg
  configured module search path = [u'/Users/remirey/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/remirey/.virtualenvs/avignon/lib/python2.7/site-packages/ansible
  executable location = /Users/remirey/.virtualenvs/avignon/bin/ansible
  python version = 2.7.13 (default, Jul 18 2017, 09:17:00) [GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)]
```

##### CONFIGURATION

```
ANSIBLE_FORCE_COLOR(/Users/remirey/dev/ansible.cfg) = True
DEFAULT_CALLBACK_WHITELIST(/Users/remirey/dev/ansible.cfg) = ['profile_tasks', 'grafana_annotations']
DEFAULT_GATHERING(/Users/remirey/dev/ansible.cfg) = explicit
DEFAULT_HASH_BEHAVIOUR(/Users/remirey/dev/ansible.cfg) = replace
DEFAULT_MANAGED_STR(/Users/remirey/dev/ansible.cfg) = Please do not change this file directly since it is managed by Ansible and will be overwritten
DEFAULT_REMOTE_USER(/Users/remirey/dev/ansible.cfg) = ec2-user
DEFAULT_VAULT_PASSWORD_FILE(/Users/remirey/dev/ansible.cfg) = /Users/remirey/dev/ansible_vault_password
HOST_KEY_CHECKING(/Users/remirey/dev/ansible.cfg) = False
RETRY_FILES_ENABLED(/Users/remirey/dev/ansible.cfg) = False
```
##### OS / ENVIRONMENT
macOS

##### STEPS TO REPRODUCE

Run any playbook with the following setion in ansible.cfg

```
[callback_grafana_annotations]
grafana_url = "https://<grafana_url_with_invalid_cert>/api/annotations"
validate_grafana_certs = false
```


##### EXPECTED RESULTS

No error reported about the certificate.

##### ACTUAL RESULTS

```
 [ERROR]: Could not submit message to Grafana: Failed to validate the SSL certificate for <grafana_url_with_invalid_cert>:443. Make sure your managed systems have a valid CA certificate installed.
You can use validate_certs=False if you do not need to confirm the servers identity but this is unsafe and not recommended. Paths checked for this platform: /etc/ssl/certs, /etc/ansible,
/usr/local/etc/openssl. The exception msg was: hostname u'<grafana_url_with_invalid_cert>' doesn't match '<any_domain>'.
```



Discussion:
The `validate_grafana_certs` parameter is not typed as a `bool` in the DOCUMENTATION yaml.
resolved_by_pr #42318 

Resolving patch:
diff --git a/lib/ansible/plugins/callback/grafana_annotations.py b/lib/ansible/plugins/callback/grafana_annotations.py
--- a/lib/ansible/plugins/callback/grafana_annotations.py
+++ b/lib/ansible/plugins/callback/grafana_annotations.py
@@ -48,13 +48,14 @@
           - section: callback_grafana_annotations
             key: grafana_url
       validate_grafana_certs:
-        description: (bool) validate the SSL certificate of the Grafana server. (For HTTPS url)
+        description: validate the SSL certificate of the Grafana server. (For HTTPS url)
         env:
           - name: GRAFANA_VALIDATE_CERT
         ini:
           - section: callback_grafana_annotations
             key: validate_grafana_certs
         default: True
+        type: bool
       http_agent:
         description: The HTTP 'User-agent' value to set in HTTP requets.
         env:


Test patch: