--- - name: Add SSH authorized key for synchronize Moudle authorized_key: user: root state: present key: "{{ lookup('file', '/root/.ssh/id_rsa.pub') }}" tags: nginx_vhost - name: Copy nginx.conf template: src=nginx.conf dest=/usr/local/openresty/nginx/conf/nginx.conf owner=root group=root mode=0644 tags: nginx_vhost # - name: Remove Old Vhost Directory # file : # path: /usr/local/openresty/nginx/conf/vhost # state: absent - name: Sync Vhost Files synchronize: # need input password in command line if ssh key is none. src: vhost dest: /usr/local/openresty/nginx/conf/ delete: yes tags: nginx_vhost - name: Sync SSL Certificate copy: src=sslkey dest=/usr/local/openresty/nginx/conf/ owner=root group=root mode=0644 tags: nginx_vhost - name: Check Configuration shell: /usr/local/openresty/nginx/sbin/nginx -t tags: nginx_vhost - name: Reload /usr/local/openresty/nginx/ shell: /usr/local/openresty/nginx/sbin/nginx -s reload tags: nginx_vhost