Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- # The following playbook automates the migration of an existing Magento store into another environment/server
- # Currently supports the following:
- #
- # - magento 1 and magento 2
- #
- # - Transferring the files including git repos across
- # - Transferring the database and setting up credentials as per the store config (local.xml/env.php)
- # - Transferring the ssh identities so that git/deploybot setups continue to work
- # - Transferring nginx configuration
- # - Transferring and setting up varnish configuration
- #
- # ansible-playbook playbooks/migrations/magento.yml --extra-vars "host=original.cfstack.com destination=new.cfstack.com"
- #
- ---
- - name: "CF Migration Utility : Magento 1/2 / Shopware"
- vars_files:
- - "../../data/variables/general.yml"
- - "../../data/variables/secret.yml"
- # This allows us to use the playbook as both a role and a utility cli task
- hosts: "{{ host | default('all') }}"
- any_errors_fatal: false
- vars:
- enable_maintenance: "false"
- ssh_port_original: 3333
- ssh_port_destination: 22
- platform: "magento1"
- php_version: "7.0"
- dump_and_restore_db: "false"
- transfer_files: "true"
- generate_ssl: "false"
- transfer_certificates: "true"
- n981url: "https://files.magerun.net/n98-magerun.phar"
- n981filename: "n98-magerun.phar"
- n982url: "https://files.magerun.net/n98-magerun2.phar"
- n982filename: "n98-magerun2.phar"
- old_url: "aspinline.co.uk"
- tasks:
- - name: "install python 2 on new host"
- raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
- delegate_to: "{{ destination }}"
- - name: "Get Public IP Address of destination host ({{ destination }})"
- ipify_facts:
- delegate_to: "{{ destination }}"
- - name: "Update CFUtilityScripts"
- git:
- repo: https://github.com/CoreFinity/CFUtilityScripts.git
- dest: /usr/bin/CFScripts/
- version: master
- accept_hostkey: yes
- - name: "Get Nginx VHOSTs Paths by parsing nginx config (used to detect magento version)"
- shell: >
- '/usr/bin/CFScripts/ansible/getNginxVhostPath.sh'
- register: vhost_path_result
- - set_fact: vhost_path={{ vhost_path_result.stdout }}
- - debug:
- msg: "Found NGINX Path by parsing the config directory, path is {{ vhost_path }} {{ ansible_all_ipv4_addresses }}"
- - name: "Get Magento version"
- command: "/usr/bin/CFScripts/ansible/getMagentoVersion.sh {{ vhost_path }}"
- register: magento_version_result
- - set_fact: magento_version={{ magento_version_result.stdout }}
- - debug:
- msg: "Magento version appears to be {{ magento_version }}"
- - name: "Create the same vhost path on the destination server"
- file:
- path: "{{ vhost_path }}"
- state: directory
- delegate_to: "{{ destination }}"
- - name: "Generating RSA key for root on original server"
- user: name=root generate_ssh_key=yes
- - name: "Downloading pub key of original server into tmp"
- fetch: src=/root/.ssh/id_rsa.pub dest=/tmp/id_rsa.tmp flat=yes
- - name: "Copying local key to destination sever"
- local_action: "shell cat /tmp/id_rsa.tmp | ssh root@{{ destination }} 'cat >> /root/.ssh/authorized_keys'"
- - name: "Deleting temporal files"
- local_action: file path=/tmp/id_rsa.tmp state=absent
- - name: "Put the original site on maintenance if enabled (m1)"
- command: "touch {{ vhost_path }}/maintenance.flag"
- when: enable_maintenance == "true" and platform == "magento1"
- - name: "Put the original site on maintenance if enabled (m2)"
- command: "touch {{ vhost_path }}/maintenance.flag"
- when: enable_maintenance == "true" and platform == "magento1"
- - name: "Backup the database"
- command: "sh /usr/bin/CFScripts/backups/backupMagentoDb.sh {{ vhost_path }} >/dev/null 2>&1"
- when: dump_and_restore_db == "true"
- - name: "Transfer site files from host ({{ inventory_hostname }}) to host ({{ destination }})"
- command: "rsync -aHAXxv --numeric-ids --delete --progress -e 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -T -c aes128-gcm@openssh.com -o Compression=no -x' {{ vhost_path }} root@{{ destination }}:{{ vhost_path }}"
- when: transfer_files == "true"
- ignore_errors: yes
- - name: "Fix problems with packages"
- shell: dpkg --configure --pending
- delegate_to: "{{ destination }}"
- - name: "Download CFUtilityScripts into destination host"
- git:
- repo: https://github.com/CoreFinity/CFUtilityScripts.git
- dest: /usr/bin/CFScripts/
- version: master
- accept_hostkey: yes
- delegate_to: "{{ destination }}"
- - name: "Installing base stack packages"
- apt: pkg={{ item }} state=present
- with_items:
- - software-properties-common
- - nano
- - vim
- - pv
- - iotop
- - gawk
- - logrotate
- - git
- - docker
- - docker-compose
- - unzip
- - letsencrypt
- - python-pycurl
- - python-mysqldb
- - apt-transport-https
- async: 120
- poll: 2
- delegate_to: "{{ destination }}"
- - name: "Set up root authosied keys"
- authorized_key: user=root key="{{ lookup('file', item) }}" state=present
- with_fileglob:
- - ../../data/public_keys/*.pub
- delegate_to: "{{ destination }}"
- - name: "Add to Zabbix server for CF monitoring suite"
- local_action:
- module: zabbix_host
- server_url: http://monitor.corefinity.com
- login_user: ansible
- login_password: Kjl5Mab47nS1
- host_name: "{{ destination }}"
- visible_name: "{{ destination }}"
- host_groups:
- - Linux servers
- - Virtual machines
- - vortex
- link_templates:
- - Template App HTTP Service
- - Template App SSH Service
- - Template DB MySQL
- - Template OS Linux
- status: enabled
- state: present
- interfaces:
- - type: 1
- main: 1
- useip: 1
- ip: "{{ ipify_public_ip }}"
- dns: "{{ destination }}"
- port: 10050
- - name: "Setup Percona repo"
- command: bash -lc "{{ item }}"
- with_items:
- - "wget https://repo.percona.com/apt/percona-release_0.1-5.$(lsb_release -sc)_all.deb -O /tmp/percona-release_0.1-5.$(lsb_release -sc)_all.deb"
- - "dpkg -i /tmp/percona-release_0.1-5.$(lsb_release -sc)_all.deb"
- - "dpkg -i /tmp/percona-*.deb"
- delegate_to: "{{ destination }}"
- - name: Update apt
- become: yes
- become_user: root
- apt: update_cache=yes
- delegate_to: "{{ destination }}"
- - name: Install Percona MySQL Server
- action: apt pkg={{ item }} state=present
- with_items:
- - percona-server-server-5.7
- - percona-server-client-5.7
- - python-mysqldb
- environment:
- DEBIAN_FRONTEND: noninteractive
- delegate_to: "{{ destination }}"
- # Start to secure MySQL
- - mysql_user:
- name: ''
- host_all: yes
- state: absent
- delegate_to: "{{ destination }}"
- - name: "create a mysql user with a random password"
- mysql_user:
- name: "{{ platform }}"
- password: "{{ lookup('password', '../../credentials/' + destination + '/' + platform + '_mysql_password chars=ascii_letters,digits') }}"
- priv: "*.*:ALL"
- state: present
- register: mysql_password
- delegate_to: "{{ destination }}"
- - debug:
- msg: "Successfully created MYSQL user {{ platform }} with password {{ mysql_password }}"
- delegate_to: "{{ destination }}"
- - name: "Update mysql root password for all root accounts"
- mysql_user: name=root host={{ item }} password={{ lookup('password', '../../credentials/' + destination + '/root_mysql_password chars=ascii_letters,digits') }}
- with_items:
- - "{{ inventory_hostname }}"
- - 127.0.0.1
- - ::1
- - localhost
- delegate_to: "{{ destination }}"
- - set_fact:
- mysql_root_password: "{{ lookup('file', '../../credentials/' + destination + '/' + 'root_mysql_password') }}"
- mysql_platform_username: "{{ platform }}"
- mysql_platform_password: "{{ lookup('file', '../../credentials/' + destination + '/' + platform + '_mysql_password') }}"
- url: "https://{{ inventory_hostname }} /"
- platform_admin_password: "{{ lookup('password', '../../credentials/' + destination + '/' + platform + '_admin_password chars=ascii_letters,digits') }}"
- domain: "{{ inventory_hostname }}"
- ip: "{{ ipify_public_ip }}"
- - name: "Copy .my.cnf file with root password credentials"
- template: src=../../templates/mysql/root.my.cnf.j2 dest=~/.my.cnf mode=0600
- delegate_to: "{{ destination }}"
- - name: "check if DB exists"
- shell: mysql --host=127.0.0.1 --user=root --password={{ mysql_root_password }} -e 'SHOW DATABASES;' | grep -c {{ platform }}
- register: dbstatus
- failed_when: dbstatus.rc == 2
- delegate_to: "{{ destination }}"
- - name: "Create database"
- mysql_db: name={{ platform }} collation=utf8mb4_unicode_ci state=present login_host=127.0.0.1 login_user=root login_password={{ mysql_root_password }}
- when: dbstatus.stdout == "0" and dump_and_restore_db == "true"
- delegate_to: "{{ destination }}"
- - name: "Extract db"
- command: "gunzip {{ vhost_path }}/var/latest.sql.gz"
- when: dump_and_restore_db == "true"
- delegate_to: "{{ destination }}"
- - name: "Import db into {{ platform }} from {{ vhost_path }}/var/latest.sql"
- mysql_db:
- state: import
- login_user: "{{ mysql_platform_username }}"
- login_password: "{{ mysql_platform_password }}"
- name: "{{ platform }}"
- target: "{{ vhost_path }}/var/latest.sql"
- async: 12000
- poll: 5
- when: dump_and_restore_db == "true"
- delegate_to: "{{ destination }}"
- - name: "Ensure group web exists"
- group:
- name: web
- state: present
- delegate_to: "{{ destination }}"
- - name: "Add the user 'web' a primary group of 'web'"
- user:
- name: web
- group: web
- delegate_to: "{{ destination }}"
- - name: "Configure varnish"
- copy:
- src: ../../templates/ubuntu/varnish/varnish.gpg
- dest: /tmp/varnish.gpg
- when: platform == "magento2"
- delegate_to: "{{ destination }}"
- - name: "Configure repo for varnish 5"
- apt_key:
- file: /tmp/varnish.gpg
- state: present
- when: platform == "magento2"
- delegate_to: "{{ destination }}"
- - name: "Configure varnish"
- copy:
- src: ../../templates/ubuntu/varnish/varnish-5-xenial.list
- dest: /etc/apt/sources.list.d/varnishcache_varnish5.list
- when: platform == "magento2"
- delegate_to: "{{ destination }}"
- - name: "Run the equivalent of apt-get update"
- apt:
- update_cache: yes
- when: platform == "magento2"
- delegate_to: "{{ destination }}"
- - name: "Install varnish 5.x"
- apt: pkg={{ item }} state=installed
- with_items:
- - ['varnish']
- when: platform == "magento2"
- delegate_to: "{{ destination }}"
- - name: "Install nginx"
- apt: pkg={{ item }} state=present
- with_items:
- - ['nginx']
- delegate_to: "{{ destination }}"
- - name: "Add ondrej/php ppp"
- command: add-apt-repository ppa:ondrej/php
- delegate_to: "{{ destination }}"
- - name: "Run the equivalent of apt-get update"
- apt:
- update_cache: yes
- delegate_to: "{{ destination }}"
- - name: "Install PHP 7.1 for Magento 2 / Shopware"
- apt: pkg={{ item }} state=present
- with_items:
- - ['php7.1','php7.1-fpm','php7.1-mysql','php7.1-soap','php7.1-opcache','php7.1-zip','php7.1-curl','php7.1-mcrypt','php7.1-mbstring','php7.1-zip', 'php7.1-dom','php7.1-gd','php7.1-intl', 'php7.1-redis']
- when: platform == "magento2" or platform == "shopware"
- delegate_to: "{{ destination }}"
- - name: "Install PHP 7.0 for Magento 1"
- apt: pkg={{ item }} state=present
- with_items:
- - ['php7.0','php7.0-fpm','php7.0-mysql','php7.0-soap','php7.0-opcache','php7.0-zip','php7.0-curl','php7.0-mcrypt','php7.0-mbstring','php7.0-zip', 'php7.0-dom','php7.0-gd','php7.0-intl', 'php7.0-redis']
- when: platform == "magento1" and php_version == "7.0"
- delegate_to: "{{ destination }}"
- - name: "Install PHP 5.6 for Magento 1"
- apt: pkg={{ item }} state=present
- with_items:
- - ['php5.6','php5.6-fpm','php5.6-mysql','php5.6-soap','php5.6-opcache','php5.6-zip','php5.6-curl','php5.6-mcrypt','php5.6-mbstring','php5.6-zip', 'php5.6-dom', 'php5.6-redis', 'php5.6-gd']
- when: platform == "magento1" and php_version == "5.6"
- delegate_to: "{{ destination }}"
- - name: "Install Redis"
- apt: pkg={{ item }} state=installed
- with_items:
- - ['redis-server']
- delegate_to: "{{ destination }}"
- - name: "get current db password from local.xml if m1 so we can search and replace it with the auto generated one"
- shell: "php {{ vhost_path }}/n98-magerun.phar --root-dir={{ vhost_path }} --skip-root-check db:info password"
- register: old_db_password_result
- when: platform == "magento1"
- delegate_to: "{{ destination }}"
- - set_fact: old_db_password={{ old_db_password_result.stdout }}
- when: platform == "magento1"
- - name: "Update local.xml (m1) with new auto generated mysql password"
- replace:
- path: "{{ vhost_path }}/app/etc/local.xml"
- regexp: "{{ old_db_password }}"
- replace: "{{ mysql_platform_password }}"
- backup: no
- when: platform == "magento1"
- delegate_to: "{{ destination }}"
- - name: "debug current db pass"
- debug: msg="current db pass is {{old_db_password}}"
- when: platform == "magento1"
- - name: "get current db username from local.xml if m1 so we can search and replace it with the auto generated one"
- shell: "php {{ vhost_path }}/n98-magerun.phar --root-dir={{ vhost_path }} --skip-root-check db:info username"
- register: old_db_username_result
- when: platform == "magento1"
- delegate_to: "{{ destination }}"
- - set_fact: old_db_username={{ old_db_username_result.stdout }}
- when: platform == "magento1"
- - name: "Update local.xml (m1) with new auto generated mysql username"
- replace:
- path: "{{ vhost_path }}/app/etc/local.xml"
- regexp: "{{ old_db_username }}"
- replace: "{{ platform }}_mysql_username "
- backup: no
- delegate_to: "{{ destination }}"
- when: platform == "magento1"
- - name: "debug current db username"
- debug: msg="current db pass is {{old_db_username}}"
- when: platform == "magento1"
- - name: "get current dbname from local.xml if m1 so we can search and replace it with the auto generated one"
- shell: "php {{ vhost_path }}/n98-magerun.phar --root-dir={{ vhost_path }} --skip-root-check db:info dbname"
- register: old_db_dbname_result
- delegate_to: "{{ destination }}"
- when: platform == "magento1"
- - set_fact: old_db_dbname={{ old_db_dbname_result.stdout }}
- when: platform == "magento1"
- - name: "Update local.xml (m1) with new auto generated mysql dbname"
- replace:
- path: "{{ vhost_path }}/app/etc/local.xml"
- regexp: "{{ old_db_dbname }}"
- replace: "{{ platform }}"
- backup: no
- delegate_to: "{{ destination }}"
- when: platform == "magento1"
- - name: "debug current db dbname"
- debug: msg="current db pass is {{old_db_dbname}}"
- when: platform == "magento1"
- - name: "Change PHP-FPM user (7.1)"
- replace:
- path: /etc/php/7.1/fpm/pool.d/www.conf
- regexp: 'www-data'
- replace: 'web'
- backup: yes
- when: platform == "magento2" or platform == "shopware"
- delegate_to: "{{ destination }}"
- - name: "Change PHP-FPM user (5.6)"
- replace:
- path: /etc/php/5.6/fpm/pool.d/www.conf
- regexp: 'www-data'
- replace: 'web'
- backup: yes
- when: platform == "magento1" and php_version == "5.6"
- delegate_to: "{{ destination }}"
- - name: "Change PHP-FPM user (7.0)"
- replace:
- path: /etc/php/7.0/fpm/pool.d/www.conf
- regexp: 'www-data'
- replace: 'web'
- backup: yes
- when: platform == "magento1" and php_version == "7.0"
- delegate_to: "{{ destination }}"
- - name: "chown the current run files for php"
- command: bash -lc "{{ item }}"
- with_items:
- - "chown -R web:web /run/php/*"
- delegate_to: "{{ destination }}"
- - name: restart php7.1-fpm
- service: name=php7.1-fpm state=restarted
- when: platform == "magento2" or platform == "shopware"
- delegate_to: "{{ destination }}"
- - name: restart php7.0-fpm
- service: name=php7.0-fpm state=restarted
- when: platform == "magento1" and php_version == "7.0"
- delegate_to: "{{ destination }}"
- - name: restart php5.6-fpm
- service: name=php5.6-fpm state=restarted
- when: platform == "magento1" and php_version == "5.6"
- delegate_to: "{{ destination }}"
- - name: "Change nginx user to web"
- replace:
- path: /etc/nginx/nginx.conf
- regexp: 'www-data'
- replace: 'web'
- backup: yes
- delegate_to: "{{ destination }}"
- - debug:
- msg: "Creating DNS A Record: {{ destination }} => {{ ipify_public_ip }}"
- - cloudflare_dns:
- zone: corefinity.com
- record: "{{ destination }}"
- type: A
- value: "{{ ipify_public_ip }}"
- account_email: "{{ cloudflare_email }}"
- account_api_token: "{{ cloudflare_token }}"
- - name: "Install latest version of composer"
- command: bash -lc "{{ item }}"
- with_items:
- - "curl -sS https://getcomposer.org/installer -o composer-setup.php"
- - "sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer"
- delegate_to: "{{ destination }}"
- - name: "Setting up the composer config directory"
- file: path="/root/.config/composer/" state=directory
- delegate_to: "{{ destination }}"
- - name: "Copy composer auth file"
- copy:
- src: ../../templates/platforms/shared/composer/auth.json
- dest: /root/.composer/auth.json
- owner: web
- group: web
- when: platform == "magento2"
- delegate_to: "{{ destination }}"
- - name: "Setting up the htdocs root"
- file: path="{{ vhost_path }}/var/composer_home/" state=directory
- when: platform == "magento2"
- delegate_to: "{{ destination }}"
- - name: stop nginx
- service: name=nginx state=stopped
- delegate_to: "{{ destination }}"
- - name: "Ensure log directory for nginx exists"
- file: path="/var/log/nginx/{{ destination }}/" state=directory
- delegate_to: "{{ destination }}"
- - name: "Get SSL certificate using certbot"
- command: bash -lc "{{ item }}"
- with_items:
- - "rm -rf /etc/letsencrypt/archive/{{ destination }}"
- - "rm -rf /etc/letsencrypt/live/{{ destination }}"
- - "rm -rf /etc/letsencrypt/renewal/{{ destination }}.conf"
- - "rm -rf /etc/letsencrypt/archive/{{ inventory_hostname }}"
- - "rm -rf /etc/letsencrypt/live/{{ inventory_hostname }}"
- - "rm -rf /etc/letsencrypt/renewal/{{ inventory_hostname }}.conf"
- - "openssl dhparam -out /etc/nginx/dhparam.pem 2048"
- - "letsencrypt certonly --standalone -d {{ destination }} --email support@corefinity.com --agree-tos"
- - "letsencrypt certonly --standalone -d {{ inventory_hostname }} --email support@corefinity.com --agree-tos"
- when: generate_ssl == "true"
- delegate_to: "{{ destination }}"
- - name: "Delete default nginx vhost"
- file:
- state: absent
- path: "/etc/nginx/sites-enabled/default"
- delegate_to: "{{ destination }}"
- - name: "Setting up the htdocs generated folder (m2)"
- file: path="{{ vhost_path }}/generated" state=directory
- delegate_to: "{{ destination }}"
- when: platform == "magento2"
- - name: "Set permissions on the vhost/var folder folder"
- command: bash -lc "{{ item }}"
- delegate_to: "{{ destination }}"
- with_items:
- - "chmod -R 777 {{ vhost_path }}/var/"
- - name: "Copy nginx config from original server ({{ inventory_hostname}}) to destination host ({{ destination }})"
- command: "rsync -aHAXxv --numeric-ids --delete --progress -e 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -T -c aes128-gcm@openssh.com -o Compression=no -x' /etc/nginx/ root@{{ destination }}:/etc/nginx/"
- - name: "Remove any instances of real_ip_header from nginx config files"
- command: bash -lc "sed -ir '/real_ip_header/d' /etc/nginx/conf.d/*.conf"
- delegate_to: "{{ destination }}"
- - name: "Update the ip address from ({{ ansible_all_ipv4_addresses }}) to ({{ ipify_public_ip }})"
- replace:
- path: "{{ item }}"
- regexp: "{{ ansible_all_ipv4_addresses }}"
- replace: "{{ ipify_public_ip }}"
- backup: no
- with_fileglob:
- - "/etc/nginx/conf.d/*.conf"
- delegate_to: "{{ destination }}"
- - name: "Transfer letsencrypt certificates from original server ({{ inventory_hostname}}) to destination host ({{ destination }})"
- command: "rsync -aHAXxv --numeric-ids --delete --progress -e 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -T -c aes128-gcm@openssh.com -o Compression=no -x' /etc/letsencrypt/ root@{{ destination }}:/etc/letsencrypt/"
- when: transfer_certificates == "true"
- - name: "Remove more_set_headers in nginx config"
- command: bash -lc "sed -ir '/more_set_headers/d' /etc/nginx/nginx.conf"
- delegate_to: "{{ destination }}"
- - name: "Create directory for to stop nginx failing"
- file: path=/var/log/nginx/aspinline.co.uk/ state=directory
- delegate_to: "{{ destination }}"
- - name: "remove old IP in nginx config"
- command: bash -lc "sed -i -e 's/"{{ ansible_all_ipv4_addresses[0] }}"/"{{ ipify_public_ip }}"/g' /etc/nginx/conf.d/aspinline.co.uk.conf"
- delegate_to: "{{ destination }}"
- - name: "rm contents of var/cache"
- command: bash -lc "/bin/rm -rf /var/www/vhosts/aspinline.co.uk/htdocs/var/cache/*"
- delegate_to: "{{ destination }}"
- - name: "update url in DB"
- shell: /usr/bin/mysql -u magento1 -p{{ mysql_platform_password }} magento1 -e 'update core_config_data set value = "https://{{ destination }}/" where config_id = 6 or config_id = 7'
- delegate_to: "{{ destination }}"
- - name: "Flush cache "
- command: "/var/www/vhosts/aspinline.co.uk/htdocs/n98-magerun.phar --root-dir={{vhost_path}} cache:flush"
- delegate_to: "{{ destination }}"
- - name: "Update old url with new hostname"
- command: bash -lc "sed -i -e 's/{{old_url}}/{{ destination }}/g' /etc/nginx/conf.d/*.conf"
- delegate_to: "{{ destination }}"
- - name: "Move ssl.includes file from old to new"
- command: bash -lc "mv /etc/nginx/conf.d/aspinline.co.uk.ssl.includes /etc/nginx/conf.d/m1.aspinline.co.uk.cfstack.com.ssl.includes"
- delegate_to: "{{ destination }}"
- - name: "Move htdocs root to new location"
- command: bash -lc "{{ item }}"
- with_items:
- - "rm -rf /var/www/vhosts/m1.aspinline.co.uk.cfstack.com/htdocs"
- - "mkdir -p /var/www/vhosts/m1.aspinline.co.uk.cfstack.com/htdocs"
- - "mv /var/www/vhosts/aspinline.co.uk/htdocs /var/www/vhosts/m1.aspinline.co.uk.cfstack.com/"
- delegate_to: "{{ destination }}"
- - name: "restart nginx"
- delegate_to: "{{ destination }}"
- service: name=nginx state=restarted
- - command: bash -lc "{{ item }}"
- delegate_to: "{{ destination }}"
- with_items:
- - "chown -R web:web /var/www/vhosts "
- - "systemctl daemon-reload"
- - name: "Configure varnish"
- copy:
- src: ../../templates/platforms/magento2/varnish/default.vcl
- dest: /etc/varnish/default.vcl
- delegate_to: "{{ destination }}"
- when: platform == "magento2"
- - name: "Change the varnish ports"
- replace:
- path: /lib/systemd/system/varnish.service
- regexp: '6081'
- replace: '80'
- backup: no
- delegate_to: "{{ destination }}"
- when: platform == "magento2"
- - command: bash -lc "{{ item }}"
- with_items:
- - "systemctl daemon-reload"
- delegate_to: "{{ destination }}"
- - name: restart varnish
- service: name=varnish state=restarted
- delegate_to: "{{ destination }}"
- when: platform == "magento2"
- - name: "Update all packages to the latest version"
- apt:
- update_cache: yes
- upgrade: dist
- delegate_to: "{{ destination }}"
- - debug:
- msg: "Successfully installed {{ platform }}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement