No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

blog.yml 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. - name: Create directories for HTML documents
  2. file: state=directory path={{ item }} group=www-data owner={{ main_user_name }}
  3. with_items: "{{ virtual_domains | json_query('[*].doc_root') | unique }}"
  4. - name: Create directory for well-known configs
  5. file: state=directory path=/var/www/well-known group=www-data owner=www-data
  6. - name: Create the Apache well-known config
  7. template:
  8. src=etc_apache2_conf-available_well-known.j2
  9. dest=/etc/apache2/conf-available/well-known.conf
  10. owner=root
  11. group=root
  12. notify: restart apache
  13. - name: Enable the Apache well-known config
  14. command: a2enconf well-known.conf creates=/etc/apache2/conf-enabled/well-known.conf.conf
  15. notify: restart apache
  16. - name: Setup PHP config
  17. template:
  18. src=etc_php_7.0_apache2_php.ini.j2
  19. dest=/etc/php/7.0/apache2/php.ini
  20. owner=root
  21. group=root
  22. notify: restart apache
  23. - name: Add custom postgres user
  24. postgresql_user:
  25. login_host=localhost
  26. login_user={{ db_admin_username }}
  27. login_password="{{ db_admin_password }}"
  28. name={{ custom_db_username }}
  29. password="{{ custom_db_password }}"
  30. encrypted=yes
  31. state=present
  32. - name: Create custom database
  33. postgresql_db:
  34. login_host=localhost
  35. login_user={{ db_admin_username }}
  36. login_password="{{ db_admin_password }}"
  37. name={{ custom_db_database }}
  38. state=present
  39. owner={{ custom_db_username }}
  40. - name: Create an example blog index page
  41. template:
  42. src=var_www_blog_index.j2
  43. dest={{ item.doc_root }}/index.html
  44. owner=www-data
  45. group=www-data
  46. force=no
  47. with_items: "{{ virtual_domains }}"
  48. - name: Create the Apache blog sites config files
  49. template:
  50. src=etc_apache2_sites-available_blog.j2
  51. dest=/etc/apache2/sites-available/{{ item.name }}.conf
  52. owner=root
  53. group=root
  54. notify: restart apache
  55. with_items: "{{ virtual_domains }}"
  56. - name: Enable Apache blog sites (creates new sites-enabled symlinks)
  57. command: a2ensite {{ item }}.conf creates=/etc/apache2/sites-enabled/{{ item }}.conf
  58. notify: restart apache
  59. with_items: "{{ virtual_domains | json_query('[*].name') }}"