arijit rakshit
arijit rakshit

Reputation: 137

How to download a rpm from s3 bucket and install using ansible plabook?

I have a rpm file kept in my aws s3 bucket. What I need is to download the file from s3 and install that package. All of these tasks need to be done by an ansible playbook.

Using the get_url ansible module I can download from s3 but how do I install the package ?

Upvotes: 1

Views: 1857

Answers (1)

Zeitounator
Zeitounator

Reputation: 44760

You simply use the ansible yum module and provide the full path to your rpm for the name parameter. You can actually do better and install the package in a single step if you provide the url directly (rather than downloading it in a separate task).

Quoting the doc for name:

You can also pass a url or a local path to a rpm file (using state=present).

Sample tasks:

- name: Install my remote package from uri directly
  yum:
    name: https://my.server.com/path/to/package.rpm
    state: present

- name: Install my package from a file on server
  yum:
    name: /path/to/my/package.rpm
    state: present

Upvotes: 1

Related Questions