diff --git a/tasks/configure.yml b/tasks/configure.yml index ecdb625..db02f9d 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -16,18 +16,21 @@ template: src=upstart-{{item.server|default(wsgi_server)}}.conf.j2 dest=/etc/init/{{item.name}}-wsgi.conf owner=root group=root mode=0644 with_items: "{{wsgi_applications}}" when: wsgi_service == 'upstart' + become: yes notify: wsgi restart - name: Setup Init template: src=init-{{item.server|default(wsgi_server)}}.j2 dest=/etc/init.d/{{item.name}}-wsgi owner=root group=root mode=0755 with_items: "{{wsgi_applications}}" when: wsgi_service == 'init' + become: yes notify: wsgi restart - name: Setup SystemD template: src=systemd-{{item.server|default(wsgi_server)}}.j2 dest=/etc/systemd/system/{{item.name}}-wsgi.service owner=root group=root mode=0644 with_items: "{{wsgi_applications}}" when: wsgi_service == 'systemd' + become: yes notify: wsgi restart - name: Ensure that the services are started diff --git a/tasks/wsgi.yml b/tasks/wsgi.yml index 7d58a49..b670ff8 100644 --- a/tasks/wsgi.yml +++ b/tasks/wsgi.yml @@ -16,19 +16,21 @@ template: src=nginx.conf.j2 dest={{item.etc_dir|default("/opt/%s/etc" % item.name)}}/{{item.name}}-nginx.conf owner={{wsgi_user}} group={{wsgi_group}} when: item.proxy|default(wsgi_proxy) == 'nginx' with_items: "{{wsgi_applications}}" - notify: nginx reload + notify: nginx reload tags: [wsgi, wsgi-nginx] - name: Enable nginx sites file: state=link dest={{nginx_sites_dir}}/{{item.name}}.conf src={{item.etc_dir|default("/opt/%s/etc" % item.name)}}/{{item.name}}-nginx.conf when: item.proxy|default(wsgi_proxy) == 'nginx' with_items: "{{wsgi_applications}}" + become: yes tags: [wsgi, wsgi-nginx] - name: Configure log rotation template: src=logrotate.conf.j2 dest=/etc/logrotate.d/{{item.name}}-wsgi.conf with_items: "{{wsgi_applications}}" when: wsgi_log_rotate + become: yes tags: [wsgi, wsgi-logrotate] # vim:sw=2:ft=ansible