36 Commits

Author SHA1 Message Date
00b1548103 axe the backticks
All checks were successful
continuous-integration/drone/push Build is passing
2022-11-08 10:10:44 +13:00
19f54c9f52 Specifically use os-release
All checks were successful
continuous-integration/drone/push Build is passing
2022-11-08 10:02:22 +13:00
1f6b4d51e0 Silence /proc
All checks were successful
continuous-integration/drone/push Build is passing
2022-11-08 07:30:20 +13:00
2652ce3653 Fix output
All checks were successful
continuous-integration/drone Build is passing
2022-11-07 22:45:06 +13:00
0f3221ac3e Fix IP address display
All checks were successful
continuous-integration/drone/push Build is passing
2022-11-06 21:56:55 +13:00
158095b011 lies, again we go
Some checks failed
continuous-integration/drone/push Build was killed
2022-11-02 17:24:56 +13:00
dec7676e87 last test
Some checks failed
continuous-integration/drone/push Build was killed
2022-11-02 17:23:16 +13:00
943aecfe55 Escape the variables
Some checks failed
continuous-integration/drone/push Build was killed
2022-11-02 17:18:50 +13:00
4924606317 ..
Some checks failed
continuous-integration/drone/push Build was killed
2022-11-02 17:14:24 +13:00
41b5efa39b Missing comma again :(
Some checks failed
continuous-integration/drone/push Build was killed
2022-11-02 16:58:11 +13:00
aece1b662a Add echo for testing
Some checks failed
continuous-integration/drone/push Build encountered an error
2022-11-02 16:57:16 +13:00
3cd00a0d1d missing comma
Some checks failed
continuous-integration/drone/push Build was killed
2022-11-02 16:43:55 +13:00
f1999f47f7 echo env
Some checks failed
continuous-integration/drone/push Build encountered an error
2022-11-02 16:42:27 +13:00
0768d5fb3e Added secrets to environment variables
Some checks failed
continuous-integration/drone/push Build was killed
2022-11-02 16:40:15 +13:00
d9e71bec29 Update apk package list
Some checks failed
continuous-integration/drone/push Build was killed
2022-11-02 16:33:54 +13:00
85213537ce Check curl is available
Some checks failed
continuous-integration/drone/push Build was killed
2022-11-02 16:33:26 +13:00
7f616fb5eb Actually exclude the main pipeline
All checks were successful
continuous-integration/drone/push Build is passing
2022-11-02 16:26:29 +13:00
10f03a610b Try triggers
All checks were successful
continuous-integration/drone/push Build is passing
2022-11-02 16:18:25 +13:00
5203103900 Cloning disable jsonnet style
All checks were successful
continuous-integration/drone/push Build is passing
2022-11-02 16:11:33 +13:00
57ab370f92 Stop cloning for notify steps
Some checks failed
continuous-integration/drone/push Build was killed
2022-11-02 16:09:27 +13:00
0a1f4323a3 Image goes on steps (doh)
Some checks failed
continuous-integration/drone/push Build was killed
2022-11-02 16:05:31 +13:00
f6713ff240 Add image
Some checks failed
continuous-integration/drone/push Build was killed
2022-11-02 16:03:52 +13:00
1ef3ba3ca9 Fix permissions
Some checks failed
continuous-integration/drone/push Build was killed
2022-11-02 16:01:57 +13:00
568b6fb667 Ordering fix
Some checks failed
continuous-integration/drone/push Build encountered an error
2022-11-02 16:00:39 +13:00
22d502de50 Update jsonnet
Some checks failed
continuous-integration/drone/push Build encountered an error
2022-11-02 15:59:12 +13:00
b11417540b Add notification on tag
Some checks failed
continuous-integration/drone/push Build was killed
2022-11-02 15:47:23 +13:00
bece894b0d Fix escape sequence
Some checks failed
continuous-integration/drone/push Build was killed
2022-11-02 15:44:46 +13:00
e43f9e0efa add missing comma
Some checks failed
continuous-integration/drone/push Build encountered an error
2022-11-02 15:43:55 +13:00
f19de75deb fix function
Some checks failed
continuous-integration/drone/push Build encountered an error
2022-11-02 15:43:20 +13:00
0c86143b56 Add pipeline for package release
Some checks failed
continuous-integration/drone/push Build encountered an error
2022-11-02 15:42:34 +13:00
c85320a15c Add pipeline for releasing from tag
Some checks failed
continuous-integration/drone/push Build encountered an error
2022-11-02 15:40:29 +13:00
50f0da12d8 damn jsonnet
All checks were successful
continuous-integration/drone/push Build is passing
2022-11-02 15:21:40 +13:00
4b367f73a2 Update pipeline
Some checks failed
continuous-integration/drone/push Build encountered an error
2022-11-02 15:20:00 +13:00
55e2036835 Updated pipeline
Some checks failed
continuous-integration/drone/push Build encountered an error
2022-11-02 15:18:36 +13:00
cdfd7e6193 Remove centos8
Some checks failed
continuous-integration/drone/push Build encountered an error
2022-11-02 15:12:41 +13:00
2cba945d2f [CI SKIP] Exclude tag 2022-11-02 15:00:12 +13:00
2 changed files with 107 additions and 26 deletions

View File

@@ -1,6 +1,5 @@
// Distros to Test on ;)
local distros = ['centos7',
'centos8',
'rockylinux8',
'debian10',
'debian11'];
@@ -60,23 +59,90 @@ local gen_pipeline(distro) =
name: 'dockersock',
temp: {},
},],
trigger:
{ event: {exclude: ['tag'],},},
when:
{ event: {exclude: ['tag']},
},
};
local gen_release() =
{kind: 'pipeline',
type: 'docker',
image: 'guisea/ansible-molecule:alpine-latest',
name: 'Generate Release',
environment:
{ USER: { from_secret: 'GITEA_USER' },
TOKEN: { from_secret: 'GITEA_TOKEN' },
REPOUSER: { from_secret: 'GITEA_REPOUSER'},
URL: { from_secret: 'GITEA_URL' },
},
commands: [
'sleep 10', // give docker enough time to start
'env',
'mkdir ${DRONE_REPO_NAME}',
'rsync -a . ${DRONE_REPO_NAME} --exclude ${DRONE_REPO_NAME}',
'cd ${DRONE_REPO_NAME}',
'echo GITEA_USER=$USER',
'apk update && apk add --no-cache curl',
'tar -czf ../${DRONE_REPO_NAME}.${DRONE_TAG}.tar.gz ./*', // Create an archive of the role
'curl --user $USER:$TOKEN --upload-file ../${DRONE_REPO_NAME}.${DRONE_TAG}.tar.gz https://$URL/api/packages/$REPOUSER/generic/ansible-role-common/${DRONE_TAG}/${DRONE_REPO_NAME}.${DRONE_TAG}.tar.gz',
],
when:
{ event: {include: ['tag']},
},
trigger:
{ event: {include: ['tag'],},},
};
local gen_pipeline_release() =
{kind: 'pipeline',
type: 'docker',
name: 'Generate release from tag',
steps:
[gen_release()],
when:
{ event: {include: ['tag']},
},
trigger:
{ event: {include: ['tag'],},},
};
// Generate the output
[
gen_pipeline('centos7'),
gen_pipeline('centos8'),
gen_pipeline('rockylinux8'),
gen_pipeline('debian10'),
gen_pipeline('debian11'),
{kind: 'pipeline',
type: 'docker',
name: 'Notify',
name: 'Notify normal',
clone: {disable: true},
steps: [email_notification()],
trigger:
{ event: {exclude: ['tag'],},},
when:
{ status: [ 'success', 'failure' ] },
{ status: [ 'success', 'failure' ] ,
event: {exclude: ['tag']},
},
depends_on:
['Test on %(distro)s' % { distro: distro }
for distro in distros]
}
},
gen_pipeline_release(),
{kind: 'pipeline',
type: 'docker',
clone: {disable: true},
name: 'Notify Tagged release',
steps: [email_notification()],
trigger:
{ event: {include: ['tag'],},},
when:
{ status: [ 'success', 'failure' ] ,
event: {include: ['tag']},
},
depends_on:
['Generate release from tag']
},
]

View File

@@ -15,21 +15,21 @@
# /usr/local/bin/dynmotd
#
USER=`whoami`
HOSTNAME=`uname -n | cut -d. -f1`
IP=`ip route get 1 | awk '{print $NF;exit}'`
NUM_CPU=`lscpu | grep "CPU(s):" | head -n 1 | awk '{print $2}'`
ROOT=`df -x fuse.gvfs-fuse-daemon -Ph | egrep -i 'root|logvol|vda' | awk '{print $4}' | tr -d '\n'`
HOME=`df -x fuse.gvfs-fuse-daemon -Ph | grep home | awk '{print $4}' | tr -d '\n'`
FILESYSTEMS=`cat /etc/fstab | grep -v '#' | grep -v 'swap' | awk '{if(NF>0) {print $2}}'`
BACKUP=`df -x fuse.gvfs-fuse-daemon -Ph | grep backup | awk '{print $4}' | tr -d '\n'`
OS_RELEASE=`awk -F= '$1=="PRETTY_NAME" { print $2 ;}' /etc/os-release | sed -e 's/^"//' -e 's/"$//'`
MEMORY=`free -m | grep "Mem" | awk '{print $2,"-",$3,"-",$4}'`
SWAP=`free -m | grep "Swap" | awk '{print $2,"-",$3,"-",$4}'`
PSA=`ps -Afl | wc -l`
USER=`/usr/bin/env whoami`
HOSTNAME=`/usr/bin/env uname -n | /usr/bin/env cut -d. -f1`
IP=`/usr/bin/env ip route get 1 | /usr/bin/env grep -Po '(?<=src.)[\w\d.]+'`
IP6=`/usr/bin/env ip -6 addr | /usr/bin/env awk -F '[ \t]+|/' '$3 == "::1" { next;} $3 ~ /^fe80::/ { next ; } /inet6/ {print $3} '`
NUM_CPU=`cat /proc/cpuinfo | grep processor | wc -l`
#ROOT=`/usr/bin/df / -x fuse.gvfs-fuse-daemon -Ph | /usr/bin/egrep -i 'root|logvol|vda' | awk '{print $4}' | tr -d '\n'`
#HOME=`/usr/bin/df /home -x fuse.gvfs-fuse-daemon -Ph | grep home | awk '{print $4}' | tr -d '\n'`
#BACKUP=`/usr/bin/df -x fuse.gvfs-fuse-daemon -Ph | grep backup | awk '{print $4}' | tr -d '\n'`
FILESYSTEMS=`cat /etc/fstab | grep -v '#' | grep -v 'swap' | grep -v 'proc' | awk '{if(NF>0) {print $2}}'`
MEMORY=`/usr/bin/env free -m | /usr/bin/env grep "Mem" | /usr/bin/env awk '{print $2,"-",$3,"-",$4}'`
SWAP=`/usr/bin/env free -m | /usr/bin/env grep "Swap" | /usr/bin/env awk '{print $2,"-",$3,"-",$4}'`
PSA=`/usr/bin/env ps -Afl | /usr/bin/env wc -l`
# time of day
HOUR=$(date +"%H")
HOUR=$(/usr/bin/env date +"%H")
if [ $HOUR -lt 12 -a $HOUR -ge 0 ]
then TIME="morning"
elif [ $HOUR -lt 17 -a $HOUR -ge 12 ]
@@ -39,17 +39,17 @@ else
fi
#System uptime
uptime=`cat /proc/uptime | cut -f1 -d.`
uptime=`/usr/bin/env cat /proc/uptime | cut -f1 -d.`
upDays=$((uptime/60/60/24))
upHours=$((uptime/60/60%24))
upMins=$((uptime/60%60))
upSecs=$((uptime%60))
#System load
LOADAVG=`cat /proc/loadavg`
LOAD1=`echo $LOADAVG | awk {'print $1'}`
LOAD5=`echo $LOADAVG | awk {'print $2'}`
LOAD15=`echo $LOADAVG | awk {'print $3'}`
LOADAVG=`/usr/bin/env cat /proc/loadavg`
LOAD1=`echo $LOADAVG | /usr/bin/env awk {'print $1'}`
LOAD5=`echo $LOADAVG | /usr/bin/env awk {'print $2'}`
LOAD15=`echo $LOADAVG | /usr/bin/env awk {'print $3'}`
echo ""
echo -e "\e[7m--- GOOD $TIME $USER ----\e[0m"
@@ -63,9 +63,19 @@ RESET_COLORS="\e[0m"
echo -e "
===========================================================================
$COLOR_COLUMN- Hostname$RESET_COLORS............: $COLOR_VALUE $HOSTNAME $RESET_COLORS
$COLOR_COLUMN- IP Address (Default)$RESET_COLORS: $COLOR_VALUE $IP $RESET_COLORS
$COLOR_COLUMN- Release$RESET_COLORS.............: $COLOR_VALUE $OS_RELEASE $RESET_COLORS
{% if common_show_ipv6 == true %}
$COLOR_COLUMN- IP Address (Main v4)$RESET_COLORS: $COLOR_VALUE $IP $RESET_COLORS
$COLOR_COLUMN- IP Address (Main v6)$RESET_COLORS: $COLOR_VALUE $IP6 $RESET_COLORS
{% else %} $COLOR_COLUMN- IP Address (Default)$RESET_COLORS: $COLOR_VALUE $IP $RESET_COLORS
{% endif %}
{% if ansible_distribution == "Alpine" %}
$COLOR_COLUMN- Release$RESET_COLORS.............: $COLOR_VALUE Alpine `/usr/bin/env cat /etc/os-release` $RESET_COLORS
{% else %}
$COLOR_COLUMN- Release$RESET_COLORS.............: $COLOR_VALUE `/usr/bin/env cat /etc/os-release | /usr/bin/env grep PRETTY_NAME | /usr/bin/env cut -d '"' -f 2` $RESET_COLORS
{% endif %}
{% if ansible_distribution != "Alpine" %}
$COLOR_COLUMN- Users$RESET_COLORS...............: $COLOR_VALUE Currently `users | wc -w` user(s) logged on $RESET_COLORS
{% endif %}
=========================================================================== $RESET_COLORS
$COLOR_COLUMN- Current user$RESET_COLORS........: $COLOR_VALUE $USER $RESET_COLORS
$COLOR_COLUMN- Number of CPU$RESET_COLORS.......: $COLOR_VALUE $NUM_CPU $RESET_COLORS
@@ -74,10 +84,15 @@ echo -e "
$COLOR_COLUMN- Swap in use$RESET_COLORS.........: $COLOR_VALUE $SWAP (total-used-free) MB $RESET_COLORS
$COLOR_COLUMN- Processes$RESET_COLORS...........: $COLOR_VALUE $PSA running $RESET_COLORS
$COLOR_COLUMN- System uptime$RESET_COLORS.......: $COLOR_VALUE $upDays days $upHours hours $upMins minutes $upSecs seconds $RESET_COLORS
{% if ansible_virtualization_type != "lxc" %}
$COLOR_COLUMN- Disk space$RESET_COLORS..........: "
for FS in ${FILESYSTEMS}; do
echo -e " $COLOR_COLUMN- ..........$RESET_COLORS..........: $COLOR_VALUE `df -H ${FS} | grep -v 'Filesystem' | grep -v '^[[:space:]]*$' | awk '{print $6 " " $4}'` remaining $RESET_COLORS"
echo -e " $COLOR_COLUMN- ..........$RESET_COLORS..........: $COLOR_VALUE `df -H ${FS} | grep -v 'Filesystem' | grep -v '^[[:space:]]*$' | awk '{print $6 \" \" $4}'` remaining $RESET_COLORS"
done
{% endif %}
echo -e "
===========================================================================
"
if [ -f /etc/motd ]; then
/usr/bin/env cat /etc/motd
fi