Skip to content

Commit

Permalink
Add Ubuntu18 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
orachide committed Jun 3, 2019
1 parent df4adda commit 843e504
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
sudo: required
language: python
python: 2.7
services:
- docker
before_install:
Expand Down
2 changes: 1 addition & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# dependencies default var
sb_app_install_java: true
sb_app_create_users: true
sb_java_package: java-1.8.0-openjdk
sb_java_package: "{{ 'java-1.8.0-openjdk' if (ansible_distribution in ['RedHat','CentOS']) else 'openjdk-8-jdk' }}"

sb_app_state: present
sb_app_extension: jar
Expand Down
2 changes: 1 addition & 1 deletion molecule/default/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

FROM {{ item.image }}

RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates curl && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \
Expand Down
6 changes: 6 additions & 0 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ platforms:
privileged: True
command: '/sbin/init'
cap_add: ['SYS_ADMIN', 'SETPCAP']
- name: sb_ubuntu18-$TOX_ENVNAME
image: solita/ubuntu-systemd
command: /sbin/init
privileged: true
volumes:
- /lib/modules:/lib/modules:ro
provisioner:
name: ansible
lint:
Expand Down
1 change: 0 additions & 1 deletion molecule/default/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
- name: Converge
hosts: all
vars:
sb_java_package: java-1.8.0-openjdk
sb_user_groups_definitions:
- name: sbgroup
sb_users_definition:
Expand Down
2 changes: 1 addition & 1 deletion molecule/default/tests/test_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

def test_service_is_started(host):
ansible_vars = host.ansible.get_variables()
if (ansible_vars['inventory_hostname'] == 'sb_centos6'):
if (ansible_vars['inventory_hostname'].startswith('sb_centos6')):
f = host.file('/etc/init.d/simple-springboot-app')
assert f.exists
assert f.user == 'sbuser'
Expand Down
4 changes: 2 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
sb_app_artifact_destination_file: "{{ sb_app_artifact_destination_folder }}/{{ sb_app_artifact_id }}-{{ sb_app_version }}.{{ sb_app_extension }}"

- name: " Service | Check if use systemd"
set_fact: use_system_d={{ (ansible_distribution in ['RedHat','CentOS'] and ansible_distribution_version is version_compare('7', '>=')) }}
set_fact: use_system_d={{ ansible_service_mgr == 'systemd' }}

- debug: var=ansible_distribution_version

- name: " Service | Check if use use_initd"
set_fact: use_initd={{ (ansible_distribution in ['RedHat','CentOS'] and ansible_distribution_version is version_compare('7', '<')) }}
set_fact: use_initd={{ ansible_service_mgr == 'sysvinit' }}

- import_tasks: install.yml
when: >
Expand Down
2 changes: 1 addition & 1 deletion vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
# vars file for role_spring_boot_app

sysd_user_services_folder: /usr/lib/systemd/system
sysd_user_services_folder: "{{ '/usr/lib/systemd/system' if (ansible_distribution in ['RedHat','CentOS']) else '/lib/systemd/system/' }}"
sysd_script: "{{ sysd_user_services_folder }}/{{ sb_app_name | lower }}.service"

0 comments on commit 843e504

Please sign in to comment.