Class: Subspace::Commands::Init
- Defined in:
- lib/subspace/commands/init.rb
Instance Method Summary collapse
-
#initialize(args, options) ⇒ Init
constructor
A new instance of Init.
- #run ⇒ Object
Methods inherited from Base
#copy, #dest_dir, #gem_path, #require_configuration, #template, #template_dir
Methods included from Ansible
Constructor Details
#initialize(args, options) ⇒ Init
Returns a new instance of Init.
5 6 7 |
# File 'lib/subspace/commands/init.rb', line 5 def initialize(args, ) run end |
Instance Method Details
#run ⇒ Object
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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/subspace/commands/init.rb', line 9 def run FileUtils.mkdir_p File.join dest_dir, "group_vars" FileUtils.mkdir_p File.join dest_dir, "host_vars" FileUtils.mkdir_p File.join dest_dir, "vars" FileUtils.mkdir_p File.join dest_dir, "roles" copy ".gitignore" #template "../provision.rb" template "ansible.cfg" template "hosts" template "group_vars/all" create_vault_pass environments.each do |env| @env = env @hostname = hostname(env) template "group_vars/template", "group_vars/#{env}" template "host_vars/template", "host_vars/#{env}" create_vars_file_for_env env template "playbook.yml", "#{env}.yml" end puts """ 1. Create a server. 2. Set your server's location: vim config/provision/host_vars/production vim config/provision/host_vars/dev 3. Set up your authorized_keys: vim config/provision/authorized_keys 4. Then provision your server: cd config/provision && ansible-playbook dev.yml """ end |