Skip to content

Commit d4eafe4

Browse files
Add website deployment playbook and related files. Update .gitignore.
1 parent def994c commit d4eafe4

5 files changed

Lines changed: 37 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,4 @@ Thumbs.db
5050
*.iml
5151
AWS-Ansible.code-workspace
5252
.prettierrc
53+
docs/Deployment.txt

playbooks/Deploy_Website.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Playbook to deploy a website to the web server(s) listed in inventory.ini
2+
- name: Deploy Website
3+
# Targets the host group 'web' defined in inventory.ini
4+
hosts: web
5+
# Sudo privileges for web server configuration
6+
become: true
7+
8+
# Variables - define before tasks
9+
vars:
10+
# Path on the web server where website files will be deployed
11+
website_source_path: "/var/www/myapp"
12+
13+
tasks:
14+
- name: Deploy entire website directory
15+
ansible.builtin.copy:
16+
# Copies files from local machine to web server (control node to managed node)
17+
# Control node path (local machine running Ansible)
18+
# The trailing slash means "copy contents of website/"
19+
src: "../website/"
20+
21+
# Destination path on the web server (managed node)
22+
dest: "{{ website_source_path }}/"
23+
24+
# AL (Amazon Linux) uses 'nginx' user/group for Nginx processes
25+
owner: nginx
26+
group: nginx
27+
mode: "0644"
28+
# Trigger nginx reload after file change
29+
notify: Reload nginx
30+
31+
# Handlers are triggered by 'notify' directives in tasks
32+
handlers:
33+
- name: Reload nginx
34+
ansible.builtin.systemd:
35+
name: nginx
36+
state: reloaded

website/css/style.css

Whitespace-only changes.

website/index.html

Whitespace-only changes.

website/js/script.js

Whitespace-only changes.

0 commit comments

Comments
 (0)