Here's the play I've tried:

- hosts: eliza
  tags:
    - grafana
  roles:
    - role: service_restart

  tasks:
    - name: Add grafana repository
      yum_repository:
        name: grafana
        description: grafana
        baseurl: https://packagecloud.io/grafana/stable/el/6/$basearch
        gpgcheck: True
        repo_gpgcheck: True
        gpgkey: https://packagecloud.io/gpg.key 
https://grafanarel.s3.amazonaws.com/RPM-GPG-KEY-grafana
        sslcacert: /etc/pki/tls/certs/ca-bundle.crt

    - rpm_key:
        state: present
        key: "{{ item }}"
      with_items:
        - https://packagecloud.io/gpg.key
        - https://grafanarel.s3.amazonaws.com/RPM-GPG-KEY-grafana

    - name: Install grafana
      package:
        name: grafana


This results is:
[vagrant@jolly ansible-repo]$ ./run-ansible-vagrant 
playbooks/prometheus/grafana.yml

PLAY [eliza] 
*******************************************************************

TASK [setup] 
*******************************************************************
ok: [eliza]

TASK [Add grafana repository] 
**************************************************
changed: [eliza]

TASK [rpm_key] 
*****************************************************************
changed: [eliza] => (item=https://packagecloud.io/gpg.key)
changed: [eliza] => 
(item=https://grafanarel.s3.amazonaws.com/RPM-GPG-KEY-grafana)

TASK [Install grafana] 
*********************************************************
fatal: [eliza]: FAILED! => {"changed": false, "failed": true, "msg": 
"Failure talking to yum: failure: repodata/repomd.xml from grafana: [Errno 
256] No more mirrors to 
try.\nhttps://packagecloud.io/grafana/stable/el/6/x86_64/repodata/repomd.xml: 
[Errno -1] repomd.xml signature could not be verified for grafana"}

NO MORE HOSTS LEFT 
*************************************************************

PLAY RECAP 
*********************************************************************
eliza                      : ok=3    changed=2    unreachable=0    failed=1

[vagrant@jolly ansible-repo]$

If I run 'yum -y install grafana' it works and accepts the gpg keys.  How 
am I supposed to do this correctly in ansible?

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ac3efe4c-391a-4f30-b1c9-1d1dd5cc1162%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to