BaseOS v1.0.21 #2

Merged
chris merged 35 commits from testing into main 2024-02-28 20:29:05 -05:00
12 changed files with 166 additions and 96 deletions

5
.ansible-lint Normal file
View File

@ -0,0 +1,5 @@
skip_list:
- yaml[colons]
- yaml[empty-lines]
- yaml[line-length]
- no-changed-when

4
.drone.env Normal file
View File

@ -0,0 +1,4 @@
# export ANSIBLE_LINT_EXCLUSION="--exclude collections/ansible_collections/ansible* --exclude collections/ansible_collections/community* --exclude .gitea"
export ANSIBLE_LINT_EXCLUSION="--exclude collections/ansible_collections --exclude .gitea"
export ANSIBLE_INVENTORY="-i 127.0.0.1, --connection=local"
export ANSIBLE_PLAYBOOK="baseos.yml"

View File

@ -1,16 +1,7 @@
--- ---
kind: pipeline kind: pipeline
type: docker type: docker
name: run_ansible_tests_centos9 name: CentOS_9-Ansible-Pipeline
global-variables:
ansible_image : &ansible_image "gitea.thezengarden.net/podman/ansible-dev/centos9:release-34"
ansible_inventory : &ansible_inventory "-i 127.0.0.1, --connection=local"
ansible_playbook : &ansible_playbook "baseos.yml"
environment:
ANSIBLE_INVENTORY : *ansible_inventory
ANSIBLE_PLAYBOOK : *ansible_playbook
trigger: trigger:
branch: branch:
@ -19,42 +10,37 @@ trigger:
event: [push] event: [push]
steps: steps:
- name: "ansible_environment_verify" - name: ansible_environment_verify
image: *ansible_image image: gitea.thezengarden.net/podman/ansible-dev/centos9:release
commands: commands:
- . ./.drone.env
- env
- git log -1 - git log -1
- ansible --version - ansible --version
- ansible-lint --version - ansible-lint --version
- name: "ansible_galaxy_requirements" - name: ansible_galaxy_requirements
image: *ansible_image image: gitea.thezengarden.net/podman/ansible-dev/centos9:release
commands: commands:
- ansible-galaxy install -r requirements.yml - ansible-galaxy install -r requirements.yml
- name: "ansible_lint" - name: ansible_lint
image: *ansible_image image: gitea.thezengarden.net/podman/ansible-dev/centos9:release
commands: commands:
- ansible-lint --offline - . ./.drone.env
- ansible-lint --offline $ANSIBLE_LINT_EXCLUSION
- name: "ansible_playbook_execution" - name: ansible_playbook_execution
image: *ansible_image image: gitea.thezengarden.net/podman/ansible-dev/centos9:release
commands: commands:
- . ./.drone.env
- ansible-playbook -v $ANSIBLE_INVENTORY $ANSIBLE_PLAYBOOK - ansible-playbook -v $ANSIBLE_INVENTORY $ANSIBLE_PLAYBOOK
--- ---
kind: pipeline kind: pipeline
type: docker type: docker
name: run_ansible_tests_fedora39 name: Fedora_39-Ansible-Pipeline
global-variables:
ansible_image : &ansible_image "gitea.thezengarden.net/podman/ansible-dev/fedora39:release-34"
ansible_inventory : &ansible_inventory "-i 127.0.0.1, --connection=local"
ansible_playbook : &ansible_playbook "baseos.yml"
environment:
ANSIBLE_INVENTORY : *ansible_inventory
ANSIBLE_PLAYBOOK : *ansible_playbook
trigger: trigger:
branch: branch:
@ -63,42 +49,37 @@ trigger:
event: [push] event: [push]
steps: steps:
- name: "ansible_environment_verify" - name: ansible_environment_verify
image: *ansible_image image: gitea.thezengarden.net/podman/ansible-dev/fedora39:release
commands: commands:
- . ./.drone.env
- env
- git log -1 - git log -1
- ansible --version - ansible --version
- ansible-lint --version - ansible-lint --version
- name: "ansible_galaxy_requirements" - name: ansible_galaxy_requirements
image: *ansible_image image: gitea.thezengarden.net/podman/ansible-dev/fedora39:release
commands: commands:
- ansible-galaxy install -r requirements.yml - ansible-galaxy install -r requirements.yml
- name: "ansible_lint" - name: ansible_lint
image: *ansible_image image: gitea.thezengarden.net/podman/ansible-dev/fedora39:release
commands: commands:
- ansible-lint --offline - . ./.drone.env
- ansible-lint --offline $ANSIBLE_LINT_EXCLUSION
- name: "ansible_playbook_execution" - name: ansible_playbook_execution
image: *ansible_image image: gitea.thezengarden.net/podman/ansible-dev/fedora39:release
commands: commands:
- . ./.drone.env
- ansible-playbook -v $ANSIBLE_INVENTORY $ANSIBLE_PLAYBOOK - ansible-playbook -v $ANSIBLE_INVENTORY $ANSIBLE_PLAYBOOK
--- ---
kind: pipeline kind: pipeline
type: docker type: docker
name: run_ansible_tests_debian11 name: Debian_11-Ansible-Pipeline
global-variables:
ansible_image : &ansible_image "gitea.thezengarden.net/podman/ansible-dev/debian11:release-34"
ansible_inventory : &ansible_inventory "-i 127.0.0.1, --connection=local"
ansible_playbook : &ansible_playbook "baseos.yml"
environment:
ANSIBLE_INVENTORY : *ansible_inventory
ANSIBLE_PLAYBOOK : *ansible_playbook
trigger: trigger:
branch: branch:
@ -107,42 +88,37 @@ trigger:
event: [push] event: [push]
steps: steps:
- name: "ansible_environment_verify" - name: ansible_environment_verify
image: *ansible_image image: gitea.thezengarden.net/podman/ansible-dev/debian11:release
commands: commands:
- . ./.drone.env
- env
- git log -1 - git log -1
- ansible --version - ansible --version
- ansible-lint --version - ansible-lint --version
- name: "ansible_galaxy_requirements" - name: ansible_galaxy_requirements
image: *ansible_image image: gitea.thezengarden.net/podman/ansible-dev/debian11:release
commands: commands:
- ansible-galaxy install -r requirements.yml - ansible-galaxy install -r requirements.yml
- name: "ansible_lint" - name: ansible_lint
image: *ansible_image image: gitea.thezengarden.net/podman/ansible-dev/debian11:release
commands: commands:
- ansible-lint --offline - . ./.drone.env
- ansible-lint --offline $ANSIBLE_LINT_EXCLUSION
- name: "ansible_playbook_execution" - name: ansible_playbook_execution
image: *ansible_image image: gitea.thezengarden.net/podman/ansible-dev/debian11:release
commands: commands:
- . ./.drone.env
- ansible-playbook -v $ANSIBLE_INVENTORY $ANSIBLE_PLAYBOOK - ansible-playbook -v $ANSIBLE_INVENTORY $ANSIBLE_PLAYBOOK
--- ---
kind: pipeline kind: pipeline
type: docker type: docker
name: run_ansible_tests_debian12 name: Debian_12-Ansible-Pipeline
global-variables:
ansible_image : &ansible_image "gitea.thezengarden.net/podman/ansible-dev/debian12:release-34"
ansible_inventory : &ansible_inventory "-i 127.0.0.1, --connection=local"
ansible_playbook : &ansible_playbook "baseos.yml"
environment:
ANSIBLE_INVENTORY : *ansible_inventory
ANSIBLE_PLAYBOOK : *ansible_playbook
trigger: trigger:
branch: branch:
@ -151,24 +127,28 @@ trigger:
event: [push] event: [push]
steps: steps:
- name: "ansible_environment_verify" - name: ansible_environment_verify
image: *ansible_image image: gitea.thezengarden.net/podman/ansible-dev/debian12:release
commands: commands:
- . ./.drone.env
- env
- git log -1 - git log -1
- ansible --version - ansible --version
- ansible-lint --version - ansible-lint --version
- name: "ansible_galaxy_requirements" - name: ansible_galaxy_requirements
image: *ansible_image image: gitea.thezengarden.net/podman/ansible-dev/debian12:release
commands: commands:
- ansible-galaxy install -r requirements.yml - ansible-galaxy install -r requirements.yml
- name: "ansible_lint" - name: ansible_lint
image: *ansible_image image: gitea.thezengarden.net/podman/ansible-dev/debian12:release
commands: commands:
- ansible-lint --offline - . ./.drone.env
- ansible-lint --offline $ANSIBLE_LINT_EXCLUSION
- name: "ansible_playbook_execution" - name: ansible_playbook_execution
image: *ansible_image image: gitea.thezengarden.net/podman/ansible-dev/debian12:release
commands: commands:
- . ./.drone.env
- ansible-playbook -v $ANSIBLE_INVENTORY $ANSIBLE_PLAYBOOK - ansible-playbook -v $ANSIBLE_INVENTORY $ANSIBLE_PLAYBOOK

View File

@ -0,0 +1,38 @@
name: Ansible Code Pipeline
run-name: ${{ gitea.actor }} is running Ansible Code Pipeline
on:
push:
branches:
- testing
jobs:
Ansible-Development-Pipeline:
strategy:
matrix:
os: [ ansible-dev-centos9, ansible-dev-fedora39, ansible-dev-debian11, ansible-dev-debian12 ]
runs-on: ${{ matrix.os }}
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Ansible Environment Verify
run: |
. ./.drone.env
env
git log -1
ansible --version
ansible-lint --version
- name: Install Ansible Galaxy Dependencies
run: |
ansible-galaxy install -r requirements.yml
- name: Run Ansible-Lint
run: |
. ./.drone.env
ansible-lint --offline $ANSIBLE_LINT_EXCLUSION
- name: Run Ansible-Playbook
run: |
. ./.drone.env
ansible-playbook -v $ANSIBLE_INVENTORY $ANSIBLE_PLAYBOOK

2
.gitignore vendored
View File

@ -1,4 +1,4 @@
inventory/* inventory/*
host_vars host_vars
ansible.cfg
collections/ansible_collections/ collections/ansible_collections/
testing*.yml

26
ansible.cfg Normal file
View File

@ -0,0 +1,26 @@
[defaults]
inventory = inventory/hosts
roles_path = roles
collections_path = collections
remote_tmp = /tmp/.ansible-${USER}/tmp
gathering = smart
gather_timeout = 600
fact_caching = jsonfile
fact_caching_connection = /tmp/.ansible_facts
fact_caching_timeout = 300
retry_files_enabled = false
forks = 40
timeout = 30
host_key_checking = false
display_skipped_hosts = false
deprecation_warnings = false
# callback_whitelist is deprecated
# we only include here for backwards compatibility
callback_whitelist = ansible.posix.profile_tasks, ansible.posix.timer
callbacks_enabled = ansible.posix.profile_tasks, ansible.posix.timer
[ssh_connection]
pipelining = True
ssh_args = -o ControlMaster=auto -o ControlPersist=60s -o PreferredAuthentications=publickey

View File

@ -1,5 +1,5 @@
--- ---
- name: Deploy a standardized base configuration - name: Deploy a standardized configuration to target hosts
hosts: all hosts: all
become: true become: true
gather_facts: true gather_facts: true
@ -10,10 +10,10 @@
tasks: tasks:
- name: Include relevant role(s) - name: Include defined role(s)
ansible.builtin.include_role: ansible.builtin.include_role:
name: "{{ item }}" name: "{{ item }}"
loop: "{{ __baseos_include_roles }}" loop: "{{ baseos_include_roles }}"
... ...

View File

@ -1,14 +0,0 @@
---
collections:
# Our Collections
- name: jchristianh.basos
source: https://github.com/jchristianh-ansible-collections/baseos.git
type: git
version: main
# External Collections
- name: community.general
- name: ansible.posix
...

13
requirements.yml Normal file
View File

@ -0,0 +1,13 @@
---
collections:
# Local Collections
- name: jchristianh.baseos
source: https://gitea.thezengarden.net/ansible_collections/ansible-collection-baseos.git
type: git
version: 1.0.21
# Galaxy Collections
- name: community.general
- name: ansible.posix
...

3
testing/ansible-test.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
ansible-playbook -v -i localhost, --connection=local baseos.yml

16
testing/env-test.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
echo "Which environment to test? (centos9, fedora39, debian11, debian12)"
read test_environment
CNAME="testing-${test_environment}"
IMG_TAG="release"
podman pull gitea.thezengarden.net/podman/ansible-dev/${test_environment}:${IMG_TAG}
podman run -ti --rm --name ${CNAME} --hostname ${CNAME} \
--cap-add SYS_ADMIN --uts=private \
-v /home/chris/Development/Ansible/Plays/baseos:/opt/ansible/baseos \
-v /home/chris/Development/Ansible/Collections/jchristianh/baseos:/opt/ansible/baseos/collections/ansible_collections/jchristianh/baseos \
gitea.thezengarden.net/podman/ansible-dev/${test_environment}:${IMG_TAG} \
/bin/bash

View File

@ -1,5 +1,5 @@
--- ---
__baseos_include_roles: baseos_include_roles:
- jchristianh.baseos.resolv_conf - jchristianh.baseos.resolv_conf
- jchristianh.baseos.hostname - jchristianh.baseos.hostname
- jchristianh.baseos.etc_hosts - jchristianh.baseos.etc_hosts
@ -9,5 +9,4 @@ __baseos_include_roles:
- jchristianh.baseos.base_packages - jchristianh.baseos.base_packages
- jchristianh.baseos.snmpd_conf - jchristianh.baseos.snmpd_conf
... ...