62 lines
1.8 KiB
YAML
62 lines
1.8 KiB
YAML
---
|
|
name: Ansible Playbook Lint and Test Execution
|
|
kind: pipeline
|
|
type: docker
|
|
|
|
|
|
steps:
|
|
- 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 $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: push commit
|
|
image: appleboy/drone-git-push
|
|
settings:
|
|
branch: testing
|
|
remote: gitea@10.10.10.109:chris/drone-test-1.git
|
|
force: false
|
|
commit: true
|
|
commit_message: "Drone build ${DRONE_COMMIT_SHA:0:7}"
|
|
author_name: "Drone CI"
|
|
author_email: "chris@thezengarden.net"
|
|
ssh_key:
|
|
from_secret: gitea_ssh_privkey
|
|
|
|
|
|
# ---
|
|
# 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
|