band-on-iac/.drone.yml
rulrich 0c0c0d2d78
All checks were successful
continuous-integration/drone/pr Build is passing
.drone.yml aktualisiert
2024-03-13 09:11:40 +01:00

133 lines
No EOL
2.6 KiB
YAML

kind: pipeline
name: default
type: docker
trigger:
branch:
- main
steps:
- name: check SSH
image: appleboy/drone-ssh
settings:
host:
- test.band-on.com
# - band-on.com
username:
from_secret: drone_ansible_user
key:
from_secret: drone_ansible_ssh_private_key
port: 22
command_timeout: 2m
script:
- echo "Hello World"
when:
event:
- push
- tag
branch:
- main
- name: Syntax Check
image: plugins/ansible:3
settings:
become: true
playbook: playbook.yml
inventory: hosts
ssh_extra_args: "-o StrictHostKeyChecking=no"
syntax_check: true
when:
event:
- pull_request
- push
- name: Lint
image: cytopia/ansible-lint
commands:
- ansible-lint playbook.yml --force-color
when:
event:
- pull_request
- push
status:
- success
- name: Show Diff and Check
image: plugins/ansible:3
settings:
become: true
playbook: playbook.yml
inventory: hosts
limit: testing
user:
from_secret: drone_ansible_user
private_key:
from_secret: drone_ansible_ssh_private_key
diff: true
check: true
ssh_extra_args: "-o StrictHostKeyChecking=no"
when:
event:
- push
status:
- success
- name: webhook-pr
image: plugins/webhook
settings:
username:
from_secret: mattermost_username
password:
from_secret: mattermost_password
urls: https://chat.host-ranger.ch/hooks/9e39cidaqt8d7f9hd4gmutkngr
content_type: application/json
template: |
{
"text": "${DRONE_REPO} build #${DRONE_BUILD_NUMBER} status: **${DRONE_BUILD_STATUS}**"
}
when:
status:
- failure
- success
event:
- pull_request
- name: webhook-push-start
image: plugins/webhook
settings:
username:
from_secret: mattermost_username
password:
from_secret: mattermost_password
urls: https://chat.host-ranger.ch/hooks/9e39cidaqt8d7f9hd4gmutkngr
content_type: application/json
template: |
{
"text": "${DRONE_REPO} build is starting\nBuild: https://drone.ulrich.engineering/rulrich/${DRONE_REPO}/${DRONE_BUILD_NUMBER}"
}
when:
branch:
- main
event:
- push
- tag
- name: Apply Playbook
image: plugins/ansible:3
settings:
become: true
playbook: playbook.yml
inventory: hosts
limit: testing
user:
from_secret: drone_ansible_user
private_key:
from_secret: drone_ansible_ssh_private_key
ssh_extra_args: "-o StrictHostKeyChecking=no"
diff: true
when:
branch:
- main
event:
- push
- tag