phpservermon/provision.yaml

86 lines
2.2 KiB
YAML

---
- hosts: all
become: yes
become_method: sudo
tasks:
- name: Update OS
package:
name: '*'
state: latest
# - name: Install base packages
# apt: name={{ item }} state=installed
# with_items:
# - nginx
# - tmux
# tags:
# - packages
#
# - name: Update apt-get repo and cache
# apt: update_cache=yes force_apt_get=yes cache_valid_time=3600
#
#
- name: wget percona release installation file
shell: cd /root/ && wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb; dpkg -i /root/percona-release_latest.$(lsb_release -sc)_all.deb
- name: setup percona repositories to percona server 5.7
shell: percona-release setup ps57
- name: Update repositories cache
apt:
update_cache: yes
- name: ensure nginx is at the latest version
apt: name=nginx state=latest
- name: start nginx
service:
name: nginx
state: started
- name: Add nginx stable repository from PPA and install its signing key on Ubuntu target
ansible.builtin.apt_repository:
repo: ppa:ondrej/php
- name: ensure php7.4-fpm is at the latest version
apt: name=php7.4-fpm state=latest
- name: install php7.4-curl
apt: name=php7.4-curl state=latest
- name: install php7.4-xml
apt: name=php7.4-xml state=latest
- name: install php7.4-pdo
apt: name=php7.4-pdo state=latest
- name: install php7.4-mysql
apt: name=php7.4-mysql state=latest
- name: ensure gpupg2 is at the latest version
apt: name=gnupg2 state=latest
- name: ensure percona-server-57 is installed
apt: name=percona-server-server-5.7 state=latest
# - name: Create a new database with name 'psm'
# shell: mysql -e "CREATE DATABASE psm;"
- name: setup mysql
shell: /vagrant/setup-mysql.sh
- name: copy psm nginx vhost
shell: /bin/cp -far /vagrant/dev/phpservermon-default /etc/nginx/sites-available/default
- name: setup php dependencies
shell: /vagrant/setup-php.sh
- name: copy psm config file
shell: /bin/cp -far /vagrant/dev/config.php /vagrant/config.php
- name: apply nginx modifications
service:
name: nginx
state: restarted