'\" t .\" Title: crm .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: 03/27/2021 .\" Manual: crmsh documentation .\" Source: crm 4.0.0 .\" Language: English .\" .TH "CRM" "8" "03/27/2021" "crm 4\&.0\&.0" "crmsh documentation" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" crm \- Pacemaker command line interface for configuration and management .SH "SYNOPSIS" .sp \fBcrm\fR [OPTIONS] [SUBCOMMAND ARGS\&...] .SH "DESCRIPTION" .sp The crm shell is a command\-line based cluster configuration and management tool\&. Its goal is to assist as much as possible with the configuration and maintenance of Pacemaker\-based High Availability clusters\&. .sp For more information on Pacemaker itself, see http://clusterlabs\&.org/\&. .sp crm works both as a command\-line tool to be called directly from the system shell, and as an interactive shell with extensive tab completion and help\&. .sp The primary focus of the crm shell is to provide a simplified and consistent interface to Pacemaker, but it also provides tools for managing the creation and configuration of High Availability clusters from scratch\&. To learn more about this aspect of crm, see the cluster section below\&. .sp The crm shell can be used to manage every aspect of configuring and maintaining a cluster\&. It provides a simplified line\-based syntax on top of the XML configuration format used by Pacemaker, commands for starting and stopping resources, tools for exploring the history of a cluster including log scraping and a set of cluster scripts useful for automating the setup and installation of services on the cluster nodes\&. .sp The crm shell is line oriented: every command must start and finish on the same line\&. It is possible to use a continuation character (\e) to write one command in two or more lines\&. The continuation character is commonly used when displaying configurations\&. .SH "OPTIONS" .PP \fB\-f, \-\-file\fR=\fIFILE\fR .RS 4 Load commands from the given file\&. If a dash \- is used in place of a file name, crm will read commands from the shell standard input (stdin)\&. .RE .PP \fB\-c, \-\-cib\fR=\fICIB\fR .RS 4 Start the session using the given shadow CIB file\&. Equivalent to cib use \&. .RE .PP \fB\-D, \-\-display=\fR\fIOUTPUT_TYPE\fR .RS 4 Choose one of the output options: plain, color\-always, color, or uppercase\&. The default is color if the terminal emulation supports colors\&. Otherwise, plain is used\&. .RE .PP \fB\-F, \-\-force\fR .RS 4 Make crm proceed with applying changes where it would normally ask the user to confirm before proceeding\&. This option is mainly useful in scripts, and should be used with care\&. .RE .PP \fB\-w, \-\-wait\fR .RS 4 Make crm wait for the cluster transition to finish (for the changes to take effect) after each processed line\&. .RE .PP \fB\-H, \-\-history\fR=\fIDIR|FILE|SESSION\fR .RS 4 A directory or file containing a cluster report to load into the history commands, or the name of a previously saved history session\&. .RE .PP \fB\-h, \-\-help\fR .RS 4 Print help page\&. .RE .PP \fB\-\-version\fR .RS 4 Print crmsh version and build information (Mercurial Hg changeset hash)\&. .RE .PP \fB\-d, \-\-debug\fR .RS 4 Print verbose debugging information\&. .RE .PP \fB\-R, \-\-regression\-tests\fR .RS 4 Enables extra verbose trace logging used by the regression tests\&. Logs all external calls made by crmsh\&. .RE .PP \fB\-\-scriptdir\fR=\fIDIR\fR .RS 4 Extra directory where crm looks for cluster scripts, or a list of directories separated by semi\-colons (e\&.g\&. /dir1;/dir2;etc\&.)\&. .RE .PP \fB\-o, \-\-opt\fR=\fIOPTION=VALUE\fR .RS 4 Set crmsh option temporarily\&. If the options are saved using options save then the value passed here will also be saved\&. Multiple options can be set by using \-o multiple times\&. .RE .SH "INTRODUCTION" .sp This section of the user guide covers general topics about the user interface and describes some of the features of crmsh in detail\&. .SS "User interface" .sp The main purpose of crmsh is to provide a simple yet powerful interface to the cluster stack\&. There are two main modes of operation with the user interface of crmsh: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Command line (single\-shot) use \- Use crm as a regular UNIX command from your usual shell\&. crm has full bash completion built in, so using it in this manner should be as comfortable and familiar as using any other command\-line tool\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Interactive mode \- By calling crm without arguments, or by calling it with only a sublevel as argument, crm enters the interactive mode\&. In this mode, it acts as its own command shell, which remembers which sublevel you are currently in and allows for rapid and convenient execution of multiple commands within the same sublevel\&. This mode also has full tab completion, as well as built\-in interactive help and syntax highlighting\&. .RE .sp Here are a few examples of using crm both as a command\-line tool and as an interactive shell: .PP \fBCommand line (one-shot) use:\fR. .sp .if n \{\ .RS 4 .\} .nf # crm resource stop www_app .fi .if n \{\ .RE .\} .PP \fBInteractive use:\fR. .sp .if n \{\ .RS 4 .\} .nf # crm crm(live)# resource crm(live)resource# unmanage tetris_1 crm(live)resource# up crm(live)# node standby node4 .fi .if n \{\ .RE .\} .PP \fBCluster configuration:\fR. .sp .if n \{\ .RS 4 .\} .nf # crm configure<, or, if at the top level of the shell, simply typing help will provide an overview of all available levels and commands\&. .sp The (live) string in the crm prompt signifies that the current CIB in use is the cluster live configuration\&. It is also possible to work with so\-called shadow CIBs\&. These are separate, inactive configurations stored in files, that can be applied and thereby replace the live configuration at any time\&. .SS "Tab completion" .sp The crm makes extensive use of tab completion\&. The completion is both static (i\&.e\&. for crm commands) and dynamic\&. The latter takes into account the current status of the cluster or information from installed resource agents\&. Sometimes, completion may also be used to get short help on resource parameters\&. Here are a few examples: .sp .if n \{\ .RS 4 .\} .nf crm(live)resource# bye failcount move restart unmigrate cd help param show unmove cleanup list promote start up demote manage quit status utilization end meta refresh stop exit migrate unmanage crm(live)configure# primitive fence\-1 heartbeat: lsb: ocf: stonith: crm(live)configure# primitive fence\-1 stonith: apcmaster external/ippower9258 fence_legacy apcmastersnmp external/kdumpcheck ibmhmc apcsmart external/libvirt ipmilan crm(live)configure# primitive fence\-1 stonith:ipmilan params auth= hostname= ipaddr= login= password= port= priv= crm(live)configure# primitive fence\-1 stonith:ipmilan params auth= auth* (string) The authorization type of the IPMI session ("none", "straight", "md2", or "md5") .fi .if n \{\ .RE .\} .sp crmsh also comes with bash completion usable directly from the system shell\&. This should be installed automatically with the command itself\&. .SS "Shorthand syntax" .sp When using the crm shell to manage clusters, you will end up typing a lot of commands many times over\&. Clear command names like configure help in understanding and learning to use the cluster shell, but is easy to misspell and is tedious to type repeatedly\&. The interactive mode and tab completion both help with this, but the crm shell also has the ability to understand a variety of shorthand aliases for all of the commands\&. .sp For example, instead of typing crm status, you can type crm st or crm stat\&. Instead of crm configure you can type crm cfg or even crm cf\&. crm resource can be shorted as crm rsc, and so on\&. .sp The exact list of accepted aliases is too long to print in full, but experimentation and typoes should help in discovering more of them\&. .SH "FEATURES" .sp The feature set of crmsh covers a wide range of functionality, and understanding how and when to use the various features of the shell can be difficult\&. This section of the guide describes some of the features and use cases of crmsh in more depth\&. The intention is to provide a deeper understanding of these features, but also to serve as a guide to using them\&. .SS "Shadow CIB usage" .sp A Shadow CIB is a normal cluster configuration stored in a file\&. They may be manipulated in much the same way as the \fIlive\fR CIB, with the key difference that changes to a shadow CIB have no effect on the actual cluster resources\&. An administrator may choose to apply any of them to the cluster, thus replacing the running configuration with the one found in the shadow CIB\&. .sp The crm prompt always contains the name of the configuration which is currently in use, or the string \fIlive\fR if using the live cluster configuration\&. .sp When editing the configuration in the configure level, no changes are actually applied until the commit command is executed\&. It is possible to start editing a configuration as usual, but instead of committing the changes to the active CIB, save them to a shadow CIB\&. .sp The following example configure session demonstrates how this can be done: .sp .if n \{\ .RS 4 .\} .nf crm(live)configure# cib new test\-2 INFO: test\-2 shadow CIB created crm(test\-2)configure# commit .fi .if n \{\ .RE .\} .SS "Configuration semantic checks" .sp Resource definitions may be checked against the meta\-data provided with the resource agents\&. These checks are currently carried out: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} are required parameters set .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} existence of defined parameters .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} timeout values for operations .RE .sp The parameter checks are obvious and need no further explanation\&. Failures in these checks are treated as configuration errors\&. .sp The timeouts for operations should be at least as long as those recommended in the meta\-data\&. Too short timeout values are a common mistake in cluster configurations and, even worse, they often slip through if cluster testing was not thorough\&. Though operation timeouts issues are treated as warnings, make sure that the timeouts are usable in your environment\&. Note also that the values given are just \fIadvisory minimum\fR\-\-\-your resources may require longer timeouts\&. .sp User may tune the frequency of checks and the treatment of errors by the check\-frequency and check\-mode preferences\&. .sp Note that if the check\-frequency is set to always and the check\-mode to strict, errors are not tolerated and such configuration cannot be saved\&. .SS "Configuration templates" \fBDeprecation note\fR .sp Configuration templates have been deprecated in favor of the more capable cluster scripts\&. To learn how to use cluster scripts, see the dedicated documentation on the crmsh website at http://crmsh\&.github\&.io/, or in the Script section\&. .sp Configuration templates are ready made configurations created by cluster experts\&. They are designed in such a way so that users may generate valid cluster configurations with minimum effort\&. If you are new to Pacemaker, templates may be the best way to start\&. .sp We will show here how to create a simple yet functional Apache configuration: .sp .if n \{\ .RS 4 .\} .nf # crm configure crm(live)configure# template crm(live)configure template# list templates apache filesystem virtual\-ip crm(live)configure template# new web apache filesystem virtual\-ip crm(live)configure template# new web apache INFO: pulling in template apache INFO: pulling in template virtual\-ip crm(live)configure template# list web2\-d web2 vip2 web3 vip web .fi .if n \{\ .RE .\} .sp We enter the template level from configure\&. Use the list command to show templates available on the system\&. The new command creates a configuration from the apache template\&. You can use tab completion to pick templates\&. Note that the apache template depends on a virtual IP address which is automatically pulled along\&. The list command shows the just created web configuration, among other configurations (I hope that you, unlike me, will use more sensible and descriptive names)\&. .sp The show command, which displays the resulting configuration, may be used to get an idea about the minimum required changes which have to be done\&. All ERROR messages show the line numbers in which the respective parameters are to be defined: .sp .if n \{\ .RS 4 .\} .nf crm(live)configure template# show ERROR: 23: required parameter ip not set ERROR: 61: required parameter id not set ERROR: 65: required parameter configfile not set crm(live)configure template# edit .fi .if n \{\ .RE .\} .sp The edit command invokes the preferred text editor with the web configuration\&. At the top of the file, the user is advised how to make changes\&. A good template should require from the user to specify only parameters\&. For example, the web configuration we created above has the following required and optional parameters (all parameter lines start with %%): .sp .if n \{\ .RS 4 .\} .nf $ grep \-n ^%% ~/\&.crmconf/web 23:%% ip 31:%% netmask 35:%% lvs_support 61:%% id 65:%% configfile 71:%% options 76:%% envfiles .fi .if n \{\ .RE .\} .sp These lines are the only ones that should be modified\&. Simply append the parameter value at the end of the line\&. For instance, after editing this template, the result could look like this (we used tabs instead of spaces to make the values stand out): .sp .if n \{\ .RS 4 .\} .nf $ grep \-n ^%% ~/\&.crmconf/web 23:%% ip 192\&.168\&.1\&.101 31:%% netmask 35:%% lvs_support 61:%% id websvc 65:%% configfile /etc/apache2/httpd\&.conf 71:%% options 76:%% envfiles .fi .if n \{\ .RE .\} .sp As you can see, the parameter line format is very simple: .sp .if n \{\ .RS 4 .\} .nf %% .fi .if n \{\ .RE .\} .sp After editing the file, use show again to display the configuration: .sp .if n \{\ .RS 4 .\} .nf crm(live)configure template# show primitive virtual\-ip IPaddr \e params ip=192\&.168\&.1\&.101 primitive apache apache \e params configfile="/etc/apache2/httpd\&.conf" monitor apache 120s:60s group websvc \e apache virtual\-ip .fi .if n \{\ .RE .\} .sp The target resource of the apache template is a group which we named websvc in this sample session\&. .sp This configuration looks exactly as you could type it at the configure level\&. The point of templates is to save you some typing\&. It is important, however, to understand the configuration produced\&. .sp Finally, the configuration may be applied to the current crm configuration (note how the configuration changed slightly, though it is still equivalent, after being digested at the configure level): .sp .if n \{\ .RS 4 .\} .nf crm(live)configure template# apply crm(live)configure template# cd \&.\&. crm(live)configure# show node xen\-b node xen\-c primitive apache apache \e params configfile="/etc/apache2/httpd\&.conf" \e op monitor interval=120s timeout=60s primitive virtual\-ip IPaddr \e params ip=192\&.168\&.1\&.101 group websvc apache virtual\-ip .fi .if n \{\ .RE .\} .sp Note that this still does not commit the configuration to the CIB which is used in the shell, either the running one (live) or some shadow CIB\&. For that you still need to execute the commit command\&. .sp To complete our example, we should also define the preferred node to run the service: .sp .if n \{\ .RS 4 .\} .nf crm(live)configure# location websvc\-pref websvc 100: xen\-b .fi .if n \{\ .RE .\} .sp If you are not happy with some resource names which are provided by default, you can rename them now: .sp .if n \{\ .RS 4 .\} .nf crm(live)configure# rename virtual\-ip intranet\-ip crm(live)configure# show node xen\-b node xen\-c primitive apache apache \e params configfile="/etc/apache2/httpd\&.conf" \e op monitor interval=120s timeout=60s primitive intranet\-ip IPaddr \e params ip=192\&.168\&.1\&.101 group websvc apache intranet\-ip location websvc\-pref websvc 100: xen\-b .fi .if n \{\ .RE .\} .sp To summarize, working with templates typically consists of the following steps: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} new: create a new configuration from templates .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} edit: define parameters, at least the required ones .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} show: see if the configuration is valid .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} apply: apply the configuration to the configure level .RE .SS "Resource testing" .sp The amount of detail in a cluster makes all configurations prone to errors\&. By far the largest number of issues in a cluster is due to bad resource configuration\&. The shell can help quickly diagnose such problems\&. And considerably reduce your keyboard wear\&. .sp Let\(cqs say that we entered the following configuration: .sp .if n \{\ .RS 4 .\} .nf node xen\-b node xen\-c node xen\-d primitive fencer stonith:external/libvirt \e params hypervisor_uri="qemu+tcp://10\&.2\&.13\&.1/system" \e hostlist="xen\-b xen\-c xen\-d" \e op monitor interval=2h primitive svc Xinetd \e params service=systat \e op monitor interval=30s primitive intranet\-ip IPaddr2 \e params ip=10\&.2\&.13\&.100 \e op monitor interval=30s primitive apache apache \e params configfile="/etc/apache2/httpd\&.conf" \e op monitor interval=120s timeout=60s group websvc apache intranet\-ip location websvc\-pref websvc 100: xen\-b .fi .if n \{\ .RE .\} .sp Before typing commit to submit the configuration to the cib we can make sure that all resources are usable on all nodes: .sp .if n \{\ .RS 4 .\} .nf crm(live)configure# rsctest websvc svc fencer .fi .if n \{\ .RE .\} .sp It is important that resources being tested are not running on any nodes\&. Otherwise, the rsctest command will refuse to do anything\&. Of course, if the current configuration resides in a CIB shadow, then a commit is irrelevant\&. The point being that resources are not running on any node\&. \fBNote on stopping all resources\fR .sp Alternatively to not committing a configuration, it is also possible to tell Pacemaker not to start any resources: .sp .if n \{\ .RS 4 .\} .nf crm(live)configure# property stop\-all\-resources=yes .fi .if n \{\ .RE .\} .sp Almost none\-\-\-resources of class stonith are still started\&. But shell is not as strict when it comes to stonith resources\&. .sp Order of resources is significant insofar that a resource depends on all resources to its left\&. In most configurations, it\(cqs probably practical to test resources in several runs, based on their dependencies\&. .sp Apart from groups, crm does not interpret constraints and therefore knows nothing about resource dependencies\&. It also doesn\(cqt know if a resource can run on a node at all in case of an asymmetric cluster\&. It is up to the user to specify a list of eligible nodes if a resource is not meant to run on every node\&. .SS "Access Control Lists (ACL)" \fBNote on ACLs in Pacemaker 1\&.1\&.12\fR .sp The support for ACLs has been revised in Pacemaker version 1\&.1\&.12 and up\&. Depending on which version you are using, the information in this section may no longer be accurate\&. Look for the acl_target configuration element for more details on the new syntax\&. .sp By default, the users from the haclient group have full access to the cluster (or, more precisely, to the CIB)\&. Access control lists allow for finer access control to the cluster\&. .sp Access control lists consist of an ordered set of access rules\&. Each rule allows read or write access or denies access completely\&. Rules are typically combined to produce a specific role\&. Then, users may be assigned a role\&. .sp For instance, this is a role which defines a set of rules allowing management of a single resource: .sp .if n \{\ .RS 4 .\} .nf role bigdb_admin \e write meta:bigdb:target\-role \e write meta:bigdb:is\-managed \e write location:bigdb \e read ref:bigdb .fi .if n \{\ .RE .\} .sp The first two rules allow modifying the target\-role and is\-managed meta attributes which effectively enables users in this role to stop/start and manage/unmanage the resource\&. The constraints write access rule allows moving the resource around\&. Finally, the user is granted read access to the resource definition\&. .sp For proper operation of all Pacemaker programs, it is advisable to add the following role to all users: .sp .if n \{\ .RS 4 .\} .nf role read_all \e read cib .fi .if n \{\ .RE .\} .sp For finer grained read access try with the rules listed in the following role: .sp .if n \{\ .RS 4 .\} .nf role basic_read \e read node attribute:uname \e read node attribute:type \e read property \e read status .fi .if n \{\ .RE .\} .sp It is however possible that some Pacemaker programs (e\&.g\&. ptest) may not function correctly if the whole CIB is not readable\&. .sp Some of the ACL rules in the examples above are expanded by the shell to XPath specifications\&. For instance, meta:bigdb:target\-role expands to: .sp .if n \{\ .RS 4 .\} .nf //primitive[@id=\*(Aqbigdb\*(Aq]/meta_attributes/nvpair[@name=\*(Aqtarget\-role\*(Aq] .fi .if n \{\ .RE .\} .sp You can see the expansion by showing XML: .sp .if n \{\ .RS 4 .\} .nf crm(live) configure# show xml bigdb_admin \&.\&.\&. .fi .if n \{\ .RE .\} .sp Many different XPath expressions can have equal meaning\&. For instance, the following two are equal, but only the first one is going to be recognized as shortcut: .sp .if n \{\ .RS 4 .\} .nf //primitive[@id=\*(Aqbigdb\*(Aq]/meta_attributes/nvpair[@name=\*(Aqtarget\-role\*(Aq] //resources/primitive[@id=\*(Aqbigdb\*(Aq]/meta_attributes/nvpair[@name=\*(Aqtarget\-role\*(Aq] .fi .if n \{\ .RE .\} .sp XPath is a powerful language, but you should try to keep your ACL xpaths simple and the builtin shortcuts should be used whenever possible\&. .SS "Syntax: Resource sets" .sp Using resource sets can be a bit confusing unless one knows the details of the implementation in Pacemaker as well as how to interpret the syntax provided by crmsh\&. .sp Three different types of resource sets are provided by crmsh, and each one implies different values for the two resource set attributes, sequential and require\-all\&. .PP sequential .RS 4 If false, the resources in the set do not depend on each other internally\&. Setting sequential to true implies a strict order of dependency within the set\&. .RE .PP require\-all .RS 4 If false, only one resource in the set is required to fulfil the requirements of the set\&. The set of A, B and C with require\-all set to false is be read as "A OR B OR C" when its dependencies are resolved\&. .RE .sp The three types of resource sets modify the attributes in the following way: .sp .RS 4 .ie n \{\ \h'-04' 1.\h'+01'\c .\} .el \{\ .sp -1 .IP " 1." 4.2 .\} Implicit sets (no brackets)\&. sequential=true, require\-all=true .RE .sp .RS 4 .ie n \{\ \h'-04' 2.\h'+01'\c .\} .el \{\ .sp -1 .IP " 2." 4.2 .\} Parenthesis set (( \&... ))\&. sequential=false, require\-all=true .RE .sp .RS 4 .ie n \{\ \h'-04' 3.\h'+01'\c .\} .el \{\ .sp -1 .IP " 3." 4.2 .\} Bracket set ([ \&... ])\&. sequential=false, require\-all=false .RE .sp To create a set with the properties sequential=true and require\-all=false, explicitly set sequential in a bracketed set, [ A B C sequential=true ]\&. .sp To create multiple sets with both sequential and require\-all set to true, explicitly set sequential in a parenthesis set: A B ( C D sequential=true )\&. .SS "Syntax: Attribute list references" .sp Attribute lists are used to set attributes and parameters for resources, constraints and property definitions\&. For example, to set the virtual IP used by an IPAddr2 resource the attribute ip can be set in an attribute list for that resource\&. .sp Attribute lists can have identifiers that name them, and other resources can reuse the same attribute list by referring to that name using an $id\-ref\&. For example, the following statement defines a simple dummy resource with an attribute list which sets the parameter state to the value 1 and sets the identifier for the attribute list to on\-state: .sp .if n \{\ .RS 4 .\} .nf primitive dummy\-1 Dummy params $id=on\-state state=1 .fi .if n \{\ .RE .\} .sp To refer to this attribute list from a different resource, refer to the on\-state name using an id\-ref: .sp .if n \{\ .RS 4 .\} .nf primitive dummy\-2 Dummy params $id\-ref=on\-state .fi .if n \{\ .RE .\} .sp The resource dummy\-2 will now also have the parameter state set to the value 1\&. .SS "Syntax: Attribute references" .sp In some cases, referencing complete attribute lists is too coarse\-grained, for example if two different parameters with different names should have the same value set\&. Instead of having to copy the value in multiple places, it is possible to create references to individual attributes in attribute lists\&. .sp To name an attribute in order to be able to refer to it later, prefix the attribute name with a $ character (as seen above with the special names $id and $id\-ref: .sp .if n \{\ .RS 4 .\} .nf primitive dummy\-1 Dummy params $state=1 .fi .if n \{\ .RE .\} .sp The identifier state can now be used to refer to this attribute from other primitives, using the @ syntax: .sp .if n \{\ .RS 4 .\} .nf primitive dummy\-2 Dummy params @state .fi .if n \{\ .RE .\} .sp In some cases, using the attribute name as the identifier doesn\(cqt work due to name clashes\&. In this case, the syntax $:= can be used to give the attribute a different identifier: .sp .if n \{\ .RS 4 .\} .nf primitive dummy\-1 params $dummy\-state\-on:state=1 primitive dummy\-2 params @dummy\-state\-on .fi .if n \{\ .RE .\} .sp There is also the possibility that two resources both use the same attribute value but with different names\&. For example, a web server may have a parameter server_ip for setting the IP address where it listens for incoming requests, and a virtual IP resource may have a parameter called ip which sets the IP address it creates\&. To configure these two resources with an IP without repeating the value, the reference can be given a name using the syntax @:\&. .sp Example: .sp .if n \{\ .RS 4 .\} .nf primitive virtual\-ip IPaddr2 params $vip:ip=192\&.168\&.1\&.100 primitive webserver apache params @vip:server_ip .fi .if n \{\ .RE .\} .SS "Syntax: Rule expressions" .sp Many of the configuration commands in crmsh now support the use of \fIrule expressions\fR, which can influence what attributes apply to a resource or under which conditions a constraint is applied, depending on changing conditions like date, time, the value of attributes and more\&. .sp Here is an example of a simple rule expression used to apply a a different resource parameter on the node named node1: .sp .if n \{\ .RS 4 .\} .nf primitive my_resource Special \e params 2: rule #uname eq node1 interface=eth1 \e params 1: interface=eth0 .fi .if n \{\ .RE .\} .sp This primitive resource has two lists of parameters with descending priority\&. The parameter list with the highest priority is applied first, but only if the rule expressions for that parameter list all apply\&. In this case, the rule #uname eq node1 limits the parameter list so that it is only applied on node1\&. .sp Note that rule expressions are not terminated and are immediately followed by the data to which the rule is applied\&. In this case, the name\-value pair interface=eth1\&. .sp Rule expressions can contain multiple expressions connected using the boolean operator or and and\&. The full syntax for rule expressions is listed below\&. .sp .if n \{\ .RS 4 .\} .nf rules :: rule [id_spec] [$role=] : [rule [id_spec] [$role=] : \&.\&.\&.] id_spec :: $id= | $id\-ref= score :: | | [\-]inf expression :: [ \&.\&.\&.] bool_op :: or | and simple_exp :: [type:] | | date type :: | | binary_op :: lt | gt | lte | gte | eq | ne unary_op :: defined | not_defined date_expr :: lt | gt | in start= end= | in start= | spec duration|date_spec :: hours= | monthdays= | weekdays= | yearsdays= | months= | weeks= | years= | weekyears= | moon= .fi .if n \{\ .RE .\} .SH "LIFETIME PARAMETER FORMAT" .sp Lifetimes can be specified in the ISO 8601 time format or the ISO 8601 duration format\&. To distinguish between months and minutes, use the PT prefix before specifying minutes\&. The duration format is one of PnYnMnDTnHnMnS, PnW, PT