Commit dd5c1ff7 authored by Dan Thomson's avatar Dan Thomson

[#1] Fail when required values aren't set.

parent 6906f4e8
Pipeline #2605 failed with stage
in 55 seconds
- name: Make sure plone_instance_name is set!
fail:
msg: "'plone_instance_name' isn't set!"
when: plone_instance_name is None
- name: Make sure plone_install_method is set!
fail:
msg: "'plone_install_method' isn't set!"
when: plone_install_method is None
- 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: Look for the destination path
stat:
path: "{{ plone_install_path }}/{{ plone_instance_name }}"
register: plone_stat
- name: Download the Plone installer
when: plone_stat.stat.exists == False
block:
- name: Create tmpdir for Plone
tempfile:
state: directory
register: tmpdir
- 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: Create plone destination path since the installer can't figure it out
file:
path: "{{ plone_install_path }}"
state: directory
owner: root
group: root
mode: 0755
become: 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 }} --build-python {% if plone_install_method == "standalone" %}standalone{% elif plone_install_method == "zeo" %}zeo{% elif plone_install_method == "none" %}none{% endif %}
args:
chdir: "{{ tmpdir.path }}/Plone-{{ plone_version }}-UnifiedInstaller"
register: install_command
failed_when: '"aborting install" in install_command.stdout'
become: yes
- name: Look for the destination path
stat:
path: "{{ plone_install_path }}/{{ plone_instance_name }}"
register: plone_stat_new
- name: Die if plone wasn't installed (the install script will "succeed" even when it fails)
fail:
msg: "Nothing found at the installation destination path"
when: plone_stat_new and plone_stat_new.stat.exists == False
always:
- name: Fix plone directory ownership
file:
path: "{{ plone_install_path }}"
state: directory
owner: "{{ plone_user }}"
group: "{{ plone_group }}"
mode: 0755
- name: Cleanup tmpdir
file:
path: "{{ tmpdir.path }}"
state: absent
when: debug == False
become: yes
- name: Update the plone port in buildout.cfg
lineinfile:
path: "{{ plone_install_path }}/{{ plone_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 }}/{{ plone_instance_name }}/bin/buildout -c {{ plone_install_path }}/{{ plone_instance_name }}/buildout.cfg"
when: port_update.changed
become: yes
become_user: "{{ plone_user }}"
- 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:
......
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