diff --git a/bin/deploy-role b/bin/deploy-role index c162b80..346a318 100755 --- a/bin/deploy-role +++ b/bin/deploy-role @@ -28,7 +28,7 @@ fi while [ ! -d .git ]; do cd .. if [ "$PWD" == '/' ]; then - echo "This needs to be run from the Ubiqtorate checkout" + echo "This needs to be run from the Kapisi checkout" exit 3 fi done diff --git a/bin/deploy-tasks b/bin/deploy-tasks new file mode 100755 index 0000000..a605796 --- /dev/null +++ b/bin/deploy-tasks @@ -0,0 +1,52 @@ +#!/bin/bash + + +# Role is first argument +taskfile="$1" +if [ -z "$taskfile" ]; then + echo Need a taskfile as first argument. + exit 1 +fi + +# Ensure we are in the source directory. +cd $(dirname $1)/.. + +# Handle verbosity +if [ "$1" == "-v" ]; then + set -x + shift + taskfile="$1" +fi + +# Handle usage +if [ "$taskfile" == "-h" ] || [ "$taskfile" == "--help" ]; then + echo "Usage: $0 -h" + echo " $0 \$taskfile \$targetgroup [\$optional_inventory]" + exit 0 +fi + +# Find the root of the git clone +while [ ! -d .git ]; do + cd .. + if [ "$PWD" == '/' ]; then + echo "This needs to be run from the Kapisi checkout" + exit 3 + fi +done + +# Get the targetgroup +targetgroup="$2" +if [ -z "$targetgroup" ]; then + targetgroup="$taskfile" # Deploy a taskfile to the server named for that function +fi + +# Allow an inventory override +inventory="$3" +if [ -z "$inventory" ]; then + inventory=examples/msn0.yml +fi + +# Invoke the one-taskfile playbook for the taskfile on the targetgroup +ansible-playbook -i "$inventory" -e "taskfile=$taskfile" -e "targets=$targetgroup" "$(dirname $0)/../playbooks/one-taskfile.yml" +# and return the exit status +exit $? diff --git a/bin/full-deploy b/bin/full-deploy index 62d99d9..58eafd3 100755 --- a/bin/full-deploy +++ b/bin/full-deploy @@ -17,7 +17,7 @@ fi while [ ! -d .git ]; do cd .. if [ "$PWD" == '/' ]; then - echo "This needs to be run from the Ubiqtorate checkout" + echo "This needs to be run from the Kapisi checkout" exit 3 fi done diff --git a/bin/generate-pihole-dns-dhcp.py b/bin/generate-pihole-dns-dhcp.py index 1fef88b..bf8eda5 100755 --- a/bin/generate-pihole-dns-dhcp.py +++ b/bin/generate-pihole-dns-dhcp.py @@ -4,7 +4,7 @@ # Description: This file generates the DNS and DHCP files for pihole. # It expects that the inventory has two levels of grouping. # -# Package: AniNIX/Ubiqtorate +# Package: AniNIX/Kapisi # Copyright: WTFPL # # Author: DarkFeather @@ -20,7 +20,7 @@ dnsfilepath=rolepath+"/dns" dhcpfilepath=rolepath+"/dhcp" entryset={} -def WriteDHCPEntries(replica_domain,dhcpfile): +def WriteDHCPEntries(dhcpfile): ### Create the DHCP entry # param content: the yaml content to parse # param hosttype: managed or unmanaged @@ -29,9 +29,9 @@ def WriteDHCPEntries(replica_domain,dhcpfile): for host in entryset: # Entries should be: # dhcp-host=mac,ip,fqdn - dhcpfile.write('dhcp-host=' + entryset[host][1] + ',' + entryset[host][0] + ',' + host + '.' + replica_domain + '\n') + dhcpfile.write('dhcp-host=' + entryset[host][1] + ',' + entryset[host][0] + ',' + entryset[host][2] + '\n') -def WriteDNSEntries(replica_domain,dnsfile): +def WriteDNSEntries(dnsfile): ### Create the DNS entry # param content: the yaml content to parse # param hosttype: managed or unmanaged @@ -40,7 +40,7 @@ def WriteDNSEntries(replica_domain,dnsfile): for host in entryset: # Entries should be: # ip host fqdn - dnsfile.write(entryset[host][0] + ' ' + host + '.' + replica_domain + ' ' + host + '\n') + dnsfile.write(entryset[host][0] + ' ' + entryset[host][2] + ' ' + host + '\n') def GenerateFiles(file): ### Open the file and parse it @@ -53,7 +53,6 @@ def GenerateFiles(file): # Parse the yaml with open(file, 'r') as stream: content = yaml.safe_load(stream) - replica_domain = content['all']['vars']['replica_domain'] external_domain = content['all']['vars']['external_domain'] # Clear the DNS file @@ -61,10 +60,10 @@ def GenerateFiles(file): dhcpfile.write('dhcp-range='+content['all']['vars']['dhcprange']+'\n') dhcpfile.write('dhcp-option=option:dns-server,'+content['all']['vars']['dns']+'\n\n') dhcpfile.write('dhcp-range='+content['all']['vars']['staticrange']+'\n') - WriteDHCPEntries(replica_domain,dhcpfile) + WriteDHCPEntries(dhcpfile) with open(dnsfilepath,'w') as dnsfile: dnsfile.write(content['all']['vars']['webfront']+' '+external_domain+' '+content['all']['vars']['external_subdomains'].replace(' ','.'+external_domain+' ')+'.'+external_domain+' '+content['all']['vars']['hosted_domains']+"\n") - WriteDNSEntries(replica_domain,dnsfile) + WriteDNSEntries(dnsfile) print('Files should be in '+rolepath); ### Main function diff --git a/bin/generate-systemd-vms.py b/bin/generate-systemd-vms.py index d8b09fc..749517e 100755 --- a/bin/generate-systemd-vms.py +++ b/bin/generate-systemd-vms.py @@ -3,7 +3,7 @@ # # Description: This file generates the systemd.service files that run our VM's # -# Package: AniNIX/Ubiqtorate +# Package: AniNIX/Kapisi # Copyright: WTFPL # # Author: DarkFeather