Created
September 27, 2012 09:12
-
-
Save goncha/3793040 to your computer and use it in GitHub Desktop.
cfengine to sync files from phub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bundle agent sync_app | |
{ | |
vars: | |
"opt_dir" string => "/home/app/opt", | |
comment => "Program directory"; | |
"etc_dir" string => "/home/app/etc", | |
comment => "Configuration directory"; | |
files: | |
!am_policy_hub:: | |
"$(opt_dir)/." | |
comment => "Make sure irectory exists.", | |
create => "true", | |
perms => u_dir_p("755", "app", "users"); | |
"$(etc_dir)/." | |
comment => "Make sure irectory exists.", | |
create => "true", | |
perms => u_dir_p("755", "app", "users"); | |
"$(opt_dir)" | |
comment => "Sync this direcotry on all server except policy hub.", | |
copy_from => u_rcp("/home/app/opt", "$(sys.policy_hub)"), | |
depth_search => u_recurse("inf"), | |
action => u_immediate; | |
"$(etc_dir)" | |
comment => "Sync this direcotry on all server except policy hub.", | |
copy_from => u_rcp("/home/app/etc", "$(sys.policy_hub)"), | |
depth_search => u_recurse("inf"), | |
action => u_immediate; | |
} | |
body perms u_dir_p(p,u,g) | |
{ | |
mode => "$(p)"; | |
owners => { "$(u)" }; | |
groups => { "$(g)" }; | |
} | |
body action u_immediate | |
{ | |
ifelapsed => "0"; | |
} | |
body depth_search u_recurse(d) | |
{ | |
depth => "$(d)"; | |
exclude_dirs => { "\.svn", "\.git" }; | |
} | |
body copy_from u_rcp(from,server) | |
{ | |
source => "$(from)"; | |
compare => "digest"; | |
trustkey => "false"; | |
servers => { "$(server)" }; | |
preserve => "true"; # keep permission | |
stealth => "true"; # keep timestamp | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment