diff options
author | elijah <elijah@riseup.net> | 2012-12-12 22:40:59 -0800 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2012-12-12 22:40:59 -0800 |
commit | 6e5d404bdd1a8f56fdfb0eee865f9029ae12b616 (patch) | |
tree | 89214d8fc93d675695af6ec8920cf2b8e8ed2cf0 /lib/leap_cli/commands | |
parent | de196e66c1b7c3b5e1e38d6d5ea024aac3fbe3bd (diff) |
auto compile before deploy (as needed)
Diffstat (limited to 'lib/leap_cli/commands')
-rw-r--r-- | lib/leap_cli/commands/compile.rb | 16 | ||||
-rw-r--r-- | lib/leap_cli/commands/deploy.rb | 11 |
2 files changed, 16 insertions, 11 deletions
diff --git a/lib/leap_cli/commands/compile.rb b/lib/leap_cli/commands/compile.rb index 45e4f2b..df2149d 100644 --- a/lib/leap_cli/commands/compile.rb +++ b/lib/leap_cli/commands/compile.rb @@ -5,15 +5,19 @@ module LeapCli desc 'Compiles node configuration files into hiera files used for deployment' command :compile do |c| c.action do |global_options,options,args| - # these must come first - update_compiled_ssh_configs - - # export generated files - manager.export_nodes - manager.export_secrets + compile_hiera_files end end + def compile_hiera_files(nodes=nil) + # these must come first + update_compiled_ssh_configs + + # export generated files + manager.export_nodes(nodes) + manager.export_secrets + end + def update_compiled_ssh_configs update_authorized_keys update_known_hosts diff --git a/lib/leap_cli/commands/deploy.rb b/lib/leap_cli/commands/deploy.rb index f94465f..cc2ea96 100644 --- a/lib/leap_cli/commands/deploy.rb +++ b/lib/leap_cli/commands/deploy.rb @@ -16,17 +16,18 @@ module LeapCli end end - nodes.each_node do |node| - assert_files_exist! Path.named_path([:hiera, node.name]), :msg => 'try running `leap compile`' - end + compile_hiera_files(nodes) ssh_connect(nodes) do |ssh| - ssh.leap.assert_initialized + ssh.leap.log :checking, 'node' do + ssh.leap.assert_initialized + end # sync hiera conf - ssh.leap.log :updating, "hiera.yaml" do + ssh.leap.log :syching, "hiera.yaml" do ssh.leap.rsync_update do |server| node = manager.node(server.host) + ssh.leap.log Path.relative_path([:hiera, node.name]) + ' -> ' + node.name + ':/etc/leap/hiera.yaml' {:source => Path.named_path([:hiera, node.name]), :dest => "/etc/leap/hiera.yaml"} end end |