Support Fedora 28

This commit is contained in:
Giacomo Longo 2018-09-19 19:57:20 +02:00
parent 34d1f0bff2
commit 492b3e525d
10 changed files with 86 additions and 4 deletions

View file

@ -92,6 +92,7 @@ Supported Linux Distributions
- **Debian** Jessie, Stretch, Wheezy - **Debian** Jessie, Stretch, Wheezy
- **Ubuntu** 16.04, 18.04 - **Ubuntu** 16.04, 18.04
- **CentOS/RHEL** 7 - **CentOS/RHEL** 7
- **Fedora** 28
- **Fedora/CentOS** Atomic - **Fedora/CentOS** Atomic
- **openSUSE** Leap 42.3/Tumbleweed - **openSUSE** Leap 42.3/Tumbleweed

5
Vagrantfile vendored
View file

@ -18,6 +18,7 @@ SUPPORTED_OS = {
"coreos-beta" => {box: "coreos-beta", bootstrap_os: "coreos", user: "core", box_url: COREOS_URL_TEMPLATE % ["beta"]}, "coreos-beta" => {box: "coreos-beta", bootstrap_os: "coreos", user: "core", box_url: COREOS_URL_TEMPLATE % ["beta"]},
"ubuntu" => {box: "bento/ubuntu-16.04", bootstrap_os: "ubuntu", user: "vagrant"}, "ubuntu" => {box: "bento/ubuntu-16.04", bootstrap_os: "ubuntu", user: "vagrant"},
"centos" => {box: "centos/7", bootstrap_os: "centos", user: "vagrant"}, "centos" => {box: "centos/7", bootstrap_os: "centos", user: "vagrant"},
"fedora" => {box: "fedora/28-cloud-base", bootstrap_os: "fedora", user: "vagrant"},
"opensuse" => {box: "opensuse/openSUSE-42.3-x86_64", bootstrap_os: "opensuse", use: "vagrant"}, "opensuse" => {box: "opensuse/openSUSE-42.3-x86_64", bootstrap_os: "opensuse", use: "vagrant"},
"opensuse-tumbleweed" => {box: "opensuse/openSUSE-Tumbleweed-x86_64", bootstrap_os: "opensuse", use: "vagrant"}, "opensuse-tumbleweed" => {box: "opensuse/openSUSE-Tumbleweed-x86_64", bootstrap_os: "opensuse", use: "vagrant"},
} }
@ -127,6 +128,10 @@ Vagrant.configure("2") do |config|
config.vm.provider :libvirt do |lv| config.vm.provider :libvirt do |lv|
lv.memory = $vm_memory lv.memory = $vm_memory
# Fix kernel panic on fedora 28
if $os == "fedora"
lv.cpu_mode = "host-passthrough"
end
end end
ip = "#{$subnet}.#{i+100}" ip = "#{$subnet}.#{i+100}"

View file

@ -0,0 +1,20 @@
---
- name: Bootstrap | Check if bootstrap is needed
raw: which "{{ item }}"
register: need_bootstrap
failed_when: false
changed_when: false
with_items:
- python
tags: facts
- name: Install python on fedora
raw: "dnf install --assumeyes --quiet {{ item['item'] }}"
when: item['rc'] != 0
loop: "{{ need_bootstrap['results'] }}"
- name: Install required python packages
dnf:
name: libselinux-python
state: present

View file

@ -8,6 +8,9 @@
- import_tasks: bootstrap-coreos.yml - import_tasks: bootstrap-coreos.yml
when: bootstrap_os == "coreos" when: bootstrap_os == "coreos"
- import_tasks: bootstrap-fedora.yml
when: bootstrap_os == "fedora"
- import_tasks: bootstrap-centos.yml - import_tasks: bootstrap-centos.yml
when: bootstrap_os == "centos" when: bootstrap_os == "centos"

View file

@ -0,0 +1,5 @@
---
crio_packages:
- cri-o
crio_service: cri-o

View file

@ -26,6 +26,9 @@ yum_conf: /etc/yum.conf
yum_repo_dir: /etc/yum.repos.d yum_repo_dir: /etc/yum.repos.d
docker_yum_conf: /etc/yum_docker.conf docker_yum_conf: /etc/yum_docker.conf
# Fedora docker-ce repo
docker_fedora_repo_base_url: 'https://download.docker.com/linux/fedora/$releasever/$basearch/stable'
docker_fedora_repo_gpgkey: 'https://download.docker.com/linux/fedora/gpg'
# CentOS/RedHat docker-ce repo # CentOS/RedHat docker-ce repo
docker_rh_repo_base_url: 'https://download.docker.com/linux/centos/7/$basearch/stable' docker_rh_repo_base_url: 'https://download.docker.com/linux/centos/7/$basearch/stable'
docker_rh_repo_gpgkey: 'https://download.docker.com/linux/centos/gpg' docker_rh_repo_gpgkey: 'https://download.docker.com/linux/centos/gpg'

View file

@ -89,6 +89,12 @@
- use_docker_engine is defined and use_docker_engine - use_docker_engine is defined and use_docker_engine
- not (ansible_os_family in ["CoreOS", "Container Linux by CoreOS", "RedHat", "Suse"] or is_atomic) and (dockerproject_repo_info.repos|length > 0) - not (ansible_os_family in ["CoreOS", "Container Linux by CoreOS", "RedHat", "Suse"] or is_atomic) and (dockerproject_repo_info.repos|length > 0)
- name: Configure docker repository on Fedora
template:
src: "fedora_docker.repo.j2"
dest: "{{ yum_repo_dir }}/docker.repo"
when: ansible_distribution == "Fedora" and not is_atomic
- name: Configure docker repository on RedHat/CentOS - name: Configure docker repository on RedHat/CentOS
template: template:
src: "rh_docker.repo.j2" src: "rh_docker.repo.j2"
@ -118,7 +124,7 @@
force: "{{item.force|default(omit)}}" force: "{{item.force|default(omit)}}"
conf_file: "{{item.yum_conf|default(omit)}}" conf_file: "{{item.yum_conf|default(omit)}}"
state: present state: present
update_cache: yes update_cache: "{{ omit if ansible_distribution == 'Fedora' else True }}"
register: docker_task_result register: docker_task_result
until: docker_task_result|succeeded until: docker_task_result|succeeded
retries: 4 retries: 4
@ -130,13 +136,17 @@
- name: get available packages on Ubuntu - name: get available packages on Ubuntu
command: apt-cache policy docker-ce command: apt-cache policy docker-ce
when: docker_task_result|failed when:
- docker_task_result|failed
- ansible_distribution == 'Ubuntu'
register: available_packages register: available_packages
- name: show available packages on ubuntu - name: show available packages on ubuntu
fail: fail:
msg: "{{available_packages}}" msg: "{{available_packages}}"
when: docker_task_result|failed when:
- docker_task_result|failed
- ansible_distribution == 'Ubuntu'
# This is required to ensure any apt upgrade will not break kubernetes # This is required to ensure any apt upgrade will not break kubernetes
- name: Set docker pin priority to apt_preferences on Debian family - name: Set docker pin priority to apt_preferences on Debian family

View file

@ -0,0 +1,7 @@
[docker-ce]
name=Docker-CE Repository
baseurl={{ docker_fedora_repo_base_url }}
enabled=1
gpgcheck=1
gpgkey={{ docker_fedora_repo_gpgkey }}
{% if http_proxy is defined %}proxy={{ http_proxy }}{% endif %}

View file

@ -0,0 +1,20 @@
---
docker_kernel_min_version: '0'
# https://docs.docker.com/install/linux/docker-ce/fedora/
docker_versioned_pkg:
'latest': docker-ce
'18.03': docker-ce-18.03.1.ce-3.fc28
'18.06': docker-ce-18.06.1.ce-3.fc28
#
# This is due to the fact that the docker
# packages available on Fedora are too recent
#
docker_version: "latest"
docker_package_info:
pkg_mgr: dnf
pkgs:
- name: "{{ docker_versioned_pkg[docker_version | string] }}"

View file

@ -25,6 +25,12 @@
delay: "{{ retry_stagger | random + 3 }}" delay: "{{ retry_stagger | random + 3 }}"
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"
- name: install rkt pkg on fedora
dnf:
name: rkt
state: present
when: ansible_distribution == "Fedora"
- name: install rkt pkg on centos - name: install rkt pkg on centos
yum: yum:
pkg: "{{ rkt_download_url }}/{{ rkt_pkg_name }}" pkg: "{{ rkt_download_url }}/{{ rkt_pkg_name }}"
@ -33,7 +39,9 @@
until: rkt_task_result|succeeded until: rkt_task_result|succeeded
retries: 4 retries: 4
delay: "{{ retry_stagger | random + 3 }}" delay: "{{ retry_stagger | random + 3 }}"
when: ansible_os_family == "RedHat" when:
- ansible_os_family == "RedHat"
- ansible_distribution != "Fedora"
- name: install rkt pkg on openSUSE - name: install rkt pkg on openSUSE
zypper: zypper: