Skip to content

Instantly share code, notes, and snippets.

@t0rik
Created July 27, 2021 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save t0rik/47dd1cffd590a0c75978d602bc27ef14 to your computer and use it in GitHub Desktop.
Save t0rik/47dd1cffd590a0c75978d602bc27ef14 to your computer and use it in GitHub Desktop.
nginx playbook
---
- hosts: all
tasks:
- name: ensure nginx is at the latest version
apt: name=nginx state=latest
become: yes
- name: start nginx
service:
name: nginx
state: started
become: yes
- name: copy the nginx config file and restart nginx
copy:
src: /home/foo/static_site.cfg
dest: /etc/nginx/sites-available/static_site.cfg
become: yes
- name: create symlink
file:
src: /etc/nginx/sites-available/static_site.cfg
dest: /etc/nginx/sites-enabled/default
state: link
become: yes
- name: copy the content of the web site
copy:
src: /home/foo/static-site-src/
dest: /home/foo/static-site
- name: restart nginx
service:
name: nginx
state: restarted
become: yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment