digitalis-io / k3s-on-prem-production

Playbooks needed to set up an on-premises K3s cluster and securize it
Apache License 2.0
157 stars 45 forks source link

RHEL only? #4

Closed aldycool closed 2 years ago

aldycool commented 2 years ago

Hi,

I haven't read all of the Ansible tasks, but I'm currently using Ubuntu distros for the nodes, and fixing here and there for the difference in packages (such as replacing crond with cron, audit with auditd, and so on). I'm beginning to wonder, or maybe it is mentioned somewhere in the README, is it tested / meant for CentOS only? I gave up at the error: "Update Grub and Initramfs /RedHat". Thanks.

89luca89 commented 2 years ago

Hi @aldycool

I think it is written in the blog post that is based on this project that it has been tested on CentOS but it should work on Debian family distros too

Anyway, using host_vars you can override the package names, just override

aide_package: 'aide'
auditd_package: 'audit'
modprobe_package: 'kmod'

with whatever is the package name variation


For the update grub part, the code supports both

- name: Update Grub and Initramfs /RedHat
  command: '{{ item }}'
  with_items:
    - 'grub2-mkconfig -o /boot/grub2/grub.cfg'
    - 'dracut --force --regenerate-all -v'
  when:
    - grub_setup_1.changed or grub_setup_2.changed or package_update.changed
    - ansible_os_family == "RedHat"

- name: Update Grub and Initramfs /Debian
  command: '{{ item }}'
  with_items:
    - 'update-grub'
  when:
    - grub_setup_1.changed or grub_setup_2.changed or package_update.changed
    - ansible_os_family == "Debian"

So either it's not picking up the ansible_os_family correctly or I'm not really sure what else is happening.

Let me know if overriding the host_vars fixes your problem :smile:

aldycool commented 2 years ago

Hi @89luca89 ,

It turns out that the ansible_os_family gets picked up with the right value ("Debian"), ONLY IF I restore all of the VMs to fresh start. If I'm continuing from some errors, then the ansible_os_family is not correct. This means, some of the tasks I think is not re-entrant. I'll see if I found which tasks get skipped that made the ansible_os_family incorrect. Thanks for your help.

89luca89 commented 2 years ago

Cool thank you!