Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- - name: Install Nginx
- hosts: all
- connection: local
- become: yes
- tasks:
- - name: Update apt package index
- apt: update_cache=yes force_apt_get=yes cache_valid_time=3600
- - name: Install Nginx
- apt:
- name: nginx
- state: present
- - name: Ensure Nginx is running and enabled
- systemd:
- name: nginx
- state: started
- enabled: yes
- - name: Copy Nginx server block file
- copy:
- src: "templates/site.conf"
- dest: "/etc/nginx/sites-enabled/site.conf"
- register: template_result
- - name: Reload Nginx if configuration changed
- systemd:
- name: nginx
- state: reloaded
- when: template_result is changed
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement