diff --git a/.travis.lxd.yml b/.travis.lxd.yml new file mode 100644 index 0000000..d47d471 --- /dev/null +++ b/.travis.lxd.yml @@ -0,0 +1,47 @@ +--- +config: + images.auto_update_interval: 6 + +networks: + - name: lxdbr0 + type: bridge + config: + ipv4.address: auto + ipv6.address: none + +storage_pools: + - name: default + driver: dir + config: + source: /var/snap/lxd/common/lxd/storage-pools/default + +profiles: + - name: default + config: + boot.autostart: "true" + security.nesting: "true" + security.privileged: "true" + linux.kernel_modules: ip_tables,ip6_tables,netlink_diag,nf_nat,overlay + raw.lxc: | + lxc.apparmor.profile = unconfined + lxc.cap.drop = + lxc.cgroup.devices.allow = a + lxc.mount.auto = proc:rw sys:rw cgroup:rw + devices: + aadisable: + path: /sys/module/nf_conntrack/parameters/hashsize + source: /dev/null + type: disk + aadisable1: + path: /sys/module/apparmor/parameters/enabled + source: /dev/null + type: disk + root: + path: / + pool: default + type: disk + eth0: + name: eth0 + nictype: bridged + parent: lxdbr0 + type: nic diff --git a/.travis.yml b/.travis.yml index bbdecd6..26cfb87 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,46 +1,30 @@ --- -sudo: required - -dist: trusty +dist: xenial language: python -python: - - 2.7 - -services: - - docker - env: - global: - - ANSIBLE_FORCE_COLOR: true - - ANSIBLE_LOG_PATH: './ansible.log' - - ANSIBLE_ROLES_PATH: '../' matrix: - - DOCKER_IMAGE: 'ubuntu:14.04' - - DOCKER_IMAGE: 'ubuntu:16.04' - - DOCKER_IMAGE: 'ubuntu:17.10' - - DOCKER_IMAGE: 'ubuntu:18.04' - - DOCKER_IMAGE: 'centos:6' - - DOCKER_IMAGE: 'centos/systemd:latest' + - LXC_IMAGE: 'images:ubuntu/16.04' + - LXC_IMAGE: 'images:ubuntu/18.04' + - LXC_IMAGE: 'images:centos/6' + - LXC_IMAGE: 'images:centos/7' before_install: - - pip install --upgrade git+git://github.com/ansible/ansible.git@stable-2.4 - - pip install --upgrade docker docker-compose - - docker pull $DOCKER_IMAGE - - DOCKER_ID="$(docker run -itd --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /sys/fs/cgroup:/sys/fs/cgroup:ro --tmpfs /run --tmpfs /run/lock $DOCKER_IMAGE | head -c12)" + - sudo apt-get -y purge lxc-* lxd-* && sudo apt-get -y autoremove + - sudo snap install lxd && sudo lxd init --preseed < .travis.lxd.yml + - sudo apt-get -y purge python-openssl && sudo apt-get -y autoremove + - sudo -H pip install --upgrade --requirement requirements.txt install: - - pip install -r ansible-requirements.txt - - ansible-galaxy install -r requirements.yml + - export ROLE=$(echo $TRAVIS_REPO_SLUG | sed 's/^.*\/ansible-role-/\//g') + - mkdir -p $HOME/.ansible/roles + - ln -s $TRAVIS_BUILD_DIR $HOME/.ansible/roles/$ROLE + - ansible-galaxy install --roles-path $HOME/.ansible/roles --role-file ansible-role-requirements.yml script: - - yamllint -c .yamllint . - - ansible-playbook -i $DOCKER_ID, -c docker tests/test.yml --syntax-check - - ansible-playbook -i $DOCKER_ID, -c docker tests/test.yml --diff - - ansible-playbook -i $DOCKER_ID, -c docker tests/test.yml --diff - - tail -n 1 $ANSIBLE_LOG_PATH | grep -Eq 'changed=0 +unreachable=0 +failed=0' + - sudo ./scripts/run-tests.sh notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ diff --git a/CHANGELOG.md b/CHANGELOG.md index b5f1452..2954560 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,25 +1,30 @@ -Ansible Role for Bamboo -======================= +# Ansible Role for Bamboo -1.2.0 - TBC ------------ +## 2.2.0 - TBC ### Major Changes -- Add Ubuntu 17.10 and 18.04 support - -1.1.0 - 2017-11-23 ------------------- +## 2.1.0 - 2018-12-10 ### Major Changes -- Install Bamboo on Ubuntu 16.04/14.04 and CentOS 7/6 from source -- Update /etc/init.d/bamboo with better support for running with dumb-init inside docker -- Update test cases + - Upgrade Ansible support to 2.6 or higher + - Support both Ubuntu 16.04/18.04 and RHEL/CentOS 6/7 + - CI with yamllint, ansible-lint and ansible-playbook --syntax-check + - CI with LXD, improve systemd support + - Use shell only when shell functionality is required + - Upgrade both MySQL and PostgreSQL JDBC driver + - Simplify implementation for building Docker image + +## 1.1.0 - 2017-11-23 + +### Major Changes -1.0.0 - 2017-09-25 ------------------- + - Install Bamboo on Ubuntu 16.04/14.04 and CentOS 7/6 from source + - Update /etc/init.d/bamboo with better support for running with dumb-init inside docker + - Update test cases -- Ininitial release for Ansible 2.4 -- Support both Ubuntu 16.04/14.04 or RHEL/CentOS 7/6 +## 1.0.0 - 2017-09-25 + - Ininitial release for Ansible 2.4 + - Support both Ubuntu 16.04/14.04 or RHEL/CentOS 7/6 diff --git a/README.md b/README.md index 048e893..cb0d078 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -Ansible Role for Bamboo -======================= +# Ansible Role for Bamboo [![Travis](https://img.shields.io/travis/alvistack/ansible-role-bamboo.svg)](https://travis-ci.org/alvistack/ansible-role-bamboo) [![GitHub release](https://img.shields.io/github/release/alvistack/ansible-role-bamboo.svg)](https://github.com/alvistack/ansible-role-bamboo) @@ -8,38 +7,31 @@ Ansible Role for Bamboo Ansible Role for Atlassian Bamboo Installation. -Requirements ------------- +## Requirements -This role require Ansible 2.4 or higher. +This role require Ansible 2.6 or higher. -This role was designed for Ubuntu 14.04/16.04/17.10/18.04 or RHEL/CentOS 6/7. +This role was designed for Ubuntu 16.04/18.04 or RHEL/CentOS 6/7. -Role Variables --------------- +## Role Variables [defaults/main.yml](defaults/main.yml) -Dependencies ------------- +## Dependencies [meta/main.yml](meta/main.yml) -Example Playbook ----------------- +## Example Playbook [tests/test.yml](tests/test.yml) -License -------- +## License -- Code released under [Apache License 2.0](LICENSE) -- Docs released under [CC BY 4.0](http://creativecommons.org/licenses/by/4.0/) + - Code released under [Apache License 2.0](LICENSE) + - Docs released under [CC BY 4.0](http://creativecommons.org/licenses/by/4.0/) -Author Information ------------------- - -- Wong Hoi Sing Edison - - - - +## Author Information + - Wong Hoi Sing Edison + - + - diff --git a/ansible-requirements.txt b/ansible-requirements.txt deleted file mode 100644 index b2c729c..0000000 --- a/ansible-requirements.txt +++ /dev/null @@ -1 +0,0 @@ -yamllint diff --git a/ansible-role-requirements.yml b/ansible-role-requirements.yml new file mode 100644 index 0000000..dae8a3c --- /dev/null +++ b/ansible-role-requirements.yml @@ -0,0 +1,31 @@ +--- + +# (c) Wong Hoi Sing Edison +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +- name: python + src: https://github.com/alvistack/ansible-role-python + version: develop + +- name: apt + src: https://github.com/alvistack/ansible-role-apt + version: develop + +- name: yum + src: https://github.com/alvistack/ansible-role-yum + version: develop + +- name: java + src: https://github.com/alvistack/ansible-role-java + version: develop diff --git a/defaults/main.yml b/defaults/main.yml index 5ec19ad..49a0ae9 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -14,34 +14,24 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Owner and group for Bamdoo. -bamboo_owner: "daemon" -bamboo_group: "daemon" - -# Location for the $BAMBOO_HOME directory. -bamboo_home: "/var/atlassian/application-data/bamboo" - -# Location for the $BAMBOO_CATALINA directory. -bamboo_catalina: "/opt/atlassian/bamboo" - -# Bamboo JVM minimal and maximum memory usage. +# JVM minimal and maximum memory usage. bamboo_jvm_minimum_memory: "512m" bamboo_jvm_maximum_memory: "1024m" -# Bamboo Apache Tomcat connector and server port. -bamboo_connector_port: "8085" -bamboo_server_port: "8007" - -# Context path for Bamboo installation. -bamboo_context_path: ~ - -# If Bamboo running behide reverse proxy, setup `bamboo_scheme` with whatever -# `http` or `https`, and supply `bamboo_proxy_name` with its domain name. -bamboo_proxy_name: ~ -bamboo_scheme: ~ +# Proxy and context path setup. +bamboo_catalina_connector_proxyname: ~ +bamboo_catalina_connector_proxyport: ~ +bamboo_catalina_connector_scheme: "http" +bamboo_catalina_connector_secure: "false" +bamboo_catalina_context_path: ~ # Atlassian Support recommended JVM arguments. bamboo_jvm_support_recommended_args: "-Datlassian.plugins.enable.wait=300" -# URL for download Bamboo archive. -bamboo_url: "https://downloads.atlassian.com/software/bamboo/downloads/atlassian-bamboo-6.3.1.tar.gz" +# Session timeout. +bamboo_session_timeout: "300" + +# URL for download archives. +bamboo_download_url: "https://downloads.atlassian.com/software/bamboo/downloads/atlassian-bamboo-6.7.1.tar.gz" +mysql_jdbc_download_url: "https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-8.0.13.tar.gz" +postgresql_jdbc_download_url: "https://jdbc.postgresql.org/download/postgresql-42.2.5.jar" diff --git a/meta/main.yml b/meta/main.yml index d37fd22..ac845c0 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -15,17 +15,16 @@ # limitations under the License. galaxy_info: + role_name: bamboo author: Wong Hoi Sing Edison description: Ansible Role for Atlassian Bamboo Installation company: PantaRei Design license: Apache License 2.0 - min_ansible_version: 2.4 + min_ansible_version: 2.6 platforms: - name: Ubuntu versions: - - trusty - xenial - - artful - bionic - name: EL versions: diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..8e99fe4 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,17 @@ +# (c) Wong Hoi Sing Edison +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +ansible +git+https://github.com/ansible/ansible-lint.git@master#egg=ansible-lint +yamllint diff --git a/requirements.yml b/requirements.yml deleted file mode 100644 index a1c928f..0000000 --- a/requirements.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- - -- src: https://github.com/alvistack/ansible-role-python - version: develop - -- src: https://github.com/alvistack/ansible-role-apt - version: develop - -- src: https://github.com/alvistack/ansible-role-yum - version: develop - -- src: https://github.com/alvistack/ansible-role-java - version: develop - -- src: https://github.com/alvistack/ansible-role-mariadb-connector-java - version: develop diff --git a/scripts/run-tests.sh b/scripts/run-tests.sh new file mode 100755 index 0000000..5188aca --- /dev/null +++ b/scripts/run-tests.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# (c) Wong Hoi Sing Edison +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -o xtrace + +cd "$(cd "$(dirname "$0")"; pwd -P)/../" + +export ANSIBLE_FORCE_COLOR=true +export ANSIBLE_LOG_PATH="./ansible.log" +export ANSIBLE_ROLES_PATH="$HOME/.ansible/roles" + +LXC_IMAGE=${LXC_IMAGE:-"ubuntu:16.04"} +LXC_ID=${LXC_ID:-"$(cat /dev/urandom | tr -dc a-z | head -c1)$(cat /dev/urandom | tr -dc a-z0-9 | head -c11)"} +lxc restart $LXC_ID || lxc launch $LXC_IMAGE $LXC_ID + +yamllint -c .yamllint . +ansible-lint . +ansible-playbook -i $LXC_ID, -c lxd tests/test.yml --syntax-check +ansible-playbook -i $LXC_ID, -c lxd tests/test.yml --diff +ansible-playbook -i $LXC_ID, -c lxd tests/test.yml --diff +tail -n 1 $ANSIBLE_LOG_PATH | grep -Eq 'changed=0 +unreachable=0 +failed=0' diff --git a/tasks/main.yml b/tasks/main.yml index ddb1fcb..c842e75 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -44,44 +44,50 @@ loop_var: "loop_var" tags: bamboo -- name: prepare files +- name: prepare directories file: dest: "{{ item.dest }}" - owner: "{{ item.owner }}" - group: "{{ item.group }}" - mode: "{{ item.mode }}" - state: "{{ item.state }}" + owner: "{{ item.owner | default('root') }}" + group: "{{ item.group | default('root') }}" + mode: "{{ item.mode | default('0755') }}" + state: "{{ item.state | default('directory') }}" with_items: - - { dest: "{{ bamboo_catalina }}", owner: "{{ bamboo_owner }}", group: "{{ bamboo_group }}", mode: "0755", state: "directory" } - - { dest: "{{ bamboo_home }}", owner: "{{ bamboo_owner }}", group: "{{ bamboo_group }}", mode: "0755", state: "directory" } + - { dest: "/opt/atlassian/bamboo", owner: "daemon", group: "daemon" } + - { dest: "/var/atlassian/application-data/bamboo", owner: "daemon", group: "daemon" } tags: bamboo - name: unarchive package shell: | - ARCHIVE="`mktemp --suffix=.tar.gz`" - curl -sL {{ bamboo_url }} > $ARCHIVE - tar zxf $ARCHIVE -C {{ bamboo_catalina }} --strip-components=1 - chown -Rf {{ bamboo_owner }}:{{ bamboo_group }} {{ bamboo_catalina }} - rm -rf $ARCHIVE + cd /opt/atlassian/bamboo + curl -skL {{ bamboo_download_url }} | tar zxf - --strip-components 1 + cd /opt/atlassian/bamboo/lib + rm -rf *mysql*.jar + curl -skL {{ mysql_jdbc_download_url }} | tar zxf - --strip-components 1 --wildcards "mysql*/*mysql*.jar" + cd /opt/atlassian/bamboo/lib + rm -rf *postgresql*.jar + curl -skL {{ postgresql_jdbc_download_url }} -O + chown -Rf daemon:daemon /opt/atlassian/bamboo args: - creates: "{{ bamboo_catalina }}/bin/start-bamboo.sh" + creates: "/opt/atlassian/bamboo/bin/start-bamboo.sh" tags: bamboo - name: copy templates template: - src: "{{ item.src }}" + src: "./templates{{ item.dest }}.j2" dest: "{{ item.dest }}" - owner: "{{ item.owner }}" - group: "{{ item.group }}" - mode: "{{ item.mode }}" + owner: "{{ item.owner | default('root') }}" + group: "{{ item.group | default('root') }}" + mode: "{{ item.mode | default('0644') }}" with_items: - - { src: "etc/init.d/bamboo.j2", dest: "/etc/init.d/bamboo", owner: "root", group: "root", mode: "0755" } - - { src: "opt/atlassian/bamboo/bin/setenv.sh.j2", dest: "{{ bamboo_catalina }}/bin/setenv.sh", owner: "{{ bamboo_owner }}", group: "{{ bamboo_group }}", mode: "0644" } - - { src: "opt/atlassian/bamboo/conf/server.xml.j2", dest: "{{ bamboo_catalina }}/conf/server.xml", owner: "{{ bamboo_owner }}", group: "{{ bamboo_group }}", mode: "0644" } + - { dest: "/etc/init.d/bamboo", mode: "0755" } + - { dest: "/opt/atlassian/bamboo/bin/setenv.sh", owner: "daemon", group: "daemon", mode: "0755" } + - { dest: "/opt/atlassian/bamboo/conf/server.xml", owner: "daemon", group: "daemon" } tags: bamboo - name: enable service service: - name: "bamboo" - enabled: "yes" + name: bamboo + enabled: yes + changed_when: false + ignore_errors: yes tags: bamboo diff --git a/templates/etc/init.d/bamboo.j2 b/templates/etc/init.d/bamboo.j2 index c11f122..e0d3104 100644 --- a/templates/etc/init.d/bamboo.j2 +++ b/templates/etc/init.d/bamboo.j2 @@ -13,11 +13,11 @@ # Provide commands for manually starting and stopping Bamboo. ### END INIT INFO -BAMBOO_OWNER={{ bamboo_owner }} -BAMBOO_GROUP={{ bamboo_group }} -BAMBOO_HOME={{ bamboo_home }} -BAMBOO_CATALINA={{ bamboo_catalina }} -BAMBOO_CATALINA_PID={{ bamboo_catalina }}/work/catalina.pid +BAMBOO_OWNER=${BAMBOO_OWNER:-daemon} +BAMBOO_GROUP=${BAMBOO_GROUP:-daemon} +BAMBOO_HOME=${BAMBOO_HOME:-/var/atlassian/application-data/bamboo} +BAMBOO_CATALINA=${BAMBOO_CATALINA:-/opt/atlassian/bamboo} +BAMBOO_CATALINA_PID=${BAMBOO_CATALINA}/work/catalina.pid start() { echo "Starting Bamboo: " @@ -69,14 +69,17 @@ status() { case "$1" in start) - start ${@:2} + shift + start $@ ;; stop) - stop ${@:2} + shift + stop $@ ;; restart) - stop ${@:2} - start ${@:2} + shift + stop $@ + start $@ ;; status) status diff --git a/templates/opt/atlassian/bamboo/bin/setenv.sh.j2 b/templates/opt/atlassian/bamboo/bin/setenv.sh.j2 index 58000d3..99f1ffd 100755 --- a/templates/opt/atlassian/bamboo/bin/setenv.sh.j2 +++ b/templates/opt/atlassian/bamboo/bin/setenv.sh.j2 @@ -1,31 +1,32 @@ -#!/bin/sh +#!/bin/bash # # {{ ansible_managed }} # # One way to set the Bamboo HOME path is here via this variable. Simply uncomment it and set a valid path like /bamboo/home. You can of course set it outside in the command terminal. That will also work. # -BAMBOO_HOME="{{ bamboo_home }}" +BAMBOO_HOME="${BAMBOO_HOME:-"/var/atlassian/application-data/bamboo"}" +BAMBOO_CATALINA="${BAMBOO_CATALINA:-"/opt/atlassian/bamboo"}" # # Occasionally Atlassian Support may recommend that you set some specific JVM arguments. You can use this variable below to do that. # -JVM_SUPPORT_RECOMMENDED_ARGS="{{ bamboo_jvm_support_recommended_args }}" +JVM_SUPPORT_RECOMMENDED_ARGS="${JVM_SUPPORT_RECOMMENDED_ARGS:-"{{ bamboo_jvm_support_recommended_args }}"}" # -# Byteman agent -#JVM_SUPPORT_RECOMMENDED_ARGS="$JVM_SUPPORT_RECOMMENDED_ARGS -javaagent:../tools/byteman/lib/byteman.jar=listener:true" +# Uncomment the line below to enable the Byteman agent. # +#JVM_SUPPORT_RECOMMENDED_ARGS="$JVM_SUPPORT_RECOMMENDED_ARGS -javaagent:../tools/byteman/lib/byteman.jar=listener:true" # # The following 2 settings control the minimum and maximum given to the Bamboo Java virtual machine. In larger Bamboo instances, the maximum amount will need to be increased. # -JVM_MINIMUM_MEMORY="{{ bamboo_jvm_minimum_memory }}" -JVM_MAXIMUM_MEMORY="{{ bamboo_jvm_maximum_memory }}" +JVM_MINIMUM_MEMORY="${JVM_MINIMUM_MEMORY:-"{{ bamboo_jvm_minimum_memory }}"}" +JVM_MAXIMUM_MEMORY="${JVM_MAXIMUM_MEMORY:-"{{ bamboo_jvm_maximum_memory }}"}" # # The following are the required arguments need for Bamboo standalone. # -JVM_REQUIRED_ARGS="" +JVM_REQUIRED_ARGS="$JVM_REQUIRED_ARGS -Dcatalina.connector.scheme=${CATALINA_CONNECTOR_SCHEME:-"{{ bamboo_catalina_connector_scheme }}"} -Dcatalina.connector.secure=${CATALINA_CONNECTOR_SECURE:-"{{ bamboo_catalina_connector_secure }}"} -Dcatalina.connector.proxyName=${CATALINA_CONNECTOR_PROXYNAME:-"{{ bamboo_catalina_connector_proxyname }}"} -Dcatalina.connector.proxyPort=${CATALINA_CONNECTOR_PROXYPORT:-"{{ bamboo_catalina_connector_proxyport }}"} -Dcatalina.context.path=${CATALINA_CONTEXT_PATH:-"{{ bamboo_catalina_context_path }}"}" #----------------------------------------------------------------------------------- # @@ -51,7 +52,6 @@ fi JAVA_OPTS="-Xms${JVM_MINIMUM_MEMORY} -Xmx${JVM_MAXIMUM_MEMORY} ${JAVA_OPTS} ${JVM_REQUIRED_ARGS} ${JVM_SUPPORT_RECOMMENDED_ARGS} ${BAMBOO_HOME_MINUSD}" - # Perm Gen size needs to be increased if encountering OutOfMemoryError: PermGen problems. Specifying PermGen size is not valid on IBM JDKs BAMBOO_MAX_PERM_SIZE=256m if [ -f "${PRGDIR}/permgen.sh" ]; then @@ -84,3 +84,5 @@ echo "" if [ "$BAMBOO_HOME_MINUSD" != "" ]; then echo "Using BAMBOO_HOME: $BAMBOO_HOME" fi + +sed -i "s/\(\).*\(<\/session-timeout>\)/\1${SESSION_TIMEOUT:-"{{ bamboo_session_timeout }}"}\2/g" ${BAMBOO_CATALINA}/atlassian-bamboo/WEB-INF/web.xml diff --git a/templates/opt/atlassian/bamboo/conf/server.xml.j2 b/templates/opt/atlassian/bamboo/conf/server.xml.j2 index 5e2c2c5..5455db8 100644 --- a/templates/opt/atlassian/bamboo/conf/server.xml.j2 +++ b/templates/opt/atlassian/bamboo/conf/server.xml.j2 @@ -1,18 +1,142 @@ - + + + + + + + + + + - + + + + + + + + + + - + + + + + + - - + + + + + diff --git a/tests/test.yml b/tests/test.yml index 6ea47f4..fa63e82 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -14,53 +14,46 @@ # See the License for the specific language governing permissions and # limitations under the License. +# Use `gather_faces: no` to initialize Python on system that not yet +# pre-installed with Python (e.g. Ubuntu 16.04 Cloud Image and Docker Image). - hosts: all remote_user: root gather_facts: no roles: - - role: ansible-role-python + - role: python - hosts: all remote_user: root roles: - - role: ansible-role-apt - - role: ansible-role-yum - - role: ansible-role-java - -- hosts: all - remote_user: root - roles: - - role: ansible-role-bamboo - # Owner and group for Bamdoo. - bamboo_owner: "daemon" - bamboo_group: "daemon" - # Location for the $BAMBOO_HOME directory. - bamboo_home: "/var/atlassian/application-data/bamboo" - # Location for the $BAMBOO_CATALINA directory. - bamboo_catalina: "/opt/atlassian/bamboo" - # Bamboo Apache Tomcat connector and server port. - bamboo_connector_port: "8085" - bamboo_server_port: "8007" - -- hosts: all - remote_user: root - roles: - - role: ansible-role-mariadb-connector-java - mariadb_connector_java_dest: "/opt/atlassian/bamboo/lib/mariadb-connector-java.jar" + - role: apt + - role: yum + - role: java + apt: + - { state: "latest", name: "openjdk-8-jdk" } + java_home: "/usr/lib/jvm/java-8-openjdk-amd64" + when: ansible_os_family | lower == 'debian' + - role: java + yum: + - { state: "latest", name: "java-1.8.0-openjdk" } + java_home: "/usr/lib/jvm/jre-openjdk" + when: ansible_os_family | lower == 'redhat' + - role: bamboo - hosts: all remote_user: root tasks: - name: start service service: - name: "bamboo" - state: "started" + name: bamboo + state: started + changed_when: false + ignore_errors: yes - name: check port wait_for: port: "8085" timeout: "300" - delay: "180" + delay: "10" async: "300" poll: "10" @@ -73,7 +66,8 @@ async: "300" poll: "10" register: result + until: result.status == 200 - name: check result fail: - when: "'Bamboo setup wizard - Atlassian Bamboo' not in result.content" + when: "'bamboo' not in result.content"