You've already forked ansible-role-common
Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e5e3f88413 | |||
| 1fedea38e3 | |||
| 797824ad76 | |||
| f80471ad66 | |||
| f732c1dd54 | |||
| 909e25687d | |||
| 936e547c9a | |||
| b217e25268 | |||
| d7c732f5d1 | |||
| 7858cae385 | |||
| e2e85d3dd7 | |||
| ef49eb146d | |||
| b2bcbd2bca | |||
| 58d82220c6 | |||
| 1263539af9 | |||
| 5e354d9fb5 | |||
| dac92a402b | |||
| b08e31ba85 | |||
| 212e979ec6 |
48
.github/workflows/ci.yml
vendored
48
.github/workflows/ci.yml
vendored
@@ -5,7 +5,6 @@ on:
|
|||||||
- "**"
|
- "**"
|
||||||
tags:
|
tags:
|
||||||
- "!**"
|
- "!**"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -61,23 +60,42 @@ jobs:
|
|||||||
- molecule
|
- molecule
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- 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
|
- uses: go-semantic-release/action@v1
|
||||||
with:
|
with:
|
||||||
custom-arguments: --provider=gitea
|
custom-arguments: --provider=gitea
|
||||||
env:
|
env:
|
||||||
GITEA_TOKEN: ${{ secrets.G_TOKEN }}
|
GITEA_TOKEN: ${{ secrets.G_TOKEN }}
|
||||||
GITEA_HOST: ${{ secrets.G_SERVER_URL}}
|
GITEA_HOST: ${{ secrets.G_SERVER_URL}}
|
||||||
|
notify:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- lint
|
||||||
|
- molecule
|
||||||
|
- release
|
||||||
|
steps:
|
||||||
|
- name: ntfy-success-notifications
|
||||||
|
uses: niniyas/ntfy-action@master
|
||||||
|
if: success()
|
||||||
|
with:
|
||||||
|
url: '${{ vars.NTFY_URL }}'
|
||||||
|
title: Workflow success - ansible-role-common
|
||||||
|
topic: 'ci-status'
|
||||||
|
headers: '{"Authorization": "Bearer ${{ secrets.NTFY_TOKEN }}" }'
|
||||||
|
priority: 4
|
||||||
|
tags: +1,partying_face,action,successfully,completed
|
||||||
|
details: Workflow has been successfully completed!
|
||||||
|
icon: 'https://styles.redditmedia.com/t5_32uhe/styles/communityIcon_xnt6chtnr2j21.png'
|
||||||
|
image: true
|
||||||
|
|
||||||
|
- name: ntfy-failed-notifications
|
||||||
|
uses: niniyas/ntfy-action@master
|
||||||
|
if: failure()
|
||||||
|
with:
|
||||||
|
url: '${{ vars.NTFY_URL }}'
|
||||||
|
title: Workflow failed - ansible-role-common
|
||||||
|
topic: 'ci-status'
|
||||||
|
headers: '{"Authorization": "Bearer ${{ secrets.NTFY_TOKEN }}" }'
|
||||||
|
priority: 5
|
||||||
|
tags: -1,skull,action,failed
|
||||||
|
details: Workflow has failed!
|
||||||
|
actions: 'default'
|
||||||
|
|||||||
62
.github/workflows/cron.yml
vendored
Normal file
62
.github/workflows/cron.yml
vendored
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
name: Regular test
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: "47 2 * * 0"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
molecule:
|
||||||
|
name: Molecule Test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
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 }}
|
||||||
|
notify:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: molecule
|
||||||
|
steps:
|
||||||
|
- name: ntfy-success-notifications
|
||||||
|
uses: niniyas/ntfy-action@master
|
||||||
|
if: success()
|
||||||
|
with:
|
||||||
|
url: '${{ vars.NTFY_URL }}'
|
||||||
|
headers: '{"Authorization": "Bearer ${{ secrets.NTFY_TOKEN }}" }'
|
||||||
|
title: Workflow success - ansible-role-common
|
||||||
|
topic: 'ci-status'
|
||||||
|
priority: 4
|
||||||
|
tags: +1,partying_face,action,successfully,completed
|
||||||
|
details: Workflow has been successfully completed!
|
||||||
|
icon: 'https://styles.redditmedia.com/t5_32uhe/styles/communityIcon_xnt6chtnr2j21.png'
|
||||||
|
image: true
|
||||||
|
|
||||||
|
- name: ntfy-failed-notifications
|
||||||
|
uses: niniyas/ntfy-action@master
|
||||||
|
if: failure()
|
||||||
|
with:
|
||||||
|
url: '${{ vars.NTFY_URL }}'
|
||||||
|
headers: '{"Authorization": "Bearer ${{ secrets.NTFY_TOKEN }}" }'
|
||||||
|
title: Workflow failed - ansible-role-common
|
||||||
|
topic: 'ci-status'
|
||||||
|
priority: 5
|
||||||
|
tags: -1,skull,action,failed
|
||||||
|
details: Workflow has failed!
|
||||||
|
actions: 'default'
|
||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -16,3 +16,6 @@ env/
|
|||||||
|
|
||||||
# Do not commit Vault password
|
# Do not commit Vault password
|
||||||
.vault_password.txt
|
.vault_password.txt
|
||||||
|
# No commit of .secrets (Only for local CI Tests)
|
||||||
|
.secrets
|
||||||
|
.vars
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
---
|
---
|
||||||
- name: Converge
|
- name: Converge
|
||||||
hosts: all
|
hosts: all
|
||||||
|
vars:
|
||||||
|
ansible_remote_tmp: /tmp/.ansible/tmp
|
||||||
tasks:
|
tasks:
|
||||||
- name: "Include common"
|
- name: "Include common"
|
||||||
include_role:
|
include_role:
|
||||||
|
|||||||
@@ -8,7 +8,10 @@ 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:rw
|
- /sys/fs/cgroup:/sys/fs/cgroup:rw
|
||||||
|
- /run
|
||||||
|
- /run/lock
|
||||||
|
- /tmp
|
||||||
cgroupns_mode: host
|
cgroupns_mode: host
|
||||||
privileged: true
|
privileged: true
|
||||||
pre_build_image: true
|
pre_build_image: true
|
||||||
@@ -16,6 +19,9 @@ provisioner:
|
|||||||
name: ansible
|
name: ansible
|
||||||
env:
|
env:
|
||||||
MOLECULE_NO_LOG: true
|
MOLECULE_NO_LOG: true
|
||||||
|
config_options:
|
||||||
|
defaults:
|
||||||
|
roles_path: "$MOLECULE_PROJECT_DIRECTORY/.."
|
||||||
# verifier:
|
# verifier:
|
||||||
# name: ansible
|
# name: ansible
|
||||||
# lint: |
|
# lint: |
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
ansible-core<2.17
|
ansible-core==2.16.3
|
||||||
ansible-compat >= 4
|
ansible-compat == 25.1.4
|
||||||
molecule[docker]== 24.2.1
|
molecule==25.3.1
|
||||||
ansible-lint==24.2.2
|
molecule-plugins[docker]==23.7.0
|
||||||
|
ansible-lint==6.22.2
|
||||||
yamllint==1.35.1
|
yamllint==1.35.1
|
||||||
passlib==1.7.4
|
passlib==1.7.4
|
||||||
|
|||||||
@@ -2,13 +2,13 @@
|
|||||||
# tasks file for common role
|
# tasks file for common role
|
||||||
- include_tasks: networking.yml
|
- include_tasks: networking.yml
|
||||||
|
|
||||||
- name: Ensure common packages (RHEL)
|
# - name: Ensure common packages (RHEL)
|
||||||
yum:
|
# yum:
|
||||||
name: "{{ common_packages }}"
|
# name: "{{ common_packages }}"
|
||||||
state: present
|
# state: present
|
||||||
enablerepo: epel
|
# enablerepo: epel
|
||||||
when: ansible_distribution != 'OracleLinux'
|
# when: ansible_distribution != 'OracleLinux'
|
||||||
tags: packages
|
# tags: packages
|
||||||
|
|
||||||
- name: Ensure common packages (OracleLinux)
|
- name: Ensure common packages (OracleLinux)
|
||||||
yum:
|
yum:
|
||||||
|
|||||||
@@ -97,5 +97,8 @@
|
|||||||
- /etc/hosts
|
- /etc/hosts
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: perm_config
|
loop_var: perm_config
|
||||||
|
when: >
|
||||||
|
ansible_virtualization_type != "docker"
|
||||||
|
and ansible_virtualization_type != "container"
|
||||||
changed_when: false
|
changed_when: false
|
||||||
tags: dns
|
tags: dns
|
||||||
|
|||||||
@@ -24,7 +24,9 @@ if getent group "{{ admin_group }}" | grep -qw "$(whoami)"; then
|
|||||||
#ROOT=`/usr/bin/df / -x fuse.gvfs-fuse-daemon -Ph | /usr/bin/egrep -i 'root|logvol|vda' | awk '{print $4}' | tr -d '\n'`
|
#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'`
|
#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'`
|
#BACKUP=`/usr/bin/df -x fuse.gvfs-fuse-daemon -Ph | grep backup | awk '{print $4}' | tr -d '\n'`
|
||||||
|
if [ -f /etc/fstab ]; then
|
||||||
FILESYSTEMS=`cat /etc/fstab | grep -v '#' | grep -v 'swap' | grep -v 'proc' | awk '{if(NF>0) {print $2}}'`
|
FILESYSTEMS=`cat /etc/fstab | grep -v '#' | grep -v 'swap' | grep -v 'proc' | awk '{if(NF>0) {print $2}}'`
|
||||||
|
fi
|
||||||
MEMORY=`/usr/bin/env free -m | /usr/bin/env grep "Mem" | /usr/bin/env awk '{print $2,"-",$3,"-",$4}'`
|
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}'`
|
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`
|
PSA=`/usr/bin/env ps -Afl | /usr/bin/env wc -l`
|
||||||
@@ -64,11 +66,9 @@ 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 %}
|
{% else %}$COLOR_COLUMN- IP Address (Default)$RESET_COLORS: $COLOR_VALUE $IP $RESET_COLORS
|
||||||
$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
|
||||||
@@ -92,6 +92,7 @@ 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
|
done
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
"
|
||||||
echo -e "
|
echo -e "
|
||||||
===========================================================================
|
===========================================================================
|
||||||
"
|
"
|
||||||
|
|||||||
Reference in New Issue
Block a user