ansible-playbooks/roles/webnode/tasks/main.yml

75 lines
1.4 KiB
YAML

---
- name: Install packages
package: name={{ item }} state=latest
with_items:
# PHP5
- php5-fpm
- php5-mysql
- libapache2-mod-auth-cas
# MySQL
- socat
#
# Apache setup
#
- name: Configure /etc/apache2 mount
mount:
name: /etc/apache2
src: /users/syscom/conf/apache2
fstype: none
opts: defaults,bind
state: mounted
- name: Restart apache2
service:
name: apache2
state: restarted
enabled: yes
#
# PHP5-FPM setup
#
- name: Configure php5-fpm www pool
file:
src: fpm-pool-www.conf
dest: /etc/php5/fpm/pool.d/www.conf
backup: no
register: fpm_configuration
- name: Restart php5-fpm
service:
name: php5-fpm
state: restarted
enabled: yes
when: fpm_configuration.changed
#
# MySQL setup
#
- name: Configure MySQL forwarding service
copy:
src: mysql-forwarding.service
dest: /etc/systemd/system/mysql-forwarding.service
backup: no
register: mysql_forwarding
- name: Configure MySQL tmp file
copy:
src: mysql-forwarding.conf
dest: /etc/tmpfiles.d/mysql-forwarding.conf
backup: no
register: mysql_forwarding_tmpfile
- name: Create tmpfiles for MySQL forwarding
command: systemd-tmpfiles --create
when: mysql_forwarding_tmpfile.changed
- name: Enable MySQL forwarding service
service:
name: mysql-forwarding
state: restarted
enabled: yes
when: mysql_forwarding.changed or mysql_forwarding_tmpfile.changed