Make config files compatible with Almanach 3.3.x

Change-Id: I87becaf01439ba6397d7b9e02c91546dfb4dd1e1
This commit is contained in:
Frédéric Guillot 2016-11-01 16:40:21 -04:00
parent 837e546212
commit bde023eee8
13 changed files with 132 additions and 73 deletions

View File

@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
almanach_version: 3.3.2
almanach_collector_program_name: almanach-collector
almanach_api_program_name: almanach-api
@ -20,6 +22,12 @@ almanach_service_names:
- "almanach-api"
- "almanach-collector"
almanach_requires_apt_packages:
- python3-pip
almanach_requires_pip_packages:
- virtualenv
almanach_system_user_name: almanach
almanach_system_group_name: almanach
almanach_system_shell: /bin/false
@ -32,7 +40,6 @@ almanach_app_dir: /opt/almanach
almanach_config_dir: /etc/almanach
almanach_config_file: /etc/almanach/almanach.cfg
almanach_logging_config_file: /etc/almanach/logging.cfg
almanach_logrotate_config_file: /etc/logrotate.d/almanach
almanach_auth_token: secret

View File

@ -25,8 +25,7 @@
- Restart almanach services
- name: Reload init scripts
shell: |
initctl reload-configuration
command: initctl reload-configuration
when: upstart_init | changed
notify:
- Restart almanach services

View File

@ -25,8 +25,7 @@
- Restart almanach services
- name: Reload init scripts
shell: |
initctl reload-configuration
command: initctl reload-configuration
when: upstart_init | changed
notify:
- Restart almanach services

View File

@ -17,15 +17,16 @@
apt: update_cache=yes
become: True
- name: Install Python dependencies
apt: name={{ item }} state=present
with_items:
- python2.7
- python-dev
- python-pip
- name: Install apt packages
apt:
name: "{{ almanach_requires_apt_packages | join(' ') }}"
state: present
- name: Install Virtualenv
pip: name=virtualenv state=latest
- name: Install pip packages
pip:
name: "{{ almanach_requires_pip_packages | join(' ') }}"
state: present
executable: pip3
- name: Install Almanach
pip: name=almanach virtualenv={{ almanach_app_dir }} virtualenv_python=python2.7
pip: name=almanach version={{ almanach_version }} virtualenv={{ almanach_app_dir }} virtualenv_python=python3

View File

@ -19,9 +19,6 @@
- name: Create almanach config file
template: src=almanach.cfg.j2 dest={{ almanach_config_file }}
- name: Create almanach config logging file
template: src=logging.cfg.j2 dest={{ almanach_logging_config_file }}
- name: Create log directory
file: path={{ almanach_log_dir }} state=directory owner={{ almanach_system_user_name }} group={{ almanach_system_group_name }}

View File

@ -26,6 +26,7 @@
- name: Check init system
command: cat /proc/1/comm
changed_when: false
register: _pid1_name
tags:
- always

View File

@ -10,7 +10,7 @@ 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 }}
ExecStart={{ almanach_app_dir }}/bin/almanach-api --config-file={{ almanach_config_file }} --log-file={{ almanach_log_file }}
TimeoutSec=300
Restart=on-failure

View File

@ -10,5 +10,5 @@ setuid {{ almanach_system_user_name }}
setgid {{ almanach_system_group_name }}
script
exec {{ almanach_app_dir }}/bin/almanach api {{ almanach_config_file }} --host {{ almanach_listen_ip }} --port {{ almanach_port }} --logging {{ almanach_logging_config_file }}
exec {{ almanach_app_dir }}/bin/almanach-api --config-file={{ almanach_config_file }} --log-file={{ almanach_log_file }}
end script

View File

@ -10,7 +10,7 @@ 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 }}
ExecStart={{ almanach_app_dir }}/bin/almanach-collector --config-file={{ almanach_config_file }} --log-file={{ almanach_log_file }}
TimeoutSec=300
Restart=on-failure

View File

@ -10,5 +10,5 @@ setuid {{ almanach_system_user_name }}
setgid {{ almanach_system_group_name }}
script
exec {{ almanach_app_dir }}/bin/almanach collector {{ almanach_config_file }} --logging {{ almanach_logging_config_file }}
exec {{ almanach_app_dir }}/bin/almanach-collector --config-file={{ almanach_config_file }} --log-file={{ almanach_log_file }}
end script

View File

@ -1,29 +1,109 @@
[ALMANACH]
auth_token={{ almanach_auth_token }}
auth_strategy={{ almanach_auth_strategy }}
volume_existence_threshold={{ almanach_volume_existence_threshold }}
device_metadata_whitelist={{ almanach_metadata_whitelist }}
[DEFAULT]
[MONGODB]
url={{ almanach_mongodb_url }}
database={{ almanach_mongodb_database }}
indexes=project_id,start,end
[api]
[RABBITMQ]
url={{ almanach_rabbitmq_url }}
queue={{ almanach_rabbitmq_queue }}
exchange={{ almanach_rabbitmq_exchange }}
routing.key={{ almanach_rabbitmq_routing_key }}
retry.time.to.live={{ almanach_rabbitmq_retry_time_to_live }}
retry.exchange={{ almanach_rabbitmq_exchange }}
retry.maximum={{ almanach_rabbitmq_retry_maximum }}
retry.queue={{ almanach_rabbitmq_retry_queue }}
retry.return.exchange={{ almanach_rabbitmq_retry_return_exchange }}
dead.queue={{ almanach_rabbitmq_dead_queue }}
dead.exchange={{ almanach_rabbitmq_dead_exchange }}
#
# From almanach
#
[KEYSTONE]
username={{ almanach_keystone_username }}
password={{ almanach_keystone_password }}
tenant_name={{ almanach_keystone_tenant_name }}
auth_url={{ almanach_keystone_auth_url }}
# IP address to listen on (IP address value)
bind_ip = {{ almanach_listen_ip }}
# TCP port number to listen on (port value)
# Minimum value: 0
# Maximum value: 65535
bind_port = {{ almanach_port }}
[auth]
#
# From almanach
#
# Authentication driver for the API (string value)
strategy = {{ almanach_auth_strategy }}
# Private key for private key authentication (string value)
private_key = {{ almanach_auth_token }}
# Keystone service username (string value)
keystone_username = {{ almanach_keystone_username }}
# Keystone service password (string value)
keystone_password = {{ almanach_keystone_password }}
# Keystone service tenant (string value)
keystone_tenant = {{ almanach_keystone_tenant_name }}
# Keystone URL (string value)
keystone_url = {{ almanach_keystone_auth_url }}
[collector]
#
# From almanach
#
# RabbitMQ connection URL (string value)
url = {{ almanach_rabbitmq_url }}
# RabbitMQ connection heartbeat (integer value)
heartbeat = 540
# Default queue name (string value)
default_queue = {{ almanach_rabbitmq_queue }}
# Default exchange name (string value)
default_exchange = {{ almanach_rabbitmq_exchange }}
# Default queue routing key (string value)
default_routing_key = {{ almanach_rabbitmq_routing_key }}
# Retry queue name (string value)
retry_queue = {{ almanach_rabbitmq_retry_queue }}
# Retry exchange name (string value)
retry_exchange = {{ almanach_rabbitmq_exchange }}
# Time to live value of messages sent on the retry queue (integer
# value)
retry_ttl = {{ almanach_rabbitmq_retry_time_to_live }}
# Maximal number of message retries (integer value)
max_retries = {{ almanach_rabbitmq_retry_maximum }}
# Dead queue name (string value)
dead_queue = {{ almanach_rabbitmq_dead_queue }}
# Dead exchange name (string value)
dead_exchange = {{ almanach_rabbitmq_dead_exchange }}
[database]
#
# From almanach
#
# Database driver (string value)
driver = mongodb
# Database connection URL (string value)
connection_url = {{ almanach_mongodb_url }}
[resources]
#
# From almanach
#
# Volume existence threshold (integer value)
volume_existence_threshold = {{ almanach_volume_existence_threshold }}
# DEPRECATED: Metadata to include in entity (string value)
# This option is deprecated for removal.
# Its value may be silently ignored in the future.
device_metadata_whitelist = {{ almanach_metadata_whitelist }}

View File

@ -1,26 +0,0 @@
[loggers]
keys=root
[logger_root]
handlers=consoleHandler,fileHandler
level=DEBUG
[handlers]
keys=consoleHandler,fileHandler
[handler_consoleHandler]
class=StreamHandler
formatter=defaultFormatter
args=(sys.stdout,)
[handler_fileHandler]
class=handlers.WatchedFileHandler
args=('{{ almanach_log_file }}','a')
formatter=defaultFormatter
[formatters]
keys=defaultFormatter
[formatter_defaultFormatter]
format=%(asctime)s [%(process)d] [%(levelname)s] [%(module)s] %(message)s
datefmt=%Y-%m-%d %H:%M:%S

View File

@ -21,6 +21,7 @@
- name: Install httplib2 so we can use the uri module
pip:
name: httplib2
executable: pip3
- name: Check the almanach-api
uri:
url: "http://localhost:8000/info"