Skip to content

Commit

Permalink
Enable apt pinning (#47)
Browse files Browse the repository at this point in the history
* Allow overriding a different upstream server for packages

* Enable APT pinning. Align variables to Mesos role.

* Preserve compatibility with people still using 'marathon=' in the variables

* fix mesosphere repos host

* yum_repo using https (as in the ansible-mesos role)

* proper conditional check handling all possible cases (incl var not defined and --extra-vars pin_priority=false)

* marathon_apt_pin_priority (debian/ubuntu specific) in the README
  • Loading branch information
lhoss authored and ernestas-poskus committed Feb 22, 2018
1 parent 8d6e6fe commit bd2b573
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ marathon_version: "1.3.6"
# Debian: Mesosphere apt repository URL
marathon_apt_package: "marathon={{ marathon_version }}-*"
marathon_apt_repo: "deb http://repos.mesosphere.com/{{ansible_distribution|lower}} {{ansible_distribution_release|lower}} main"
# Debian apt pin priority for the marathon package. If empty (the default), no pin priority is used.
marathon_apt_pin_priority:

# RedHat: Mesosphere yum repository URL
marathon_yum_package: "marathon-{{ marathon_version }}"
Expand Down
12 changes: 9 additions & 3 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
---
marathon_version: "1.3.6"

marathon_repo_host: repos.mesosphere.com

# Debian: Mesosphere apt repository URL
marathon_apt_package: "marathon={{ marathon_version }}-*"
marathon_apt_repo: "deb http://repos.mesosphere.com/{{ansible_distribution|lower}} {{ansible_distribution_release|lower}} main"
marathon_package_version: "1.0.540"
marathon_os_distribution: "{{ ansible_distribution | lower }}"
marathon_os_version: "{{ ansible_distribution_version.split('.') | join('') }}"
marathon_apt_url: "http://{{ marathon_repo_host }}/{{ ansible_distribution | lower }}"
marathon_package_full_version: "{{ marathon_version }}-{{ marathon_package_version }}.{{ marathon_os_distribution }}{{ marathon_os_version }}"
marathon_apt_package: "marathon={{ marathon_package_full_version }}"

# RedHat: Mesosphere yum repository URL
marathon_yum_package: "marathon-{{ marathon_version }}"
mesosphere_yum_repo: "http://repos.mesosphere.com/el/{{ os_version_major }}/noarch/RPMS/{{ mesosphere_releases[os_version_major] }}"
mesosphere_yum_repo: "https://{{ marathon_repo_host }}/el/{{ os_version_major }}/noarch/RPMS/{{ mesosphere_releases[os_version_major] }}"

marathon_hostname: "{{ inventory_hostname }}"
marathon_port: 8080
Expand Down
8 changes: 7 additions & 1 deletion tasks/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
apt_key: id=E56151BF keyserver=keyserver.ubuntu.com state=present

- name: Add Mesosphere repo
apt_repository: repo="{{marathon_apt_repo}}" state=present update_cache=yes
apt_repository: repo='deb {{ marathon_apt_url }} {{ ansible_distribution_release | lower }} main' state=present update_cache=yes

- name: Pin Marathon version
template:
src: marathon.pref.j2
dest: /etc/apt/preferences.d/marathon.pref
when: marathon_apt_pin_priority | default(false) | bool

- name: Install Marathon package
apt: pkg={{ marathon_apt_package }} state=present
Expand Down
3 changes: 3 additions & 0 deletions templates/marathon.pref.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Package: marathon
Pin: version {{ marathon_package_full_version }}
Pin-Priority: {{ marathon_apt_pin_priority }}

0 comments on commit bd2b573

Please sign in to comment.