Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yum module, add downloadonly and downloaddir options #24004

Closed
aroundthecode opened this issue Apr 26, 2017 · 13 comments · Fixed by #53171
Closed

Yum module, add downloadonly and downloaddir options #24004

aroundthecode opened this issue Apr 26, 2017 · 13 comments · Fixed by #53171
Labels
affects_2.4 This issue/PR affects Ansible v2.4 feature This issue/PR relates to a feature request. module This issue/PR relates to a module. packaging Packaging category support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@aroundthecode
Copy link

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

yum module

SUMMARY

add parameters to yum module to support downloadonly and downloaddir parameters

from yum install --help

--downloadonly don't update, just download
--downloaddir=DLDIR specifies an alternate directory to store packages

this is quite useful to use yum to download RPM packages once to be installed elsewhere (e.g. subnets with no direct internet access)

@ansibot ansibot added affects_2.4 This issue/PR affects Ansible v2.4 feature_idea module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. labels Apr 26, 2017
@MarkusTeufelberger
Copy link
Contributor

You mean like #23220, just for yum?

@Qalthos Qalthos removed the needs_triage Needs a first human triage before being processed. label Apr 27, 2017
@aroundthecode
Copy link
Author

@MarkusTeufelberger yes, it's quite similar, but my focus is also on the fact that the downloaded packages should not simply be available on the yum local cache (which is the expected behaviour in the linked apt module ticket, or with only the downloadonly parameter) but downloaded on a desired location (the downloaddir parameter) to be easily managed afterwards.

Currently to do this simple step I have to relay on command module or upload bash script simply to add the two extra parameters to the yum command (this parameters afaik cannot be managed via yum configuration via external file, i.e. via conf_file module parameter ).

Probably a more generic "extra_args" to be passed to the yum command like the one available in the PIP module could do this (and many other) tricks.
With the extra_args i could simply invoke the yum module with "present" state including the 2 additional parameter an obtain the very same goal.

@spl
Copy link

spl commented May 1, 2017

Adding the --downloadonly, --downloaddir, and --releasever flags would allow one to use the yum module to do the trick I'm currently using command for, in which I download packages and create a local repository:

- name: Create managed-epel repository configuration
  yum_repository:
    name: managed-epel
    description: Managed EPEL - CentOS-$releasever
    baseurl: "file://{{managed_epel_repository_path}}/"
    gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever
    gpgcheck: yes
    enabled: yes

- name: Create temporary installroot
  shell: mktemp -d
  register: installroot

- name: Download ansible
  command: >
    yum install
      --downloadonly
      --releasever=/
      --installroot={{installroot.stdout}}
      --downloaddir={{managed_epel_repository_path}}
      --disablerepo=*
      --enablerepo=managed-centos-media,epel
      ansible

- name: Update managed-epel repository database
  command: createrepo --update --database {{managed_epel_repository_path}}

Of course, the change check for the --downloadonly option would be to check if the package was successfully downloaded, not if it was installed. (Currently, I do all of the above plus install the packages and check if the packages are installed.)

@ansibot ansibot added the support:core This issue/PR relates to code supported by the Ansible Engineering Team. label Jun 29, 2017
@ansibot
Copy link
Contributor

ansibot commented Jul 18, 2017

1 similar comment
@ansibot
Copy link
Contributor

ansibot commented Jul 18, 2017

@ansibot
Copy link
Contributor

ansibot commented Sep 26, 2017

@ansibot
Copy link
Contributor

ansibot commented Oct 4, 2017

@ansibot ansibot added feature This issue/PR relates to a feature request. and removed feature_idea labels Mar 2, 2018
@ansibot
Copy link
Contributor

ansibot commented Apr 11, 2018

@ansibot
Copy link
Contributor

ansibot commented Aug 18, 2018

@ansibot ansibot added the packaging Packaging category label Feb 17, 2019
@zhelanov
Copy link

+1 for this request.
It might be useful to be able to prepare environment on a machine where ansible installed: just download latest (!) versions of software from rpm repos to copy and install them on managed hosts which don't have (and must not have) access to that repos

@maxamillion
Copy link
Contributor

FWIW I'm on board with the change but I don't see myself being able to prioritize it anytime soon. If anyone would like to contribute a pull request, I would be happy to review.

@dglinder
Copy link
Contributor

dglinder commented May 31, 2019

For those like me who keep getting this page in their searches, in Ansible 2.7 the download_only: option has been added, and in 2.8 the download_dir: option was added:
https://docs.ansible.com/ansible/2.8/modules/yum_module.html

@MarkusTeufelberger
Copy link
Contributor

And for everyone else in the future: https://docs.ansible.com/ansible/latest/modules/yum_module.html

@ansible ansible locked and limited conversation to collaborators Jul 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.4 This issue/PR affects Ansible v2.4 feature This issue/PR relates to a feature request. module This issue/PR relates to a module. packaging Packaging category support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants