A | |
alpha, Cron | |
alphanum, Cron | |
at, Syslog | |
att_def1, Test_Xml | |
att_def2, Test_Xml | |
att_def3, Test_Xml | |
attr1, Test_Xml | |
attr2, Test_Xml | |
B | |
bang, Syslog | |
C | |
cdata1, Test_Xml | |
colon | |
comma | |
command, Aliases | |
comment | |
comment_ace, Test_IniFile | |
comment_acf, Test_IniFile | |
comment_ade, Test_IniFile | |
comment_adf, Test_IniFile | |
comment_bce, Test_IniFile | |
comment_bcf, Test_IniFile | |
comment_bde, Test_IniFile | |
comment_bdf, Test_IniFile | |
comment_default, IniFile | |
comment_re, IniFile | |
comparison, Syslog | |
conf | |
conf_ace, Test_IniFile | |
conf_acf, Test_IniFile | |
conf_ade, Test_IniFile | |
conf_adf, Test_IniFile | |
conf_bce, Test_IniFile | |
conf_bcf, Test_IniFile | |
conf_bde, Test_IniFile | |
conf_bdf, Test_IniFile | |
config1, Test_FAI_DiskConfig | |
config2, Test_FAI_DiskConfig | |
config3, Test_FAI_DiskConfig | |
controller, cgrules | |
ctrl_key, cgrules | |
ctrl_value, cgrules | |
D | |
decimal, Rx | |
default_approx, Test_Approx | |
del_opt_ws, Util | |
del_str, Util | |
del_ws, Util | |
del_ws_spc, Util | |
del_ws_tab, Util | |
device, FAI_DiskConfig | |
device_name, Rx | |
disk, FAI_DiskConfig | |
disk_config, FAI_DiskConfig | |
disk_config_entry, FAI_DiskConfig | |
disk_list, FAI_DiskConfig | |
disk_with_opt, FAI_DiskConfig | |
dot, Syslog |
let alpha = /[A-Za-z]{3}/
let alphanum = (num|alpha) . ("-" . (num|alpha))?
Deletes a at and default to it
let at = Util.del_str "@"
let att_def1 = "<!ATTLIST termdef id ID #REQUIRED name CDATA #IMPLIED>"
let att_def2 = "<!ATTLIST list type (bullets|ordered|glossary) \"ordered\">"
let att_def3 = "<!ATTLIST form method CDATA #FIXED \"POST\">"
let attr1 = " attr1=\"value1\" attr2=\"value2\""
let attr2 = " attr2=\"foo\""
Deletes a bang and default to it
let bang = Util.del_str "!"
let cdata1 = "<![CDATA[testing]]>"
this is the standard field separator “ : “
let colon = del (Rx.opt_space . ":" . Rx.opt_space) " : "
let colon = Util.del_str ":"
Deletes a colon and default to it
let colon = sep_tab_opt . Util.del_str ":" . sep_tab_opt
let comma = Sep.comma
let comma = Util.del_str ","
Deletes a comma and default to it
let comma = sep_tab_opt . Util.del_str "," . sep_tab_opt
a command can contain spaces, if enclosed in double quotes, the case without spaces is taken care with word
let command = /(\|([^", \t\n]+|"[^"\n]+"))|("\|[^"\n]+")/
let comment = Util.comment
let comment = Util.comment
let comment = Util.comment
let comment = Util.comment
let comment = Util.comment
let comment = Util.comment
let comment_ace = IniFile.comment IniFile.comment_re IniFile.comment_default
let comment_acf = IniFile.comment IniFile.comment_re IniFile.comment_default
let comment_ade = IniFile.comment ";" ";"
let comment_adf = IniFile.comment ";" ";"
let comment_bce = IniFile.comment IniFile.comment_re IniFile.comment_default
let comment_bcf = IniFile.comment IniFile.comment_re IniFile.comment_default
let comment_bde = IniFile.comment ";" ";"
let comment_bdf = IniFile.comment ";" ";"
Default value for comment pattern
let comment_default = ";"
Default regexp for comment pattern
let comment_re = /[;#]/
a comparison is an optional !
let comparison = /(!|[<=>]+|![<=>]+)/
A full configuration
let conf = "+ : ALL : LOCAL + : root : localhost.localdomain - : root : 127.0.0.1 .localdomain + : root alice@server1 @admins (wheel) : cron crond :0 tty1 tty2 tty3 tty4 tty5 tty6 # IP v6 support + : john foo : 2001:4ca0:0:101::1 2001:4ca0:0:101::/64 # Except + : ALL EXCEPT john @wheel : ALL EXCEPT LOCAL .win.tue.nl # No spaces +:root:.example.com "
A full configuration file
let conf = "! This is a comment ! Configuration File for keepalived global_defs { ! this is who emails will go to on alerts notification_email { admins@example.com fakepager@example.com ! add a few more email addresses here if you would like } notification_email_from admins@example.com smtp_server 127.0.0.1 ! I use the local machine to relay mail smtp_connect_timeout 30 ! each load balancer should have a different ID ! this will be used in SMTP alerts, so you should make ! each router easily identifiable lvs_id LVS_EXAMPLE_01 } vrrp_sync_group VG1 { group { inside_network # name of vrrp_instance (below) outside_network # One for each moveable IP. } } vrrp_instance VI_1 { state MASTER interface eth0 track_interface { eth0 # Back eth1 # DMZ } track_script { check_apache2 # weight = +2 si ok, 0 si nok } garp_master_delay 5 priority 50 advert_int 2 authentication { auth_type PASS auth_pass mypass } virtual_ipaddress { 10.234.66.146/32 dev eth0 } lvs_sync_daemon_interface eth0 ha_suspend notify_master \"/svr/scripts/notify_master.sh\" notify_backup \"/svr/scripts/notify_backup.sh\" notify_fault \"/svr/scripts/notify_fault.sh\" ! each virtual router id must be unique per instance name! virtual_router_id 51 ! MASTER and BACKUP state are determined by the priority ! even if you specify MASTER as the state, the state will ! be voted on by priority (so if your state is MASTER but your ! priority is lower than the router with BACKUP, you will lose ! the MASTER state) ! I make it a habit to set priorities at least 50 points apart ! note that a lower number is lesser priority - lower gets less vote priority 150 ! how often should we vote, in seconds? advert_int 1 ! send an alert when this instance changes state from MASTER to BACKUP smtp_alert ! this authentication is for syncing between failover servers ! keepalived supports PASS, which is simple password ! authentication ! or AH, which is the IPSec authentication header. ! I don't use AH ! yet as many people have reported problems with it authentication { auth_type PASS auth_pass example } ! these are the IP addresses that keepalived will setup on this ! machine. Later in the config we will specify which real ! servers are behind these IPs ! without this block, keepalived will not setup and takedown the ! any IP addresses virtual_ipaddress { 192.168.1.11 10.234.66.146/32 dev vlan933 # parse it well ! and more if you want them } } virtual_server 192.168.1.11 22 { delay_loop 6 ! use round-robin as a load balancing algorithm lb_algo rr ! we are doing NAT lb_kind NAT nat_mask 255.255.255.0 protocol TCP ! there can be as many real_server blocks as you need real_server 10.20.40.10 22 { ! if we used weighted round-robin or a similar lb algo, ! we include the weight of this server weight 1 ! here is a health checker for this server. ! we could use a custom script here (see the keepalived docs) ! but we will just make sure we can do a vanilla tcp connect() ! on port 22 ! if it fails, we will pull this realserver out of the pool ! and send email about the removal TCP_CHECK { connect_timeout 3 connect_port 22 } } } virtual_server_group DNS_1 { 192.168.0.1 22 10.234.55.22-25 36 10.45.58.59/32 27 } vrrp_script chk_apache2 { # Requires keepalived-1.1.13 script \"killall -0 apache2\" # faster interval 2 # check every 2 seconds weight 2 # add 2 points of prio if OK } ! that's all "
A full configuration
let conf = "# ftpmaster allow * by key 74BF771E allow sections 'desktop/*' by anybody allow sections 'gforge/*' and binaries contain 'bzr' or not source '*melanie*'|'katya' by any key "
let conf_ace = "# comment with sharp [section1] test_ace = value # end of line comment test_ace = ; comment with colon "
let conf_acf = "# comment with sharp [section1] test_acf = value test_acf = test_acf : value2 # end of line comment ; comment with colon "
let conf_ade = "; a first comment with colon [section1] test_ade = value test_ade : value2 ; end of line comment ; comment with colon test_ade = "
let conf_adf = "; a first comment with colon [section1] test_adf = value test_adf : value2 ; end of line comment ; comment with colon test_adf = "
let conf_bce = "# comment with sharp [section1] test_bce = value # end of line comment ; comment with colon test_bce = "
let conf_bcf = "# conf with sharp [section1] test_bcf = value # end of line comment ; comment with colon test_bcf = "
let conf_bde = "; first comment with colon [section1] test_bde = value ; end of line comment ; comment with colon test_bde = "
let conf_bdf = "; first comment with colon [section1] test_bdf = value ; end of line comment ; comment with colon test_bdf = "
Another full configuration
let config1 = "disk_config disk1 bootable:1 preserve_always:all always_format:5,6,7,8,9,10,11 primary - 0 - - primary - 0 - - logical / 0 ext3 rw,relatime,errors=remount-ro createopts=\"-c -j\" logical swap 0 swap sw logical /var 0 ext3 rw,relatime createopts=\"-m 5 -j\" logical /tmp 0 ext3 rw createopts=\"-m 0 -j\" logical /usr 0 ext3 rw,relatime createopts=\"-j\" logical /home 0 ext3 rw,relatime,nosuid,nodev createopts=\"-m 1 -j\" logical /wrk 0 ext3 rw,relatime,nosuid,nodev createopts=\"-m 1 -j\" logical /transfer 0 vfat rw "
Another full configuration
let config2 = "disk_config /dev/sda primary - 250M - - primary - 20G - - logical - 8G - - logical - 4G - - logical - 5G - - disk_config /dev/sdb sameas:/dev/sda disk_config raid raid1 /boot sda1,sdb1 ext3 defaults raid1 / sda2,sdb2 ext3 defaults,errors=remount-ro raid1 swap sda5,sdb5 swap defaults raid1 /tmp sda6,sdb6 ext3 defaults createopts=\"-m 1\" raid1 /var sda7,sdb7 ext3 defaults "
Another full configuration
let config3 = "disk_config /dev/sdb primary / 21750 ext3 defaults,errors=remount-ro primary /boot 250 ext3 defaults logical - 4000 - - logical - 2000 - - logical - 10- - - disk_config cryptsetup randinit swap swap /dev/sdb5 swap defaults tmp /tmp /dev/sdb6 ext2 defaults luks /local00 /dev/sdb7 ext3 defaults,errors=remount-ro createopts=\"-m 0\" "
let controller = ws . [ key ctrl_key . ws . store ctrl_value ]
let ctrl_key = /[^ \t\n\/]+/
let ctrl_value = /[^ \t\n]+/
A decimal value (using ‘,’ or ‘.’
let decimal = /[0-9]+([.,][0-9]+)?/
A full configuration
let default_approx = "# The following are the defaults, so there is no need # to uncomment them unless you want a different value. # See approx.conf(5) for details. $interface any $port 9999 $interval 720 $max_wait 10 $max_rate unlimited $debug false # Here are some examples of remote repository mappings. # See http://www.debian.org/mirror/list for mirror sites. debian http://ftp.nl.debian.org/debian debian-volatile http://ftp.nl.debian.org/debian-volatile security http://security.debian.org "
Delete optional whitespace
let del_opt_ws = del /[ \t]*/
Delete a string and default to it
let del_str (s:string) = del s s
Delete mandatory whitespace
let del_ws = del /[ \t]+/
Delete mandatory whitespace, default to single space
let del_ws_spc = del_ws " "
Delete mandatory whitespace, default to single tab
let del_ws_tab = del_ws "\t"
let device = [ label "device" . store Rx.fspath ]
A Linux device name like eth0 or i2c-0.
let device_name = /[a-zA-Z0-9_?.+:!-]+/
let disk = [ label "disk" . store /[^., \t\n]+/ . partition? ]
let disk_config = let other_label = Rx.fspath - "lvm" - "raid" - "end" - /disk[0-9]+/ - "cryptsetup" - "tmpfs" in disk_config_entry "lvm" lvmoption volume_lvm | disk_config_entry "raid" raidoption volume_raid | disk_config_entry "tmpfs" option volume_tmpfs | disk_config_entry "end" option volume (* there shouldn't be an option here *) | disk_config_entry /disk[0-9]+/ option volume | disk_config_entry "cryptsetup" cryptoption volume_cryptsetup | disk_config_entry other_label option volume
let disk_config_entry (kw:regexp) (opt:lens) (vol:lens) = [ key "disk_config" . space . store kw . (space . opt)* . eol . (volume_or_comment vol)? ]
A list of disk_with_opts
let disk_list = Build.opt_list disk_with_opt Sep.comma
A disk with a spare/missing option for raids
let disk_with_opt = [ label "disk" . store /[^:., \t\n]+/ . partition? . spare_missing* ]
Deletes a dot and default to it
let dot = Util.del_str "."