Hey, I'd recommend you read fully through the 'Getting Started <http://docs.ansible.com/ansible/intro_getting_started.html>' guide, and carry on reading through the other docs - reading these and implementing/playing with what they teach is the quickest, most efficient way to learn.
That said, if the RPMs you're talking about are hosted in a repository, you can use the 'yum' module (or 'package', if you're running Ansible 2.0 - not yet released). See here <http://docs.ansible.com/ansible/yum_module.html> for the yum modules documentation, it has a 'state' value. Setting this to 'latest' would do what you're wanting to achieve, like so: - name: Ensure packages are installed and the latest available version yum: name=some_package state=latest Or, for a list of packages: - name: Ensure packages are installed and the latest available version yum: name="{{ item }}" state=latest with_items: - some_package - some_other_package - a_third_package This example shows iterating over a list of values, using 'with_items'. <http://docs.ansible.com/ansible/playbooks_loops.html> Hope this helps - make sure you read through the docs and try and learn these things yourself :) Kind Regards, Calum On Tuesday, 15 December 2015 04:40:52 UTC, 张斌 wrote: > > > hi, > > i'm new to ansible. i want to install a list of RPMs, and upgrade if > already installed, otherwise just install it. > > How to do this with ansible? > > Thanks > On Tuesday, 15 December 2015 04:40:52 UTC, 张斌 wrote: > > > hi, > > i'm new to ansible. i want to install a list of RPMs, and upgrade if > already installed, otherwise just install it. > > How to do this with ansible? > > Thanks > -- 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-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/182e5274-0ec5-4693-805c-dc5b0f451791%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.