Merge pull request 'ansible with drone ci' (#1) from development into main
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing

Reviewed-on: #1
This commit is contained in:
Chris Hammer 2023-11-17 00:48:10 -05:00
commit 68f9c4d550
2 changed files with 39 additions and 3 deletions

2
.ansible-lint Normal file
View File

@ -0,0 +1,2 @@
skip_list:
- yaml[line-length]

View File

@ -1,12 +1,46 @@
---
name: Test Ansible Linting of drone-test-1
name: Ansible Playbook Lint and Test Execution
kind: pipeline
type: docker
steps:
- name: Testing Drone CI with a simple Ansible Playbook
- name: Install requirements, lint, and run Ansible playbook
image: gitea.thezengarden.net/podman/images/ansible-dev:latest
environment:
GITEA_TOKEN:
from_secret: gitea_token
ANSIBLE_INVENTORY:
from_secret: ansible_inventory
commands:
- ansible-galaxy install -r $DRONE_WORKSPACE/requirements.yml
- ansible-lint --offline $DRONE_WORKSPACE
- ansible-playbook -v -i 127.0.0.1, $DRONE_WORKSPACE/hello.yml
- ansible-playbook -v -i $ANSIBLE_INVENTORY $DRONE_WORKSPACE/hello.yml
- echo "Build complete and successful for $DRONE_REPO_NAME"
when:
branch:
- development
event:
include:
- push
exclude:
- pull_request
# ---
# name: Test Ansible Linting of drone-test-1
# kind: pipeline
# type: docker
# steps:
# - name: Add comment to pull request
# image: gitea.thezengarden.net/podman/images/ansible-dev:latest
# environment:
# GITEA_TOKEN:
# from_secret: gitea_token
# 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\"}"'
# depends_on:
# - "Install requirements, lint, and run Ansible playbook"
# when:
# event:
# - pull_request