mirror of
https://bitbucket.org/atlassian/dc-deployments-automation.git
synced 2025-12-13 00:13:09 -06:00
201 lines
7.4 KiB
YAML
201 lines
7.4 KiB
YAML
---
|
|
|
|
- name: Create server config
|
|
ansible.builtin.template:
|
|
src: server.xml.j2
|
|
dest: "{{ atl_product_installation_versioned }}/apache-tomcat/conf/server.xml"
|
|
|
|
- name: Set the minimum heap size (Xms)
|
|
ansible.builtin.lineinfile:
|
|
path: "{{ atl_product_installation_versioned }}/apache-tomcat/bin/setenv.sh"
|
|
regexp: '^(.*)Xms(\d+\w)(\s.*)$'
|
|
line: '\1Xms{{ atl_jvm_heap }}\3'
|
|
backrefs: yes
|
|
|
|
- name: Set the maxmimum heap size (Xmx)
|
|
ansible.builtin.lineinfile:
|
|
path: "{{ atl_product_installation_versioned }}/apache-tomcat/bin/setenv.sh"
|
|
regexp: '^(.*)Xmx(\d+\w)(\s.*)$'
|
|
line: '\1Xmx{{ atl_jvm_heap }}\3'
|
|
backrefs: yes
|
|
|
|
- name: Set Crowd home directory in crowd-init.properties file
|
|
ansible.builtin.lineinfile:
|
|
path: "{{ atl_product_installation_versioned }}/crowd-webapp/WEB-INF/classes/crowd-init.properties"
|
|
line: 'crowd.home={{ atl_product_home }}'
|
|
|
|
- name: Export CATALINA_OPTS in setenv.sh
|
|
ansible.builtin.lineinfile:
|
|
path: '{{ atl_product_installation_versioned }}/apache-tomcat/bin/setenv.sh'
|
|
line: 'export CATALINA_OPTS'
|
|
|
|
- name: CATALINA_OPTS to list
|
|
ansible.builtin.set_fact:
|
|
catalina_ops_list: "{{ catalina_ops_list | default([]) + (item | trim | regex_replace('^-')).split(' -') }}"
|
|
loop:
|
|
- '{{ atl_catalina_opts }}'
|
|
- '{{ atl_catalina_opts_extra }}'
|
|
|
|
- name: CATALINA_OPTS unique and sorted
|
|
ansible.builtin.set_fact:
|
|
catalina_opts: "{{ query('flattened', catalina_ops_list) | reject('equalto', '') | unique | sort }}"
|
|
|
|
- name: Set CATALINA_OPTS in setenv.sh
|
|
ansible.builtin.blockinfile:
|
|
block: "{{ lookup('template', 'templates/catalina_opts.j2') }}"
|
|
path: "{{ atl_product_installation_versioned }}/apache-tomcat/bin/setenv.sh"
|
|
insertbefore: "^export CATALINA_OPTS$"
|
|
marker: "# {mark} ANSIBLE MANAGED CATALINA_OPTS"
|
|
|
|
- name: Set JAVA_HOME
|
|
ansible.builtin.lineinfile:
|
|
path: "{{ atl_product_installation_versioned }}/apache-tomcat/bin/setenv.sh"
|
|
insertafter: "EOF"
|
|
line: "export JAVA_HOME={{ atl_java_home }}"
|
|
|
|
- name: Create application directories
|
|
ansible.builtin.file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
mode: 0750
|
|
owner: "{{ atl_product_user }}"
|
|
group: "{{ atl_product_user }}"
|
|
with_items:
|
|
- "{{ atl_product_home }}"
|
|
- "{{ atl_product_home_shared }}"
|
|
- "{{ atl_product_shared_plugins }}"
|
|
changed_when: false # For Molecule idempotence check
|
|
|
|
- name: Limit permissions on the installer temp directory, recursively
|
|
ansible.builtin.file:
|
|
path: "{{ atl_installer_temp }}"
|
|
owner: "root"
|
|
group: "root"
|
|
mode: "u=rwX,g=rX,o=rX"
|
|
recurse: true
|
|
changed_when: false # For Molecule idempotence check
|
|
|
|
- name: Limit permissions on the installation directory, non-recursively
|
|
ansible.builtin.file:
|
|
path: "{{ atl_product_installation_versioned }}"
|
|
owner: "root"
|
|
group: "root"
|
|
mode: "u=rwX,g=rX,o=rX"
|
|
changed_when: false # For Molecule idempotence check
|
|
|
|
- name: Find top-level files/directories in installation directory, excluding tomcat
|
|
ansible.builtin.find:
|
|
paths: "{{ atl_product_installation_versioned }}"
|
|
depth: 1
|
|
file_type: any
|
|
excludes: apache-tomcat
|
|
register: atl_product_installation_versioned_file_list
|
|
|
|
- name: Find top-level files/directories in tomcat directory, excluding working directories
|
|
ansible.builtin.find:
|
|
paths: "{{ atl_product_installation_versioned }}/apache-tomcat"
|
|
depth: 1
|
|
file_type: any
|
|
excludes: logs,temp,work
|
|
register: atl_product_installation_versioned_tomcat_file_list
|
|
|
|
- name: Limit permissions on files and directories in the installation and tomcat directories, recursively, excluding working directories
|
|
ansible.builtin.file:
|
|
path: "{{ item.path }}"
|
|
owner: "root"
|
|
group: "root"
|
|
mode: "u=rwX,g=rX,o=rX"
|
|
recurse: "{{ item.isdir }}"
|
|
loop: "{{ atl_product_installation_versioned_file_list.files + atl_product_installation_versioned_tomcat_file_list.files }}"
|
|
changed_when: false # For Molecule idempotence check
|
|
|
|
- name: Grant access to the product working directories
|
|
ansible.builtin.file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
mode: "u=rwX,g=rX,o-rwx"
|
|
owner: "{{ atl_product_user }}"
|
|
group: "{{ atl_product_user }}"
|
|
recurse: true
|
|
with_items:
|
|
- "{{ atl_product_installation_versioned }}/apache-tomcat/logs"
|
|
- "{{ atl_product_installation_versioned }}/apache-tomcat/temp"
|
|
- "{{ atl_product_installation_versioned }}/apache-tomcat/work"
|
|
changed_when: false # For Molecule idempotence check
|
|
|
|
- name: Create conf/Catalina directory owned by product so catalina.out logging works
|
|
ansible.builtin.file:
|
|
path: "{{ atl_product_installation_versioned }}/conf/Catalina"
|
|
state: directory
|
|
mode: "u=rwX,g=rX,o-rwx"
|
|
owner: "{{ atl_product_user }}"
|
|
group: "{{ atl_product_user }}"
|
|
changed_when: false # For Molecule idempotence check
|
|
|
|
- name: Symlink Crowd shared home directory
|
|
ansible.builtin.file:
|
|
src: "{{ atl_product_home_shared }}"
|
|
dest: "{{ atl_product_home }}/shared"
|
|
state: link
|
|
owner: "{{ atl_product_user }}"
|
|
group: "{{ atl_product_user }}"
|
|
changed_when: false # For Molecule idempotence check
|
|
|
|
- name: Assert baseurl to same as atl_proxy_name
|
|
community.postgresql.postgresql_query:
|
|
login_host: "{{ atl_db_host }}"
|
|
login_user: "{{ atl_jdbc_user }}"
|
|
login_password: "{{ atl_jdbc_password }}"
|
|
db: "{{ atl_jdbc_db_name }}"
|
|
query: >
|
|
update cwd_property set property_value=%s
|
|
where property_name = 'base.url'
|
|
positional_args:
|
|
- "{{ atl_tomcat_scheme }}://{{ atl_proxy_name }}{{ atl_tomcat_contextpath }}"
|
|
when:
|
|
- atl_proxy_name is defined
|
|
- atl_tomcat_scheme is defined
|
|
- db_created is undefined or not db_created.changed
|
|
tags:
|
|
- skip_on_stack_update
|
|
ignore_errors: yes # For Molecule as it has no db test framework included
|
|
|
|
- name: Check that crowd.cfg.xml exists
|
|
ansible.builtin.stat:
|
|
path: "{{ atl_product_home_shared }}/crowd.cfg.xml"
|
|
register: crowd_cfg_stat_result
|
|
|
|
- block:
|
|
- name: Assert JDBC password to same as atl_jdbc_password
|
|
community.general.xml:
|
|
path: "{{ atl_product_home_shared }}/crowd.cfg.xml"
|
|
xpath: "/application-configuration/properties/property[@name='hibernate.connection.password']"
|
|
value: "{{ atl_jdbc_password }}"
|
|
|
|
- name: Assert JDBC url to same as atl_jdbc_url
|
|
community.general.xml:
|
|
path: "{{ atl_product_home_shared }}/crowd.cfg.xml"
|
|
xpath: "/application-configuration/properties/property[@name='hibernate.connection.url']"
|
|
value: "{{ atl_jdbc_url }}?reWriteBatchedInserts=true"
|
|
|
|
- name: Assert hibernate.c3p0.max_size to same as atl_db_poolmaxsize
|
|
community.general.xml:
|
|
path: "{{ atl_product_home_shared }}/crowd.cfg.xml"
|
|
xpath: "/application-configuration/properties/property[@name='hibernate.c3p0.max_size']"
|
|
value: "{{ atl_db_poolmaxsize }}"
|
|
when: atl_db_poolmaxsize is defined
|
|
|
|
- name: Assert hibernate.c3p0.min_size to same as atl_db_poolminsize
|
|
community.general.xml:
|
|
path: "{{ atl_product_home_shared }}/crowd.cfg.xml"
|
|
xpath: "/application-configuration/properties/property[@name='hibernate.c3p0.min_size']"
|
|
value: "{{ atl_db_poolminsize }}"
|
|
when: atl_db_poolminsize is defined
|
|
|
|
when: crowd_cfg_stat_result.stat.exists
|
|
|
|
- name: Remove crowd.xml to prevent duplicates from appearing in cluster reporting
|
|
ansible.builtin.file:
|
|
path: "{{ atl_product_installation_versioned }}/apache-tomcat/conf/Catalina/localhost/crowd.xml"
|
|
state: absent
|