Proper way to do a yum update

Hi,
What is the proper way to do this?

action: yum name=update state=latest

Do I need to use the command action?

Thanks,
James

Hi,
What is the proper way to do this?

action: yum name=update state=latest

To update a package named “update”? Exactly like you have it.

Assuming you mean update everything though.

Do I need to use the command action?

Yes, but I would just update the packages you want updated, that way you have a more explicit configuration than updating whatever everyone may have installed.

Hi,
I want to just do a yum update, to update a machine that has been just
provisioned. But it seems to fail. I think I'm having trouble with
the yum action:

TASK: [Make sure gcc is up to date] *********************
failed: [cl401.example.net] => {"changed": false, "failed": true,
"item": "", "module": "yum", "msg": "No Package matching 'gcc' found
available, installed or updated", "rc": 0, "results": ""}

This is in my yml file:

  - name: Make sure gcc is up to date
    action: yum name=gcc state=latest

  - name: Make sure ntpd is up to date
    action: yum name=ntpd state=latest

  - name: Make sure the system is up to date
    action: yum name=update state=latest

Is this correct?

James

Hi,
I want to just do a yum update, to update a machine that has been just
provisioned. But it seems to fail. I think I’m having trouble with
the yum action:

TASK: [Make sure gcc is up to date] *********************
failed: [cl401.example.net] => {“changed”: false, “failed”: true,
“item”: “”, “module”: “yum”, “msg”: “No Package matching ‘gcc’ found
available, installed or updated”, “rc”: 0, “results”: “”}

This is in my yml file:

  • name: Make sure gcc is up to date
    action: yum name=gcc state=latest

Can you install a package named gcc with yum on the command line on this system? If not, it’s not available to you.

If you can, we have some other problem with the yum module and I guess it matters if you’re using RHN and what repos you are using and lots of other things.

Off topic, but you might as well use “with_items” here too.

  • name: Make sure ntpd is up to date
    action: yum name=ntpd state=latest

  • name: Make sure the system is up to date
    action: yum name=update state=latest

I feel like I’m repeating myself here, this last statement is definitely not correct, and you need to use the command module for that.

I hope this is helpful, I logged into the machine and did a sudo su -

[root@cl401 ~]# yum install gcc
Loaded plugins: dellsysid, fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.kernel.org
* extras: mirror.stanford.edu
* updates: mirror.5ninesolutions.com
Setting up Install Process
Package gcc-4.1.2-52.el5_8.1.x86_64 already installed and latest version
Nothing to do

So its already installed and the latest version, do I need to provide
any other information?

Thanks,
James

What version of Ansible? Is this still 0.5?

If you are not using the latest git, please try with that and let us know.

can you check if you have yum-utils installed on that system?

rpm -q yum-utils

if not then:
1. you need to install it
2. you should update your checkout of ansible as a check for that has been pushed to there.

-sv

Hi,
I'm running:
sheepchase:CitrusLeaf jmarcus$ ansible --version
ansible 0.6

Without updating ansible I was able to manually install yum-utils and
then I was able to successfully run the gcc and ntp installs. In the
future should I install yum-utils with the raw command?

Thanks for the help.

James

The yum module should have yelled at you and given you a better error, though we would generally expect yum-utils to be part of @base in kickstart, per conversation in IRC.

If that’s not true, I’m generally of the opinion that if doing a package install and it needs it, we should try to ask yum to install yum-utils rather than get into an awkward bootstrapping case, but it seems
to be true that it’s in @base. (yes?)

If you're using ansible from more recently than a 4 day old checkout the yum module should error out if you do not have repoquery installed:

https://github.com/ansible/ansible/commit/fd492bebc6e544745bd0a85f2b069b7e54abfe75

make sure you're on the latest checkout of ansible.

thanks
-sv

From IRC discussion, it seems you may be running from an old git checkout.

Please update first, remove gcc and yum-utils, and try installing with ansible again to see if you get a better message.

The answer to this is:

yum: name=* state=latest