3 Commits

Author SHA1 Message Date
79b3a22519 Fixes
All checks were successful
Ansible Code Pipeline / Ansible-Development-Pipeline (push) Successful in 15s
2025-08-25 13:28:27 -04:00
c1bf3ddefb Ansible-lint fixes
All checks were successful
Ansible Code Pipeline / Ansible-Development-Pipeline (ansible-dev-centos) (push) Successful in 13s
Ansible Code Pipeline / Ansible-Development-Pipeline (ansible-dev-debian) (push) Successful in 12s
Ansible Code Pipeline / Ansible-Development-Pipeline (ansible-dev-fedora) (push) Successful in 13s
2025-08-21 11:44:10 -04:00
e5f280987a Logic updates, CI fixes, formatting
Some checks failed
Ansible Code Pipeline / Ansible-Development-Pipeline (ansible-dev-centos) (push) Successful in 14s
Ansible Code Pipeline / Ansible-Development-Pipeline (ansible-dev-debian) (push) Failing after 12s
Ansible Code Pipeline / Ansible-Development-Pipeline (ansible-dev-fedora) (push) Failing after 12s
2025-08-21 11:39:43 -04:00
14 changed files with 48 additions and 164 deletions

View File

View File

@ -1,111 +0,0 @@
---
kind: pipeline
type: docker
name: CentOS_9-Ansible-Pipeline
trigger:
branch:
exclude:
- main
event: [push]
steps:
- name: ansible_environment_verify
image: gitea.thezengarden.net/podman/ansible-dev/centos9:release
commands:
- . ./.drone.env
- env
- git log -1
- ansible --version
- ansible-lint --version
- name: ansible_lint
image: gitea.thezengarden.net/podman/ansible-dev/centos9:release
commands:
- . ./.drone.env
- ansible-lint --offline --nocolor $ANSIBLE_LINT_EXCLUSION
---
kind: pipeline
type: docker
name: Fedora_39-Ansible-Pipeline
trigger:
branch:
exclude:
- main
event: [push]
steps:
- name: ansible_environment_verify
image: gitea.thezengarden.net/podman/ansible-dev/fedora39:release
commands:
- . ./.drone.env
- env
- git log -1
- ansible --version
- ansible-lint --version
- name: ansible_lint
image: gitea.thezengarden.net/podman/ansible-dev/fedora39:release
commands:
- . ./.drone.env
- ansible-lint --offline --nocolor $ANSIBLE_LINT_EXCLUSION
---
kind: pipeline
type: docker
name: Debian_11-Ansible-Pipeline
trigger:
branch:
exclude:
- main
event: [push]
steps:
- name: ansible_environment_verify
image: gitea.thezengarden.net/podman/ansible-dev/debian11:release
commands:
- . ./.drone.env
- env
- git log -1
- ansible --version
- ansible-lint --version
- name: ansible_lint
image: gitea.thezengarden.net/podman/ansible-dev/debian11:release
commands:
- . ./.drone.env
- ansible-lint --offline --nocolor $ANSIBLE_LINT_EXCLUSION
---
kind: pipeline
type: docker
name: Debian_12-Ansible-Pipeline
trigger:
branch:
exclude:
- main
event: [push]
steps:
- name: ansible_environment_verify
image: gitea.thezengarden.net/podman/ansible-dev/debian12:release
commands:
- . ./.drone.env
- env
- git log -1
- ansible --version
- ansible-lint --version
- name: ansible_lint
image: gitea.thezengarden.net/podman/ansible-dev/debian12:release
commands:
- . ./.drone.env
- ansible-lint --offline --nocolor $ANSIBLE_LINT_EXCLUSION

View File

@ -7,10 +7,7 @@ on:
jobs: jobs:
Ansible-Development-Pipeline: Ansible-Development-Pipeline:
strategy: runs-on: ansible-dev-centos
matrix:
os: [ ansible-dev-centos9, ansible-dev-fedora39, ansible-dev-debian11, ansible-dev-debian12 ]
runs-on: ${{ matrix.os }}
steps: steps:
- name: Clone repository - name: Clone repository
@ -18,13 +15,18 @@ jobs:
- name: Ansible Environment Verify - name: Ansible Environment Verify
run: | run: |
. ./.drone.env echo "BUILD HOST: $(cat /etc/hostname)" && echo
env echo "BUILD USER: $(whoami)" && echo
git log -1 echo "PWD: $(pwd)" && echo
ansible --version lscpu && echo
ansible-lint --version . ./.ci.env && echo
env && echo
git log -1 && echo
ansible --version && echo
ansible-lint --version --offline && echo
- name: Run Ansible-Lint - name: Run Ansible-Lint
run: | run: |
. ./.drone.env . ./.ci.env
ansible-lint --offline --nocolor $ANSIBLE_LINT_EXCLUSION ansible-lint --offline --nocolor $ANSIBLE_LINT_EXCLUSION

View File

@ -8,7 +8,7 @@ namespace: jchristianh
name: baseos name: baseos
# The version of the collection. Must be compatible with semantic versioning # The version of the collection. Must be compatible with semantic versioning
version: 1.0.34 version: 1.0.36
# The path to the Markdown (.md) readme file. This path is relative to the root of the collection # The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md readme: README.md

View File

@ -1,2 +1,2 @@
--- ---
requires_ansible: ">=2.14.0" requires_ansible: ">=2.15.0"

View File

@ -3,7 +3,7 @@
ansible.builtin.set_fact: ansible.builtin.set_fact:
etc_hosts_etc_hosts_file: "{{ etc_hosts_etc_hosts_file }}.docker" etc_hosts_etc_hosts_file: "{{ etc_hosts_etc_hosts_file }}.docker"
when: when:
- ansible_virtualization_type | regex_search("docker|podman|container") - ansible_virtualization_type is search("docker|podman|container")
- name: Deploy {{ etc_hosts_etc_hosts_file }} - name: Deploy {{ etc_hosts_etc_hosts_file }}

View File

@ -2,7 +2,7 @@
- name: Use hostname module to set hostname, or failback to command module - name: Use hostname module to set hostname, or failback to command module
when: when:
- not ansible_virtualization_type | regex_search("docker|podman|container") - not ansible_virtualization_type is search("docker|podman|container")
block: block:
- name: Set hostname for host using hostname module - name: Set hostname for host using hostname module
ansible.builtin.hostname: ansible.builtin.hostname:

View File

@ -1,13 +1,13 @@
--- ---
motd_motd_file: /etc/motd motd_motd_file: /etc/motd
motd_host_ip : "{{ ansible_default_ipv4.address | default('127.0.0.1') }}" motd_host_ip: "{{ ansible_default_ipv4.address | default('127.0.0.1') }}"
motd_host_uptime : "{{ now().replace(microsecond=0) - now().fromtimestamp(now(fmt='%s') | int - ansible_uptime_seconds) }}" motd_host_uptime: "{{ now().replace(microsecond=0) - now().fromtimestamp(now(fmt='%s') | int - ansible_uptime_seconds) }}"
motd_day_filter : "(.* day[s]?),\\s+(\\d+):(\\d+):(\\d+)" motd_day_filter: "(.* day[s]?),\\s+(\\d+):(\\d+):(\\d+)"
motd_nonday_filter : "(\\d+):(\\d+):(\\d+)" motd_nonday_filter: "(\\d+):(\\d+):(\\d+)"
motd_day_filter_repl : "\\1 \\2 hours \\3 minutes" motd_day_filter_repl: "\\1 \\2 hours \\3 minutes"
motd_nonday_filter_repl : "\\1 hours \\2 minutes \\3 seconds" motd_nonday_filter_repl : "\\1 hours \\2 minutes \\3 seconds"
... ...

View File

@ -1,20 +1,16 @@
--- ---
- name: Format uptime using Jinja - name: Format uptime using Jinja
ansible.builtin.set_fact: ansible.builtin.set_fact:
uptime_formatted: | motd_uptime_formatted: |
{% if 'day' in motd_host_uptime %} {% if 'day' in motd_host_uptime %}
{{ motd_host_uptime | regex_replace(motd_day_filter, motd_day_filter_repl) }} {{ motd_host_uptime | regex_replace(motd_day_filter, motd_day_filter_repl) }}
{% else %} {% else %}
{{ motd_host_uptime | regex_replace(motd_nonday_filter, motd_nonday_filter_repl) }} {{ motd_host_uptime | regex_replace(motd_nonday_filter, motd_nonday_filter_repl) }}
{% endif %} {% endif %}
- name: Update MOTD - name: Update MOTD
ansible.builtin.template: ansible.builtin.template:
src : templates/motd.j2 src: templates/motd.j2
dest : "{{ motd_motd_file }}" dest: "{{ motd_motd_file }}"
mode : "0644" mode: "0644"
changed_when : false changed_when: false
...

View File

@ -19,6 +19,6 @@ IP : {{ motd_host_ip }}
CPU : {{ ansible_processor_vcpus }} x {{ ansible_processor[2] | regex_replace('\\s+', ' ') }} CPU : {{ ansible_processor_vcpus }} x {{ ansible_processor[2] | regex_replace('\\s+', ' ') }}
Memory : {{ "{0:0.2f}".format(ansible_memfree_mb/1024) }} GB free of {{ (ansible_memtotal_mb/1024)|round}} GB Memory : {{ "{0:0.2f}".format(ansible_memfree_mb/1024) }} GB free of {{ (ansible_memtotal_mb/1024)|round}} GB
Platform : {{ ansible_distribution }} {{ ansible_distribution_version }} {{ ansible_kernel }} Platform : {{ ansible_distribution }} {{ ansible_distribution_version }} {{ ansible_kernel }}
Up : {{ uptime_formatted | trim }} Up : {{ motd_uptime_formatted | trim }}

View File

@ -1,33 +1,31 @@
--- ---
- name: Update node status when not running in a container - name: Update node status when not running in a container
when: not ansible_virtualization_type | regex_search("docker|podman|container") when: not ansible_virtualization_type is search("docker|podman|container")
block: block:
- name: Create directory {{ node_status_dir }} - name: Create directory {{ node_status_dir }}
ansible.builtin.file: ansible.builtin.file:
path : "{{ node_status_dir }}" path: "{{ node_status_dir }}"
state : directory state: directory
mode : '0755' mode: '0755'
become : false become: false
run_once : true run_once: true
delegate_to : "{{ node_status_host }}" delegate_to: "{{ node_status_host }}"
- name: Capture system uptime - name: Capture system uptime
ansible.builtin.command : uptime ansible.builtin.command : uptime
register : r_node_status_uptime register: node_status_sys_uptime
changed_when: false changed_when: false
- name: Log node status - name: Log node status
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path : "{{ node_status_dir }}/{{ node_status_file }}" path: "{{ node_status_dir }}/{{ node_status_file }}"
state : present state: present
regexp : "{{ inventory_hostname }}" regexp: "{{ inventory_hostname }}"
line : "{{ ansible_date_time.epoch }},,{{ inventory_hostname }},,{{ ansible_distribution }} {{ ansible_distribution_version }},,{{ r_node_status_uptime.stdout }}" line: "{{ ansible_date_time.epoch }},,{{ inventory_hostname }},,{{ ansible_distribution }} {{ ansible_distribution_version }},,{{ node_status_sys_uptime.stdout }}"
create : true create: true
mode : '0644' mode: '0644'
owner : "{{ node_status_user }}" owner: "{{ node_status_user }}"
group : "{{ node_status_group }}" group: "{{ node_status_group }}"
delegate_to : "{{ node_status_host }}" delegate_to: "{{ node_status_host }}"
throttle : 1 throttle: 1

View File

@ -3,7 +3,7 @@
ansible.builtin.set_fact: ansible.builtin.set_fact:
resolv_conf_resolv_conf_file: "{{ resolv_conf_resolv_conf_file }}.container" resolv_conf_resolv_conf_file: "{{ resolv_conf_resolv_conf_file }}.container"
when: when:
- ansible_virtualization_type | regex_search("docker|podman|container") - ansible_virtualization_type is search("docker|podman|container")
- name: Deploy {{ resolv_conf_resolv_conf_file }} - name: Deploy {{ resolv_conf_resolv_conf_file }}

View File

@ -4,4 +4,4 @@
name : snmpd name : snmpd
state: restarted state: restarted
when: when:
- not ansible_virtualization_type | regex_search("docker|podman|container") - not ansible_virtualization_type is search("docker|podman|container")

View File

@ -1,12 +1,11 @@
--- ---
- name: Deploy and configure SNMP - name: Deploy and configure SNMP
block: block:
- name: Set package name for Debian 12 - name: Set package name for Debian
ansible.builtin.set_fact: ansible.builtin.set_fact:
snmpd_conf_snmp_pkg: snmpd snmpd_conf_snmp_pkg: snmpd
when: when:
- ansible_distribution | lower == 'debian' - ansible_distribution | lower == 'debian'
- ansible_distribution_major_version == '12'
- name: Install SNMP - name: Install SNMP
ansible.builtin.package: ansible.builtin.package: