personal_ansible_desktop_configs icon indicating copy to clipboard operation
personal_ansible_desktop_configs copied to clipboard

maybe a bug?

Open zombiehoffa opened this issue 4 years ago • 2 comments

I notice in your pre_tasks in your main local.yml you update the apt cache and specify when: ansible_distribution in ["Debian", "Ubuntu"]

but in your cleanup tasks you specify ansible_distribution in ["Debian", "Pop!_OS", "Ubuntu"]

So does that mean that if you run this on pop os it won't update your cache for popos or is it smart enough to figure out pop os is apt based and run it anyway? Would popos then be redundant in the cleanup phase?

as a side question, for the arch section will manjaro identify as arch there or should that be specified as one of the distributions in both the pre task and clean up tasks specifically if you want to be able to use these sections with manjaro?

zombiehoffa avatar Dec 29 '20 23:12 zombiehoffa

As far as the absence of Pop!_OS in the ansible_distribution statement and that potentially not running on Pop!_OS hosts, you're sort of correct. The reason I say "sort of", is because Ansible is normally able to tell when a distribution is based on another, and it "should" run. So if Ansible is behaving properly, I shouldn't need to add Pop!_OS in that statement at all and it should still update the cache. However, I added Pop!_OS everywhere because there's a bug in Ansible and it wasn't honoring that. The bug may have been fixed, I haven't had a chance to check. In addition, Pop!_OS usually refreshes the Apt cache in the background anyway, so you can make a solid argument that clarifying it there isn't necessary.

In regards to Manjaro, that's the same logic as Pop!_OS. When Ansible is working correctly, it can tell that Manjaro is based on Arch and both should run. But the issue with that (and it's the same with Pop!_OS) is that there are notable differences between Manjaro and Arch (much in the same way as there is with Pop!_OS and Ubuntu). Both Manjaro and Pop have additional repositories that include packages that exist in one but not the other. For example, the last time I checked, Lutris was available in Pop!_OS repositories but not Ubuntu's. Thus, I often have to clarify one or the other anyway or the job may fail. I felt it was better to call out every distro, even if it's redundant. That way, I'm not overly worried about pointing out each edge-case.

I hope that clears it up for you.

On Tue, Dec 29, 2020 at 6:28 PM zombiehoffa [email protected] wrote:

I notice in your pre_tasks in your main local.yml you update the apt cache and specify when: ansible_distribution in ["Debian", "Ubuntu"]

but in your cleanup tasks you specify ansible_distribution in ["Debian", "Pop!_OS", "Ubuntu"]

So does that mean that if you run this on pop os it won't update your cache for popos or is it smart enough to figure out pop os is apt based and run it anyway? Would popos then be redundant in the cleanup phase?

as a side question, for the arch section will manjaro identify as arch there or should that be specified as one of the distributions in both the pre task and clean up tasks specifically if you want to be able to use these sections with manjaro?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/LearnLinuxTV/personal_ansible_desktop_configs/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABIT3PDG4ABNDWMUFXGZZETSXJQ2VANCNFSM4VNW5YJQ .

LearnLinuxTV avatar Dec 30 '20 14:12 LearnLinuxTV

Howdy!

After trying to figure this out myself I'd recommend using the fact ansible_pkg_mgr.

In my recent experience with ansible [2.9.9 (Ubuntu and Pop!_OS 20.10), 2.9.7 (FreeBSD 12.2), 2.7.7 (Debian 10)], ansible_distribution is specific to the distribution and unfortunately will not be smart enough to do this.

After running ansible -m setup localhost > facts.json on my systems:

  • In Debian and Ubuntu there is a fact ansible_os_family with value "Debian", but at least in Pop!_OS 20.10 the fact holds "Pop!_OS".
  • I see no references to Debian at all in Pop!_OS and the only reference to Ubuntu is buried in ansible_kernel_version.

Here's a quick test of all these fact variables:

- name: Testing Package Cache Refresh
  package:
    update_cache: yes
  when: ansible_os_family == "Debian"

- name: Testing Apt Cache Refresh
  apt: update_cache=yes
  when: ansible_distribution in ["Debian", "Ubuntu"]

- name: Testing Apt Cache Refresh 2
  apt: update_cache=yes
  when: ansible_pkg_mgr == "apt"

Output from Pop!_OS:

TASK [Testing Package Cache Refresh] *******************************************
skipping: [localhost]

TASK [Testing Apt Cache Refresh] ***********************************************
skipping: [localhost]

TASK [Testing Apt Cache Refresh 2] *********************************************
ok: [localhost]

Output from Ubuntu + Debian (both performed identically):

TASK [Testing Package Cache Refresh] *******************************************
ok: [localhost]

TASK [Testing Apt Cache Refresh] ***********************************************
ok: [localhost]

TASK [Testing Apt Cache Refresh 2] *********************************************
ok: [localhost]

I hope this helps! :)

Hype

Hyperling avatar Feb 01 '21 12:02 Hyperling

Closing due to age

LearnLinuxTV avatar Oct 13 '22 15:10 LearnLinuxTV