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

Upload multiple rpms with content_upload #1678

Closed
VfBfoerst opened this issue Oct 23, 2023 · 2 comments
Closed

Upload multiple rpms with content_upload #1678

VfBfoerst opened this issue Oct 23, 2023 · 2 comments

Comments

@VfBfoerst
Copy link

SUMMARY

Hi :}
Our foreman can't reach our internal repo-server, therefore we cannot sync the repository with repo-discovery. We need to upload all RPMs using the content_upload module. Since we have a lot of rpms, it would be nice if we could upload all rpms in a given directory, for example:

[...]
  src: /given/directory/*.rpms
[...]

At the moment, the playbook fails if I try to upload multiple rpms:

[...]
[Errno 2] No such file or directory: b'/home/ansible/customrpms/*.rpm'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
[...]

Uploading a single rpm succeeds.
Or is there already a way I haven't found yet? :)

Thank you very much!

ISSUE TYPE
  • Feature Idea
@evgeni
Copy link
Member

evgeni commented Oct 24, 2023

Hi,

well, honestly, I think the correct fix is to fix your network to make Foreman be able to access the repo-server?

But failing that, you can use with_fileglob Ansible loop:

- name: "Upload packages"
  theforeman.foreman.content_upload:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    src: "{{ item }}"
    repository: "Build RPMs"
    product: "My Product"
    organization: "Default Organization"
  with_fileglob:
    - "/srv/rpms/*.rpm"

@VfBfoerst
Copy link
Author

Hi :} ,

I didn't know the with_fileglob ansible loop, thank you very much! This can be the workaround for our "problem", i guess, since we do not want to make the repo-server reachable to ensure security.
Thanks :}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants