Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oracle Linux Distribution not identified correctly #239

Closed
BillSkiCO opened this issue Dec 1, 2023 · 0 comments · Fixed by #253
Closed

Oracle Linux Distribution not identified correctly #239

BillSkiCO opened this issue Dec 1, 2023 · 0 comments · Fixed by #253

Comments

@BillSkiCO
Copy link
Contributor

BillSkiCO commented Dec 1, 2023

Environment
Project Version: latest
Ansible Version: latest
OS: Oracle Linux 8.8

Identified in the prelim task

  • ansible_distribution variable for Oracle Linux is OracleLinux (no space). See ansible/lib/ansible/module_utils/facts/system/distribution.py ODIST_LIST
  • prelim task is checking for Oracle Linux (with a space in distribution name)
      - name: "PRELIM | set fact if UEFI boot | Oracle Linux"
        ansible.builtin.set_fact:
            rhel8stig_bootloader_path: /boot/efi/EFI/redhat
            rhel8stig_legacy_boot: false
        when:
            - rhel8_efi_boot.stat.exists
            - ansible_distribution == 'Oracle Linux'    # <-- Here

This causes a downstream failure of the make grub2 config handler as the rhel8stig_bootloader_path for Oracle Linux is interpreted as /boot/efi/EFI/oraclelinux/ instead of /boot/efi/EFI/redhat which causes the make grub2 config to fail.

- name: make grub2 config
  ansible.builtin.shell: /usr/sbin/grub2-mkconfig --output={{ rhel8stig_bootloader_path }}/grub.cfg
  when:
      - rhel8stig_grub2_user_cfg.stat.exists
      - not rhel8stig_skip_for_travis
      - not system_is_container

Error Observed:

FAILED! => {"changed": true, "cmd": "/usr/sbin/grub2-mkconfig --output=/boot/efi/EFI/oraclelinux/grub.cfg", 
"delta": "0:00:20.741084", "end": "2023-11-29 08:32:42.667555",
"msg": "non-zero return code", "rc": 1, "start": "2023-11-29 08:32:21.926471",
"stderr": "/usr/sbin/grub2-mkconfig: line 274: /boot/efi/EFI/oraclelinux/grub.cfg.new: No such file or directory",
"stderr_lines": ["/usr/sbin/grub2-mkconfig: line 274: /boot/efi/EFI/oraclelinux/grub.cfg.new: No such file or directory"],
"stdout": "", "stdout_lines": []}

Proposed fix
Change ansible_distribuition check to OracleLinux in prelim.yml

      - name: "PRELIM | set fact if UEFI boot | Oracle Linux"
        ansible.builtin.set_fact:
            rhel8stig_bootloader_path: /boot/efi/EFI/redhat
            rhel8stig_legacy_boot: false
        when:
            - rhel8_efi_boot.stat.exists
            - ansible_distribution == 'OracleLinux'
BillSkiCO added a commit to BillSkiCO/RHEL8-STIG that referenced this issue Feb 2, 2024
Update prelim.yml
Addressing Oracle Linux distribution identification issue ansible-lockdown#239

Signed-off-by: William Golembieski <william@armoryanalytics.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant