-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c089660
commit d1be04b
Showing
1 changed file
with
25 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,35 @@ | ||
name: Ansible Playbook Weekly Update Servers | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
paths: | ||
- "ansible/**" | ||
- ".github/workflows/**" | ||
schedule: | ||
- cron: "0 0 * * 6" | ||
push: | ||
branches: ["main"] | ||
paths: | ||
- "ansible/**" | ||
- ".github/workflows/**" | ||
schedule: | ||
- cron: "0 0 * * 6" | ||
|
||
env: | ||
ANSIBLE_HOSTS_FILE: ${{ secrets.ANSIBLE_HOSTS_FILE }} | ||
ANSIBLE_SSH_PRIVATE_KEY_FILE: ${{ secrets.ANSIBLE_SSH_PRIVATE_KEY_FILE }} | ||
ANSIBLE_HOSTS_FILE: ${{ secrets.ANSIBLE_HOSTS_FILE }} | ||
ANSIBLE_SSH_PRIVATE_KEY_FILE: ${{ secrets.ANSIBLE_SSH_PRIVATE_KEY_FILE }} | ||
|
||
jobs: | ||
update-servers: | ||
name: Update Servers | ||
runs-on: self-hosted | ||
update-servers: | ||
name: Update Servers | ||
runs-on: self-hosted | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set Environment Variables | ||
working-directory: ansible | ||
run: | | ||
mkdir inventory | ||
echo $ANSIBLE_HOSTS_FILE | base64 -d > inventory/hosts | ||
echo $ANSIBLE_SSH_PRIVATE_KEY_FILE | base64 -d > ansible_key | ||
chmod 600 ansible_key | ||
- name: Set Environment Variables | ||
working-directory: ansible | ||
run: | | ||
mkdir inventory | ||
echo $ANSIBLE_HOSTS_FILE | base64 -d > inventory/hosts | ||
echo $ANSIBLE_SSH_PRIVATE_KEY_FILE | base64 -d > ansible_key | ||
chmod 600 ansible_key | ||
- name: Run Ansible Playbook | ||
run: | | ||
ansible-playbook update.yaml | ||
- name: Run Ansible Playbook | ||
working-directory: ansible | ||
run: | | ||
ansible-playbook update.yaml |