roles/nginx/tasks/main.yaml
changeset 61 2dd82d9e2103
equal deleted inserted replaced
60:48a3a65119d5 61:2dd82d9e2103
       
     1 ---
       
     2 
       
     3 - name: set hostname in OS
       
     4   become: yes
       
     5   hostname: name="{{inventory_hostname}}"
       
     6 
       
     7 - name: change timezone to UTC
       
     8   become: yes
       
     9   timezone: name="UTC"
       
    10 
       
    11 - name: install nginx packages
       
    12   become: yes
       
    13   apt: name="nginx"
       
    14 
       
    15 - name: disable default site
       
    16   become: yes
       
    17   file: path="/etc/nginx/sites-enabled/default" state="absent"
       
    18   notify: restart nginx
       
    19 
       
    20 - name: install site
       
    21   become: yes
       
    22   template: src="{{nginx_conf_src}}" dest="/etc/nginx/sites-available/{{nginx_conf_dst}}"
       
    23   notify: restart nginx
       
    24 
       
    25 - import_tasks: certbot.yaml
       
    26   when: nginx_enable_ssl
       
    27 
       
    28 - name: enable site
       
    29   become: yes
       
    30   file:
       
    31     src:  "/etc/nginx/sites-available/{{nginx_conf_dst}}"
       
    32     dest: "/etc/nginx/sites-enabled/{{nginx_conf_dst}}"
       
    33     state: "link"
       
    34   notify: restart nginx
       
    35 
       
    36 - name: enable nginx service
       
    37   become: yes
       
    38   systemd: name="nginx" enabled="yes" state="started"