tasks:
- name: Install prerequisites
apt: name={{ item }} update_cache=yes state=absent force_apt_get=yes
loop: [ 'aptitude' ]
#Apache Configuration
- name: Install LAMP Packages
apt: name={{ item }} update_cache=yes state=absent
loop: [ 'apache2', 'mysql-server', 'python3-pymysql', 'php', 'php-mysql', 'libapache2-mod-php' ]
- name: Create document root
file:
path: "/var/www/{{ http_host }}"
state: directory
owner: "{{ app_user }}"
mode: '0755'
- name: Set up Apache virtualhost
template:
src: "files/apache.conf.j2"
dest: "/etc/apache2/sites-available/{{ http_conf }}"
notify: Reload Apache
- name: Enable new site
shell: /usr/sbin/a2ensite {{ http_conf }}
notify: Reload Apache
- name: Disable default Apache site
shell: /usr/sbin/a2dissite 000-default.conf
when: disable_default
notify: Reload Apache
# MySQL Configuration
- name: Sets the root password
mysql_user:
name: root