I am completely new to ansible this is my second day working with ansible, What I'm ultimately trying to do is configure a kubernetes cluster which has a master node and one worker node. But my problem is I've been asked to add an apt-key without using a hardcoded url. So I have an ansible playbook called kube-repos.yml which is as follows:
- hosts: all
become: yes
tasks:
- name: add Kubernetes apt-key
apt_key:
url: "https://packages.cloud.google.com/apt/doc/apt-key.gpg"
state: present
- name: add Kubernetes' APT repository
apt_repository:
repo: deb http://apt.kubernetes.io/ kubernetes-xenial main
state: present
where I add the apt-key I need to use another method to add the apt-key where it needs to be defined per-host. If anyone knows of other ways of adding an apt-key I would really like to hear them so I can look further into alternate ways of adding an apt-key. Thanks in advanced for any help or points in the right direction.