* Updated the database components to use the name 'anvil' and the user 'admin'. The 'database:❌:user' and 'database:❌:name' variables are still supported, but now hidden.
* Fixed a bug where some '$anvil->{}' variables should have been '$anvil->data->{}'. * Started merging message keys on 'error_xxxx', 'warning_xxxx', etc. * The anvil-configure-network now configures the network. Commented out, the tool can reconfigure the entire network without a reboot, but a current issue with the post-configured system refusing to use the allocated interface as the default gateway is to be reviewed at a future time. For now, a closing reboot will be issued. * Started creating 'anvil-change-password' that will update passwords, including apache (and configure .htpasswd when needed). Signed-off-by: Digimer <digimer@alteeve.ca>main
parent
e4f7bcf661
commit
a294c6c4fa
16 changed files with 581 additions and 216 deletions
@ -0,0 +1,5 @@ |
||||
The 'master.tar.gz' file from the anvil github repo: |
||||
https://github.com/digimer/anvil should be stored in this directory when |
||||
building the .spec file. |
||||
|
||||
* wget -c https://github.com/digimer/anvil/archive/master.zip |
@ -0,0 +1,203 @@ |
||||
%define debug_package %{nil} |
||||
Name: anvil |
||||
Version: 3.0 |
||||
Release: 3%{?dist} |
||||
Summary: Alteeve Anvil! complete package. |
||||
|
||||
License: GPLv2+ |
||||
URL: https://github.com/digimer/anvil |
||||
Source0: https://github.com/digimer/anvil/archive/master.tar.gz |
||||
BuildArch: noarch |
||||
|
||||
|
||||
%description |
||||
This package generates the anvil-core, anvil-striker, anvil-node and anvil-dr |
||||
RPM's. The 'core' RPM is common to all machines in an Anvil! cluster, with the |
||||
other three used for each machine, given its roll. |
||||
|
||||
WARNING: This is an alpha-stage project. Many features are missing and this |
||||
should not be used for anything other than development purposes! The |
||||
first stable release will be 3.1. Anything 3.0 is UNSTABLE. |
||||
|
||||
%package core |
||||
Summary: Alteeve's Anvil! Core package |
||||
Requires: bash-completion |
||||
Requires: bind-utils |
||||
Requires: fence-agents-all |
||||
Requires: fence-agents-virsh |
||||
Requires: firewalld |
||||
Requires: gpm |
||||
Requires: mlocate |
||||
Requires: perl-Data-Dumper |
||||
Requires: perl-DBD-Pg |
||||
Requires: perl-DBI |
||||
Requires: perl-JSON |
||||
Requires: perl-Log-Journald |
||||
Requires: perl-Net-SSH2 |
||||
Requires: perl-NetAddr-IP |
||||
Requires: perl-XML-Simple |
||||
Requires: postgresql-contrib |
||||
Requires: postgresql-plperl |
||||
Requires: rsync |
||||
Requires: screen |
||||
Requires: vim |
||||
# iptables-services conflicts with firewalld |
||||
Conflicts: iptables-services |
||||
# We handle interface naming |
||||
Conflicts: biosdevname |
||||
|
||||
%description core |
||||
Common base libraries required for the Anvil! system. |
||||
|
||||
|
||||
%package striker |
||||
Summary: Alteeve's Anvil! Striker dashboard package |
||||
BuildRequires: httpd |
||||
Requires: anvil-core |
||||
Requires: httpd |
||||
Requires: nmap |
||||
Requires: perl-CGI |
||||
Requires: postgresql-server |
||||
# A Striker dashboard is not allowed to host servers or be a migration target. |
||||
# So the node and dr packages can not be installed. |
||||
Conflicts: anvil-node |
||||
Conflicts: anvil-dr |
||||
%description striker |
||||
Web interface of the Striker dashboard for Alteeve Anvil! systems |
||||
|
||||
|
||||
%package node |
||||
Summary: Alteeve's Anvil! node package |
||||
Requires: anvil-core |
||||
Requires: bridge-utils |
||||
Requires: drbd |
||||
Requires: drbd-bash-completion |
||||
Requires: drbd-kernel |
||||
Requires: drbd-utils |
||||
Requires: kernel-doc |
||||
Requires: kmod-drbd |
||||
Requires: libvirt |
||||
Requires: libvirt-daemon |
||||
Requires: libvirt-daemon-driver-qemu |
||||
Requires: libvirt-daemon-kvm |
||||
Requires: libvirt-docs |
||||
Requires: pacemaker |
||||
Requires: pcs |
||||
Requires: qemu-kvm |
||||
Requires: qemu-kvm-common |
||||
Requires: qemu-kvm-tools |
||||
Requires: virt-install |
||||
# A node is allowed to host servers and be a live migration target. It is not |
||||
# allowed to host a database or be a DR host. |
||||
Conflicts: anvil-striker |
||||
Conflicts: anvil-dr |
||||
|
||||
%description node |
||||
|
||||
Provides support for active node in an Anvil! pair. |
||||
|
||||
NOTE: On RHEL proper, this requires the node had the "High-Availability |
||||
Add-on". |
||||
|
||||
NOTE: LINBIT customers must have access to the LINBIT repositories configured. |
||||
|
||||
%package dr |
||||
Summary: Alteeve's Anvil! DR host package |
||||
Requires: anvil-core |
||||
Requires: bridge-utils |
||||
Requires: drbd |
||||
Requires: drbd-bash-completion |
||||
Requires: drbd-kernel |
||||
Requires: drbd-utils |
||||
Requires: kernel-doc |
||||
Requires: kmod-drbd |
||||
Requires: libvirt |
||||
Requires: libvirt-daemon |
||||
Requires: libvirt-daemon-driver-qemu |
||||
Requires: libvirt-daemon-kvm |
||||
Requires: libvirt-docs |
||||
Requires: qemu-kvm |
||||
Requires: qemu-kvm-common |
||||
Requires: qemu-kvm-tools |
||||
Requires: virt-install |
||||
# A DR host is not allowed to be a live-migration target or host a database. |
||||
Conflicts: anvil-striker |
||||
Conflicts: anvil-node |
||||
|
||||
%description dr |
||||
|
||||
Provides support for asynchronous disaster recovery hosts in an Anvil! cluster. |
||||
|
||||
|
||||
%prep |
||||
%autosetup -n anvil-master |
||||
|
||||
|
||||
%build |
||||
|
||||
|
||||
%install |
||||
rm -rf $RPM_BUILD_ROOT |
||||
mkdir -p %{buildroot}/%{_sbindir}/anvil/ |
||||
mkdir -p %{buildroot}/%{_sysconfdir}/anvil/ |
||||
mkdir -p %{buildroot}/%{_localstatedir}/www/ |
||||
install -d -p Anvil %{buildroot}/%{_datadir}/perl5/ |
||||
install -d -p html %{buildroot}/%{_localstatedir}/www/ |
||||
install -d -p cgi-bin %{buildroot}/%{_localstatedir}/www/ |
||||
install -d -p units/ %{buildroot}/usr/lib/systemd/system/ |
||||
install -d -p tools/ %{buildroot}/%{_sbindir}/ |
||||
cp -R -p Anvil %{buildroot}/%{_datadir}/perl5/ |
||||
cp -R -p html %{buildroot}/%{_localstatedir}/www/ |
||||
cp -R -p cgi-bin %{buildroot}/%{_localstatedir}/www/ |
||||
cp -R -p units/* %{buildroot}/usr/lib/systemd/system/ |
||||
cp -R -p tools/* %{buildroot}/%{_sbindir} |
||||
cp -R -p anvil.conf %{buildroot}/%{_sysconfdir}/anvil/ |
||||
cp -R -p anvil.version %{buildroot}/%{_sysconfdir}/anvil/ |
||||
mv %{buildroot}/%{_sbindir}/anvil.sql %{buildroot}/%{_datadir}/anvil.sql |
||||
mv %{buildroot}/%{_sbindir}/snmp-models.json %{buildroot}/%{_sysconfdir}/anvil/snmp-models.json |
||||
sed -i "1s/^.*$/%{version}/" %{buildroot}/%{_sysconfdir}/anvil/anvil.version |
||||
|
||||
|
||||
%post |
||||
restorecon -rv %{buildroot}/%{_localstatedir}/www |
||||
|
||||
%post striker |
||||
systemctl enable httpd.service |
||||
systemctl start httpd.service |
||||
|
||||
%files core |
||||
%doc README.md notes |
||||
%config(noreplace) %{_sysconfdir}/anvil/anvil.conf |
||||
%config(noreplace) %{_datadir}/anvil.sql |
||||
%{_usr}/lib/* |
||||
%{_sbindir}/* |
||||
%{_sysconfdir}/anvil/anvil.version |
||||
%{_datadir}/perl5/* |
||||
|
||||
|
||||
%files striker |
||||
%attr(0775, apache, root) %{_localstatedir}/www/*/* |
||||
%{_sysconfdir}/anvil/snmp-models.json |
||||
%ghost %{_sysconfdir}/anvil/snmp-vendors.txt |
||||
|
||||
%files node |
||||
#<placeholder for node specific files> |
||||
|
||||
%files dr |
||||
#<placeholder for node specific files> |
||||
|
||||
|
||||
%changelog |
||||
* Sun Mar 18 2018 Madison Kelly <mkelly@alteeve.ca> 3.0-3 |
||||
- Changed the 'Obsoletes' to 'Conflicts'. |
||||
|
||||
* Sat Mar 17 2018 Madison Kelly <mkelly@alteeve.ca> 3.0-2 |
||||
- Added a post task to striker to enable/start apache. |
||||
|
||||
* Wed Mar 14 2018 Madison Kelly <mkelly@alteeve.ca> 3.0-1 |
||||
- Dropped the 'a' from the version. |
||||
- Expanded the list of requirements. |
||||
- Added the 'node' and 'dr' packages. |
||||
|
||||
* Fri Jan 26 2018 Matthew Marangoni <matthew.marangoni@senecacollege.ca> 3.0a-1 |
||||
- Initial RPM release |
@ -0,0 +1,91 @@ |
||||
#!/usr/bin/perl |
||||
# |
||||
# This program sets/changes passwords on the Anvil! platform (nodes and dashboards). |
||||
# |
||||
# Exit codes; |
||||
# 0 = Normal exit. |
||||
# 1 = The program is not running as root. |
||||
# 2 = Failed to connect to database(s). |
||||
# |
||||
|
||||
use strict; |
||||
use warnings; |
||||
use Data::Dumper; |
||||
use Anvil::Tools; |
||||
|
||||
my $THIS_FILE = ($0 =~ /^.*\/(.*)$/)[0]; |
||||
my $running_directory = ($0 =~ /^(.*?)\/$THIS_FILE$/)[0]; |
||||
if (($running_directory =~ /^\./) && ($ENV{PWD})) |
||||
{ |
||||
$running_directory =~ s/^\./$ENV{PWD}/; |
||||
} |
||||
|
||||
# Turn off buffering so that the pinwheel will display while waiting for the SSH call(s) to complete. |
||||
$| = 1; |
||||
|
||||
# Prevent a discrepency between UID/GID and EUID/EGID from throwing an error. |
||||
$< = $>; |
||||
$( = $); |
||||
|
||||
my $anvil = Anvil::Tools->new(); |
||||
$anvil->Log->level({set => 2}); |
||||
$anvil->Log->secure({set => 0}); |
||||
|
||||
# Read switches |
||||
$anvil->Get->switches; |
||||
|
||||
# Paths |
||||
$anvil->Storage->read_config({file => $anvil->data->{path}{config}{'anvil.conf'}}); |
||||
|
||||
# Make sure we're running as 'root' |
||||
# $< == real UID, $> == effective UID |
||||
if (($< != 0) && ($> != 0)) |
||||
{ |
||||
# Not root |
||||
print $anvil->Words->string({key => "error_0005"})."\n"; |
||||
$anvil->nice_exit({code => 1}); |
||||
} |
||||
|
||||
# Connect |
||||
my $connections = $anvil->Database->connect(); |
||||
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, secure => 0, key => "log_0132", variables => { connections => $connections }}); |
||||
if (not $connections) |
||||
{ |
||||
# No databases, exit. |
||||
print $anvil->Words->string({key => "error_0003"}); |
||||
$anvil->nice_exit({exit_code => 2}); |
||||
} |
||||
|
||||
### TODO: Check for access to all known Anvil! nodes and warn the user that they will have to manually update |
||||
### the password for us on any node we can't access |
||||
### NOTE: 'anvil' can be a name or UUID |
||||
# If we're called without an '--anvil' switch, then change the local password only. |
||||
if ($anvil->data->{switches}{anvil}) |
||||
{ |
||||
# Find the Anvil! and verify access to both nodes. If neither are accessible, abort. |
||||
} |
||||
else |
||||
{ |
||||
### TODO: Support '--peers' to also update the peer dashboards. |
||||
# Updating just ourself |
||||
update_local_passwords($anvil); |
||||
} |
||||
|
||||
|
||||
$anvil->nice_exit({code => 0}); |
||||
|
||||
############################################################################################################# |
||||
# Functions # |
||||
############################################################################################################# |
||||
|
||||
# This updates the local passwords. |
||||
sub update_local_passwords |
||||
{ |
||||
my ($anvil) = @_; |
||||
|
||||
# Update the local users. |
||||
|
||||
# Update the database password. |
||||
|
||||
return(0); |
||||
} |
Loading…
Reference in new issue