* Finished (but not yet tested) tools/striker-auto-initialize-all. Expect many bugs if used.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 4 years ago
parent e71c7d4966
commit 426b5f58f7
  1. 32
      share/words.xml
  2. 858
      tools/striker-auto-initialize-all
  3. 105
      tools/striker-auto-initialize-all.example

@ -339,6 +339,8 @@ Output (if any):
<key name="error_0245">The DNS IP: [#!variable!ip!#] is invalid.</key> <key name="error_0245">The DNS IP: [#!variable!ip!#] is invalid.</key>
<key name="error_0246">The gateway IP: [#!variable!ip!#] is invalid.</key> <key name="error_0246">The gateway IP: [#!variable!ip!#] is invalid.</key>
<key name="error_0247">The variable: [#!variable!variable!#] is invalid: [#!variable!value!#].</key> <key name="error_0247">The variable: [#!variable!variable!#] is invalid: [#!variable!value!#].</key>
<key name="error_0248">Failed to add the UPS: [#!variable!ups_name!#] at: [#!variable!aups_ip_address!#] using the agent: [#!variable!ups_agent!#]!</key>
<key name="error_0249">Failed to add the fence device: [#!variable!fence_name!#] using the agent: [#!variable!fence_agent!#]!</key>
<!-- Files templates --> <!-- Files templates -->
<!-- NOTE: Translating these files requires an understanding of which likes are translatable --> <!-- NOTE: Translating these files requires an understanding of which likes are translatable -->
@ -690,6 +692,36 @@ It should be provisioned in the next minute or two.</key>
<key name="job_0231">Waiting now for the peer Striker: [#!variable!number!#] with host UUID: [#!variable!peer_host_uuid!#] to show up in our database.</key> <key name="job_0231">Waiting now for the peer Striker: [#!variable!number!#] with host UUID: [#!variable!peer_host_uuid!#] to show up in our database.</key>
<key name="job_0232">The peer Striker: [#!variable!number!#] with host name: [#!variable!peer_host_name!#] has successfully peered with us!</key> <key name="job_0232">The peer Striker: [#!variable!number!#] with host name: [#!variable!peer_host_name!#] has successfully peered with us!</key>
<key name="job_0233">The peer Striker: [#!variable!number!#] with host UUID: [#!variable!peer_host_uuid!#] has not yet started using our database. Waiting a bit before checking again...</key> <key name="job_0233">The peer Striker: [#!variable!number!#] with host UUID: [#!variable!peer_host_uuid!#] has not yet started using our database. Waiting a bit before checking again...</key>
<key name="job_0234">Peering Striker dashbaords</key>
<key name="job_0235">Striker peers now working with us!</key>
<key name="job_0236">Adding UPSes now.</key>
<key name="job_0237">Successfully added/updated the UPS: [#!variable!ups_name!#] at: [#!variable!ups_ip_address!#] using the agent: [#!variable!ups_agent!#]. It's UPS UUID is: [#!variable!ups_uuid!#].</key>
<key name="job_0238">Failed to assemble the Anvil!, aborting.</key>
<key name="job_0239">All UPSes added/updated.</key>
<key name="job_0240">Adding fence devices now.</key>
<key name="job_0241">Successfully added/updated the fence device: [#!variable!fence_name!#] using the agent: [#!variable!fence_agent!#]. It's fence UUID is: [#!variable!fence_uuid!#].</key>
<key name="job_0242">All fence devices added/updated.</key>
<key name="job_0243">Creating Install Manifest(s).</key>
<key name="job_0244">Created the manifest: [#!variable!manifest_name!#] with the UUID: [#!variable!manifest_uuid!#].</key>
<key name="job_0245">Install Manifest(s) created.</key>
<key name="job_0246">Initializing nodes and, if applicable, DR host(s).</key>
<key name="job_0247">The machine: [#!variable!machine!#] is already initialized and has the host UUID: [#!variable!host_uuid!#]. No need to initialize.</key>
<key name="job_0248">Trying to connect to: [#!variable!machine!#] using IP: [#!variable!ip!#] with the initial password.</key>
<key name="job_0249">Trying to connect to: [#!variable!machine!#] using IP: [#!variable!ip!#] with the desired password.</key>
<key name="job_0250">Connected! We will initialize using the IP: [#!variable!ip!#]</key>
<key name="job_0251">Failed to connect to: [#!variable!machine!#] using any IP address. We'll sleep and then try again shortly.</key>
<key name="job_0252">Created the job to initialize: [#!variable!host_name!#] via the IP address: [#!variable!ip!#] with job UUID: [#!variable!job_uuid!#].</key>
<key name="job_0253">All machines should now be initializing. Waiting now for all machines to register in the database.</key>
<key name="job_0254">The machine: [#!variable!machine!#] hasn't connected to the database yet.</key>
<key name="job_0255">One (or more) machines have not yet initialized. Waiting a few seconds, then checking again.</key>
<key name="job_0256">All machines have been initialized!</key>
<key name="job_0257">Ready to create jobs to assemble Anvil! systems.</key>
<key name="job_0258">Created (or updated) the Anvil! [#!variable!anvil_name!#] with the UUID: [#!variable!anvil_uuid!#].</key>
<key name="job_0259">Created the job for: [#!variable!machine_name!#] with host UUID: [#!variable!host_uuid!#] to the Anvil!: [#!variable!anvil_name!#] with the job UUID: [#!variable!job_uuid!#].</key>
<key name="job_0260">Add machines have been asked to joing their Anvil! system(s). We'll now wait for all jobs to complete.</key>
<key name="job_0261">The job UUID: [#!variable!job_uuid!#] is at: [#!variable!progress!#%].</key>
<key name="job_0262">Not all jobs are done yet, will check again in a bit.</key>
<key name="job_0263">All jobs are complete! Baring problems, the Anvil! system(s) should now be ready to use.</key>
<!-- Log entries --> <!-- Log entries -->
<key name="log_0001">Starting: [#!variable!program!#].</key> <key name="log_0001">Starting: [#!variable!program!#].</key>

@ -21,48 +21,11 @@ if (($running_directory =~ /^\./) && ($ENV{PWD}))
$running_directory =~ s/^\./$ENV{PWD}/; $running_directory =~ s/^\./$ENV{PWD}/;
} }
=cut
# At this point, the Striker should be coming up at the IP. Once both/all Strikers are up, update their anvil.conf to add each other's UUID database entry.
# FROM ONE STRIKER;
job_uuid | job_host_uuid | job_command | job_data | job_picked_up_by | job_picked_up_at | job_updated | job_name | job_progress | job_title | job_description | job_status | modified_date
--------------------------------------+--------------------------------------+------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+------------------+------------------+-------------+-------------------+--------------+-----------+-----------------+------------+-------------------------------
6ca30d0b-c03c-43f9-bd7c-c40a79ca52a8 | 46c00674-fea2-44af-981d-2833d5c8270a | /usr/sbin/striker-manage-peers --add --host-uuid a64c477b-b0a1-4985-9968-f4b46d75fb0c --host 10.201.4.2 --port 5432 --ping 1 | password=super secret password +| 0 | 0 | 1613699163 | striker-peer::add | 0 | job_0011 | job_0012 | | 2021-02-18 20:46:03.305568-05
| | | peer_job_command=/usr/sbin/striker-manage-peers --add --host-uuid 46c00674-fea2-44af-981d-2833d5c8270a --host 10.201.4.1 --port 5432 --ping 1 | | | | | | | | |
(1 row)
# Initialize nodes / dr hosts (may need to call striker-get-peer-data)
anvil=# SELECT * FROM jobs ;
job_uuid | job_host_uuid | job_command | job_data | job_picked_up_by | job_picked_up_at | job_updated | job_name | job_progress | job_title | job_description | job_status | modified_date
--------------------------------------+--------------------------------------+-----------------------------------+---------------------------------+------------------+------------------+-------------+-----------------------------------+--------------+-----------+-----------------+------------+------------------------------
a5c3381c-c581-4020-baa0-72e136c75a68 | 46c00674-fea2-44af-981d-2833d5c8270a | /usr/sbin/striker-initialize-host | password=Initial1 +| 0 | 0 | 1613957250 | initialize::node::192.168.122.207 | 0 | job_0020 | job_0022 | | 2021-02-21 20:27:30.73576-05
| | | rh_password= +| | | | | | | | |
| | | rh_user= +| | | | | | | | |
| | | host_ip_address=192.168.122.207+| | | | | | | | |
| | | ssh_port=22 +| | | | | | | | |
| | | type=node +| | | | | | | | |
| | | host_name=di-a02n01.alteeve.com+| | | | | | | | |
| | | | | | | | | | | |
(1 row)
anvil=# SELECT * FROM jobs WHERE job_progress != 100;
job_uuid | job_host_uuid | job_command | job_data | job_picked_up_by | job_picked_up_at | job_updated | job_name | job_progress | job_title | job_description | job_status | modified_date
--------------------------------------+--------------------------------------+-----------------------------------+----------------------------------+------------------+------------------+-------------+---------------------------------+--------------+-----------+-----------------+------------+-------------------------------
6c21d7ca-1c86-4389-9821-0ae945529754 | 46c00674-fea2-44af-981d-2833d5c8270a | /usr/sbin/striker-initialize-host | password=Initial1 +| 0 | 0 | 1614047831 | initialize::dr::192.168.122.141 | 0 | job_0021 | job_0022 | | 2021-02-22 21:37:11.082112-05
| | | rh_password= +| | | | | | | | |
| | | rh_user= +| | | | | | | | |
| | | host_ip_address=192.168.122.141 +| | | | | | | | |
| | | ssh_port=22 +| | | | | | | | |
| | | type=dr +| | | | | | | | |
| | | host_name=di-a02dr01.alteeve.com+| | | | | | | | |
| | | | | | | | | | | |
(1 row)
=cut
my $anvil = Anvil::Tools->new(); my $anvil = Anvil::Tools->new();
exit(0);
$anvil->Database->connect; $anvil->Database->connect;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, secure => 0, key => "log_0132"}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, secure => 0, key => "log_0132"});
if (not $anvil->data->{sys}{database}{connections}) if (not $anvil->data->{sys}{database}{connections})
@ -122,10 +85,6 @@ else
striker_stage1($anvil); striker_stage1($anvil);
} }
#print Dumper $anvil->data->{base};
#print Dumper $anvil->data->{striker};
$anvil->nice_exit({exit_code => 0}); $anvil->nice_exit({exit_code => 0});
@ -142,15 +101,800 @@ sub striker_stage2
# Merge my peer Striker. # Merge my peer Striker.
merge_peer_striker($anvil); merge_peer_striker($anvil);
# Add UPSes.
add_upses($anvil);
# Add fence devices
add_fences($anvil);
# Create manifest.
create_manifest($anvil);
# Initialize nodes and DR.
initialize_machines($anvil);
# Run the manifest(s).
run_manifests($anvil);
return(0);
}
# By this point, all machines should be initialized and online.
sub run_manifests
{
my ($anvil) = @_;
update_progress($anvil, 70, "job_0257");
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0257"});
# All machines are up!
my $job_uuids = [];
foreach my $anvil_number (sort {$a cmp $b} keys %{$anvil->data->{anvil}})
{
my $anvil_name = $anvil->data->{process}{anvil}{$anvil_number}{name};
my $manifest_uuid = $anvil->data->{process}{anvil}{$anvil_number}{manifest_uuid};
my $manifest_name = $anvil->data->{process}{anvil}{$anvil_number}{manifest_name};
my $node1_host_uuid = $anvil->data->{process}{anvil}{$anvil_number}{node1}{host_uuid};
my $node2_host_uuid = $anvil->data->{process}{anvil}{$anvil_number}{node2}{host_uuid};
my $dr1_host_uuid = exists $anvil->data->{process}{anvil}{$anvil_number}{dr1}{host_uuid} ? $anvil->data->{process}{anvil}{$anvil_number}{dr1}{host_uuid} : "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
's1:anvil_name' => $anvil_name,
's2:manifest_name' => $manifest_name,
's3:manifest_uuid' => $manifest_uuid,
's4:node1_host_uuid' => $node1_host_uuid,
's5:node2_host_uuid' => $node2_host_uuid,
's6:dr1_host_uuid' => $dr1_host_uuid,
}});
my ($anvil_uuid) = $anvil->Database->insert_or_update_anvils({
debug => 2,
anvil_description => $anvil->data->{anvil}{$anvil_number}{description},
anvil_name => $anvil_name,
anvil_password => $anvil->data->{base}{password}{desired},
anvil_node1_host_uuid => $node1_host_uuid,
anvil_node2_host_uuid => $node2_host_uuid,
anvil_dr1_host_uuid => $dr1_host_uuid,
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { anvil_uuid => $anvil_uuid }});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0258", variables => {
anvil_name => $anvil_name,
anvil_uuid => $anvil_uuid,
}});
# Tell node 1 to join.
my ($node1_job_uuid) = $anvil->Database->insert_or_update_jobs({
job_host_uuid => $node1_host_uuid,
job_command => $anvil->data->{path}{exe}{'anvil-join-anvil'},
job_data => "as_machine=node1,manifest_uuid=".$manifest_uuid.",anvil_uuid=".$anvil_uuid,
job_name => "join_anvil::node1",
job_title => "job_0072",
job_description => "job_0073",
job_progress => 0,
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { node1_job_uuid => $node1_job_uuid }});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0259", variables => {
machine_name => "node1",
anvil_name => $anvil_name,
host_uuid => $node1_host_uuid,
job_uuid => $node1_job_uuid,
}});
push @{$job_uuids}, $node1_job_uuid;
my ($node2_job_uuid) = $anvil->Database->insert_or_update_jobs({
job_host_uuid => $node2_host_uuid,
job_command => $anvil->data->{path}{exe}{'anvil-join-anvil'},
job_data => "as_machine=node2,manifest_uuid=".$manifest_uuid.",anvil_uuid=".$anvil_uuid,
job_name => "join_anvil::node2",
job_title => "job_0072",
job_description => "job_0073",
job_progress => 0,
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { node2_job_uuid => $node2_job_uuid }});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0259", variables => {
machine_name => "node2",
anvil_name => $anvil_name,
host_uuid => $node2_host_uuid,
job_uuid => $node2_job_uuid,
}});
push @{$job_uuids}, $node2_job_uuid;
if ($anvil->data->{cgi}{dr1_host}{value})
{
my ($dr1_job_uuid) = $anvil->Database->insert_or_update_jobs({
job_host_uuid => $dr1_host_uuid,
job_command => $anvil->data->{path}{exe}{'anvil-join-anvil'},
job_data => "as_machine=dr1,manifest_uuid=".$manifest_uuid.",anvil_uuid=".$anvil_uuid,
job_name => "join_anvil::dr1",
job_title => "job_0072",
job_description => "job_0073",
job_progress => 0,
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { dr1_job_uuid => $dr1_job_uuid }});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0259", variables => {
machine_name => "dr1",
anvil_name => $anvil_name,
host_uuid => $dr1_host_uuid,
job_uuid => $dr1_job_uuid,
}});
push @{$job_uuids}, $dr1_job_uuid;
}
}
update_progress($anvil, 80, "job_0257");
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0257"});
# Wait for jobs to complete.
my $waiting = 1;
while ($waiting)
{
$waiting = 0;
foreach my $job_uuid (@{$job_uuids})
{
my $return = $anvil->Database->get_job_details({job_uuid => $job_uuid});
my $job_progress = $return->{job_progress};
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0259", variables => {
job_uuid => $job_uuid,
progress => $job_progress,
}});
if ($job_progress != 100)
{
# Still waiting
$waiting = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { waiting => $waiting }});
}
}
if ($waiting)
{
# Wait a bit and check again.
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0262"});
sleep 10;
}
else
{
# We're done.
update_progress($anvil, 100, "job_0263");
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0263"});
}
}
return(0);
}
# This initializes nodes and DR hosts. This also sets the 'cgi::<variable>::value' hashes that will be needed
# later to create the install manifest.
sub initialize_machines
{
my ($anvil) = @_;
update_progress($anvil, 60, "job_0246");
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0245"});
foreach my $anvil_number (sort {$a cmp $b} keys %{$anvil->data->{anvil}})
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { anvil_number => $anvil_number }});
foreach my $machine_type ("node", "dr")
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { machine_type => $machine_type }});
foreach my $machine_number (sort {$a cmp $b} keys %{$anvil->data->{anvil}{$anvil_number}{$machine_type}})
{
my $startup_ip = $anvil->data->{anvil}{$anvil_number}{$machine_type}{start_ip};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
machine_number => $machine_number,
startup_ip => $startup_ip,
}});
# Find the IP we can access the machine with and the machine's host_uuid.
my $machine_host_uuid = "";
my $machine_ips = [];
push @{$machine_ips}, $startup_ip;
foreach my $network (sort {$a cmp $b} keys %{$anvil->data->{anvil}{$anvil_number}{$machine_type}{network}})
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { network => $network }});
foreach my $network_number (sort {$a cmp $b} keys %{$anvil->data->{anvil}{$anvil_number}{$machine_type}{network}{$network}})
{
my $ip_address = $anvil->data->{anvil}{$anvil_number}{$machine_type}{$machine_number}{network}{$network}{$network_number}{ip};
my $subnet_mask = $anvil->data->{anvil}{$anvil_number}{$machine_type}{$machine_number}{network}{$network}{$network_number}{subnet_mask};
my $link1_mac = $anvil->data->{anvil}{$anvil_number}{$machine_type}{$machine_number}{network}{$network}{$network_number}{'link'}{1}{mac};
my $link2_mac = $anvil->data->{anvil}{$anvil_number}{$machine_type}{$machine_number}{network}{$network}{$network_number}{'link'}{1}{mac};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
's1:ip_address' => $ip_address,
's2:subnet_mask' => $subnet_mask,
's3:link1_mac' => $link1_mac,
's4:link2_mac' => $link2_mac,
}});
# No sense pushing SN IPs
if ($network != /^sn/)
{
push @{$machine_ips}, $ip_address;
}
if (not $machine_host_uuid)
{
$machine_host_uuid = get_host_uuid_from_mac($anvil, $link1_mac);
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { machine_host_uuid => $machine_host_uuid }});
}
if (not $machine_host_uuid)
{
$machine_host_uuid = get_host_uuid_from_mac($anvil, $link2_mac);
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { machine_host_uuid => $machine_host_uuid }});
}
}
}
# If I don't have a machine host uuid, initialize the machine.
if ($machine_host_uuid)
{
# Already initialized
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0247", variables => {
machine => $machine_type.$machine_number,
host_uuid => $machine_host_uuid,
}});
}
else
{
# Which IP should be use to initialize?
my $use_ip = "";
my $use_password = $anvil->data->{base}{password}{current};
until ($use_ip)
{
foreach my $ip_address (@{$machine_ips})
{
next if $use_ip;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { ip_address => $ip_address }});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0248", variables => {
machine => $machine_type.$machine_number,
ip => $ip_address,
}});
my $access = $anvil->Remote->test_access({
target => $ip_address,
password => $use_password,
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { access => $access }});
if ($access)
{
$use_ip = $ip_address;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { use_ip => $use_ip }});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0250", variables => { ip => $use_ip }});
}
else
{
# Failed to log in, try again with the
# desired password, the machine might already
# be updated.
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0249", variables => {
machine => $machine_type.$machine_number,
ip => $ip_address,
}});
$access = $anvil->Remote->test_access({
target => $ip_address,
password => $anvil->data->{base}{password}{desired},
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { access => $access }});
if ($access)
{
# The new password worked.
$use_password = $anvil->data->{base}{password}{desired};
$use_ip = $ip_address;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { use_ip => $use_ip }});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0250", variables => { ip => $use_ip }});
}
}
}
if (not $use_ip)
{
# Sleep and try again.
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0251", variables => { machine => $machine_type.$machine_number }});
sleep 10;
}
}
# Now register a job to initialize the target.
my $padded_sequence = $anvil_number;
if (length($padded_sequence) == 1)
{
$padded_sequence = sprintf("%02d", $padded_sequence);
}
my $machine_suffix = $machine_type eq "node" ? "n".sprintf("%02d", $machine_number) : "dr".sprintf("%02d", $machine_number);
my $name_prefix = "a".$padded_sequence;
my $say_host_name = $anvil->data->{base}{prefix}."-".$name_prefix.$machine_suffix.".".$anvil->data->{base}{domain};
# Store the peer's password as the job data
my $job_data = "password=".$anvil->data->{base}{password}{desired}."\n";
$job_data .= "rh_password=".$anvil->data->{base}{rhn}{password}."\n";
$job_data .= "rh_user=".$anvil->data->{base}{rhn}{user}."\n";
$job_data .= "host_ip_address=".$use_ip."\n";
$job_data .= "ssh_port=22\n";
$job_data .= "type=".$machine_type."\n";
$job_data .= "host_name=".$say_host_name;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, secure => 1, list => { job_data => $job_data }});
# Store the job
my ($job_uuid) = $anvil->Database->insert_or_update_jobs({
debug => 2,
file => $THIS_FILE,
line => __LINE__,
job_command => $anvil->data->{path}{exe}{'striker-initialize-host'},
job_data => $job_data,
job_name => "initialize::".$machine_type."::".$use_ip,
job_title => $machine_type eq "dr" ? "job_0021" : "job_0020",
job_description => "job_0022",
job_progress => 0,
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { job_uuid => $job_uuid }});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0246", variables => {
host_name => $say_host_name,
ip => $use_ip,
job_uuid => $job_uuid,
}});
}
}
}
}
update_progress($anvil, 65, "job_0253");
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0253"});
# Now wait until all machines are in the database.
my $waiting = 1;
my $node1_host_uuid = "";
my $node2_host_uuid = "";
my $dr1_host_uuid = "";
while($waiting)
{
$waiting = 0;
foreach my $anvil_number (sort {$a cmp $b} keys %{$anvil->data->{anvil}})
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { anvil_number => $anvil_number }});
foreach my $machine_type ("node", "dr")
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { machine_type => $machine_type }});
foreach my $machine_number (sort {$a cmp $b} keys %{$anvil->data->{anvil}{$anvil_number}{$machine_type}})
{
my $machine_host_uuid = "";
foreach my $network (sort {$a cmp $b} keys %{$anvil->data->{anvil}{$anvil_number}{$machine_type}{network}})
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { network => $network }});
foreach my $network_number (sort {$a cmp $b} keys %{$anvil->data->{anvil}{$anvil_number}{$machine_type}{network}{$network}})
{
next if $machine_host_uuid;
my $link1_mac = $anvil->data->{anvil}{$anvil_number}{$machine_type}{$machine_number}{network}{$network}{$network_number}{'link'}{1}{mac};
my $link2_mac = $anvil->data->{anvil}{$anvil_number}{$machine_type}{$machine_number}{network}{$network}{$network_number}{'link'}{1}{mac};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
's1:link1_mac' => $link1_mac,
's2:link2_mac' => $link2_mac,
}});
# No sense pushing SN IPs
if (not $machine_host_uuid)
{
$machine_host_uuid = get_host_uuid_from_mac($anvil, $link1_mac);
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { machine_host_uuid => $machine_host_uuid }});
}
if (not $machine_host_uuid)
{
$machine_host_uuid = get_host_uuid_from_mac($anvil, $link2_mac);
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { machine_host_uuid => $machine_host_uuid }});
}
}
}
if ($machine_host_uuid)
{
# Ready
my $key = $machine_type.$machine_number;
$anvil->data->{process}{anvil}{$anvil_number}{$key}{host_uuid} = $machine_host_uuid;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"process::anvil::${anvil_number}::${key}::host_uuid" => $anvil->data->{process}{anvil}{$anvil_number}{$key}{host_uuid},
}});
}
else
{
# At least one machine isn't up yet.
$waiting = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { waiting => $waiting }});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0254", variables => { machine => $machine_type.$machine_number }});
}
}
}
}
if ($waiting)
{
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0255"});
sleep 10;
}
}
update_progress($anvil, 65, "job_0256");
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0256"});
return(0);
}
# This creates the manifests
sub create_manifest
{
my ($anvil) = @_;
# By here, the peer(s) are joined.
update_progress($anvil, 50, "job_0243");
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0243"});
$anvil->Database->get_upses({debug => 2});
$anvil->Database->get_fences({debug => 2});
# This is common for all Anvil! systems we might be building
$anvil->data->{cgi}{prefix}{value} = $anvil->data->{base}{prefix};
$anvil->data->{cgi}{domain}{value} = $anvil->data->{base}{domain};
$anvil->data->{cgi}{mtu}{value} = $anvil->data->{base}{mtu};
$anvil->data->{cgi}{dns}{value} = $anvil->data->{base}{dns};
$anvil->data->{cgi}{ntp}{value} = $anvil->data->{base}{ntp};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"cgi::prefix::value" => $anvil->data->{cgi}{prefix}{value},
"cgi::domain::value" => $anvil->data->{cgi}{domain}{value},
"cgi::mtu::value" => $anvil->data->{cgi}{mtu}{value},
"cgi::dns::value" => $anvil->data->{cgi}{dns}{value},
"cgi::ntp::value" => $anvil->data->{cgi}{ntp}{value},
}});
foreach my $anvil_number (sort {$a cmp $b} keys %{$anvil->data->{anvil}})
{
$anvil->data->{cgi}{sequence}{value} = $anvil_number;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"cgi::sequence::value" => $anvil->data->{cgi}{sequence}{value},
}});
my $padded_sequence = $anvil_number;
if (length($padded_sequence) == 1)
{
$padded_sequence = sprintf("%02d", $padded_sequence);
}
my $anvil_name = $anvil->data->{cgi}{prefix}{value}."-anvil-".$padded_sequence;
my $query = "SELECT manifest_uuid FROM manifests WHERE manifest_name = ".$anvil->Database->quote($anvil_name).";";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }});
$anvil->data->{process}{anvil}{$anvil_number}{name} = $anvil_name;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"process::anvil::${anvil_number}::name" => $anvil->data->{process}{anvil}{$anvil_number}{name},
}});
my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});
my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
results => $results,
count => $count,
}});
if ($count)
{
$anvil->data->{cgi}{manifest_uuid}{value} = $results->[0]->[0];
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"cgi::manifest_uuid::value" => $anvil->data->{cgi}{manifest_uuid}{value},
}});
}
else
{
$anvil->data->{cgi}{manifest_uuid}{value} = "new";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"cgi::manifest_uuid::value" => $anvil->data->{cgi}{manifest_uuid}{value},
}});
}
foreach my $machine_type ("node", "dr")
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { machine_type => $machine_type }});
foreach my $machine_number (sort {$a cmp $b} keys %{$anvil->data->{anvil}{$anvil_number}{$machine_type}})
{
my $machine = $machine_type.$machine_number;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
machine => $machine,
machine_number => $machine_number,
}});
$anvil->data->{cgi}{bcn_count}{value} = keys %{$anvil->data->{anvil}{$anvil_number}{$machine_type}{$machine_number}{network}{bcn}};
$anvil->data->{cgi}{sn_count}{value} = keys %{$anvil->data->{anvil}{$anvil_number}{$machine_type}{$machine_number}{network}{sn}};
$anvil->data->{cgi}{ifn_count}{value} = keys %{$anvil->data->{anvil}{$anvil_number}{$machine_type}{$machine_number}{network}{ifn}};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"cgi::bcn_count::value" => $anvil->data->{cgi}{bcn_count}{value},
"cgi::sn_count::value" => $anvil->data->{cgi}{sn_count}{value},
"cgi::ifn_count::value" => $anvil->data->{cgi}{ifn_count}{value},
}});
# The machine might already be initialized, so we'll look in our database for
# any entries ith the same MAC addresses. If none are found, we'll wait to
# ping it on the startup IP and then initialize it.
my $machine_host_uuid = "";
my $machine_ips = [];
my $startup_ip = $anvil->data->{anvil}{$anvil_number}{$machine_type}{$machine_number}{startup_ip};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { startup_ip => $startup_ip }});
foreach my $network (sort {$a cmp $b} keys %{$anvil->data->{anvil}{$anvil_number}{$machine_type}{$machine_number}{network}})
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { network => $network }});
foreach my $network_number (sort {$a cmp $b} keys %{$anvil->data->{anvil}{$anvil_number}{$machine_type}{$machine_number}{network}{$network}})
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { network_number => $network_number }});
my $ip_address = $anvil->data->{anvil}{$anvil_number}{$machine_type}{$machine_number}{network}{$network}{$network_number}{ip};
my $subnet_mask = $anvil->data->{anvil}{$anvil_number}{$machine_type}{$machine_number}{network}{$network}{$network_number}{subnet_mask};
my $link1_mac = $anvil->data->{anvil}{$anvil_number}{$machine_type}{$machine_number}{network}{$network}{$network_number}{'link'}{1}{mac};
my $link2_mac = $anvil->data->{anvil}{$anvil_number}{$machine_type}{$machine_number}{network}{$network}{$network_number}{'link'}{1}{mac};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
's1:ip_address' => $ip_address,
's2:subnet_mask' => $subnet_mask,
's3:link1_mac' => $link1_mac,
's4:link2_mac' => $link2_mac,
}});
push @{$machine_ips}, $ip_address."/".$subnet_mask;
if (not $machine_host_uuid)
{
$machine_host_uuid = get_host_uuid_from_mac($anvil, $link1_mac);
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { machine_host_uuid => $machine_host_uuid }});
}
if (not $machine_host_uuid)
{
$machine_host_uuid = get_host_uuid_from_mac($anvil, $link2_mac);
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { machine_host_uuid => $machine_host_uuid }});
}
my $network_name = $network.$network_number;
my $network_key = $network_name."_network";
my $subnet_key = $network_name."_subnet";
my $gateway_key = $network_name."_gateway";
my $ip_key = $machine."_".$network_name."_ip";
$anvil->data->{cgi}{$network_key}{value} = $anvil->Network->get_network({ip => $ip_address, subnet_mask => $subnet_mask});
$anvil->data->{cgi}{$subnet_key}{value} = $subnet_mask;
$anvil->data->{cgi}{$gateway_key}{value} = $anvil->data->{base}{gateway_network} eq $network_name ? $anvil->data->{base}{gateway_network} : "";
$anvil->data->{cgi}{$ip_key}{value} = $ip_address;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"cgi::${network_key}::value" => $anvil->data->{cgi}{$network_key}{value},
"cgi::${subnet_key}::value" => $anvil->data->{cgi}{$subnet_key}{value},
"cgi::${gateway_key}::value" => $anvil->data->{cgi}{$gateway_key}{value},
"cgi::${ip_key}::value" => $anvil->data->{cgi}{$ip_key}{value},
}});
if ($network_name eq "bcn1")
{
my $ipmi_ip_key = $machine."_ipmi_ip";
$anvil->data->{cgi}{$ipmi_ip_key}{value} = $anvil->data->{$machine_type}{$machine_number}{network}{$network}{$network_number}{ipmi_ip};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"cgi::${ipmi_ip_key}::value" => $anvil->data->{cgi}{$ipmi_ip_key}{value},
}});
### Find the UPSes.
# Preset all known UPSes to not used
foreach my $ups_name (sort {$a cmp $b} keys %{$anvil->data->{upses}{ups_name}})
{
my $ups_key = $machine."_ups_".$ups_name;
$anvil->data->{cgi}{$ups_key}{value} = "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"cgi::${ups_key}::value" => $anvil->data->{cgi}{$ups_key}{value},
}});
}
# Now flip on the ones configured for use
foreach my $ups_number (sort {$a cmp $b} keys %{$anvil->data->{anvil}{$anvil_number}{$machine_type}{$machine_number}{ups}})
{
my $ups_name = $anvil->data->{anvil}{$anvil_number}{$machine_type}{$machine_number}{ups}{$ups_number}{name};
my $ups_key = $machine."_ups_".$ups_name;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
ups_number => $ups_number,
ups_name => $ups_name,
}});
$anvil->data->{cgi}{$ups_key}{value} = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"cgi::${ups_key}::value" => $anvil->data->{cgi}{$ups_key}{value},
}});
}
### Find the Fence devices.
# Preset all known fence devices to have no port.
foreach my $fence_name (sort {$a cmp $b} keys %{$anvil->data->{fences}{fence_name}})
{
my $fence_key = $machine."_fence_".$fence_name;
$anvil->data->{cgi}{$fence_key}{value} = "" if not defined $anvil->data->{cgi}{$fence_key}{value};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"cgi::${fence_key}::value" => $anvil->data->{cgi}{$fence_key}{value},
}});
}
foreach my $fence_number (sort {$a cmp $b} keys %{$anvil->data->{anvil}{$anvil_number}{$machine_type}{$machine_number}{fence}})
{
my $fence_name = $anvil->data->{anvil}{$anvil_number}{$machine_type}{$machine_number}{fence}{$fence_number}{name};
my $fence_port = $anvil->data->{anvil}{$anvil_number}{$machine_type}{$machine_number}{fence}{$fence_number}{port};
my $fence_key = $machine."_fence_".$fence_name;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
fence_number => $fence_number,
fence_name => $fence_name,
fence_port => $fence_port,
}});
$anvil->data->{cgi}{$fence_key}{value} = $fence_port;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"cgi::${fence_key}::value" => $anvil->data->{cgi}{$fence_key}{value},
}});
}
}
}
}
}
}
# Now generate the manifest.
my ($manifest_uuid, $manifest_name) = $anvil->Striker->generate_manifest({debug => 2});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
manifest_uuid => $manifest_uuid,
manifest_name => $manifest_name,
}});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0244", variables => {
manifest_name => $manifest_name,
manifest_uuid => $manifest_uuid,
}});
$anvil->data->{process}{anvil}{$anvil_number}{manifest_uuid} = $manifest_uuid;
$anvil->data->{process}{anvil}{$anvil_number}{manifest_name} = $manifest_name;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"process::anvil::${anvil_number}::manifest_name" => $anvil->data->{process}{anvil}{$anvil_number}{manifest_name},
"process::anvil::${anvil_number}::manifest_uuid" => $anvil->data->{process}{anvil}{$anvil_number}{manifest_uuid},
}});
}
update_progress($anvil, 55, "job_0245");
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0245"});
return(0); return(0);
} }
sub add_fences
{
my ($anvil) = @_;
# By here, the peer(s) are joined.
update_progress($anvil, 40, "job_0240");
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0240"});
foreach my $fence_number (sort {$a cmp $b} keys %{$anvil->data->{fence}})
{
my $fence_name = $anvil->data->{fence}{$fence_number}{name};
my $fence_agent = $anvil->data->{fence}{$fence_number}{agent};
my $fence_arguments = $anvil->data->{fence}{$fence_number}{arguments};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
's1:fence_number' => $fence_number,
's2:fence_name' => $fence_name,
's3:fence_agent' => $fence_agent,
's4:fence_arguments' => $fence_arguments,
}});
my ($fence_uuid) = $anvil->Database->insert_or_update_fences({
fence_agent => $fence_agent,
fence_arguments => $fence_arguments,
fence_name => $fence_name,
});
if (($fence_uuid) && ($anvil->Validate->uuid({uuid => $fence_uuid})))
{
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0241", variables => {
fence_name => $fence_name,
fence_agent => $fence_agent,
fence_uuid => $fence_uuid,
}});
}
else
{
# WTF?
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 0, key => "error_0249", variables => {
fence_name => $fence_name,
fence_arguments => $fence_arguments,
fence_agent => $fence_agent,
}});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 0, key => "job_0238"});
update_progress($anvil, 100, "job_0238");
$anvil->nice_exit({exit_code => 1});
}
}
update_progress($anvil, 45, "job_0242");
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0242"});
return(0);
}
sub add_upses
{
my ($anvil) = @_;
# By here, the peer(s) are joined.
update_progress($anvil, 30, "job_0236");
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0236"});
foreach my $ups_number (sort {$a cmp $b} keys %{$anvil->data->{ups}})
{
my $ups_name = $anvil->data->{ups}{$ups_number}{name};
my $ups_agent = $anvil->data->{ups}{$ups_number}{agent};
my $ups_ip_address = $anvil->data->{ups}{$ups_number}{ip_address};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
's1:ups_number' => $ups_number,
's2:ups_name' => $ups_name,
's3:ups_agent' => $ups_agent,
's4:ups_ip_address' => $ups_ip_address,
}});
my ($ups_uuid) = $anvil->Database->insert_or_update_upses({
ups_agent => $ups_agent,
ups_ip_address => $ups_ip_address,
ups_name => $ups_name,
});
if (($ups_uuid) && ( $anvil->Validate->uuid({uuid => $ups_uuid})))
{
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0237", variables => {
ups_name => $ups_name,
ups_ip_address => $ups_ip_address,
ups_agent => $ups_agent,
ups_uuid => $ups_uuid,
}});
}
else
{
# WTF?
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 0, key => "error_0248", variables => {
ups_name => $ups_name,
ups_ip_address => $ups_ip_address,
ups_agent => $ups_agent,
}});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 0, key => "job_0238"});
update_progress($anvil, 100, "job_0238");
$anvil->nice_exit({exit_code => 1});
}
}
update_progress($anvil, 35, "job_0239");
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0239"});
return(0);
}
# This takes a MAC address and returns the host_uuid, if found.
sub get_host_uuid_from_mac
{
my ($anvil, $mac_address) = @_;
my $host_uuid = "";
my $query = "
SELECT
network_interface_host_uuid
FROM
network_interfaces
WHERE
network_interface_operational != 'DELETED'
AND
network_interface_mac_address = ".$anvil->Database->quote($mac_address)."
;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});
my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
results => $results,
count => $count,
}});
if ($count)
{
$host_uuid = $results->[0]->[0];
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { host_uuid => $host_uuid }});
}
return($host_uuid);
}
# Merge my peer Striker. # Merge my peer Striker.
sub merge_peer_striker sub merge_peer_striker
{ {
my ($anvil) = @_; my ($anvil) = @_;
# For each peer, see if we're already connected to it. # For each peer, see if we're already connected to it.
update_progress($anvil, 0, "clear");
update_progress($anvil, 10, "job_0234");
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0234"});
foreach my $striker_number (sort {$a cmp $b} keys %{$anvil->data->{striker}}) foreach my $striker_number (sort {$a cmp $b} keys %{$anvil->data->{striker}})
{ {
next if $striker_number !~ /^\d+$/; next if $striker_number !~ /^\d+$/;
@ -159,7 +903,7 @@ sub merge_peer_striker
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { striker_number => $striker_number }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { striker_number => $striker_number }});
# Use the MAC address(es) to look for a host UUID. If we don't find one, we need to peer it. # Use the MAC address(es) to look for a host UUID. If we don't find one, we need to peer it.
my $peer_host_uuid = 0; my $peer_host_uuid = "";
my $peer_ips = []; my $peer_ips = [];
foreach my $network (sort {$a cmp $b} keys %{$anvil->data->{striker}{$striker_number}{network}}) foreach my $network (sort {$a cmp $b} keys %{$anvil->data->{striker}{$striker_number}{network}})
{ {
@ -182,32 +926,11 @@ sub merge_peer_striker
link_number => $link_number, link_number => $link_number,
mac_address => $mac_address, mac_address => $mac_address,
}}); }});
my $query = " $peer_host_uuid = get_host_uuid_from_mac($anvil, $mac_address);
SELECT
network_interface_host_uuid
FROM
network_interfaces
WHERE
network_interface_operational != 'DELETED'
AND
network_interface_mac_address = ".$anvil->Database->quote($mac_address)."
;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});
my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
results => $results,
count => $count,
}});
if ($count)
{
$peer_host_uuid = $results->[0]->[0];
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { peer_host_uuid => $peer_host_uuid }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { peer_host_uuid => $peer_host_uuid }});
} }
} }
} }
}
if (not $peer_host_uuid) if (not $peer_host_uuid)
{ {
@ -376,6 +1099,8 @@ fi;
} }
# By here, the peer(s) are joined. # By here, the peer(s) are joined.
update_progress($anvil, 20, "job_0235");
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0235"});
return(0); return(0);
} }
@ -735,7 +1460,6 @@ sub update_progress
} }
$anvil->Job->update_progress({ $anvil->Job->update_progress({
debug => 3,
progress => $progress, progress => $progress,
message => $message, message => $message,
job_uuid => $anvil->data->{switches}{'job-uuid'}, job_uuid => $anvil->data->{switches}{'job-uuid'},

@ -16,6 +16,15 @@ base::domain = alteeve.com
# These are the DNS server to use when configuring networks, comma separated. # These are the DNS server to use when configuring networks, comma separated.
base::dns = 8.8.8.8,8.8.4.4 base::dns = 8.8.8.8,8.8.4.4
# If you have specific NTP servers to use, specify them here
base::ntp =
# If you want to set a specific MTU, set it here.
base::mtu =
# When generating the Anvil! install manifest, what will the Anvil! sequence be?
base::anvil::sequence = 1
# This is the default gateway for the IFN # This is the default gateway for the IFN
base::gateway = 192.168.122.1 base::gateway = 192.168.122.1
@ -28,6 +37,10 @@ base::password::current = Initial1
# This is the password to set for all systems. # This is the password to set for all systems.
base::password::desired = super secret password base::password::desired = super secret password
# If registering with RH, here is where you can set your credentials.
base::rhn::user =
base::rhn::password =
############################################################################################################# #############################################################################################################
# Striker configurations # # Striker configurations #
@ -53,3 +66,95 @@ striker::2::network::bcn::1::ip = 10.201.4.2
striker::2::network::bcn::1::subnet_mask = 255.255.0.0 striker::2::network::bcn::1::subnet_mask = 255.255.0.0
striker::2::network::bcn::1::link::1::mac = 52:54:00:b8:34:a7 striker::2::network::bcn::1::link::1::mac = 52:54:00:b8:34:a7
striker::2::network::bcn::1::link::2::mac = 52:54:00:30:f9:db striker::2::network::bcn::1::link::2::mac = 52:54:00:30:f9:db
#############################################################################################################
# Node and DR configuration #
#############################################################################################################
### UPSes - Optional
# Note: The 'ups_agent' is the ScanCore agent that will be used to monitor to state/health of the UPSes.
ups::1::name = an-ups01
ups::1::agent = scan-apc-ups
ups::1::ip_address = 10.201.3.1
ups::2::name = an-ups01
ups::2::agent = scan-apc-ups
ups::2::ip_address = 10.201.3.1
### Fence device(s)
# NOTE: Do NOT specify fence_ipmilan! It is detected / configured automatically.
# The fence_arguments only needs to contain variable="value" pairs that don't have a useful default.
fence::1::name = gravitar
fence::1::agent = virsh
fence::1::arguments = action="reboot" ip="192.168.122.1" password_script="/root/gravitar_password" username="root"
# Example PDUs
#fence::2::name = an-pdu01
#fence::2::agent = apc_snmp
#fence::2::arguments = action="reboot" ip="10.201.2.1"
#fence::3::name = an-pdu02
#fence::3::agent = apc_snmp
#fence::3::arguments = action="reboot" ip="10.201.2.2"
# Anvil description
anvil::1::description = "Test Anvil! running on gravitar"
### Nodes
anvil::1::node::1::start_ip = 192.168.122.235
anvil::1::node::1::network::ifn::1::ip = 192.168.122.11
anvil::1::node::1::network::ifn::1::subnet_mask = 255.255.255.0
anvil::1::node::1::network::ifn::1::link::1::mac = 52:54:00:17:d6:0b
anvil::1::node::1::network::ifn::1::link::2::mac = 52:54:00:c4:87:b6
anvil::1::node::1::network::bcn::1::ip = 10.201.10.1
anvil::1::node::1::network::bcn::1::ipmi_ip = 10.201.11.1
anvil::1::node::1::network::bcn::1::subnet_mask = 255.255.0.0
anvil::1::node::1::network::bcn::1::link::1::mac = 52:54:00:d2:6b:0b
anvil::1::node::1::network::bcn::1::link::2::mac = 52:54:00:01:11:0e
anvil::1::node::1::network::sn::1::ip = 10.101.4.1
anvil::1::node::1::network::sn::1::subnet_mask = 255.255.0.0
anvil::1::node::1::network::sn::1::link::1::mac = 52:54:00:7e:b8:9e
anvil::1::node::1::network::sn::1::link::2::mac = 52:54:00:23:e8:46
# Fence (IPMI configured automatically), same fence types grouped automatically
anvil::1::node::1::fence::1::name = gravitar
anvil::1::node::1::fence::1::port = an-a01n01
#anvil::1::node::1::fence::2::name = an-pdu01
#anvil::1::node::1::fence::2::port = 1
#anvil::1::node::1::fence::3::name = an-pdu02
#anvil::1::node::1::fence::3::port = 1
# Set for UPSes powering the node, if any
#anvil::1::node::1::ups::1::name = an-ups01
#anvil::1::node::1::ups::2::name = an-ups02
anvil::1::node::2::start_ip = 192.168.122.185
anvil::1::node::2::network::ifn::1::ip = 192.168.122.12
anvil::1::node::2::network::ifn::1::subnet_mask = 255.255.255.0
anvil::1::node::2::network::ifn::1::link::1::mac = 52:54:00:09:b7:90
anvil::1::node::2::network::ifn::1::link::2::mac = 52:54:00:78:a3:41
anvil::1::node::2::network::bcn::1::ip = 10.201.10.2
anvil::1::node::2::network::bcn::1::ipmi_ip = 10.201.11.2
anvil::1::node::2::network::bcn::1::subnet_mask = 255.255.0.0
anvil::1::node::2::network::bcn::1::link::1::mac = 52:54:00:06:2e:2d
anvil::1::node::2::network::bcn::1::link::2::mac = 52:54:00:14:16:98
anvil::1::node::2::network::sn::1::ip = 10.101.4.2
anvil::1::node::2::network::sn::1::subnet_mask = 255.255.0.0
anvil::1::node::2::network::sn::1::link::1::mac = 52:54:00:79:1c:ce
anvil::1::node::2::network::sn::1::link::2::mac = 52:54:00:5d:d3:6d
# Set for UPSes powering the node, if any
anvil::1::node::2::ups::1::name = an-ups01
anvil::1::node::2::ups::2::name = an-ups02
### DR host (optional)
anvil::1::dr::1::start_ip = 192.168.122.153
anvil::1::dr::1::network::ifn::1::ip = 192.168.122.10
anvil::1::dr::1::network::ifn::1::subnet_mask = 255.255.255.0
anvil::1::dr::1::network::ifn::1::link::1::mac = 52:54:00:6d:05:5e
anvil::1::dr::1::network::ifn::1::link::2::mac = 52:54:00:7e:87:ec
anvil::1::dr::1::network::bcn::1::ip = 10.201.10.3
anvil::1::dr::1::network::bcn::1::ipmi_ip = 10.201.11.3
anvil::1::dr::1::network::bcn::1::subnet_mask = 255.255.0.0
anvil::1::dr::1::network::bcn::1::link::1::mac = 52:54:00:6a:88:c2
anvil::1::dr::1::network::bcn::1::link::2::mac = 52:54:00:4b:58:fe
anvil::1::dr::1::network::sn::1::ip = 10.101.4.3
anvil::1::dr::1::network::sn::1::subnet_mask = 255.255.0.0
anvil::1::dr::1::network::sn::1::link::1::mac = 52:54:00:d6:f8:8d
anvil::1::dr::1::network::sn::1::link::2::mac = 52:54:00:51:7b:b6

Loading…
Cancel
Save