I want install all packages from my repo, I can't repeat this command:

yum repo-pkgs reponame install

in Ansible playbook.

All what i found it: example how install one package or list of know packages:

- name: upgrade all packagesyum: name=* state=latest

not work: write all packages installed -but it not right

1

Best Answer


As the documentation suggests, the following task will update all already installed packages, not install available ones:

- name: upgrade all packagesyum: name: '*'state: latest

To achieve what you want, you need first to register the list of packages returned by your first command:

- name: gather list of packages availableshell: yum repo-pkgs reponame listregister: packages- name: install/upgrade all packagesyum: name: "{{packages.stdout_lines|join(',')}}"state: latest

Disclaimer: this was not tested, so it may need adjusting.