Fixing text
This commit is contained in:
@@ -28,7 +28,7 @@ fi
|
|||||||
while [ ! -d .git ]; do
|
while [ ! -d .git ]; do
|
||||||
cd ..
|
cd ..
|
||||||
if [ "$PWD" == '/' ]; then
|
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
|
exit 3
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
52
bin/deploy-tasks
Executable file
52
bin/deploy-tasks
Executable file
@@ -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 $?
|
@@ -17,7 +17,7 @@ fi
|
|||||||
while [ ! -d .git ]; do
|
while [ ! -d .git ]; do
|
||||||
cd ..
|
cd ..
|
||||||
if [ "$PWD" == '/' ]; then
|
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
|
exit 3
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
# Description: This file generates the DNS and DHCP files for pihole.
|
# Description: This file generates the DNS and DHCP files for pihole.
|
||||||
# It expects that the inventory has two levels of grouping.
|
# It expects that the inventory has two levels of grouping.
|
||||||
#
|
#
|
||||||
# Package: AniNIX/Ubiqtorate
|
# Package: AniNIX/Kapisi
|
||||||
# Copyright: WTFPL
|
# Copyright: WTFPL
|
||||||
#
|
#
|
||||||
# Author: DarkFeather <darkfeather@aninix.net>
|
# Author: DarkFeather <darkfeather@aninix.net>
|
||||||
@@ -20,7 +20,7 @@ dnsfilepath=rolepath+"/dns"
|
|||||||
dhcpfilepath=rolepath+"/dhcp"
|
dhcpfilepath=rolepath+"/dhcp"
|
||||||
entryset={}
|
entryset={}
|
||||||
|
|
||||||
def WriteDHCPEntries(replica_domain,dhcpfile):
|
def WriteDHCPEntries(dhcpfile):
|
||||||
### Create the DHCP entry
|
### Create the DHCP entry
|
||||||
# param content: the yaml content to parse
|
# param content: the yaml content to parse
|
||||||
# param hosttype: managed or unmanaged
|
# param hosttype: managed or unmanaged
|
||||||
@@ -29,9 +29,9 @@ def WriteDHCPEntries(replica_domain,dhcpfile):
|
|||||||
for host in entryset:
|
for host in entryset:
|
||||||
# Entries should be:
|
# Entries should be:
|
||||||
# dhcp-host=mac,ip,fqdn
|
# 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
|
### Create the DNS entry
|
||||||
# param content: the yaml content to parse
|
# param content: the yaml content to parse
|
||||||
# param hosttype: managed or unmanaged
|
# param hosttype: managed or unmanaged
|
||||||
@@ -40,7 +40,7 @@ def WriteDNSEntries(replica_domain,dnsfile):
|
|||||||
for host in entryset:
|
for host in entryset:
|
||||||
# Entries should be:
|
# Entries should be:
|
||||||
# ip host fqdn
|
# 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):
|
def GenerateFiles(file):
|
||||||
### Open the file and parse it
|
### Open the file and parse it
|
||||||
@@ -53,7 +53,6 @@ def GenerateFiles(file):
|
|||||||
# Parse the yaml
|
# Parse the yaml
|
||||||
with open(file, 'r') as stream:
|
with open(file, 'r') as stream:
|
||||||
content = yaml.safe_load(stream)
|
content = yaml.safe_load(stream)
|
||||||
replica_domain = content['all']['vars']['replica_domain']
|
|
||||||
external_domain = content['all']['vars']['external_domain']
|
external_domain = content['all']['vars']['external_domain']
|
||||||
|
|
||||||
# Clear the DNS file
|
# Clear the DNS file
|
||||||
@@ -61,10 +60,10 @@ def GenerateFiles(file):
|
|||||||
dhcpfile.write('dhcp-range='+content['all']['vars']['dhcprange']+'\n')
|
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-option=option:dns-server,'+content['all']['vars']['dns']+'\n\n')
|
||||||
dhcpfile.write('dhcp-range='+content['all']['vars']['staticrange']+'\n')
|
dhcpfile.write('dhcp-range='+content['all']['vars']['staticrange']+'\n')
|
||||||
WriteDHCPEntries(replica_domain,dhcpfile)
|
WriteDHCPEntries(dhcpfile)
|
||||||
with open(dnsfilepath,'w') as dnsfile:
|
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")
|
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);
|
print('Files should be in '+rolepath);
|
||||||
|
|
||||||
### Main function
|
### Main function
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# Description: This file generates the systemd.service files that run our VM's
|
# Description: This file generates the systemd.service files that run our VM's
|
||||||
#
|
#
|
||||||
# Package: AniNIX/Ubiqtorate
|
# Package: AniNIX/Kapisi
|
||||||
# Copyright: WTFPL
|
# Copyright: WTFPL
|
||||||
#
|
#
|
||||||
# Author: DarkFeather <darkfeather@aninix.net>
|
# Author: DarkFeather <darkfeather@aninix.net>
|
||||||
|
Reference in New Issue
Block a user