lamp.yml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. ---
  2. -
  3. gather_facts: false
  4. hosts: tag_type_webinar
  5. become: yes
  6. vars:
  7. mysql_root_password: "mypass"
  8. tasks:
  9. - name: Install LAMP
  10. apt: pkg={{ item }} state=installed update_cache=true
  11. with_items:
  12. - apache2
  13. - mysql-server
  14. - mysql-client
  15. - python-mysqldb
  16. - libmysqlclient-dev
  17. - php-fpm
  18. - php-gd
  19. - php-curl
  20. - php-mysql
  21. - php-dom
  22. - php-xml
  23. - name: Enable apache2 modules
  24. command: a2enmod rewrite actions alias
  25. - name: Upload apache2 default configuration
  26. copy: src=files/000-default.conf dest=/etc/apache2/sites-enabled/
  27. - name: Remove default apache2 index.html file
  28. ignore_errors: yes
  29. command: rm /var/www/html/index.html
  30. - name: Upload default index.php for host
  31. copy: src=files/index.php dest=/var/www/html/ mode=0644
  32. - name: Restart webserver
  33. service: name=apache2 state=restarted
  34. - name : Ensure mysql started
  35. become: yes
  36. service: name=mysql state=started enabled=yes
  37. - name: Update MySQL root password for all root accounts
  38. mysql_user: name=root
  39. host={{ item }}
  40. password={{ mysql_root_password }}
  41. login_user=root
  42. login_password=""
  43. state=present
  44. with_items:
  45. - 127.0.0.1
  46. - ::1
  47. - localhost
  48. - name: Configure php-fom with apache2
  49. become: true
  50. copy: src=files/www.conf dest=/etc/php/7.0/fpm/pool.d/