You've already forked ansible-role-common
Compare commits
33 Commits
v1.0.12
...
af2a57fb62
| Author | SHA1 | Date | |
|---|---|---|---|
| af2a57fb62 | |||
| c776b9bdab | |||
| 779e10bf4c | |||
| 24b1721e8c | |||
| 352ea54e11 | |||
| 6c80c1b07b | |||
| 463dfdf732 | |||
| 517ac07529 | |||
| 0bf187611a | |||
| a73eb8d69b | |||
| 3b9cff78df | |||
| 183d438c06 | |||
| 0902ffb768 | |||
| 29dc2c1142 | |||
| 86e63365ce | |||
| 98bd8c9a9e | |||
| 6e7800f161 | |||
| 65f576a65c | |||
| 8e8ea09da4 | |||
| ed89133f1b | |||
| ee0b737af7 | |||
| 0b1424b9e2 | |||
| 2bf9c2a674 | |||
| 1417edf527 | |||
| 050feb602a | |||
| f24cd077be | |||
| e4d69aaffa | |||
| 2c98ed5c63 | |||
| 4fcbdd8147 | |||
| 93a4eac70f | |||
| 8263f2d4f8 | |||
| 2c3e2c322e | |||
| a0bce37886 |
83
.github/workflows/ci.yml
vendored
Normal file
83
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
name: CI
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- "**"
|
||||||
|
tags:
|
||||||
|
- "!**"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.10'
|
||||||
|
cache: 'pip' # caching pip dependencies
|
||||||
|
- name: Ensure requirements are installed
|
||||||
|
run: pip install -r requirements.txt
|
||||||
|
- name: Lint with ansible-lint
|
||||||
|
run: ansible-lint -c ".ansible-lint"
|
||||||
|
env:
|
||||||
|
PY_COLORS: '1'
|
||||||
|
ANSIBLE_FORCE_COLOR: '1'
|
||||||
|
- name: Lint with yamllint
|
||||||
|
run: yamllint .
|
||||||
|
env:
|
||||||
|
PY_COLORS: '1'
|
||||||
|
ANSIBLE_FORCE_COLOR: '1'
|
||||||
|
molecule:
|
||||||
|
name: Molecule Test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: lint
|
||||||
|
strategy:
|
||||||
|
fail-fast: true
|
||||||
|
matrix:
|
||||||
|
os: [almalinux8, almalinux9]
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.10'
|
||||||
|
cache: 'pip' # caching pip dependencies
|
||||||
|
|
||||||
|
- name: Ensure requirements are installed
|
||||||
|
run: pip install -r requirements.txt
|
||||||
|
|
||||||
|
- name: Run Molecule tests.
|
||||||
|
run: molecule test
|
||||||
|
env:
|
||||||
|
PY_COLORS: '1'
|
||||||
|
ANSIBLE_FORCE_COLOR: '1'
|
||||||
|
MOLECULE_DISTRO: ${{ matrix.os }}
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- lint
|
||||||
|
- molecule
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: '1.22'
|
||||||
|
- name: Install gitea provider for Go Semantic Release
|
||||||
|
run: |
|
||||||
|
mkdir -p .semrel/$(go env GOOS)_$(go env GOARCH)/provider-gitea/${GITEA_PROVIDER_VER}/ && \
|
||||||
|
wget https://github.com/cybercinch/go-semantic-release-provider-gitea/releases/download/v${GITEA_PROVIDER_VER}/go-semantic-release-provider-gitea_v${GITEA_PROVIDER_VER}_linux_amd64 \
|
||||||
|
-O .semrel/$(go env GOOS)_$(go env GOARCH)/provider-gitea/${GITEA_PROVIDER_VER}/gitea && \
|
||||||
|
chmod a+x .semrel/$(go env GOOS)_$(go env GOARCH)/provider-gitea/${GITEA_PROVIDER_VER}/gitea
|
||||||
|
env:
|
||||||
|
GITEA_PROVIDER_VER: 1.0.11
|
||||||
|
- run: |
|
||||||
|
echo "github repo: ${GITHUB_REPOSITORY}"
|
||||||
|
echo "env vars: $(env)"
|
||||||
|
- uses: go-semantic-release/action@v1
|
||||||
|
with:
|
||||||
|
custom-arguments: --provider=gitea
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.G_TOKEN }}
|
||||||
|
GITEA_HOST: ${{ secrets.G_SERVER_URL}}
|
||||||
48
.woodpecker/release.yml
Normal file
48
.woodpecker/release.yml
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- MOLECULE_DISTRO: centos7
|
||||||
|
- MOLECULE_DISTRO: almalinux8
|
||||||
|
- MOLECULE_DISTRO: almalinux9
|
||||||
|
|
||||||
|
clone:
|
||||||
|
git:
|
||||||
|
image: woodpeckerci/plugin-git
|
||||||
|
settings:
|
||||||
|
recursive: true
|
||||||
|
submodule_update_remote: true
|
||||||
|
when:
|
||||||
|
event: [ push ]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
create-release:
|
||||||
|
name: Test on ${MOLECULE_DISTRO}
|
||||||
|
image: guisea/ansible-molecule
|
||||||
|
pull: true
|
||||||
|
environment:
|
||||||
|
PY_COLORS: '1'
|
||||||
|
ANSIBLE_FORCE_COLOR: '1'
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
commands:
|
||||||
|
- molecule test --scenario-name ${MOLECULE_SCENARIO:-default}
|
||||||
|
#secrets: [ auth_duo_host, auth_duo_ikey, auth_duo_skey, auth_duo_mirror_url ]
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
- manual
|
||||||
|
ntfy:
|
||||||
|
image: codeberg.org/l-x/woodpecker-ntfy
|
||||||
|
settings:
|
||||||
|
url: https://ntfy.cybercinch.nz/ci-status
|
||||||
|
title: "Test failed for ${CI_REPO_NAME} - Distro: ${MOLECULE_DISTRO} Scenario: ${MOLECULE_SCENARIO:-default}"
|
||||||
|
priority: urgent
|
||||||
|
icon: https://woodpecker-ci.org/img/logo.svg
|
||||||
|
tags: robot,warning,rotating_light,${CI_BUILD_EVENT},${CI_REPO_NAME}
|
||||||
|
message: >
|
||||||
|
📝 Commit by ${CI_COMMIT_AUTHOR} on ${CI_COMMIT_BRANCH}:
|
||||||
|
${CI_COMMIT_MESSAGE}
|
||||||
|
when:
|
||||||
|
event: [ push, manual ]
|
||||||
|
status: [ failure ]
|
||||||
|
depends_on:
|
||||||
|
- lint
|
||||||
@@ -2,6 +2,7 @@ matrix:
|
|||||||
include:
|
include:
|
||||||
- MOLECULE_DISTRO: centos7
|
- MOLECULE_DISTRO: centos7
|
||||||
- MOLECULE_DISTRO: almalinux8
|
- MOLECULE_DISTRO: almalinux8
|
||||||
|
- MOLECULE_DISTRO: almalinux9
|
||||||
|
|
||||||
clone:
|
clone:
|
||||||
git:
|
git:
|
||||||
@@ -24,7 +25,7 @@ steps:
|
|||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
commands:
|
commands:
|
||||||
- molecule test --scenario-name ${MOLECULE_SCENARIO:-default}
|
- molecule test --scenario-name ${MOLECULE_SCENARIO:-default}
|
||||||
secrets: [ auth_duo_host, auth_duo_ikey, auth_duo_skey, auth_duo_mirror_url ]
|
#secrets: [ auth_duo_host, auth_duo_ikey, auth_duo_skey, auth_duo_mirror_url ]
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
- push
|
- push
|
||||||
|
|||||||
2
Makefile
2
Makefile
@@ -13,7 +13,7 @@ virtualenv:
|
|||||||
@echo
|
@echo
|
||||||
|
|
||||||
test:
|
test:
|
||||||
for distro in centos7 almalinux8 ; do \
|
for distro in almalinux9 ; do \
|
||||||
MOLECULE_DISTRO=$$distro molecule test --all ; \
|
MOLECULE_DISTRO=$$distro molecule test --all ; \
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Common [](https://ci.cybercinch.nz/repos/4)
|
# 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.
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ platforms:
|
|||||||
image: "cybercinch/docker-${MOLECULE_DISTRO:-almalinux8}-ansible:latest"
|
image: "cybercinch/docker-${MOLECULE_DISTRO:-almalinux8}-ansible:latest"
|
||||||
command: ${MOLECULE_DOCKER_COMMAND:-""}
|
command: ${MOLECULE_DOCKER_COMMAND:-""}
|
||||||
volumes:
|
volumes:
|
||||||
- /sys/fs/cgroup:/sys/fs/cgroup:ro
|
- /sys/fs/cgroup:/sys/fs/cgroup:rw
|
||||||
|
cgroupns_mode: host
|
||||||
privileged: true
|
privileged: true
|
||||||
pre_build_image: true
|
pre_build_image: true
|
||||||
provisioner:
|
provisioner:
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
debug:
|
debug:
|
||||||
msg: "Virtualization is: {{ ansible_virtualization_type }}"
|
msg: "Virtualization is: {{ ansible_virtualization_type }}"
|
||||||
|
|
||||||
- name: Ensure DNS and SSH common config
|
- name: Ensure Network Setup (RedHat only)
|
||||||
template:
|
template:
|
||||||
src: "{{ network_config.src }}"
|
src: "{{ network_config.src }}"
|
||||||
dest: "{{ network_config.dest }}"
|
dest: "{{ network_config.dest }}"
|
||||||
@@ -16,8 +16,25 @@
|
|||||||
mode: u+rw,
|
mode: u+rw,
|
||||||
a+r,
|
a+r,
|
||||||
}
|
}
|
||||||
|
when: >
|
||||||
|
ansible_virtualization_type != "docker"
|
||||||
|
and ansible_virtualization_type != "container"
|
||||||
|
and ansible_os_family == "RedHat"
|
||||||
|
loop_control:
|
||||||
|
loop_var: network_config
|
||||||
|
tags: dns
|
||||||
|
|
||||||
|
- name: Ensure Resolvers Configured
|
||||||
|
template:
|
||||||
|
src: "{{ network_config.src }}"
|
||||||
|
dest: "{{ network_config.dest }}"
|
||||||
|
mode: "{{ network_config.mode }}"
|
||||||
|
backup: yes
|
||||||
|
with_items:
|
||||||
- { src: etc.resolv.conf.j2, dest: /etc/resolv.conf, mode: u+rw, a+r }
|
- { src: etc.resolv.conf.j2, dest: /etc/resolv.conf, mode: u+rw, a+r }
|
||||||
when: ansible_virtualization_type != "docker" and ansible_virtualization_type != "container"
|
when: >
|
||||||
|
ansible_virtualization_type != "docker"
|
||||||
|
and ansible_virtualization_type != "container"
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: network_config
|
loop_var: network_config
|
||||||
tags: dns
|
tags: dns
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
# /usr/local/bin/dynmotd
|
# /usr/local/bin/dynmotd
|
||||||
#
|
#
|
||||||
|
|
||||||
|
if getent group "{{ admin_group }}" | grep -qw "$(whoami)"; then
|
||||||
USER=`/usr/bin/env whoami`
|
USER=`/usr/bin/env whoami`
|
||||||
HOSTNAME=`/usr/bin/env uname -n | /usr/bin/env cut -d. -f1`
|
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.]+'`
|
IP=`/usr/bin/env ip route get 1 | /usr/bin/env grep -Po '(?<=src.)[\w\d.]+'`
|
||||||
@@ -66,7 +67,8 @@ echo -e "
|
|||||||
{% 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 %}
|
||||||
|
$COLOR_COLUMN- IP Address (Default)$RESET_COLORS: $COLOR_VALUE $IP $RESET_COLORS
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if ansible_distribution == "Alpine" %}
|
{% if ansible_distribution == "Alpine" %}
|
||||||
$COLOR_COLUMN- Release$RESET_COLORS.............: $COLOR_VALUE Alpine `/usr/bin/env cat /etc/os-release` $RESET_COLORS
|
$COLOR_COLUMN- Release$RESET_COLORS.............: $COLOR_VALUE Alpine `/usr/bin/env cat /etc/os-release` $RESET_COLORS
|
||||||
@@ -96,3 +98,7 @@ 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
|
||||||
|
# Just exit :)
|
||||||
|
exit 0
|
||||||
|
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