Before apt-key
was deprecated, I was using Ansible playbooks to add and update keys in my servers. At the moment, apt-key
no longer updates the keys. In few searches, I found that I need to use gpg
now. However, I have many servers and I don't want to do this manually for each one of them. Is there a way to manage my keyrings with gpg
with Ansible?
Here are my Ansible tasks, with deprecated apt-key
:
- apt_key:
url: "https://packages.treasuredata.com/GPG-KEY-td-agent"
state: present
- apt_repository:
repo: "deb http://packages.treasuredata.com/3/ubuntu/{{ ansible_distribution_release }}/ {{ ansible_distribution_release }} contrib"
state: present
filename: "treasure-data" # Name of the pre-compiled fluentd-agent
I tried apt-key update
but it is not working for me. If a key already exists but it is expired, it doesn't update it anymore.