Commit 6e003a1d authored by Dan Thomson's avatar Dan Thomson

Initial commit - plone installer

parent ff382fbc
Pipeline #2587 canceled with stage
image: alpine:3.7
cache:
key: ${CI_COMMIT_REF_SLUG}
stages:
- test
variables:
SECRETS_FILE: secrets.yml
ADMIN_PASSWORD: admin-abc123
centos7_test_install:
stage: test
image: centos:centos7
before_script:
- |
yum -y update && yum -y install ansible
mkdir -p tests/roles
ln -s $(pwd) tests/roles/plone
echo "plone_admin_password: ${ADMIN_PASSWORD}" > tests/$SECRETS_FILE
echo "localhost" > tests/inventory
after_script:
- rm -f $SECRETS_FILE
- rm -rf tests/roles
script:
- |
# Basic role syntax check
ansible-playbook --inventory tests/inventory --connection local --list-hosts --extra-vars @${SECRETS_FILE} --extra-vars plone_instance_name=testplone --extra-vars plone_install_method=standalone tests/test-playbook.yml
ansible-playbook --inventory tests/inventory --connection local --syntax-check --extra-vars @${SECRETS_FILE} --extra-vars plone_instance_name=testplone --extra-vars plone_install_method=standalone tests/test-playbook.yml
# Run the first time
ansible-playbook --inventory tests/inventory --connection local --extra-vars @${SECRETS_FILE} --extra-vars plone_instance_name=testplone --extra-vars plone_install_method=standalone tests/test-playbook.yml
- >
ansible-playbook --inventory tests/inventory --connection local --extra-vars @${SECRETS_FILE} --extra-vars plone_instance_name=testplone --extra-vars plone_install_method=standalone tests/test-playbook.yml
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
plone_version: 5.1.2
plone_install_method: null
plone_install_path: "/opt/plone/{{ plone_version }}"
plone_instance_name: null
plone_var_path: "{{ install_path }}/{{ instance_name }}/var"
plone_admin_password: abc123
plone_user: plone
plone_group: plone
plone_port: 8080
plone_zeo_address: 127.0.0.1:8100
---
galaxy_info:
author: Dan Thomson
description: Ansible Role for Installing Plone
company: TRIUMF
min_ansible_version: 2.0
platforms:
- name: CentOS
versions:
- 7
dependencies: []
- name: Install Software Collections Repo
yum:
name: scl-utils centos-release-scl-rh
state: latest
become: yes
- name: Install dependency packages
yum:
name: "{{ package }}"
state: latest
with_items: "{{ packages }}"
loop_control:
loop_var: package
become: yes
- name: Enable python27 from scl
command: scl enable python27 bash
become: yes
- name: Load {{ ansible_distribution }} {{ ansible_distribution_major_version }} variables
include_vars: "{{ file | basename }}" # This include_vars module is kind of dumb, so we need to test the full path but only include basename
with_first_found:
- files:
- "{{ role_path }}/vars/{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version }}.yml"
- "{{ role_path }}/vars/{{ ansible_distribution | lower }}.yml"
- "{{ role_path }}/vars/{{ ansible_os_family | lower }}.yml"
- "{{ role_path }}/vars/default.yml"
skip: true
loop_control:
loop_var: file
- name: Load {{ ansible_distribution }} {{ ansible_distribution_major_version }} dependencies
include_tasks: "{{ file }}"
with_first_found:
- files:
- "tasks/{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version }}-dependencies.yml"
- "tasks/{{ ansible_distribution | lower }}-dependencies.yml"
- "tasks/{{ ansible_os_family | lower }}-dependencies.yml"
- "tasks/default-dependencies.yml"
skip: true
loop_control:
loop_var: file
- name: Download the Plone installer
block:
- name: Create tmpdir for Plone
tempfile:
state: directory
register: tmpdir
https://launchpad.net/plone/5.1/5.1.2/+download/Plone-5.1.2-UnifiedInstaller.tgz
- name: Extract Plone installer into tmpdir
unarchive:
src: "https://launchpad.net/plone/{{ plone_version | regex_replace('(\d+)\.(\d+)\.\(\d+)$', '\1.\2') }}/{{ plone_version }}/+download/Plone-{{ plone_version }}-UnifiedInstaller.tgz"
dest: "{{ tmpdir.path }}"
remote_src: yes
- name: Run the Plone installer
command: ./install.sh --target={{ plone_install_path }} --instance={{ plone_instance_name }} --var={{ plone_var_path }} --password={{ plone_admin_password }} --owner={{ plone_user }} --group={{ plone_group }} --with-python=/usr/bin/python {% if plone_install_method == 'standalone' %}standalone{% elif plone_install_method == 'zeo' %}zeo{% elif plone_install_method == 'none' %}none{% endif %}
args:
chdir: "{{ tmpdir.path }}"
become: yes
always:
- name: Cleanup tmpdir
file:
path: "{{ tmpdir.path }}"
state: absent
become: yes
- name: Update the plone port in buildout.cfg
lineinfile:
path: "{{ plone_install_path }}/{{ instance_name }}/buildout.cfg"
regexp: '^\s*http-address\s*=\s*'
line: "http-address = {{ plone_port }}"
register: port_update
become: yes
- name: Rerun buildout
command: "{{ plone_install_path }}/{{ instance_name }}/bin/buildout"
when: port_update.changed
become: yes
packages:
- bzip2
- gcc
- git
- openssl-devel
- libjpeg-turbo-devel
- libxml2-devel
- libxslt-devel
- make
- patch
- poppler-devel
- poppler-utils
- python27-devel
- python-setuptools
- sudo
- which
- zlib-devel
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment