Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installer updates #42

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions bin/tape
Expand Up @@ -37,6 +37,11 @@ opt_parser = OptionParser.new do |opts|
options.host_pattern = p
end

opts.on("-t", "--tags [TAGS]",
String, "only run plays and tasks tagged with these values") do |t|
options.tags = t
end

opts.separator ''
opts.separator "MODULES"
TapeBoxer.registered_modules.values.each do |exec_module|
Expand Down
1 change: 1 addition & 0 deletions lib/tape/ansible_runner.rb
Expand Up @@ -61,6 +61,7 @@ def exec_ansible(playbook, args)
enforce_roles_path!
cmd = "ANSIBLE_CONFIG=#{local_dir}/.tape/ansible.cfg ansible-playbook -i #{inventory_file} #{playbook} #{args} #{hosts_flag} -e tape_dir=#{tape_dir}"
cmd += ' -vvvv' if opts.verbose
cmd += " -t #{opts.tags}" if opts.tags
STDERR.puts "Executing: #{cmd}" if opts.verbose
Kernel.exec(cmd)
end
Expand Down
18 changes: 16 additions & 2 deletions lib/tape/installer.rb
Expand Up @@ -2,6 +2,9 @@ module TapeBoxer
class Installer < ExecutionModule
TapeBoxer.register_module :installer, self

action :dependencies,
proc { dependencies },
'Install dependencies'
action :install,
proc {install},
'Creates all nessisary hosts and config files'
Expand All @@ -14,9 +17,20 @@ def initialize(*args)
end

protected

def dependencies
puts 'Dependencies:'

if system "ansible-galaxy install -r #{tape_dir}/requirements.yml -p #{tape_dir}/vendor --force"
print 'Installing/updating dependencies: '
puts '✔'.green
else
puts '✘'.red
end
end

def install
puts "Installing ansible galaxy roles".pink
`ansible-galaxy install -r #{tape_dir}/requirements.yml -p #{tape_dir}/vendor --force`
dependencies
mkdir 'roles'
copy_example 'omnibox.example.yml', 'omnibox.yml'
copy_example 'deploy.example.yml', 'deploy.yml'
Expand Down