Cfengine: Installing Xrootd with cfengine

From GridPP Wiki
Jump to: navigation, search

cf.xrootd-package

All nodes at manchester will get this package, as it provides the binaries and also users.

######################################################################
#
# This is the file to install the xrootd package
#
######################################################################
packages:
        xrootd action=install
copy:   
        ${master_cfinput}/all-nodes/xrootd.sh dest=/etc/profile.d/xrootd.sh
                                mode=0755 o=root g=root server=${policyhost}
        ${master_cfinput}/all-nodes/xrootd.csh dest=/etc/profile.d/xrootd.csh
                                mode=0755 o=root g=root server=${policyhost}
editfiles:
        {
                /etc/passwd
                DeleteLinesMatching "xrootd:x:101:101:xRoot Daemon:/opt/xrootd/:/bin/bash"
                AppendIfNoSuchLine "xrootd:x:105:105:xRoot Daemon:/opt/xrootd/:/bin/bash"
        }
        {
                /etc/shadow
                AppendIfNoSuchLine "xrootd:!!:13300:0:99999:7:::"
                DeleteLinesMatching "xrootd:!!:13299:0:99999:7:::"
        }
        {
                /etc/group
                DeleteLinesMatching "xrootd:x:101:"
                AppendIfNoSuchLine "xrootd:x:105:"
        }
directories:
        /opt/xrootd  mode=755 owner=105 group=105
        /opt/xrootd/logs/  mode=755 owner=105 group=105
files:  
        /opt/xrootd  owner=105 group=105 action=fixall recurse=inf

cf.xrootd

The use of <action>.<class> deserves a mention here as it's quite unusual, more documentation on this will be available at a later date. Essentially, for a given action, define the class and then run the action section. This is useful for forcing some actions to happen in a different order, or even be repeated. For example, with the file below, we must have the /usr/local/bin/access file before we try and start xrootd. so we append processes.xrootd_process to the end of the actionsequence.

######################################################################
#
# This is the file to manage the xrootd installation
#
######################################################################
classes:
        xrootd = ( bohr_nodes xrootd01 ) #nodes to install the xrootd daemon on
control:
        actionsequence = ( packages directories copy links shellcommands.xootd_shell  processes.xrootd_process )
        AddInstallable = ( new_xrootd_conf xrootd_process )

copy:   
        xrootd::
                ${master_cfinput}/all-nodes/StartXRD.cf dest=/opt/xrootd/etc/StartXRD.cf
                                mode=0644 o=xrootd g=xrootd server=${policyhost}
                ${master_cfinput}/all-nodes/StartOLB.cf dest=/opt/xrootd/etc/StartOLB.cf
                                mode=0644 o=xrootd g=xrootd server=${policyhost}
                ${master_cfinput}/all-nodes/xrootd-init dest=/etc/rc.d/init.d/xrootd
                                mode=0744 o=root g=root server=${policyhost}
                ${master_cfinput}/all-nodes/xrootd-init dest=/etc/rc.d/init.d/olbd
                                mode=0744 o=root g=root server=${policyhost}

        xrootd.(bohr_nodes_set1|xrootd01)::
                ${master_cfinput}/ce01-cluster/ce01-xrootd.conf   dest=/etc/xrootd.conf
                                mode=0644 o=root g=root server=${policyhost} backup=true define=new_xrootd_conf

processes:
        xrootd_process.xrootd::
                "xrootd -l /opt/xrootd/logs//olbdlog -c /etc/xrootd.conf"       restart "/etc/init.d/xrootd restart && /etc/init.d/olbd restart"
                "olbd -l /opt/xrootd/logs//olbdlog -c /etc/xrootd.conf"         restart "/etc/init.d/olbd restart"
files:  
        /data1  owner=105 group=105 action=fixall recurse=inf
        /tmp m=1777 action=fixall
        /usr/local/bin/access    mode=700 owner=105 group=105 action=touch
links:  
        /opt/xrootd/etc/xrootd.conf -> /etc/xrootd.conf
shellcommands:
        xroot_shell.new_xrootd_conf::
                "/etc/init.d/xrootd restart && /etc/init.d/olbd restart"