You've already forked ansible-role-common
Compare commits
5 Commits
v1.1.1
...
af2a57fb62
| Author | SHA1 | Date | |
|---|---|---|---|
| af2a57fb62 | |||
| c776b9bdab | |||
| 779e10bf4c | |||
| 24b1721e8c | |||
| 352ea54e11 |
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
|||||||
- uses: actions/setup-python@v5
|
- uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: '3.10'
|
python-version: '3.10'
|
||||||
#cache: 'pip' # caching pip dependencies
|
cache: 'pip' # caching pip dependencies
|
||||||
- name: Ensure requirements are installed
|
- name: Ensure requirements are installed
|
||||||
run: pip install -r requirements.txt
|
run: pip install -r requirements.txt
|
||||||
- name: Lint with ansible-lint
|
- name: Lint with ansible-lint
|
||||||
@@ -43,7 +43,7 @@ jobs:
|
|||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: '3.10'
|
python-version: '3.10'
|
||||||
#cache: 'pip' # caching pip dependencies
|
cache: 'pip' # caching pip dependencies
|
||||||
|
|
||||||
- name: Ensure requirements are installed
|
- name: Ensure requirements are installed
|
||||||
run: pip install -r requirements.txt
|
run: pip install -r requirements.txt
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Common [](https://ci.cybercinch.nz/repos/8)
|
# Common [](https://hub.cybercinch.nz/cybercinch/ansible-role-common/actions?workflow=ci.yml)
|
||||||
=========
|
=========
|
||||||
|
|
||||||
A brief description of the role goes here.
|
A brief description of the role goes here.
|
||||||
|
|||||||
@@ -52,52 +52,53 @@ if getent group "{{ admin_group }}" | grep -qw "$(whoami)"; then
|
|||||||
LOAD5=`echo $LOADAVG | /usr/bin/env awk {'print $2'}`
|
LOAD5=`echo $LOADAVG | /usr/bin/env awk {'print $2'}`
|
||||||
LOAD15=`echo $LOADAVG | /usr/bin/env awk {'print $3'}`
|
LOAD15=`echo $LOADAVG | /usr/bin/env awk {'print $3'}`
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "\e[7m--- GOOD $TIME $USER ----\e[0m"
|
echo -e "\e[7m--- GOOD $TIME $USER ----\e[0m"
|
||||||
echo ""
|
echo ""
|
||||||
#MESSAGE=`/usr/bin/fortune | /usr/bin/cowsay`
|
#MESSAGE=`/usr/bin/fortune | /usr/bin/cowsay`
|
||||||
#echo -e " $MESSAGE"
|
#echo -e " $MESSAGE"
|
||||||
|
|
||||||
COLOR_COLUMN="\e[1m-"
|
COLOR_COLUMN="\e[1m-"
|
||||||
COLOR_VALUE="\e[31m"
|
COLOR_VALUE="\e[31m"
|
||||||
RESET_COLORS="\e[0m"
|
RESET_COLORS="\e[0m"
|
||||||
echo -e "
|
echo -e "
|
||||||
===========================================================================
|
===========================================================================
|
||||||
$COLOR_COLUMN- Hostname$RESET_COLORS............: $COLOR_VALUE $HOSTNAME $RESET_COLORS
|
$COLOR_COLUMN- Hostname$RESET_COLORS............: $COLOR_VALUE $HOSTNAME $RESET_COLORS
|
||||||
{% if common_show_ipv6 == true %}
|
{% if common_show_ipv6 == true %}
|
||||||
$COLOR_COLUMN- IP Address (Main v4)$RESET_COLORS: $COLOR_VALUE $IP $RESET_COLORS
|
$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
|
$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
|
{% else %}
|
||||||
{% endif %}
|
$COLOR_COLUMN- IP Address (Default)$RESET_COLORS: $COLOR_VALUE $IP $RESET_COLORS
|
||||||
{% if ansible_distribution == "Alpine" %}
|
{% endif %}
|
||||||
$COLOR_COLUMN- Release$RESET_COLORS.............: $COLOR_VALUE Alpine `/usr/bin/env cat /etc/os-release` $RESET_COLORS
|
{% if ansible_distribution == "Alpine" %}
|
||||||
{% else %}
|
$COLOR_COLUMN- Release$RESET_COLORS.............: $COLOR_VALUE Alpine `/usr/bin/env cat /etc/os-release` $RESET_COLORS
|
||||||
$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
|
{% else %}
|
||||||
{% endif %}
|
$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
|
||||||
{% if ansible_distribution != "Alpine" %}
|
{% endif %}
|
||||||
$COLOR_COLUMN- Users$RESET_COLORS...............: $COLOR_VALUE Currently `users | wc -w` user(s) logged on $RESET_COLORS
|
{% if ansible_distribution != "Alpine" %}
|
||||||
{% endif %}
|
$COLOR_COLUMN- Users$RESET_COLORS...............: $COLOR_VALUE Currently `users | wc -w` user(s) logged on $RESET_COLORS
|
||||||
=========================================================================== $RESET_COLORS
|
{% endif %}
|
||||||
$COLOR_COLUMN- Current user$RESET_COLORS........: $COLOR_VALUE $USER $RESET_COLORS
|
=========================================================================== $RESET_COLORS
|
||||||
$COLOR_COLUMN- Number of CPU$RESET_COLORS.......: $COLOR_VALUE $NUM_CPU $RESET_COLORS
|
$COLOR_COLUMN- Current user$RESET_COLORS........: $COLOR_VALUE $USER $RESET_COLORS
|
||||||
$COLOR_COLUMN- CPU usage$RESET_COLORS...........: $COLOR_VALUE $LOAD1 - $LOAD5 - $LOAD15 (1-5-15 min) $RESET_COLORS
|
$COLOR_COLUMN- Number of CPU$RESET_COLORS.......: $COLOR_VALUE $NUM_CPU $RESET_COLORS
|
||||||
$COLOR_COLUMN- Memory used$RESET_COLORS.........: $COLOR_VALUE $MEMORY (total-used-free) $RESET_COLORS
|
$COLOR_COLUMN- CPU usage$RESET_COLORS...........: $COLOR_VALUE $LOAD1 - $LOAD5 - $LOAD15 (1-5-15 min) $RESET_COLORS
|
||||||
$COLOR_COLUMN- Swap in use$RESET_COLORS.........: $COLOR_VALUE $SWAP (total-used-free) MB $RESET_COLORS
|
$COLOR_COLUMN- Memory used$RESET_COLORS.........: $COLOR_VALUE $MEMORY (total-used-free) $RESET_COLORS
|
||||||
$COLOR_COLUMN- Processes$RESET_COLORS...........: $COLOR_VALUE $PSA running $RESET_COLORS
|
$COLOR_COLUMN- Swap in use$RESET_COLORS.........: $COLOR_VALUE $SWAP (total-used-free) MB $RESET_COLORS
|
||||||
$COLOR_COLUMN- System uptime$RESET_COLORS.......: $COLOR_VALUE $upDays days $upHours hours $upMins minutes $upSecs seconds $RESET_COLORS
|
$COLOR_COLUMN- Processes$RESET_COLORS...........: $COLOR_VALUE $PSA running $RESET_COLORS
|
||||||
{% if ansible_virtualization_type != "lxc" %}
|
$COLOR_COLUMN- System uptime$RESET_COLORS.......: $COLOR_VALUE $upDays days $upHours hours $upMins minutes $upSecs seconds $RESET_COLORS
|
||||||
$COLOR_COLUMN- Disk space$RESET_COLORS..........: "
|
{% if ansible_virtualization_type != "lxc" %}
|
||||||
for FS in ${FILESYSTEMS}; do
|
$COLOR_COLUMN- Disk space$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"
|
for FS in ${FILESYSTEMS}; do
|
||||||
done
|
echo -e "$COLOR_COLUMN- ..........$RESET_COLORS..........: $COLOR_VALUE `df -H ${FS} | grep -v 'Filesystem' | grep -v '^[[:space:]]*$' | awk '{print $6 \" \" $4}'` remaining $RESET_COLORS"
|
||||||
{% endif %}
|
done
|
||||||
echo -e "
|
{% endif %}
|
||||||
===========================================================================
|
echo -e "
|
||||||
"
|
===========================================================================
|
||||||
if [ -f /etc/motd ]; then
|
"
|
||||||
|
if [ -f /etc/motd ]; then
|
||||||
/usr/bin/env cat /etc/motd
|
/usr/bin/env cat /etc/motd
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# Just exit :)
|
# Just exit :)
|
||||||
exit 0
|
exit 0
|
||||||
fi;
|
fi;
|
||||||
|
|||||||
22
terraform/.terraform.lock.hcl
generated
22
terraform/.terraform.lock.hcl
generated
@@ -1,22 +0,0 @@
|
|||||||
# This file is maintained automatically by "terraform init".
|
|
||||||
# Manual edits may be lost in future updates.
|
|
||||||
|
|
||||||
provider "registry.terraform.io/linode/linode" {
|
|
||||||
version = "1.16.0"
|
|
||||||
constraints = "1.16.0"
|
|
||||||
hashes = [
|
|
||||||
"h1:JpBtHnebAi6yr/aDdlk8EybaEiEY+VPtFP3o0QoMTng=",
|
|
||||||
"zh:03c867440797b82012cd5d97f58fef5885dc0248683227299a39af836df222db",
|
|
||||||
"zh:0486be7f72d6ea73d10140e23be8c1d2772b2d8be28c7bb39c73be83601405cf",
|
|
||||||
"zh:181929d6880cac6500f4af1f3799385c47ccd69872cacf1042a3a48e445b2b02",
|
|
||||||
"zh:18b7f6cc1ddf86e28322638607e1f84c1e9d56824c26903e22d4d12352f20b6e",
|
|
||||||
"zh:4e65e7f9e17c334ff7047fc2dd8fc479c2509cba66834d89e2033a45e9275fe3",
|
|
||||||
"zh:6077eda3fdf77a5158d9dc1a0c38492e23f7d679b1ac96382ba92ebe92e19266",
|
|
||||||
"zh:642e7c96867c519176d84228a7f9104352212ae3c999b409eee1076b7ed90a96",
|
|
||||||
"zh:6451f5117125fad9884214fe2f2635a2bed95912e64cf1c66a57c38558dfe907",
|
|
||||||
"zh:83b957b30da19586393b9aea2cc93524a7d4c43dd07d11129a11d29c2b4bfb21",
|
|
||||||
"zh:852954fe6cfe5278bd7c3d1079a9832bbf8c58436486489ed85154c0a0600633",
|
|
||||||
"zh:a2385c51147a3c40707f7bfceb673c077e1054e8af6fb4c808cef56f995b8193",
|
|
||||||
"zh:d21cd5cb5a635d18547430fe6cdfe3c6898541f9f3adc110edbf8d6e0439390d",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
variable "drone_instances" {
|
|
||||||
description = "How many runner instances should there be?"
|
|
||||||
default = 3
|
|
||||||
}
|
|
||||||
variable "root_pass" {
|
|
||||||
description = "Root password to set on the node"
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "linode_api_token" {
|
|
||||||
description = "Linode API Token"
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "ssh_pubkey" {
|
|
||||||
description = "SSH key to be allowed access by default"
|
|
||||||
}
|
|
||||||
|
|
||||||
terraform {
|
|
||||||
required_providers {
|
|
||||||
linode = {
|
|
||||||
source = "linode/linode"
|
|
||||||
version = "1.16.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
backend "local" {
|
|
||||||
path = "/data/runner.tfstate"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
provider "linode" {
|
|
||||||
token = var.linode_api_token
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "linode_instance" "terraform-drone" {
|
|
||||||
connection {
|
|
||||||
type = "ssh"
|
|
||||||
user = "root"
|
|
||||||
password = var.root_pass
|
|
||||||
host = self.ip_address
|
|
||||||
}
|
|
||||||
|
|
||||||
count = var.drone_instances
|
|
||||||
image = "private/15818922"
|
|
||||||
label = "drone-runner-${count.index + 1}"
|
|
||||||
group = "docker"
|
|
||||||
tags = ["tag_Testing","docker"]
|
|
||||||
region = "ap-southeast"
|
|
||||||
type = "g6-standard-2"
|
|
||||||
authorized_keys = [ var.ssh_pubkey ]
|
|
||||||
root_pass = var.root_pass
|
|
||||||
|
|
||||||
provisioner "remote-exec" {
|
|
||||||
inline = [
|
|
||||||
"yum upgrade -y && systemctl restart docker",
|
|
||||||
"docker rm -f runner",
|
|
||||||
"docker run --detach --volume=/var/run/docker.sock:/var/run/docker.sock --env=DRONE_RPC_PROTO=https --env=DRONE_RPC_HOST=drone.guise.net.nz --env=DRONE_RPC_SECRET=super-duper-secret --env=DRONE_RUNNER_CAPACITY=2 --env=DRONE_RUNNER_NAME=drone-runner-${count.index + 1} --env=DRONE_RUNNER_LABELS='linodrone:true' --env=--publish=3000:3000 --restart=always --name=runner drone/drone-runner-docker:1"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user