Skip to content

Commit

Permalink
Support mesos with SSL enabled (#43)
Browse files Browse the repository at this point in the history
* Support mesos with SSL enabled

* Prevent having an empty ssl.conf file
  • Loading branch information
veger authored and ernestas-poskus committed Feb 2, 2017
1 parent a0a9067 commit b09871b
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ marathon_zookeeper_state: "zk://{{ zookeeper_hostnames }}{{ marathon_zookeeper_p
# The path to install the haproxy configuration script. If this is an empty string ```""``` haproxy configuration will be disabled.
haproxy_script_location: "/usr/local/bin"

# **Mesos** SSL support
mesos_ssl_enabled: false # When mesos has SSL enabled, set to true and fill in other `mesos_ssl_` variables.
mesos_ssl_support_downgrade: false
mesos_ssl_key_file: # When mesos SSL is enabled this must be used to point to the SSL key file
mesos_ssl_cert_file: # When mesos SSL is enabled this must be used to point to the SSL certificate file

# optional
artifact_store: ""
checkpoint: "true"
Expand Down
4 changes: 4 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ marathon_zookeeper_state: "zk://{{ zookeeper_hostnames }}{{ marathon_zookeeper_p
# The path to install the haproxy configuration script. If this is an empty string ```""``` haproxy configuration will be disabled.
haproxy_script_location: "/usr/local/bin"

# SSL
mesos_ssl_enabled: false
mesos_ssl_support_downgrade: false

# optional
artifact_store: ""
checkpoint: "true"
Expand Down
4 changes: 4 additions & 0 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
---
- name: Reload systemd
command: systemctl daemon-reload
when: ansible_service_mgr == 'systemd'

- name: Restart marathon
service: name=marathon state=restarted

Expand Down
24 changes: 24 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,29 @@
tags:
- haproxy

- name: Make sure service dropin directory is available
file:
path: /etc/systemd/system/marathon.service.d/
state: directory
when: ansible_service_mgr == 'systemd'

- name: Add SSL settings/environment variables
template:
src: ssl.conf.j2
dest: /etc/systemd/system/marathon.service.d/ssl.conf
when: ansible_service_mgr == 'systemd' and mesos_ssl_enabled
notify:
- Reload systemd
- Restart marathon

- name: Remove SSL settings/environment variables
file:
path: /etc/systemd/system/marathon.service.d/ssl.conf
state: absent
when: ansible_service_mgr == 'systemd' and not mesos_ssl_enabled
notify:
- Reload systemd
- Restart marathon

- name: Enable Marathon service
service: name=marathon enabled=yes
5 changes: 5 additions & 0 deletions templates/ssl.conf.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[Service]
Environment="LIBPROCESS_SSL_ENABLED=true"
Environment="LIBPROCESS_SSL_SUPPORT_DOWNGRADE={{ mesos_ssl_support_downgrade | ternary('true', 'false')}}"
Environment="LIBPROCESS_SSL_KEY_FILE={{ mesos_ssl_key_file }}"
Environment="LIBPROCESS_SSL_CERT_FILE={{ mesos_ssl_cert_file }}"

0 comments on commit b09871b

Please sign in to comment.