On Tue, May 07, 2019 at 03:17:40PM +0200, Andrea Bolognani wrote:
Instead of hardcoding the name of the package manager in
commands, use the value obtained from the inventory.
In some cases this is necessary, eg. when RPM-based
distributions are involved; for most other cases we could
get away with keepking the hardcoded names, but it's better
to be completely consistent to hopefully avoid usage of the
wrong package manager slipping with further changes.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
guests/lcitool | 40 +++++++++++----------
guests/playbooks/update/tasks/base.yml | 12 +++----
guests/playbooks/update/tasks/bootstrap.yml | 16 ++-------
3 files changed, 29 insertions(+), 39 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange(a)redhat.com>
- name: Bootstrap Ansible
- raw: 'yum install -y {{ python }}'
- when:
- - package_format == 'rpm'
-
-- name: Bootstrap Ansible
- raw: 'apt-get install -y {{ python }}'
- when:
- - package_format == 'deb'
-
-- name: Bootstrap Ansible
- raw: 'pkg install -y {{ python }}'
- when:
- - package_format == 'pkg'
+ raw: '{{ package_manager }} install -y {{ python }}'
Heh, rather amuzing that all three package managers happen to support
the same "install -y" command syntax.
Regards,
Daniel
--
|:
https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|:
https://libvirt.org -o-
https://fstop138.berrange.com :|
|:
https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|