lamp.yml 1.4 KB

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