nginx/tasks/main.yaml
changeset 40 b42b417751e5
child 47 3f1771bb0d79
equal deleted inserted replaced
39:90b1b7c4be70 40:b42b417751e5
       
     1 ---
       
     2 
       
     3 - name: install nginx packages
       
     4   become: yes
       
     5   apt: name="nginx"
       
     6 
       
     7 - name: install site
       
     8   become: yes
       
     9   template: src="{{nginx_conf_src}}" dest="/etc/nginx/sites-available/{{nginx_conf_dst}}"
       
    10   notify: restart nginx
       
    11 
       
    12 - name: install nginx packages
       
    13   become: yes
       
    14   apt: name="python-certbot-nginx"
       
    15   notify: restart nginx
       
    16   when: nginx_enable_certbot
       
    17 
       
    18 - name: install certbot in nginx
       
    19   become: yes
       
    20   command: "certbot certonly --nginx -n --agree-tos -d {{nginx_server_name}} -m {{nginx_admin_email}}"
       
    21   changed_when: false
       
    22   when: nginx_enable_certbot
       
    23 
       
    24 - name: disable default site
       
    25   become: yes
       
    26   file: path="/etc/nginx/sites-enabled/default" state="absent"
       
    27   notify: restart nginx
       
    28 
       
    29 - name: enable site
       
    30   become: yes
       
    31   file:
       
    32     src:  "/etc/nginx/sites-available/{{nginx_conf_dst}}"
       
    33     dest: "/etc/nginx/sites-enabled/{{nginx_conf_dst}}"
       
    34     state: "link"
       
    35   notify: restart nginx
       
    36 
       
    37 - name: enable nginx service
       
    38   become: yes
       
    39   systemd: name="nginx" enabled="yes" state="started"