#!/usr/bin/ansible-playbook # vim:ft=ansible: --- - name: Install, configure, and start Apache block: - name: Install Apache packages apt: name: "{{ packages }}" vars: packages: - apache2 - libapache2-mod-php7.2 - php7.2 - php7.2-gd - php7.2-json - php7.2-mysql - php7.2-curl - php7.2-mbstring - php7.2-intl - php7.2-xml - php7.2-zip - php7.2-cgi - php7.2-cli - name: Copy configuration copy: src: "{{ item.src }}" dest: "{{ item.dest }}" mode: "{{ item.mode }}" loop: - { src: "php-apache2.ini", dest: "/etc/php/7.2/apache2/php.ini", mode: "0644" } - { src: "php-cgi.ini", dest: "/etc/php/7.2/cgi/php.ini", mode: "0644" } - name: Disable default website file: # This is a symlink so who cares path: "/etc/apache2/sites-enabled/000-default.conf" state: absent - name: Enable modules shell: "{{ item }}" loop: - "a2enmod rewrite" - "a2enmod ssl" become: yes