Brak opisu
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.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. when: ansible_distribution_version == '9'
  24. - name: Setup PHP config
  25. template:
  26. src=etc_php_7.3_apache2_php.ini.j2
  27. dest=/etc/php/7.3/apache2/php.ini
  28. owner=root
  29. group=root
  30. notify: restart apache
  31. when: ansible_distribution_version == '10'
  32. - name: Setup PHP config
  33. template:
  34. src=etc_php_7.4_apache2_php.ini.j2
  35. dest=/etc/php/7.4/apache2/php.ini
  36. owner=root
  37. group=root
  38. notify: restart apache
  39. when: ansible_distribution_version == '11'
  40. - name: Add custom postgres user
  41. postgresql_user:
  42. login_host=localhost
  43. login_user={{ db_admin_username }}
  44. login_password="{{ db_admin_password }}"
  45. name={{ custom_db_username }}
  46. password="{{ custom_db_password }}"
  47. encrypted=yes
  48. state=present
  49. - name: Create custom database
  50. postgresql_db:
  51. login_host=localhost
  52. login_user={{ db_admin_username }}
  53. login_password="{{ db_admin_password }}"
  54. name={{ custom_db_database }}
  55. state=present
  56. owner={{ custom_db_username }}
  57. - name: Create an example blog index page
  58. template:
  59. src=var_www_blog_index.j2
  60. dest={{ item.doc_root }}/index.html
  61. owner=www-data
  62. group=www-data
  63. force=no
  64. with_items: "{{ virtual_domains }}"
  65. - name: Create an example blog 404 error page
  66. template:
  67. src=var_www_blog_404.j2
  68. dest={{ item.doc_root }}/404.html
  69. owner=www-data
  70. group=www-data
  71. force=no
  72. with_items: "{{ virtual_domains }}"
  73. - name: Create the Apache blog sites config files
  74. template:
  75. src=etc_apache2_sites-available_blog.j2
  76. dest=/etc/apache2/sites-available/{{ item.name }}.conf
  77. owner=root
  78. group=root
  79. notify: restart apache
  80. with_items: "{{ virtual_domains }}"
  81. - name: Enable Apache blog sites (creates new sites-enabled symlinks)
  82. command: a2ensite {{ item }}.conf creates=/etc/apache2/sites-enabled/{{ item }}.conf
  83. notify: restart apache
  84. with_items: "{{ virtual_domains | json_query('[*].name') }}"