fede2cr.alfresco52
alfresco_ansible 
Ansible Recipes for Alfresco
Description
Recipes for:
- Automatic installation and update of Alfresco 5.2
- Automatic installation of Alfresco 6.1 (in progress)
Usage
The Ansible role for Alfresco is designed so that tasks are divided into tags. This allows you to choose which parts you want to run in a single sequential execution, so the same role can install Alfresco on a new machine or update to the version specified in the inventory.
Installation from Scratch
Requirements for Ansible
On a physical or virtual machine with Ubuntu 18.04, ensure you have enough space for installing Alfresco and backing up its data. First, enable the SSH service, copy an SSH key to the user that will connect, and grant sudo permission by creating the /etc/sudoers.d/ansible
file with the appropriate user:
%sudo ALL=(ALL) NOPASSWD: ALL
Defaults:greencore !requiretty
Next, install some necessary packages for the initial connection, including distribution and Python packages:
# Ubuntu Packages
sudo apt install -y python3-minimal python3-pip
# For MySQL
sudo apt install -y python3-pymysql
# For PostgreSQL
sudo apt install -y python3-psycopg2 libpq-dev postgresql libpostgresql-jdbc-java
# Python Packages
sudo pip3 install ansible psutil # You can skip "ansible" on the remote machine; it's only needed on the controller
Inventory Configuration
You only need to edit one file, the inventory, where you will define the server's IP address for the Alfresco installation or update, and specify the parameters used for Alfresco configuration.
For example, in inventory/hosts.yml
:
---
alfresco:
hosts:
10.xx.xx.xx: # Change to your Alfresco server IP
ansible_user: greencore # SSH user to use
alfresco_installer: alfresco-community-installer-201707-linux-x64.bin # Specify the installer version, uncomment if used
# old version
#alfresco_installer: alfresco-community-installer-201602-linux-x64.bin
alf_glob_prop_path: /opt/alfresco_community/tomcat/shared/classes/alfresco-global.properties # Path to alfresco-global.properties
alf_root: /opt/alfresco_community/ # Alfresco root directory
dir_root: /opt/alfresco_community/alf_data # alf_data directory
solr4_root: /opt/alfresco_community/alf_data/solr4/index # Solr directory
installer_delay: 190 # Time to wait for installer to complete
Before continuing, check the inventory and run ansible in general by executing:
ansible -i inventory/hosts.yml -m ping alfresco
10.xx.xx.xx | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": false,
"ping": "pong"
}
To check the availability of configuration files, download files, necessary Python modules for Ansible, etc., run ansible in dry-run mode, which means it will not make any changes.
ansible-playbook -C -i inventory/hosts.yml install_alfresco52-mysql_no_docker.yml --tags install,mysql_install,mysql
If no issues are detected, you can run the installation of Alfresco without the -C
option:
ansible-playbook -i inventory/hosts.yml install_alfresco52-mysql_no_docker.yml --tags install,mysql_install,mysql
Updating Alfresco
Before starting, it's recommended to check the machine's services before updating, follow change request protocols, use test machines, and always back up production systems.
If you are performing the complete lab for installation and update, you might need to change the version of Alfresco to be installed as per the inventory file.
In this case, additional tags mysql_preupgrade and mysql_postupgrade are responsible for backing up data, moving the Alfresco directory, and re-importing the data in MySQL as well as the dir.root for the update.
ansible-playbook -i inventory/hosts.yml install_alfresco52-mysql_no_docker.yml --tags install,mysql_preupgrade,mysql,mysql_postupgrade
Finally, check the service to ensure that the content is in place, and review the log files for any potential error messages.
Troubleshooting
If something fails, for example, if the installer timeout is too low, you can continue after that task using this command as a base:
ansible-playbook -i inventory playbook.yml --tags a,b,c --start-at-task="Full task name"
ansible-galaxy install fede2cr.alfresco52