Implementing an installation guide as a ansible project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible-shopware/tasks/shopware.yml

136 lines
3.0 KiB

- name: apt_repository
apt_repository:
repo: ppa:ondrej/php
- name: Shopware Dependencies
package:
name:
- unzip
- nginx
- php7.4
- php7.4-mysql
- php7.4-fpm
- php7.4-json
- php7.4-curl
- php7.4-gd
- php7.4-xml
- php7.4-zip
- php7.4-opcache
- php7.4-mbstring
- php7.4-intl
- php7.4-cli
- mariadb-server
- python3-pymysql
state: latest
#configure mariadb
- name: Copy my.cnf
copy:
src: ../my.cnf
dest: /etc/mysql/my.cnf
- name: update mariadb root user
mysql_user:
login_unix_socket: /var/run/mysqld/mysqld.sock
login_user: "{{shopware_root_username}}"
login_password: "{{shopware_root_pass}}"
name: "{{shopware_root_username}}"
password: "{{shopware_root_pass}}"
check_implicit_admin: yes
state: present
- name: Restart service httpd, in all cases
ansible.builtin.service:
name: mariadb
state: restarted
- name: Make sure service is started and enabled
systemd:
name: mariadb
state: started
enabled: yes
- name: Remove the SQL test database
community.mysql.mysql_db:
db: "test"
state: absent
config_file: /etc/mysql/my.cnf
- name: Create Database
become: yes
community.mysql.mysql_db:
name: shopware
state: present
config_file: /etc/mysql/my.cnf
- name: Create user with password, all database privileges and 'WITH GRANT OPTION' shopware database
become: yes
community.mysql.mysql_user:
login_user: "{{shopware_root_username}}"
login_password: "{{shopware_root_pass}}"
state: present
name: "{{shopware_db_username}}"
password: "{{shopware_db_pass}}"
priv:
'shopware.*': 'ALL,GRANT'
#configure php
- name: Setting PHP memory limit
lineinfile:
dest: /etc/php/7.4/fpm/php.ini
regexp: "^memory_limit = 128M$"
line: "memory_limit = 512M"
- name: Setting PHP POST MAX SIZE
lineinfile:
dest: /etc/php/7.4/fpm/php.ini
regexp: "^post_max_size = 8M$"
line: "post_max_size = 32M"
- name: Setting Upload Max Filesize
lineinfile:
dest: /etc/php/7.4/fpm/php.ini
regexp: "^upload_max_filesize = 2M$"
line: "upload_max_filesize = 32M"
- name: Restart php 8
ansible.builtin.service:
name: php7.4-fpm
state: restarted
- name: Make sure service is started and enabled
systemd:
name: php7.4-fpm
state: started
enabled: yes
# nginx
- name: Copy nginx config
copy:
src: ../default
dest: /etc/nginx/sites-enabled/default
- name: Restart nginx
ansible.builtin.service:
name: nginx
state: restarted
# install shopware 6
- name: delete nginx index file
ansible.builtin.file:
path: /var/www/html/index.nginx-debian.html
state: absent
- name: dl & unarchive shopware
ansible.builtin.unarchive:
src: "{{ shopware_dl_link }}"
dest: /var/www/html
remote_src: yes
# set system settings
- name: Change file ownership, group and permissions
ansible.builtin.file:
path: /var/www/html
recurse: yes
owner: www-data
group: www-data