summaryrefslogtreecommitdiff
path: root/lib/leap_cli/remote/tasks.rb
blob: 6bfffb20746e68c2ff06d9bb2a892864812fb1f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#
# This file is evaluated just the same as a typical capistrano "deploy.rb"
# For DSL manual, see https://github.com/capistrano/capistrano/wiki
#

require 'supply_drop'

MAX_HOSTS = 10

task :install_authorized_keys, :max_hosts => MAX_HOSTS do
  run 'mkdir -p /root/.ssh && chmod 700 /root/.ssh'
  upload LeapCli::Path.named_path(:authorized_keys), '/root/.ssh/authorized_keys', :mode => '600'
end

task :install_prerequisites, :max_hosts => MAX_HOSTS do
  packages = "puppet ruby-hiera-puppet rsync lsb-release"
  run "mkdir -p #{puppet_destination}"
  run "apt-get update"
  run "DEBIAN_FRONTEND=noninteractive apt-get -q -y -o DPkg::Options::=--force-confold install #{packages}"
end

#task :update_platform, :max_hosts => MAX_HOSTS do
#  puppet.update_code
#end

#task :mk_leap_dir, :max_hosts => MAX_HOSTS do
#  run 'mkdir -p /root/leap/config && chown -R root /root/leap && chmod -R ag-rwx,u+rwX /root/leap'
#end

task :apply_puppet, :max_hosts => MAX_HOSTS do
  raise "now such directory #{puppet_source}" unless File.directory?(puppet_source)
  puppet.apply
end