Playbooks to a new Lilik
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.

74 lines
2.0 KiB

8 years ago
8 years ago
  1. ---
  2. - name: install wordpress
  3. apt:
  4. name: "{{ item }}"
  5. state: present
  6. update_cache: yes
  7. cache_valid_time: 3600
  8. with_items:
  9. - wordpress
  10. notify: restart apache2
  11. - name: install inetutils-ping
  12. apt:
  13. name: "{{ item }}"
  14. state: present
  15. update_cache: yes
  16. cache_valid_time: 3600
  17. with_items:
  18. - inetutils-ping
  19. - name: unarchive setup-mysql.gz
  20. # unarchive dosn't support .gz file
  21. # unarchive: src=/usr/share/doc/wordpress/examples/setup-mysql.gz dest=/usr/share/doc/wordpress/examples/ remote_src=yes copy=no
  22. # use shell command instead
  23. shell: gunzip -d -k setup-mysql.gz
  24. args:
  25. chdir: /usr/share/doc/wordpress/examples/
  26. creates: setup-mysql
  27. - name: make setup-mysql executable
  28. file:
  29. path: /usr/share/doc/wordpress/examples/setup-mysql
  30. mode: u=rwx,g=rx,o=rx
  31. - name: add apache2 configurations for wordpress
  32. template:
  33. src: "wordpress.apache2.j2"
  34. dest: "/etc/apache2/sites-available/{{ item }}.conf"
  35. when: site_names is defined
  36. with_items: "{{ site_names }}"
  37. - name: enable apache2 configuration
  38. file:
  39. src: "/etc/apache2/sites-available/{{ item }}.conf"
  40. dest: "/etc/apache2/sites-enabled/{{ item }}.conf"
  41. state: link
  42. with_items: "{{ site_names }}"
  43. when: site_names is defined
  44. notify: restart apache2
  45. - name: add sites to hosts
  46. lineinfile:
  47. dest: /etc/hosts
  48. line: "127.0.0.1 {{ item }}"
  49. when: site_names is defined
  50. with_items: "{{ site_names }}"
  51. - name: create wordpress databases
  52. shell: "/usr/share/doc/wordpress/examples/setup-mysql -n {{ item }} {{ item }}.lilik.it"
  53. args:
  54. creates: /etc/wordpress/config-{{ item }}.lilik.it.php
  55. when: site_names is defined
  56. with_items: "{{ site_names }}"
  57. - name: edit wordpress configurations
  58. blockinfile:
  59. dest: /etc/wordpress/config-{{ item }}.lilik.it.php
  60. block: |
  61. define('DB_CHARSET', 'utf8');
  62. define( 'FS_METHOD', 'direct');
  63. define ('WPLANG','it_IT');
  64. insertbefore: '\?>'
  65. when: site_names is defined
  66. with_items: "{{ site_names }}"