Compare commits
87 Commits
1.0.0
...
developmen
Author | SHA1 | Date | |
---|---|---|---|
b894894c7c | |||
9240abe863 | |||
654181364a | |||
18ed3a2197 | |||
f58229937d | |||
e33a5059fe | |||
6f4ce26baa | |||
b7b150de94 | |||
f08a5de39b | |||
de4b4bff42 | |||
07b1c64282 | |||
85e92d9f8c | |||
ce16b086a4 | |||
b0c67c10d1 | |||
1411f31406 | |||
4cb2be284f | |||
2f73c2ed2a | |||
e3c8d2930c | |||
1b6291e52f | |||
450aea89a6 | |||
215db93cd7 | |||
1d9bb863d0 | |||
641338b16c | |||
25436afc0c | |||
4edf11953f | |||
fa0caaf516 | |||
2672ce0653 | |||
b83d0e566b | |||
c09d9eb878 | |||
4335f5762a | |||
cdf37dca49 | |||
c5de2157c3 | |||
0097a0bdfb | |||
9681ef97f0 | |||
1999484cd8 | |||
ee63cf75f8 | |||
e2e8648977 | |||
a709bb3094 | |||
127f0e65ec | |||
75b4e17394 | |||
9282a0e073 | |||
04d16e2111 | |||
5623c6186f | |||
fba685488a | |||
97f05614fc | |||
185d47b0e4 | |||
31b7fe0acc | |||
59bfbf0c2b | |||
3a260ac16b | |||
cbbeaa4af9 | |||
d49c00ceb5 | |||
2321723c09 | |||
7a60623201 | |||
c689cd19bd | |||
af2c35003c | |||
2ed92a0eda | |||
3a02d1d9bd | |||
c6c3bf23d7 | |||
8186d8d4ae | |||
c3d223f289 | |||
c0e107641f | |||
a900700a1c | |||
0b2a1bd882 | |||
ed78bb72f7 | |||
e3fbdb375c | |||
5070ee375e | |||
353b71d339 | |||
6eed651dc6 | |||
4a9aa413f0 | |||
be2e76a870 | |||
ae6f03030e | |||
891aceb04d | |||
48ed5a92ba | |||
b3a3cd6da6 | |||
ff22e1cb50 | |||
42ad0c68c2 | |||
93d839ece1 | |||
4d5fae6872 | |||
6d76533294 | |||
462f84151a | |||
5b144c5e88 | |||
cc9f96b470 | |||
fd4b03d2f9 | |||
da407eddee | |||
93076731fe | |||
1f4974e1dd | |||
c71c2ce761 |
@ -1,2 +1,7 @@
|
|||||||
skip_list:
|
skip_list:
|
||||||
- yaml[line-length]
|
- yaml[line-length]
|
||||||
|
- yaml[colons]
|
||||||
|
|
||||||
|
exclude_paths:
|
||||||
|
- .drone.yml
|
||||||
|
- requirements.yml
|
||||||
|
246
.drone.yml
246
.drone.yml
@ -1,46 +1,226 @@
|
|||||||
---
|
---
|
||||||
name: Ansible Playbook Lint and Test Execution
|
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
|
name: run_ansible_tests_fedora39
|
||||||
|
|
||||||
|
global-variables:
|
||||||
|
ansible_image : &ansible_image "gitea.thezengarden.net/podman/images/ansible-dev:latest"
|
||||||
|
ansible_inventory : &ansible_inventory "-i 127.0.0.1, --connection=local"
|
||||||
|
ansible_playbook : &ansible_playbook "hello.yml"
|
||||||
|
|
||||||
|
environment:
|
||||||
|
ANSIBLE_INVENTORY : *ansible_inventory
|
||||||
|
ANSIBLE_PLAYBOOK : *ansible_playbook
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
exclude:
|
||||||
|
- main
|
||||||
|
event: [push]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Install requirements, lint, and run Ansible playbook
|
- name: "ansible_environment_verify"
|
||||||
image: gitea.thezengarden.net/podman/images/ansible-dev:latest
|
image: *ansible_image
|
||||||
environment:
|
|
||||||
GITEA_TOKEN:
|
|
||||||
from_secret: gitea_token
|
|
||||||
ANSIBLE_INVENTORY:
|
|
||||||
from_secret: ansible_inventory
|
|
||||||
commands:
|
commands:
|
||||||
- ansible-galaxy install -r $DRONE_WORKSPACE/requirements.yml
|
- git log -1
|
||||||
- ansible-lint --offline $DRONE_WORKSPACE
|
- ansible --version
|
||||||
- ansible-playbook -v -i $ANSIBLE_INVENTORY $DRONE_WORKSPACE/hello.yml
|
- ansible-lint --version
|
||||||
- echo "Build complete and successful for $DRONE_REPO_NAME"
|
|
||||||
when:
|
- name: "ansible_galaxy_requirements"
|
||||||
branch:
|
image: *ansible_image
|
||||||
- development
|
commands:
|
||||||
event:
|
- ansible-galaxy install -r requirements.yml
|
||||||
include:
|
|
||||||
- push
|
- name: "ansible_lint"
|
||||||
exclude:
|
image: *ansible_image
|
||||||
- pull_request
|
commands:
|
||||||
|
- ansible-lint --offline
|
||||||
|
|
||||||
|
- name: "ansible_playbook_execution"
|
||||||
|
image: *ansible_image
|
||||||
|
commands:
|
||||||
|
- ansible-playbook -v $ANSIBLE_INVENTORY $ANSIBLE_PLAYBOOK
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: run_ansible_tests_centos9
|
||||||
|
|
||||||
|
global-variables:
|
||||||
|
ansible_image : &ansible_image "gitea.thezengarden.net/podman/images/ansible-dev:centos-stream9"
|
||||||
|
ansible_inventory : &ansible_inventory "-i 127.0.0.1, --connection=local"
|
||||||
|
ansible_playbook : &ansible_playbook "hello.yml"
|
||||||
|
|
||||||
|
environment:
|
||||||
|
ANSIBLE_INVENTORY : *ansible_inventory
|
||||||
|
ANSIBLE_PLAYBOOK : *ansible_playbook
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
exclude:
|
||||||
|
- main
|
||||||
|
event: [push]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: "ansible_environment_verify"
|
||||||
|
image: *ansible_image
|
||||||
|
commands:
|
||||||
|
- git log -1
|
||||||
|
- ansible --version
|
||||||
|
- ansible-lint --version
|
||||||
|
|
||||||
|
- name: "ansible_galaxy_requirements"
|
||||||
|
image: *ansible_image
|
||||||
|
commands:
|
||||||
|
- ansible-galaxy install -r requirements.yml
|
||||||
|
|
||||||
|
- name: "ansible_lint"
|
||||||
|
image: *ansible_image
|
||||||
|
commands:
|
||||||
|
- ansible-lint --offline
|
||||||
|
|
||||||
|
- name: "ansible_playbook_execution"
|
||||||
|
image: *ansible_image
|
||||||
|
commands:
|
||||||
|
- ansible-playbook -v $ANSIBLE_INVENTORY $ANSIBLE_PLAYBOOK
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: run_ansible_tests_debian12
|
||||||
|
|
||||||
|
global-variables:
|
||||||
|
ansible_image : &ansible_image "gitea.thezengarden.net/podman/images/ansible-dev:debian-12"
|
||||||
|
ansible_inventory : &ansible_inventory "-i 127.0.0.1, --connection=local"
|
||||||
|
ansible_playbook : &ansible_playbook "hello.yml"
|
||||||
|
|
||||||
|
environment:
|
||||||
|
ANSIBLE_INVENTORY : *ansible_inventory
|
||||||
|
ANSIBLE_PLAYBOOK : *ansible_playbook
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
exclude:
|
||||||
|
- main
|
||||||
|
event: [push]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: "ansible_environment_verify"
|
||||||
|
image: *ansible_image
|
||||||
|
commands:
|
||||||
|
- git log -1
|
||||||
|
- ansible --version
|
||||||
|
- ansible-lint --version
|
||||||
|
|
||||||
|
- name: "ansible_galaxy_requirements"
|
||||||
|
image: *ansible_image
|
||||||
|
commands:
|
||||||
|
- ansible-galaxy install -r requirements.yml
|
||||||
|
|
||||||
|
- name: "ansible_lint"
|
||||||
|
image: *ansible_image
|
||||||
|
commands:
|
||||||
|
- ansible-lint --offline
|
||||||
|
|
||||||
|
- name: "ansible_playbook_execution"
|
||||||
|
image: *ansible_image
|
||||||
|
commands:
|
||||||
|
- ansible-playbook -v $ANSIBLE_INVENTORY $ANSIBLE_PLAYBOOK
|
||||||
|
|
||||||
|
|
||||||
# ---
|
# ---
|
||||||
# name: Test Ansible Linting of drone-test-1
|
|
||||||
# kind: pipeline
|
# kind: pipeline
|
||||||
# type: docker
|
# type: exec
|
||||||
|
# name: check_docker
|
||||||
|
|
||||||
|
# trigger:
|
||||||
|
# branch:
|
||||||
|
# exclude:
|
||||||
|
# - main
|
||||||
|
# event: [push]
|
||||||
|
# status: [success]
|
||||||
|
|
||||||
|
# depends_on:
|
||||||
|
# - run_ansible_tests
|
||||||
|
|
||||||
# steps:
|
# steps:
|
||||||
# - name: Add comment to pull request
|
# - name: check_env
|
||||||
# image: gitea.thezengarden.net/podman/images/ansible-dev:latest
|
|
||||||
# environment:
|
|
||||||
# GITEA_TOKEN:
|
|
||||||
# from_secret: gitea_token
|
|
||||||
# commands:
|
# commands:
|
||||||
# - 'curl -sL -X POST -H "Authorization: token $GITEA_TOKEN" -H "Content-type: application/json" https://gitea.thezengarden.net/api/v1/repos/${DRONE_REPO_OWNER}/${DRONE_REPO_NAME}/issues/${DRONE_PULL_REQUEST}/comments -d "{\"body\": \"Build complete and successful for $DRONE_REPO_NAME\"}"'
|
# - whoami
|
||||||
# depends_on:
|
# - hostnamectl
|
||||||
# - "Install requirements, lint, and run Ansible playbook"
|
# - env
|
||||||
# when:
|
# - pwd
|
||||||
# event:
|
# - tree
|
||||||
# - pull_request
|
# - cat requirements.yml
|
||||||
|
|
||||||
|
# - name: docker_info
|
||||||
|
# commands:
|
||||||
|
# - docker info
|
||||||
|
|
||||||
|
# - name: docker_build
|
||||||
|
# environment:
|
||||||
|
# REGISTRY : gitea.thezengarden.net
|
||||||
|
# BUILD_PREFIX : "podman/images"
|
||||||
|
# BUILD_NAME : ansible-dev
|
||||||
|
# commands:
|
||||||
|
# - echo "docker build --no-cache -t $REGISTRY/$BUILD_PREFIX/$BUILD_NAME:$CI_BUILD_NUMBER ."
|
||||||
|
# - docker build --no-cache -t $REGISTRY/$BUILD_PREFIX/$BUILD_NAME:$CI_BUILD_NUMBER .
|
||||||
|
|
||||||
|
# - 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_push
|
||||||
|
# environment:
|
||||||
|
# REGISTRY : gitea.thezengarden.net
|
||||||
|
# BUILD_PREFIX : "podman/images"
|
||||||
|
# BUILD_NAME : ansible-dev
|
||||||
|
# commands:
|
||||||
|
# - docker push $REGISTRY/$BUILD_PREFIX/$BUILD_NAME:$CI_BUILD_NUMBER
|
||||||
|
# - docker images | grep "$REGISTRY/$BUILD_PREFIX/$BUILD_NAME"
|
||||||
|
|
||||||
|
# - name: docker_images
|
||||||
|
# environment:
|
||||||
|
# REGISTRY : gitea.thezengarden.net
|
||||||
|
# BUILD_PREFIX : "podman/images"
|
||||||
|
# BUILD_NAME : ansible-dev
|
||||||
|
# commands:
|
||||||
|
# - docker images | grep "$REGISTRY/$BUILD_PREFIX/$BUILD_NAME"
|
||||||
|
|
||||||
|
|
||||||
|
# ---
|
||||||
|
# kind: pipeline
|
||||||
|
# type: exec
|
||||||
|
# name: setup_env
|
||||||
|
|
||||||
|
# trigger:
|
||||||
|
# branch:
|
||||||
|
# exclude:
|
||||||
|
# - main
|
||||||
|
# event: [push]
|
||||||
|
|
||||||
|
# steps:
|
||||||
|
# - name: write_vars
|
||||||
|
# environment:
|
||||||
|
# DIMG:
|
||||||
|
# from_secret: docker_image
|
||||||
|
# commands:
|
||||||
|
# - pwd
|
||||||
|
# - ls -ltra
|
||||||
|
# - echo "dimg=$DIMG" > .drone_env_test
|
||||||
|
|
||||||
|
# - name: read_vars
|
||||||
|
# commands:
|
||||||
|
# - pwd
|
||||||
|
# - ls -ltra
|
||||||
|
# - cat .drone_env_test
|
||||||
|
# - source .drone_env_test
|
||||||
|
# - echo $dimg
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
---
|
|
||||||
name: Ansible Linting of drone-test-1
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: "Ansible Testing: Install required packages and Python modules"
|
|
||||||
image: quay.io/centos/centos:stream9
|
|
||||||
commands:
|
|
||||||
- dnf update -y
|
|
||||||
- dnf install -y python3-pip git hostname
|
|
||||||
- pip3 install ansible-core==2.14.11 ansible-lint==6.13.1
|
|
||||||
|
|
||||||
|
|
||||||
- name: "Ansible Testing: Make repo directory and clone desired repository"
|
|
||||||
image: quay.io/centos/centos:stream9
|
|
||||||
commands:
|
|
||||||
- mkdir /opt/test
|
|
||||||
- git clone https://gitea.thezengarden.net/chris/drone-test-1.git /opt/test/drone-test-1
|
|
||||||
depends_on:
|
|
||||||
- "Ansible Testing: Install required packages and Python modules"
|
|
||||||
|
|
||||||
|
|
||||||
- name: "Ansible Testing: Run Ansible-Lint and Ansible-Playbook against cloned repo"
|
|
||||||
image: quay.io/centos/centos:stream9
|
|
||||||
commands:
|
|
||||||
- ansible-lint /opt/test/drone-test-1
|
|
||||||
- ansible-playbook -v -i 127.0.0.1, /opt/test/drone-test-1/hello.yml
|
|
||||||
depends_on:
|
|
||||||
- "Ansible Testing: Make repo directory and clone desired repository"
|
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.old
|
20
Dockerfile
Normal file
20
Dockerfile
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
FROM 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 update -y
|
||||||
|
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"]
|
10
ansible/ansible-check.yml
Normal file
10
ansible/ansible-check.yml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
- name: Ansible Install Test
|
||||||
|
hosts: all
|
||||||
|
become: false
|
||||||
|
gather_facts: false
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Test Ansible Installation
|
||||||
|
ansible.builtin.debug:
|
||||||
|
msg: "Ansible has been successfully installed!"
|
7
conf/dnf.conf
Normal file
7
conf/dnf.conf
Normal file
@ -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
|
1
conf/hosts
Normal file
1
conf/hosts
Normal file
@ -0,0 +1 @@
|
|||||||
|
10.10.10.109 gitea.thezengarden.net
|
14
conf/ssh_config
Normal file
14
conf/ssh_config
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
AddKeysToAgent yes
|
||||||
|
|
||||||
|
Host 10.*
|
||||||
|
StrictHostKeyChecking no
|
||||||
|
UserKnownHostsFile=/dev/null
|
||||||
|
|
||||||
|
Host git git.thezengarden.net
|
||||||
|
Hostname gitlab
|
||||||
|
|
||||||
|
|
||||||
|
Host gitea gitea.thezengarden.net
|
||||||
|
Hostname 10.10.10.109
|
||||||
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
|||||||
- name: Hello world
|
- name: Hello world
|
||||||
hosts: localhost
|
hosts: all
|
||||||
connection: local
|
|
||||||
become: false
|
become: false
|
||||||
gather_facts: false
|
gather_facts: false
|
||||||
|
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Say Hello world
|
- name: Say Hello world
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
---
|
|
||||||
name: Ansible Linting of drone-test-1
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Prepare CentOS 8 image, clone, and test code
|
|
||||||
image: centos:8
|
|
||||||
commands:
|
|
||||||
- hostname
|
|
||||||
- lscpu
|
|
||||||
- dnf --disablerepo '*' --enablerepo=extras swap centos-linux-repos centos-stream-repos -y
|
|
||||||
- dnf distro-sync -y
|
|
||||||
- dnf update -y
|
|
||||||
- hostname
|
|
||||||
- dnf install -y ansible-core git
|
|
||||||
- pip3 install ansible-lint
|
|
||||||
- mkdir /opt/test
|
|
||||||
- git clone https://gitea.thezengarden.net/chris/drone-test-1.git /opt/test/drone-test-1
|
|
||||||
- ansible-lint /opt/test/drone-test-1
|
|
||||||
|
|
2
python/requirements.txt
Normal file
2
python/requirements.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
ansible-core==2.14.11
|
||||||
|
ansible-lint==6.13.1
|
@ -1,5 +1,3 @@
|
|||||||
collections:
|
collections:
|
||||||
- community.general
|
- name: ansible.posix
|
||||||
- ansible.netcommon
|
- name: community.general
|
||||||
- community.docker
|
|
||||||
- containers.podman
|
|
||||||
|
Reference in New Issue
Block a user