vhost.yml 1016 B

1234567891011121314151617181920212223242526272829303132333435
  1. ---
  2. - name: Add SSH authorized key for synchronize Moudle
  3. authorized_key:
  4. user: root
  5. state: present
  6. key: "{{ lookup('file', '/root/.ssh/id_rsa.pub') }}"
  7. tags: nginx_vhost
  8. - name: Copy nginx.conf
  9. template: src=nginx.conf dest=/usr/local/openresty/nginx/conf/nginx.conf owner=root group=root mode=0644
  10. tags: nginx_vhost
  11. # - name: Remove Old Vhost Directory
  12. # file :
  13. # path: /usr/local/openresty/nginx/conf/vhost
  14. # state: absent
  15. - name: Sync Vhost Files
  16. synchronize: # need input password in command line if ssh key is none.
  17. src: vhost
  18. dest: /usr/local/openresty/nginx/conf/
  19. delete: yes
  20. tags: nginx_vhost
  21. - name: Sync SSL Certificate
  22. copy: src=sslkey dest=/usr/local/openresty/nginx/conf/ owner=root group=root mode=0644
  23. tags: nginx_vhost
  24. - name: Check Configuration
  25. shell: /usr/local/openresty/nginx/sbin/nginx -t
  26. tags: nginx_vhost
  27. - name: Reload /usr/local/openresty/nginx/
  28. shell: /usr/local/openresty/nginx/sbin/nginx -s reload
  29. tags: nginx_vhost