Make the role compatible with Ubuntu Xenial

This commit is contained in:
Frédéric Guillot 2016-10-05 13:02:06 -04:00
parent 7610442766
commit f9760d8c98
17 changed files with 144 additions and 20 deletions

View File

@ -3,7 +3,7 @@ OpenStack-Ansible Almanach
:tags: openstack, almanach, cloud, ansible
:category: \*nix
This Ansible role installs and configures OpenStack Almanach on Ubuntu 14.04.
This Ansible role installs and configures OpenStack Almanach on Ubuntu 14.04 and 16.04.
This role will install the following Upstart services:
* almanach-api

View File

@ -23,6 +23,7 @@ galaxy_info:
- name: Ubuntu
versions:
- trusty
- xenial
galaxy_tags:
- cloud
- python

View File

@ -13,8 +13,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- include: almanach_init_api.yml
when: inventory_hostname in groups['almanach_api']
- include: almanach_init_api_upstart.yml
when: inventory_hostname in groups['almanach_api'] and pid1_name == "init"
- include: almanach_init_collector.yml
when: inventory_hostname in groups['almanach_collector']
- include: almanach_init_collector_upstart.yml
when: inventory_hostname in groups['almanach_collector'] and pid1_name == "init"
- include: almanach_init_api_systemd.yml
when: inventory_hostname in groups['almanach_api'] and pid1_name == "systemd"
- include: almanach_init_collector_systemd.yml
when: inventory_hostname in groups['almanach_collector'] and pid1_name == "systemd"

View File

@ -0,0 +1,29 @@
---
# Copyright 2016, Internap Inc.
#
# 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: Place the systemd init script
template:
src: "almanach-api-systemd.j2"
dest: "/etc/systemd/system/{{ almanach_api_program_name }}.service"
mode: "0644"
owner: "root"
group: "root"
register: systemd_init
- name: Reload the systemd daemon
command: "systemctl daemon-reload"
when: systemd_init | changed
notify:
- Restart almanach services

View File

@ -15,7 +15,7 @@
- name: Place the init script
template:
src: "almanach-api-upstart-init.j2"
src: "almanach-api-upstart.j2"
dest: "/etc/init/{{ almanach_api_program_name }}.conf"
mode: "0644"
owner: "root"

View File

@ -0,0 +1,29 @@
---
# Copyright 2016, Internap Inc.
#
# 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: Place the collector systemd init script
template:
src: "almanach-collector-systemd.j2"
dest: "/etc/systemd/system/{{ almanach_collector_program_name }}.service"
mode: "0644"
owner: "root"
group: "root"
register: systemd_init
- name: Reload the systemd daemon
command: "systemctl daemon-reload"
when: systemd_init | changed
notify:
- Restart almanach services

View File

@ -15,7 +15,7 @@
- name: Place the init script
template:
src: "almanach-collector-upstart-init.j2"
src: "almanach-collector-upstart.j2"
dest: "/etc/init/{{ almanach_collector_program_name }}.conf"
mode: "0644"
owner: "root"

View File

@ -24,6 +24,18 @@
tags:
- always
- name: Check init system
command: cat /proc/1/comm
register: _pid1_name
tags:
- always
- name: Set the name of pid1
set_fact:
pid1_name: "{{ _pid1_name.stdout }}"
tags:
- always
- include: almanach_pre_install.yml
tags:
- almanach-install

View File

@ -0,0 +1,20 @@
# {{ ansible_managed }}
[Unit]
Description=Almanach api openstack service
After=syslog.target
After=network.target
[Service]
Type=simple
User={{ almanach_system_user_name }}
Group={{ almanach_system_group_name }}
ExecStart={{ almanach_app_dir }}/bin/almanach api {{ almanach_config_file }} --host {{ almanach_listen_ip }} --port {{ almanach_port }} --logging {{ almanach_logging_config_file }}
TimeoutSec=300
Restart=on-failure
RestartSec=150
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,20 @@
# {{ ansible_managed }}
[Unit]
Description=Almanach collector openstack service
After=syslog.target
After=network.target
[Service]
Type=simple
User={{ almanach_system_user_name }}
Group={{ almanach_system_group_name }}
ExecStart={{ almanach_app_dir }}/bin/almanach collector {{ almanach_config_file }} --logging {{ almanach_logging_config_file }}
TimeoutSec=300
Restart=on-failure
RestartSec=150
[Install]
WantedBy=multi-user.target

View File

@ -1,6 +1,6 @@
# {{ ansible_managed }}
description "{{ almanach_api_program_name }}"
description "{{ almanach_collector_program_name }}"
start on runlevel [2345]
stop on runlevel [!2345]

View File

@ -57,7 +57,7 @@
- name: Add almanach database user
mongodb_user:
login_host: "10.100.100.2"
database: almanach
database: admin
name: almanach
password: secrete
roles: 'readWrite,dbAdmin'

View File

@ -13,12 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
almanach_mongodb_url: mongodb://almanach:secrete@10.100.100.2:27017/almanach
almanach_mongodb_database: almanach
internal_lb_vip_address: 10.100.100.2
external_lb_vip_address: 10.100.100.2
rabbitmq_servers: 10.100.100.2
rabbitmq_use_ssl: true
rabbitmq_port: 5671
almanach_mongodb_url: mongodb://almanach:secrete@10.100.100.2:27017/admin

View File

@ -116,8 +116,6 @@ commands =
{toxinidir}/tests/test.yml -vvvv
bash -c 'mkdir -p {toxinidir}/logs'
bash -c 'rsync --archive --verbose --ignore-errors /var/log/ /openstack/log/ {toxinidir}/logs/ || true'
bash -c 'find "{toxinidir}/logs/" -type f | sed "p;s|$|.txt|" | xargs -n2 mv'
bash -c 'command gzip --best --recursive "{toxinidir}/logs/"'
[testenv:linters]

17
vars/ubuntu-16.04.yml Normal file
View File

@ -0,0 +1,17 @@
---
# Copyright 2016, Internap Inc.
#
# 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.
## APT Cache options
cache_timeout: 600