lamp.yml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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: 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-xml
  22. - name: Enable apache2 modules
  23. command: a2enmod rewrite actions alias
  24. - name: Upload apache2 default configuration
  25. copy: src=files/000-default.conf dest=/etc/apache2/sites-enabled/
  26. - name: Remove default apache2 index.html file
  27. ignore_errors: yes
  28. command: rm /var/www/html/index.html
  29. - name: Upload default index.php for host
  30. copy: src=files/index.php dest=/var/www/html/ mode=0644
  31. - name: Restart webserver
  32. service: name=apache2 state=restarted
  33. - name : Ensure mysql started
  34. become: yes
  35. service: name=mysql state=started enabled=yes
  36. - name: Update MySQL root password for all root accounts
  37. mysql_user: name=root
  38. host={{ item }}
  39. password={{ mysql_root_password }}
  40. login_user=root
  41. login_password=""
  42. state=present
  43. with_items:
  44. - 127.0.0.1
  45. - ::1
  46. - localhost
  47. - name: Configure php-fom with apache2
  48. become: true
  49. copy: src=files/www.conf dest=/etc/php/7.0/fpm/pool.d/