adding what I've gotten so far

This commit is contained in:
Ubergeek 2019-11-12 17:56:16 +00:00
parent fe1b5f83d2
commit 02484c4e85
3 changed files with 171 additions and 1 deletions

View File

@ -1,3 +1,23 @@
# thunixctl
These are a set of tools to allow users to carry out basic administrative tasks, in a secure manner.
These are a set of tools to allow users to carry out basic administrative tasks, in a secure manner.
# thunixctl
thunixctl {service} {action}
thunixctl is a tool that allows for end-user execution of simple administrative tasks, in a secure fashion.
{service} and {action} are required arguments.
Currently, the available services are ansible, www, and gopher. Actions are pull for all three, and run for ansible. "Run" allows users to kick off an ansible run on the machine. "Pull" grabs the latest copy of the repo into it's thunix working location.
# openissue
openissue {repo} {title} {body}
openissue eases the ability for users to open issues in the pertient Thunix repo, without the need to create a tildegit account.
{repo} - Any of the project repos Thunix uses to operate. A list can be found (here)[https://tildegit.org/thunix].
{title} - A short description of the issue
{body} - Full length description of the problem. Your username will be included here, so we know who to address regarding this issue.

50
openissue Executable file
View File

@ -0,0 +1,50 @@
#!/bin/bash
################################################################################
#
# $0 is a toold that allows end users to more easily open issues
#
# Arguments:
# {repo}
# {title}
# {description}
#
# Return codes:
# 0 Exectuted without problem
# 1 Incorrect usage pattern.
#
# This software is licensed under the AGPL 3.0 or later, by
# ubergeek <ubergeek@thunix.net>
#
################################################################################
REPO=$1
if [[ ! $REPO =~ www|ansible|gopher ]]; then
echo "Please specify a valid repo for the project."
exit 1
fi
if [[ $2 = "" !! $3 = "" ]]; then
echo "Please specify a title, and description in your arguments."
exit 1
fi
. ./setenv
ISSUE_TITLE="$2"
ISSUE_DESCRIPTION="Opened by:`whoami` Description: $3"
REQUEST_BODY="{
\"assignee\": \"string\",
\"assignees\":
[
\"string\"
],
\"body\": \"$ISSUE_DESCRIPTION\",
\"closed\": false,
\"title\": \"$ISSUE_TITLE\"
}
"
curl -s -X POST "$GIT_URL" \
-H "accept: application/json" \
-H "Content-Type: application/json" -d "$REQUEST_BODY" > /dev/null

100
thunixctl Executable file
View File

@ -0,0 +1,100 @@
#!/bin/bash
################################################################################
#
# $0 is a toold that allows end users to execute simple admin tasks.
#
# Arguments:
# {service}
# {action}
#
# Return codes:
# 0 Exectuted without problem
# 1 Incorrect usage pattern.
#
# This software is licensed under the AGPL 3.0 or later, by
# ubergeek <ubergeek@thunix.net>
#
################################################################################
NOUN=$1
VERB=$2
function usage() {
cat << _EOF
$0 {service} {action}
$0 is a tool that allows for end-user execution of simple administrative tasks, in a secure fashion.
{service} and {action} are required arguments.
_EOF
return
}
function ansible() {
case $VERB in
run)
echo "Running the ansible playbok..."
CURDIR=`pwd`
cd /var/thunix/ansible/
git pull
cd $CURDIR
ansible-playbook -i /var/thunix/ansible/hosts /var/thunix/ansible/site.yml
;;
pull)
echo "Pulling the latest playbook..."
CURDIR=`pwd`
cd /var/thunix/ansible/
git pull
cd $CURDIR
;;
*)
echo "That action was not recognized."
usage
;;
esac
return
}
function www() {
if [ $NOUN = "www" ]; then
WORKDIR="/var/www/thunix.cf"
fi
if [ $NOUN = "gopher" ]; then
WORKDIR="/var/gopher"
fi
case $VERB in
pull)
echo "Pulling the latest $NOUN..."
CURDIR=`pwd`
cd $WORKDIR
git pull
cd $CURDIR
;;
*)
echo "That action was not recognized."
usage
exit 1
;;
esac
return
}
case $NOUN in
ansible)
echo ansible
ansible
exit 0
;;
www|gopher)
echo www
www
exit 0
;;
*)
echo fail
usage
exit 1
;;
esac