Unable to use 'yum install'

2,690 views
Skip to first unread message

Fabio Gomes Sakiyama

unread,
May 10, 2018, 12:25:36 PM5/10/18
to Ansible Project
Hi,

I'm trying to install kubelet with Ansible, but I'm struggling to do it.


This is my playbook:


---
  - hosts: all
    become: yes
    tasks:
      - name: install docker
        yum:
          name: docker
          state: present
          update_cache: true

      - name: add repo
        yum_repository:
          name: kuberepo
          description: kubernetes-repo
          baseurl: "https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64"
          enabled: yes
          gpgcheck: yes
          repo_gpgcheck: yes
          gpgkey:
            - "https://packages.cloud.google.com/yum/doc/yum-key.gpg"
            - "https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg"

      - name: setenforce
        shell: setenforce 0

      - name: install kubelet
        yum:
          name: kubelet
          state: present
          update_cache: true


This is the error when i run the playbook (ansible-playbook -i hosts kube-dependencies.yml) 


The "ok" from [master] node is because I manually executed "sudo yum install kubelet" on that machine, and it worked.


Conclusions: So basically, manually executing the yum install command it works, but I can't make it work with ansible.


Any clues? What am I doing wrong?


Thanks in advance!


Nick Rogers

unread,
May 10, 2018, 1:05:21 PM5/10/18
to Ansible Project
I would try to `curl https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64/repodata/repomd.xml' from the error on worker1/2 and see if it reports anything more helpful than what you're getting back. Feels like a networking problem to me.

Fabio Gomes Sakiyama

unread,
May 10, 2018, 1:12:58 PM5/10/18
to Ansible Project
Hi Nick, thanks for helping!

the curl executed fine, I didn't mention but my environment is running on google cloud. 
If I enter the worker node and manually execute 'yum install kubelet', it works. But the same command on ansible playbook throws the error i mentioned... :(

Tony Chia

unread,
May 10, 2018, 2:21:17 PM5/10/18
to Ansible Project

Maybe try adding "disable_gpg_check: true" to the "install kuberlet" task? 

Fabio Gomes Sakiyama

unread,
May 10, 2018, 3:58:00 PM5/10/18
to Ansible Project
Hi Tony,

Does it mean that it'll not use the security provided by gpg signatures of the packages?

Jean-Yves LENHOF

unread,
May 10, 2018, 4:02:54 PM5/10/18
to ansible...@googlegroups.com

Hi,

Could you try to add the GPG key with something like this before doing the yum ansible command ?

- name: Add repository key
  rpm_key:
    key: "https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg"

Regards,

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/d20d7fb9-3fb7-4084-8655-950b69a38380%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

js.a

unread,
May 10, 2018, 11:11:46 PM5/10/18
to Ansible Project
Hey Fabio, like Jean-Yves said, try to split up your "Add repo" task in two, key install and package install. Something like this:

- name: add key repo
        rpm_key:
          key: "https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg"
          state: present


- name: add repo
        yum_repository:
          name: kuberepo
          description: kubernetes-repo
          baseurl: "https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64"
          enabled: yes
          gpgcheck: yes
          repo_gpgcheck: yes


-------------------------------------------------

Fabio Gomes Sakiyama

unread,
May 11, 2018, 7:26:32 AM5/11/18
to Ansible Project
Hi Jean/js.a

I splitted up but the error persists. I'm not sure if my playbook is correct though. Here's the splitted playbook.

---
 
- hosts: all
    become
: yes
    tasks
:
     
- name: install docker
        yum
:
          name
: docker
          state
: present
          update_cache
: true


     
- name: add yum key repo
        rpm_key
:
          key
: "https://packages.cloud.google.com/yum/doc/yum-key.gpg"
          state
: present

     
- name: add rpm key repo
        rpm_key
:

          key
: "https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg"
          state
: present

     
- name: add repo
        yum_repository
:
          name
: kuberepo
          description
: kubernetes-repo
          baseurl
: "https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64"
          enabled
: yes
          gpgcheck
: yes
          repo_gpgcheck
: yes

Jean-Yves LENHOF

unread,
May 11, 2018, 7:44:37 AM5/11/18
to ansible...@googlegroups.com

Hi,

Please provide logs to see the exact problem

Perhaps information given by a manual yum could help also...


But looking for your problem I found some related information that could (not sure) let us know that the problem is somewhere else :

https://github.com/kubernetes/kubernetes/issues/37922

https://github.com/kubernetes/kubernetes/issues/60134

Regards,

JY

Fabio Gomes Sakiyama

unread,
May 11, 2018, 8:28:19 AM5/11/18
to Ansible Project
Hi all,

The problem was that the workers needed to be updated with ''yum -y update''. I added the following code to my playbook:

      - name: yum update
        yum
:
          name
: '*'
          state
: latest

Unfortunately I don't know why this solved the problem :(

Thanks for helping!
Reply all
Reply to author
Forward
0 new messages