add weekly playbook runs
This commit is contained in:
parent
fd2ea44b26
commit
8295535ad9
4 changed files with 20 additions and 7 deletions
|
@ -1,6 +1,9 @@
|
||||||
name: Run Ansible Playbook
|
name: Run Ansible Playbook
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
schedule:
|
||||||
|
# Runs weekly at 3:00 AM every Monday (UTC)
|
||||||
|
- cron: "0 3 * * 1"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
playbook:
|
playbook:
|
||||||
|
@ -8,14 +11,14 @@ on:
|
||||||
required: true
|
required: true
|
||||||
type: choice
|
type: choice
|
||||||
options:
|
options:
|
||||||
- apt.yml
|
|
||||||
- docker-count.yml
|
- docker-count.yml
|
||||||
- docker-login.yml
|
- docker-login.yml
|
||||||
- docker-prune.yml
|
|
||||||
- git-pull-reset.yml
|
- git-pull-reset.yml
|
||||||
- main-reboot-required.yml
|
- maint-reboot-required.yml
|
||||||
- ntp.yml
|
- ntp.yml
|
||||||
- zsh.yml
|
- zsh.yml
|
||||||
|
- weekly/docker-prune.yml
|
||||||
|
- weekly/apt.yml
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
run-playbook:
|
run-playbook:
|
||||||
|
@ -85,10 +88,20 @@ jobs:
|
||||||
eval $(ssh-agent -s)
|
eval $(ssh-agent -s)
|
||||||
ssh-add /root/.ssh/id_rsa
|
ssh-add /root/.ssh/id_rsa
|
||||||
|
|
||||||
- name: Run the selected playbook
|
- name: Run Playbooks
|
||||||
env:
|
env:
|
||||||
BWS_ACCESS_TOKEN: ${{ secrets.BWS_ACCESS_TOKEN }}
|
BWS_ACCESS_TOKEN: ${{ secrets.BWS_ACCESS_TOKEN }}
|
||||||
ANSIBLE_CONFIG: ansible/ansible.cfg
|
ANSIBLE_CONFIG: ansible/ansible.cfg
|
||||||
run: |
|
run: |
|
||||||
ansible-playbook -i ansible/hosts.ini ./ansible/playbooks/${{ github.event.inputs.playbook }} \
|
if [ -z "${{ github.event.inputs.playbook }}" ]; then
|
||||||
|
echo "Running all playbooks in ansible/playbooks/weekly..."
|
||||||
|
for playbook in ansible/playbooks/weekly/*.yml; do
|
||||||
|
echo "Running $playbook..."
|
||||||
|
ansible-playbook -i ansible/hosts.ini $playbook \
|
||||||
--extra-vars "bw_access_token=${{ secrets.BW_ACCESS_TOKEN }}"
|
--extra-vars "bw_access_token=${{ secrets.BW_ACCESS_TOKEN }}"
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "Running selected playbook: ${{ github.event.inputs.playbook }}"
|
||||||
|
ansible-playbook -i ansible/hosts.ini ansible/playbooks/${{ github.event.inputs.playbook }} \
|
||||||
|
--extra-vars "bw_access_token=${{ secrets.BW_ACCESS_TOKEN }}"
|
||||||
|
fi
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
- name: check if system reboot is required
|
- name: check if system reboot is required
|
||||||
hosts: "*"
|
hosts: "*"
|
||||||
become: yes
|
become: true
|
||||||
tasks:
|
tasks:
|
||||||
- name: check if system reboot is required
|
- name: check if system reboot is required
|
||||||
become: true
|
become: true
|
Loading…
Reference in a new issue