class Subspace::Commands::Bootstrap

Constants

PASS_THROUGH_PARAMS

Public Class Methods

new(args, options) click to toggle source
# File lib/subspace/commands/bootstrap.rb, line 4
def initialize(args, options)
  @host_spec = args.first
  @options = options
  @ask_pass = options.password
  @yum = options.yum
  run
end

Public Instance Methods

run() click to toggle source
# File lib/subspace/commands/bootstrap.rb, line 12
def run
  # ansible atlanta -m copy -a "src=/etc/hosts dest=/tmp/hosts"
  install_python
  ensure_ssh_dir
end

Private Instance Methods

bootstrap_command(cmd) click to toggle source
# File lib/subspace/commands/bootstrap.rb, line 48
def bootstrap_command(cmd)
  if @ask_pass
    cmd.push("--ask-pass")
  end
  ansible_command *cmd
end
ensure_ssh_dir() click to toggle source
# File lib/subspace/commands/bootstrap.rb, line 20
def ensure_ssh_dir
  cmd = ["ansible",
    @host_spec,
    "-m",
    "file",
    "-a",
    "path=/home/{{ansible_ssh_user}}/.ssh state=directory mode=0700",
    "-vvvv"
  ]
  cmd = cmd | pass_through_params
  bootstrap_command cmd
end
install_python() click to toggle source
# File lib/subspace/commands/bootstrap.rb, line 33
def install_python
  update_ansible_cfg
  cmd = ["ansible",
    @host_spec,
    "-m",
    "raw",
    "-a",
    "test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)",
    "--become",
    "-vvvv"
  ]
  cmd = cmd | pass_through_params
  bootstrap_command cmd
end