shiftstack / dev-install

13 stars 16 forks source link

Ignore error if yum/dnf fails on localhost #142

Closed dulek closed 3 years ago

dulek commented 3 years ago

We shouldn't assume the script is run on something having yum/dnf. Let's ignore the error of the task requiring it and assume that user can install it manually if it's not there.

Also it prevents from errors like below when user running the playbook isn't added to wheel group. You can fix it with `sudo gpasswd -a

wheel` BTW. fatal: [standalone]: FAILED! => {"changed": false, "msg": ["Could not detect which major revision of yum is in use, which is required to determine module backend.", "You can manually specify use_backend to tell the module whether to use the yum (yum3) or dnf (yum4) backend})"]}
EmilienM commented 3 years ago

what's your OS ?

dulek commented 3 years ago

Fedora 34 and

ansible 2.9.24
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/mdulko/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.9/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.9.6 (default, Jul 16 2021, 00:00:00) [GCC 11.1.1 20210531 (Red Hat 11.1.1-3)]

@gryf tried with newer Ansible on Gentoo with the same results. Removing the task seems to help.

EmilienM commented 3 years ago

@dulek oh I remember now, you're probably using Silverblue, which is a containerized distro, so you can't use yum/dnf/rpm. Please do not remove this task and make it ignoring errors, with ignore_errors: true. Your system probably have the package installed, but think about systems which don't have it, they'll need it to generate SSL bits.

Thanks

dulek commented 3 years ago

@dulek oh I remember now, you're probably using Silverblue, which is a containerized distro, so you can't use yum/dnf/rpm. Please do not remove this task and make it ignoring errors, with ignore_errors: true. Your system probably have the package installed, but think about systems which don't have it, they'll need it to generate SSL bits.

Thanks

Ouch, this thing runs on my laptop? I thought it's on the host, I should be able to figure it out locally then! And it explains why it worked for me once.

I use regular Fedora 34, not Silverblue.

dulek commented 3 years ago

Apparently I need to run this in order to fix it: sudo gpasswd -a <laptop-user> wheel.

EmilienM commented 3 years ago

/lgtm

dulek commented 3 years ago

Anyway there's value in adding ignore_errors: true - @gryf uses Gentoo so no yum/dnf there.