Skip to content

Commit

Permalink
Ansible test
Browse files Browse the repository at this point in the history
  • Loading branch information
leonmelein committed Dec 26, 2024
1 parent f4cfdea commit b98d523
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,13 @@ jobs:

- name: Build app
run: npm run build

- name: Run playbook
uses: dawidd6/action-ansible-playbook@v2
with:
playbook: playbook.yml
directory: .playbook/
key: ${{secrets.SSH_KEY}}
options: |
--inventory inventory
--extra-vars repositoryPath=$GITHUB_WORKSPACE
5 changes: 5 additions & 0 deletions .playbook/inventory
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[beta]
beta.thesociallions.nl

[production]
thesociallions.nl
25 changes: 25 additions & 0 deletions .playbook/playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
- name: Copy file to target servers
hosts: beta
tasks:
# Ensure website folder exists
- name: Ensure subfolder exists
ansible.builtin.file:
path: /www/swim
owner: github-actions
group: www-data
state: directory
mode: '0775'

- name: Copy files
ansible.builtin.copy:
src: "{{ repositoryPath }}/"
dest: /www/swim
mode: '0644'

- name: Restart nginx
ansible.builtin.service:
name: nginx
state: restarted

# Handle certificates

0 comments on commit b98d523

Please sign in to comment.