<def-group>
  <definition class="inventory" id="installed_OS_is_rhcos4" version="1">
    <metadata>
      <title>Red Hat Enterprise Linux CoreOS</title>
      <affected family="unix">
        <platform>multi_platform_all</platform>
      </affected>
      <reference ref_id="cpe:/o:redhat:enterprise_linux_coreos:4" source="CPE" />
      <description>The operating system installed on the system is
      Red Hat Enterprise Linux CoreOS release 4</description>
    </metadata>
    <criteria operator="OR">
      <criteria operator="AND">
        <criterion comment="CoreOS variant" test_ref="test_rhel_coreos_variant" />
        <criterion comment="RHCOS version 4 is installed" test_ref="test_rhcos4" />
      </criteria>
      <criteria operator="AND">
        <criterion comment="RHCOS is installed (ID='rhcos')" test_ref="test_rhcos" />
        <criterion comment="RHEL_VERSION is 8" test_ref="test_rhcos4_rhel8_rhel_version" />
      </criteria>
      <criteria operator="AND">
        <criterion comment="RHCOS is installed (ID='rhcos')" test_ref="test_rhcos" />
        <criterion comment="RHEL_VERSION is 9" test_ref="test_rhcos4_rhel9_rhel_version" />
      </criteria>
      <criteria operator="AND">
        <criterion comment="ID is rhel" test_ref="test_rhel_id" />
        <criterion comment="Major version is 9" test_ref="test_rhel_coreos_version9" />
      </criteria>
      <criteria operator="AND">
        <criterion comment="ID is rhel" test_ref="test_rhel_id" />
        <criterion comment="Major version is 10" test_ref="test_rhel_coreos_version10" />
      </criteria>
    </criteria>
  </definition>

  <ind:textfilecontent54_test check="all" comment="os-release is rhcos" id="test_rhcos" version="1">
    <ind:object object_ref="obj_rhcos" />
    <ind:state state_ref="state_rhcos" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="obj_rhcos" version="1">
    <ind:filepath>/etc/os-release</ind:filepath>
    <ind:pattern operation="pattern match">^ID=&quot;(\w+)&quot;$</ind:pattern>
    <ind:instance operation="greater than or equal" datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>
  <ind:textfilecontent54_state id="state_rhcos" version="1">
    <ind:subexpression operation="pattern match">rhcos</ind:subexpression>
  </ind:textfilecontent54_state>

  <ind:textfilecontent54_test check="all" id="test_rhel_coreos_variant" comment="Check for variant=CoreOS" version="1">
    <ind:object object_ref="obj_rhel_coreos_variant" />
    <ind:state state_ref="state_rhel_coreos_variant" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="obj_rhel_coreos_variant" version="1">
    <ind:filepath>/etc/os-release</ind:filepath>
    <ind:pattern operation="pattern match">^VARIANT_ID=(\S+)$</ind:pattern>
    <ind:instance operation="greater than or equal" datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>
  <ind:textfilecontent54_state id="state_rhel_coreos_variant" version="1">
    <ind:subexpression operation="pattern match">coreos</ind:subexpression>
  </ind:textfilecontent54_state>

  <ind:textfilecontent54_test check="all" id="test_rhel_coreos_version9" comment="Check if VERSION_ID=9.x" version="1">
    <ind:object object_ref="obj_rhel_coreos_version9" />
    <ind:state state_ref="state_rhel_coreos_version9" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="obj_rhel_coreos_version9" version="1">
    <ind:filepath>/etc/os-release</ind:filepath>
    <ind:pattern operation="pattern match">^VERSION_ID=&quot;(\d+\.\d+)&quot;$</ind:pattern>
    <ind:instance operation="greater than or equal" datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>
  <ind:textfilecontent54_state id="state_rhel_coreos_version9" version="1">
    <ind:subexpression operation="pattern match">^9\.</ind:subexpression>
  </ind:textfilecontent54_state>

  <ind:textfilecontent54_test check="all" id="test_rhel_coreos_version10" comment="Check if VERSION_ID=10.x" version="1">
    <ind:object object_ref="obj_rhel_coreos_version10" />
    <ind:state state_ref="state_rhel_coreos_version10" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="obj_rhel_coreos_version10" version="1">
    <ind:filepath>/etc/os-release</ind:filepath>
    <ind:pattern operation="pattern match">^VERSION_ID=&quot;(\d+\.\d+)&quot;$</ind:pattern>
    <ind:instance operation="greater than or equal" datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>
  <ind:textfilecontent54_state id="state_rhel_coreos_version10" version="1">
    <ind:subexpression operation="pattern match">^10\.</ind:subexpression>
  </ind:textfilecontent54_state>


  <ind:textfilecontent54_test check="all" comment="rhcoreos is version 4" id="test_rhcos4" version="1">
    <ind:object object_ref="obj_rhcos4" />
    <ind:state state_ref="state_rhcos4" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="obj_rhcos4" version="1">
    <ind:filepath>/etc/os-release</ind:filepath>
    <ind:pattern operation="pattern match">^OPENSHIFT_VERSION=&quot;(\d)\.\d+&quot;$</ind:pattern>
    <ind:instance operation="greater than or equal" datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>
  <ind:textfilecontent54_state id="state_rhcos4" version="1">
    <ind:subexpression operation="pattern match">4</ind:subexpression>
  </ind:textfilecontent54_state>
</def-group>

<def-group>
  <definition class="inventory" id="installed_OS_is_rhcos4_rhel8" version="1">
    <metadata>
      <title>Red Hat Enterprise Linux CoreOS RHEL8 Based</title>
      <affected family="unix">
        <platform>multi_platform_all</platform>
      </affected>
      <reference ref_id="cpe:/o:redhat:rhcos4:8" source="CPE" />
      <description>The operating system installed on the system is
      Red Hat Enterprise Linux CoreOS RHEL8 Based</description>
    </metadata>
    <criteria operator="AND" comment="Old format: ID=rhcos with RHEL_VERSION=8.x">
      <criterion comment="ID is rhcos" test_ref="test_rhcos" />
      <criterion comment="RHEL_VERSION is 8" test_ref="test_rhcos4_rhel8_rhel_version" />
    </criteria>
  </definition>

  <ind:textfilecontent54_test check="all" comment="rhcoreos RHEL_VERSION is 8 (old format)" id="test_rhcos4_rhel8_rhel_version" version="1">
    <ind:object object_ref="obj_rhcos4_rhel8_rhel_version" />
    <ind:state state_ref="state_rhcos4_rhel8_rhel_version" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="obj_rhcos4_rhel8_rhel_version" version="1">
    <ind:filepath>/etc/os-release</ind:filepath>
    <ind:pattern operation="pattern match">^RHEL_VERSION=&quot;?(\d+\.?\d*)&quot;?$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>
  <ind:textfilecontent54_state id="state_rhcos4_rhel8_rhel_version" version="1">
    <ind:subexpression operation="pattern match">^8\.</ind:subexpression>
  </ind:textfilecontent54_state>
</def-group>

<def-group>
  <definition class="inventory" id="installed_OS_is_rhcos4_rhel9" version="1">
    <metadata>
      <title>Red Hat Enterprise Linux CoreOS RHEL9 Based</title>
      <affected family="unix">
        <platform>multi_platform_all</platform>
      </affected>
      <reference ref_id="cpe:/o:redhat:rhcos4:9" source="CPE" />
      <description>The operating system installed on the system is
      Red Hat Enterprise Linux CoreOS RHEL9 Based</description>
    </metadata>
    <criteria operator="OR">
      <criteria operator="AND" comment="Old format: ID=rhcos with RHEL_VERSION=9.x">
        <criterion comment="ID is rhcos" test_ref="test_rhcos" />
        <criterion comment="RHEL_VERSION is 9" test_ref="test_rhcos4_rhel9_rhel_version" />
      </criteria>
      <criteria operator="AND" comment="New format: ID=rhel with VERSION_ID=9.x">
        <criterion comment="ID is rhel" test_ref="test_rhel_id" />
        <criterion comment="CoreOS variant" test_ref="test_rhel_coreos_variant" />
        <criterion comment="VERSION_ID is 9.x" test_ref="test_rhel_coreos_version9" />
      </criteria>
    </criteria>
  </definition>

  <ind:textfilecontent54_test check="all" comment="ID is rhel" id="test_rhel_id" version="1">
    <ind:object object_ref="obj_rhel_id" />
    <ind:state state_ref="state_rhel_id" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="obj_rhel_id" version="1">
    <ind:filepath>/etc/os-release</ind:filepath>
    <ind:pattern operation="pattern match">^ID=&quot;(\w+)&quot;$</ind:pattern>
    <ind:instance operation="greater than or equal" datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>
  <ind:textfilecontent54_state id="state_rhel_id" version="1">
    <ind:subexpression operation="pattern match">rhel</ind:subexpression>
  </ind:textfilecontent54_state>

  <ind:textfilecontent54_test check="all" comment="rhcoreos RHEL_VERSION is 9 (old format)" id="test_rhcos4_rhel9_rhel_version" version="1">
    <ind:object object_ref="obj_rhcos4_rhel9_rhel_version" />
    <ind:state state_ref="state_rhcos4_rhel9_rhel_version" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="obj_rhcos4_rhel9_rhel_version" version="1">
    <ind:filepath>/etc/os-release</ind:filepath>
    <ind:pattern operation="pattern match">^RHEL_VERSION=&quot;?(\d+\.?\d*)&quot;?$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>
  <ind:textfilecontent54_state id="state_rhcos4_rhel9_rhel_version" version="1">
    <ind:subexpression operation="pattern match">^9\.</ind:subexpression>
  </ind:textfilecontent54_state>
</def-group>

<def-group>
  <definition class="inventory" id="installed_OS_is_rhcos4_rhel10" version="1">
    <metadata>
      <title>Red Hat Enterprise Linux CoreOS RHEL10 Based</title>
      <affected family="unix">
        <platform>multi_platform_all</platform>
      </affected>
      <reference ref_id="cpe:/o:redhat:rhcos4:10" source="CPE" />
      <description>The operating system installed on the system is
      Red Hat Enterprise Linux CoreOS RHEL10 Based</description>
    </metadata>
    <criteria operator="AND">
      <criterion comment="ID is rhel" test_ref="test_rhel_id" />
      <criterion comment="CoreOS variant" test_ref="test_rhel_coreos_variant" />
      <criterion comment="VERSION_ID is 10.x" test_ref="test_rhel_coreos_version10" />
    </criteria>
  </definition>
</def-group>
