Module: CemAcpt::Bolt::Helpers
- Included in:
- TaskList, TestRunner
- Defined in:
- lib/cem_acpt/bolt/helpers.rb
Overview
Module containing helper methods for Bolt
Constant Summary collapse
- BOLT_PROJECT_FILE =
'bolt-project.yaml'
- INVENTORY_FILE =
'inventory.yaml'
Instance Method Summary collapse
- #bolt_bin ⇒ Object
- #load_object_test(bolt_test_data, bolt_object) ⇒ Object
- #new_bolt_project_hash(module_name, config) ⇒ Object
- #new_inventory_hash(hosts, private_key, config) ⇒ Object
Instance Method Details
#bolt_bin ⇒ Object
47 48 49 |
# File 'lib/cem_acpt/bolt/helpers.rb', line 47 def bolt_bin @bolt_bin ||= CemAcpt::Utils::Shell.which('bolt', raise_if_not_found: true) end |
#load_object_test(bolt_test_data, bolt_object) ⇒ Object
12 13 14 15 16 |
# File 'lib/cem_acpt/bolt/helpers.rb', line 12 def load_object_test(bolt_test_data, bolt_object) return { params: {} } unless bolt_test_data bolt_test_data[bolt_object].transform || { params: {} } end |
#new_bolt_project_hash(module_name, config) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/cem_acpt/bolt/helpers.rb', line 18 def new_bolt_project_hash(module_name, config) { 'name' => module_name, 'analytics' => false, }.merge(config.get('bolt.project')&.transform_keys(&:to_s) || {}) end |
#new_inventory_hash(hosts, private_key, config) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/cem_acpt/bolt/helpers.rb', line 25 def new_inventory_hash(hosts, private_key, config) { 'groups' => [ { 'name' => 'nix', 'targets' => hosts, 'config' => { 'transport' => 'ssh', 'ssh' => { 'connect-timeout' => 60, 'disconnect-timeout' => 60, 'host-key-check' => false, 'private-key' => private_key || '~/.ssh/id_rsa', 'run-as' => 'root', 'tmpdir' => '/var/tmp', # /tmp is usually noexec }.merge(config.get('bolt.transport.ssh')&.transform_keys(&:to_s) || {}), }, }, ], } end |