Puppet Plan: oci_config::start_instances
- Defined in:
- plans/start_instances.pp
Summary
This plan will start the specified OCI instancesOverview
See the file “LICENSE” for the full license governing this code.
--
–++–
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 |
# File 'plans/start_instances.pp', line 19
plan oci_config::start_instances(
TargetSpec $instances,
TargetSpec $oci_master = 'localhost',
) {
if get_targets($oci_master).length > 1 {
fail_plan("${oci_master} did not resolve to a single target")
}
$instance_nodes = get_targets($instances)
$instance_nodes.each |$instance| {
$hostname = $instance.host
$node_facts = puppetdb_fact([$hostname])
if $node_facts == {} {
warning("Skipping node ${instance.host} not found in Puppetdb.")
} elsif $node_facts.dig($hostname, 'oci_instance_id') == undef {
warning("Skipping node ${instance.host} not an OCI node.")
} else {
$instance_id = $node_facts.dig($hostname, 'oci_instance_id')
notice("Execute startup on OCI-level for ${hostname} with ocid ${instance_id}...")
run_task('oci_config::instance_action', $oci_master,
instance_id => $instance_id,
action => 'START' )
}
}
}
|