votum.magento2
Ansible Role: votum.magento2
This is an Ansible role designed to install the Magento2 e-commerce system.
Requirements
You need to have the Magerun2 command-line tool installed on the server where you are setting up Magento2. You can find the installation instructions here.
Role Variables
Here are the available variables along with their default values (also found in defaults/main.yml
):
magento2_instance_name: "magento2"
This is the name used mainly for cronjobs. It’s helpful if you plan to install multiple Magento instances on the same server.
magento2_version_to_install: "magento-ce-2.0.7"
This is the version of Magento you want to install. You can choose from various versions available.
magento2_install_path: "/var/www"
This is the installation directory for Magento. Note that this should not be the web root for your virtual host; the virtual host should point to
{{magento2_install_path}}/pub
.magento2_magerun_bin_path: "/usr/local/bin/n98-magerun2.phar"
This is the path to the Magerun2 tool. The installation depends on it. For more details, check the Magerun2 website.
magento2_install_sample_data: true
This determines if sample data will be installed. The default is true.
magento2_enable_crons: true
This sets whether to enable Magento2 cron jobs. Default is true.
magento2_auth_public_key and magento2_auth_private_key: "xxxxxxxxxxxxxxxxxxxxxx"
To install Magento2 via Composer, you need a developer account with Magento and your public/private keys.
Database Configuration:
- magento2_db_host: "127.0.0.1"
- magento2_db_name: "magento2"
- magento2_db_user: "root"
- magento2_db_password: ""
- magento2_db_prefix: ""
These variables are for setting up the database connection.
Localization and Settings:
- magento2_language: "en_US"
- magento2_currency: "USD"
- magento2_timezone: "Europe/Berlin"
These are additional settings for the installation.
Admin Account Details:
- magento2_admin_firstname: "John"
- magento2_admin_lastname: "Doe"
- magento2_admin_email: "mageadmin@example.com"
- magento2_admin_user: "admin"
- magento2_admin_password: "admin123"
This is for the admin login details.
Admin URL Path:
- magento2_backend_frontname: "admin"
This is the URL path to access the admin backend.
Base URLs:
- magento2_base_url: "{{ '{{base_url}}' }}"
- magento2_base_url_secure: ""
These are the base URLs for Magento. They must include protocols and trailing slashes.
Security and Session Settings:
- magento2_use_rewrites: "1"
- magento2_use_secure: "1"
- magento2_use_secure_admin: "1"
- magento2_use_security_key: "1"
- magento2_session_save: "files"
These settings manage security and session handling.
Others:
magento2_cleanup_database: "1"
This ensures the database is cleaned up before installation.
magento2_key: ""
If you have an encryption key, specify it here. Otherwise, Magento2 will generate one for you.
magento2_sales_order_increment_prefix: ""
You can set a prefix for sales order numbers here.
Dependencies
None.
Example Playbook
Here’s an example of how to use this role in an Ansible playbook:
---
- name: Setup demo installation of Magento2
hosts: app
vars_files:
- group_vars/main.yml
- group_vars/magento2-ce20-demo.yml
pre_tasks: []
roles:
- { role: votum.magerun2 }
- { role: votum.magento2, ansible_become: yes, ansible_become_user: www-data }
post_tasks: []
License
MIT
Author Information
Copyright VOTUM GmbH (info@votum.de)