Installing yum with Cfengine

From Cfwiki

Jump to: navigation, search

Here's a snippet to make sure that yum is installed. Thanks to wilco for the tip!

control:
   actionsequence  = ( copy packages shellcommands )
   Split           = ( | )
   yum_base_url    = ( http://yumserver.example.com/yum/ )

   redhat::
       rpm_bin     = ( /bin/rpm )

   redhat_7_3::
       yum_conf    = ( yum.conf.rh73 )
       yum_rpm     = ( yum-1.0.3-6.0.7.x.legacy.noarch.rpm )
       rpm_python_rpm = ( rpm-python-4.0.4-7x.18.i386.rpm )

   redhat_es_3::
       yum_conf    = ( yum.conf.rhes3 )
       yum_rpm     = ( yum-2.0.6-1.nac.0.noarch.rpm )

copy:
   ${configroot}/global/etc/$(yum_conf) dest=/etc/yum.conf
       server=${cfengine_server} owner=root group=root mode=0644
       type=checksum

packages:
       yum pkgmgr=rpm elsedefine=needs_yum

shellcommands:
   redhat_7_3.needs_yum::
        "$(rpm_bin) -Uvh $(yum_base_url)/pub/redhat/linux/7.3/en/os/i386/RedHat/RPMS/$(rpm_python_rpm)"   
        "$(rpm_bin) -Uvh $(yum_base_url)/pub/redhat/linux/7.3/en/os/legacy-utils/$(yum_rpm)"

   redhat_es_3.needs_yum::
       "$(rpm_bin) -Uvh $(yum_base_url)/nakedape/rhes3/rpm/yum/$(yum_rpm)"



caveat: if you don't include the Split above, the yum_base_url is treated as a list of 2 items. (Presumably because of the ':' in the url. -Ed)

Personal tools