From 1f807294912f1c9c6ec7ed51a6469b9125bef616 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Fri, 8 Dec 2023 15:26:54 -0500 Subject: [PATCH] initial project commit --- .drone.yml | 65 ++++++++++++++++++++++++++++++ ansible/ansible-check.yml | 11 +++++ build/Containerfile.centos-stream9 | 21 ++++++++++ build/Containerfile.debian-11 | 18 +++++++++ build/Containerfile.debian-12 | 18 +++++++++ build/Containerfile.fedora39 | 19 +++++++++ conf/dnf.conf | 7 ++++ conf/hosts | 1 + conf/ssh_config | 6 +++ python/requirements.txt | 2 + 10 files changed, 168 insertions(+) create mode 100644 .drone.yml create mode 100644 ansible/ansible-check.yml create mode 100644 build/Containerfile.centos-stream9 create mode 100644 build/Containerfile.debian-11 create mode 100644 build/Containerfile.debian-12 create mode 100644 build/Containerfile.fedora39 create mode 100644 conf/dnf.conf create mode 100644 conf/hosts create mode 100644 conf/ssh_config create mode 100644 python/requirements.txt diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..80c44e2 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,65 @@ +--- +kind: pipeline +type: exec +name: ansible_dev_centos_stream9 + + +trigger: + branch: + exclude: + - main + event: [push] + status: [success] + + +steps: + - name: check_env + commands: + - hostnamectl + - env + - whoami + - pwd + - tree + + - name: docker_info + commands: + - docker info + + - name: docker_login + environment: + REGISTRY : gitea.thezengarden.net + GITEA_USER : + from_secret: gitea_user + GITEA_PASSWORD : + from_secret: gitea_password + commands: + - echo "$GITEA_PASSWORD" | docker login --username chris --password-stdin $REGISTRY + + - name: docker_build + environment: + REGISTRY : gitea.thezengarden.net + BUILD_PREFIX : podman/ansible-dev + BUILD_NAME : centos9 + BUILD_TAG : "$CI_COMMIT_BRANCH-$CI_BUILD_NUMBER" + commands: + - echo "docker build -f build/Containerfile.centos-stream9 -t $REGISTRY/$BUILD_PREFIX/$BUILD_NAME:$BUILD_TAG ." + - docker build -f build/Containerfile.centos-stream9 -t $REGISTRY/$BUILD_PREFIX/$BUILD_NAME:$BUILD_TAG . + + - name: docker_push + environment: + REGISTRY : gitea.thezengarden.net + BUILD_PREFIX : podman/ansible-dev + BUILD_NAME : centos9 + BUILD_TAG : "$CI_COMMIT_BRANCH-$CI_BUILD_NUMBER" + commands: + - docker push $REGISTRY/$BUILD_PREFIX/$BUILD_NAME:$BUILD_TAG + - docker images | grep "$REGISTRY/$BUILD_PREFIX/$BUILD_NAME" + + - name: docker_images + environment: + REGISTRY : gitea.thezengarden.net + BUILD_PREFIX : podman/ansible-dev + BUILD_NAME : centos9 + BUILD_TAG : "$CI_COMMIT_BRANCH-$CI_BUILD_NUMBER" + commands: + - docker images | grep "$REGISTRY/$BUILD_PREFIX/$BUILD_NAME" diff --git a/ansible/ansible-check.yml b/ansible/ansible-check.yml new file mode 100644 index 0000000..991ffef --- /dev/null +++ b/ansible/ansible-check.yml @@ -0,0 +1,11 @@ +--- +- name: Ansible Installation Verification + hosts: all + become: false + gather_facts: true + + + tasks: + - name: Test Ansible Installation + ansible.builtin.debug: + msg: "Ansible is successfully installed on {{ inventory_hostname }}!" diff --git a/build/Containerfile.centos-stream9 b/build/Containerfile.centos-stream9 new file mode 100644 index 0000000..ae250b9 --- /dev/null +++ b/build/Containerfile.centos-stream9 @@ -0,0 +1,21 @@ +FROM quay.io/centos/centos:stream9 +LABEL maintainer="Chris Hammer (chris@thezengarden.net)" + +RUN rm /etc/localtime \ + && ln -s /usr/share/zoneinfo/US/Eastern /etc/localtime + +RUN mkdir -p /root/.ssh +COPY conf/ssh_config /root/.ssh/config +COPY conf/hosts /etc/hosts +COPY conf/dnf.conf /etc/dnf/dnf.conf +# COPY python/requirements.txt /tmp/requirements.txt + +# RUN dnf install -y python3-pip git ansible-core python3-ansible-lint +RUN dnf update -y \ + && dnf install -y python3-pip git \ + && pip install pip --upgrade \ + && pip install -r /tmp/requirements.txt + +COPY ansible/ansible-check.yml /tmp/ansible-check.yml + +CMD ["/bin/bash"] diff --git a/build/Containerfile.debian-11 b/build/Containerfile.debian-11 new file mode 100644 index 0000000..669b206 --- /dev/null +++ b/build/Containerfile.debian-11 @@ -0,0 +1,18 @@ +FROM docker.io/debian:11 +LABEL maintainer="Chris Hammer (chris@thezengarden.net)" + +RUN rm /etc/localtime \ + && ln -s /usr/share/zoneinfo/US/Eastern /etc/localtime + +RUN mkdir -p /root/.ssh +COPY conf/ssh_config /root/.ssh/config +COPY conf/hosts /etc/hosts + +RUN apt update \ + && apt dist-upgrade -y \ + && apt autoremove --purge -y \ + && apt install -y ansible-core ansible-lint git + +COPY ansible/ansible-check.yml /tmp/ansible-check.yml + +CMD ["/bin/bash"] diff --git a/build/Containerfile.debian-12 b/build/Containerfile.debian-12 new file mode 100644 index 0000000..58dcb5a --- /dev/null +++ b/build/Containerfile.debian-12 @@ -0,0 +1,18 @@ +FROM docker.io/debian:12 +LABEL maintainer="Chris Hammer (chris@thezengarden.net)" + +RUN rm /etc/localtime \ + && ln -s /usr/share/zoneinfo/US/Eastern /etc/localtime + +RUN mkdir -p /root/.ssh +COPY conf/ssh_config /root/.ssh/config +COPY conf/hosts /etc/hosts + +RUN apt update \ + && apt dist-upgrade -y \ + && apt autoremove --purge -y \ + && apt install -y ansible-core ansible-lint git + +COPY ansible/ansible-check.yml /tmp/ansible-check.yml + +CMD ["/bin/bash"] diff --git a/build/Containerfile.fedora39 b/build/Containerfile.fedora39 new file mode 100644 index 0000000..2088107 --- /dev/null +++ b/build/Containerfile.fedora39 @@ -0,0 +1,19 @@ +FROM registry.fedoraproject.org/fedora:39 +LABEL maintainer="Chris Hammer (chris@thezengarden.net)" + +RUN rm /etc/localtime \ + && ln -s /usr/share/zoneinfo/US/Eastern /etc/localtime + +RUN mkdir -p /root/.ssh +COPY conf/ssh_config /root/.ssh/config +COPY conf/hosts /etc/hosts +COPY conf/dnf.conf /etc/dnf/dnf.conf +# COPY python/requirements.txt /tmp/requirements.txt + +RUN dnf install -y python3-pip git ansible-core python3-ansible-lint +# && pip install pip --upgrade \ +# && pip install -r /tmp/requirements.txt + +COPY ansible/ansible-check.yml /tmp/ansible-check.yml + +CMD ["/bin/bash"] diff --git a/conf/dnf.conf b/conf/dnf.conf new file mode 100644 index 0000000..4705c7d --- /dev/null +++ b/conf/dnf.conf @@ -0,0 +1,7 @@ +[main] +gpgcheck=1 +installonly_limit=3 +clean_requirements_on_remove=True +best=True +skip_if_unavailable=False +max_parallel_downloads=20 diff --git a/conf/hosts b/conf/hosts new file mode 100644 index 0000000..f8c9a93 --- /dev/null +++ b/conf/hosts @@ -0,0 +1 @@ +10.10.10.109 gitea.thezengarden.net diff --git a/conf/ssh_config b/conf/ssh_config new file mode 100644 index 0000000..830d8db --- /dev/null +++ b/conf/ssh_config @@ -0,0 +1,6 @@ +AddKeysToAgent yes + +Host gitea gitea.thezengarden.net + Hostname 10.10.10.109 + StrictHostKeyChecking no + UserKnownHostsFile=/dev/null diff --git a/python/requirements.txt b/python/requirements.txt new file mode 100644 index 0000000..30c5d76 --- /dev/null +++ b/python/requirements.txt @@ -0,0 +1,2 @@ +ansible-core==2.14.11 +ansible-lint==6.13.1