I need to complete one of the kubeadm installation steps which include the following commands on a centos machine
yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
I need to perform this via an Ansible automation script and I have not been able to figure out which way to correctly implement this step I tried
- name: Install these packages - kubelet kubeadm kubectl
yum:
name: "{{ packages }}"
vars:
packages:
- kubelet
- kubeadm
- kubectl
state: latest
disable_excludes: repoid
disablerepo: kubernetes
become: yes
become_user: root
And i got the following output :
TASK [Install these packages - kubelet kubeadm kubectl] *****************************************************************************************************
fatal: [k8s-head]: FAILED! => {"ansible_facts": {"pkg_mgr": "yum"}, "changed": false, "msg": "Failure talking to yum: failure: repodata/repomd.xml from kubernetes: [Errno 256] No more mirrors to try.\nhttps://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64/repodata/repomd.xml: [Errno -1] repomd.xml signature could not be verified for kubernetes"}
fatal: [k8s-node-1]: FAILED! => {"ansible_facts": {"pkg_mgr": "yum"}, "changed": false, "msg": "Failure talking to yum: failure: repodata/repomd.xml from kubernetes: [Errno 256] No more mirrors to try.\nhttps://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64/repodata/repomd.xml: [Errno -1] repomd.xml signature could not be verified for kubernetes"}
I know I am doing this wrong but I do not understand if I am supposed to use yum.conf file to rectify it or use any other option from the yum module to disable_exclude Kubernetes. I can always use the shell module but I want to keep it as a last resort.
EDIT : TRIED INDENTATION Disclaimer this worked but is not a solution. So i corrected my identation and tried the ansible script as following
- name: Install these packages - kubelet kubeadm kubectl
yum:
name: "{{ packages }}"
state: latest
disable_excludes: all
exclude: kubernetes
vars:
packages:
- kubelet
- kubeadm
- kubectl
become: yes
become_user: root
I still am not sure if that is the correct way to implement the following commands
yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
but my packages are getting installed without an error so it does the job that i want it to do for now.