Skip to content

Commit

Permalink
Enable apt pinning (#81)
Browse files Browse the repository at this point in the history
* Enable APT pinning

* Allow overriding a different upstream server for packages

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

* Update EPEL URLs with default unversioned package

* Update for Ansible syntax change
  • Loading branch information
lhoss authored and ernestas-poskus committed Feb 8, 2018
1 parent 25e23a0 commit 27b7829
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 11 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ mesos_version: "1.0.1"

# Debian
mesos_package_version: "2.0.93"
mesosphere_apt_url: "http://repos.mesosphere.com/{{ ansible_distribution | lower }}"
mesos_os_distribution: "{{ ansible_distribution | lower }}"
mesos_os_version: "{{ ansible_distribution_version.split('.') | join('') }}"
mesos_apt_package: "mesos={{ mesos_version }}-{{ mesos_package_version }}.{{ mesos_os_distribution }}{{ mesos_os_version }}"
mesos_apt_url: "http://{{ mesos_repo_host }}/{{ ansible_distribution | lower }}"
mesos_package_full_version: "{{ mesos_version }}-{{ mesos_package_version }}.{{ mesos_os_distribution }}{{ mesos_os_version }}"
mesos_apt_package: "mesos={{ mesos_package_full_version }}"

# RedHat: EPEL and Mesosphere yum repositories URL
epel_repo: "https://dl.fedoraproject.org/pub/epel/{{ os_version_major }}/{{ ansible_architecture }}/{{ epel_releases[os_version_major] }}"
Expand Down
11 changes: 7 additions & 4 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
mesos_install_mode: "master" # {master|slave|master-slave}
mesos_version: "1.1.0"

mesos_repo_host: repos.mesosphere.com

# Debian
mesos_package_version: "2.0.107"
mesosphere_apt_url: "http://repos.mesosphere.com/{{ ansible_distribution | lower }}"
mesos_os_distribution: "{{ ansible_distribution | lower }}"
mesos_os_version: "{{ ansible_distribution_version.split('.') | join('') }}"
mesos_apt_package: "mesos={{ mesos_version }}-{{ mesos_package_version }}.{{ mesos_os_distribution }}{{ mesos_os_version }}"
mesos_package_full_version: "{{ mesos_version }}-{{ mesos_package_version }}.{{ mesos_os_distribution }}{{ mesos_os_version }}"
mesosphere_apt_url: "http://{{ mesos_repo_host }}/{{ ansible_distribution | lower }}"
mesos_apt_package: "mesos={{ mesos_package_full_version }}"

# RedHat: EPEL and Mesosphere yum repositories URL
epel_repo: "https://dl.fedoraproject.org/pub/epel/{{ os_version_major }}/{{ ansible_architecture }}/{{ epel_releases[os_version_major] }}"
mesosphere_yum_repo: "https://repos.mesosphere.com/el/{{ os_version_major }}/noarch/RPMS/{{ mesosphere_releases[os_version_major] }}"
epel_repo: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ os_version_major }}.noarch.rpm"
mesosphere_yum_repo: "https://{{ mesos_repo_host }}/el/{{ os_version_major }}/noarch/RPMS/{{ mesosphere_releases[os_version_major] }}"

# conf file settings
mesos_cluster_name: "mesos_cluster"
Expand Down
6 changes: 6 additions & 0 deletions tasks/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
- name: Add mesosphere repo
apt_repository: repo='deb {{ mesosphere_apt_url }} {{ ansible_distribution_release | lower }} main' state=present update_cache=yes

- name: Pin Mesos version
template:
src: mesos.pref.j2
dest: /etc/apt/preferences.d/mesos.pref
when: mesos_apt_pin_priority is defined

- name: Install Debian OS packages
apt: pkg={{ item }} state=present update_cache=yes cache_valid_time=3600
with_items:
Expand Down
3 changes: 3 additions & 0 deletions templates/mesos.pref.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Package: mesos
Pin: version {{ mesos_package_full_version }}
Pin-Priority: {{ mesos_apt_pin_priority }}
5 changes: 0 additions & 5 deletions vars/RedHat.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
os_version_major: "{{ ansible_distribution_major_version }}"

# EPEL repository released packaged per OS version
epel_releases:
'6': 'epel-release-6-8.noarch.rpm'
'7': 'e/epel-release-7-10.noarch.rpm'

# Mesosphere released packaged per OS version
mesosphere_releases:
'6': 'mesosphere-el-repo-6-3.noarch.rpm'
Expand Down

0 comments on commit 27b7829

Please sign in to comment.