File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,3 +50,4 @@ Thumbs.db
5050* .iml
5151AWS-Ansible.code-workspace
5252.prettierrc
53+ docs /Deployment.txt
Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments