diff --git a/cluster.yml b/cluster.yml index e10c0d2c9..ce169a161 100644 --- a/cluster.yml +++ b/cluster.yml @@ -28,6 +28,7 @@ roles: - { role: kubernetes/preinstall, tags: preinstall } - { role: docker, tags: docker } + - { role: rkt, tags: rkt } - hosts: etcd:!k8s-cluster any_errors_fatal: true diff --git a/inventory/group_vars/all.yml b/inventory/group_vars/all.yml index 839da100a..a3598e9db 100644 --- a/inventory/group_vars/all.yml +++ b/inventory/group_vars/all.yml @@ -197,3 +197,7 @@ k8s_image_pull_policy: IfNotPresent # default packages to install within the cluster kpm_packages: [] # - name: kube-system/grafana + +rkt_version: 1.21.0 +etcd_deployment_type: rkt +kubelet_deployment_type: docker diff --git a/roles/download/defaults/main.yml b/roles/download/defaults/main.yml index df9bd75c7..8c1225527 100644 --- a/roles/download/defaults/main.yml +++ b/roles/download/defaults/main.yml @@ -121,7 +121,7 @@ downloads: unarchive: true owner: "etcd" mode: "0755" - container: "{{ etcd_deployment_type == 'docker' }}" + container: "{{ etcd_deployment_type }} in [ 'docker', 'rkt' ]" repo: "{{ etcd_image_repo }}" tag: "{{ etcd_image_tag }}" hyperkube: diff --git a/roles/rkt/defaults/main.yml b/roles/rkt/defaults/main.yml new file mode 100644 index 000000000..6794429a5 --- /dev/null +++ b/roles/rkt/defaults/main.yml @@ -0,0 +1,6 @@ +--- + +rkt_version: 1.12.0 +rkt_pkg_version: "{{ rkt_version }}-1" +rkt_download_src: https://github.com/coreos/rkt +rkt_download_url: "{{ rkt_download_src }}/releases/download/v{{ rkt_version }}" diff --git a/roles/rkt/tasks/install.yml b/roles/rkt/tasks/install.yml new file mode 100644 index 000000000..0317c7a7e --- /dev/null +++ b/roles/rkt/tasks/install.yml @@ -0,0 +1,41 @@ +--- +- name: gather os specific variables for rkt + include_vars: "{{ item }}" + with_first_found: + - files: + - "{{ ansible_distribution|lower }}-{{ ansible_distribution_version|lower|replace('/', '_') }}.yml" + - "{{ ansible_distribution|lower }}-{{ ansible_distribution_release }}.yml" + - "{{ ansible_distribution|lower }}-{{ ansible_distribution_major_version|lower|replace('/', '_') }}.yml" + - "{{ ansible_distribution|lower }}.yml" + - "{{ ansible_os_family|lower }}.yml" + - defaults.yml + paths: + - ../vars + skip: true + tags: facts + +#- name: download rkt pkg +# get_url: +# url: "{{ rkt_download_url }}/{{rkt_pkg_name}}" +# dest: "{{ local_release_dir }}" +# when: (ansible_os_family != "CoreOS") and "rkt" in [ etcd_deployment_type, kubelet_deployment_type ] + +- name: install rkt pkg on ubuntu + apt: + deb: "{{ rkt_download_url }}/{{ rkt_pkg_name }}" + state: present + register: rkt_task_result + until: rkt_task_result|success + retries: 4 + delay: "{{ retry_stagger | random + 3 }}" + when: ansible_os_family == "Debian" and "rkt" in [ etcd_deployment_type, kubelet_deployment_type ] + +- name: "install rkt pkg on centos" + yum: + pkg: "{{ rkt_download_url }}/{{ rkt_pkg_name }}" + state: present + register: rkt_task_result + until: rkt_task_result|success + retries: 4 + delay: "{{ retry_stagger | random + 3 }}" + when: ansible_os_family == "RedHat" and "rkt" in [ etcd_deployment_type, kubelet_deployment_type ] diff --git a/roles/rkt/tasks/main.yml b/roles/rkt/tasks/main.yml new file mode 100644 index 000000000..9d87123bb --- /dev/null +++ b/roles/rkt/tasks/main.yml @@ -0,0 +1,4 @@ +--- + +- name: Install rkt + include: install.yml diff --git a/roles/rkt/vars/debian.yml b/roles/rkt/vars/debian.yml new file mode 100644 index 000000000..9cfffe5c9 --- /dev/null +++ b/roles/rkt/vars/debian.yml @@ -0,0 +1,2 @@ +--- +rkt_pkg_name: "rkt_{{ rkt_pkg_version }}_amd64.deb" diff --git a/roles/rkt/vars/fedora.yml b/roles/rkt/vars/fedora.yml new file mode 100644 index 000000000..13149e8fb --- /dev/null +++ b/roles/rkt/vars/fedora.yml @@ -0,0 +1,2 @@ +--- +rkt_pkg_name: "rkt-{{ rkt_pkg_version }}.x86_64.rpm" diff --git a/roles/rkt/vars/redhat.yml b/roles/rkt/vars/redhat.yml new file mode 100644 index 000000000..13149e8fb --- /dev/null +++ b/roles/rkt/vars/redhat.yml @@ -0,0 +1,2 @@ +--- +rkt_pkg_name: "rkt-{{ rkt_pkg_version }}.x86_64.rpm"