Ansible: Run from locally built binaries

Instead of from distro packages
pull/6/head
Eric Paris 2015-07-11 17:25:51 -04:00
parent c3849fd240
commit 90ecd96f84
15 changed files with 151 additions and 11 deletions

View File

@ -1,3 +1,11 @@
# This value determines how kubernetes binaries, config files, and service
# files are loaded onto the target machines. The following are the only
# valid options:
#
# localBuild - requires make release to have been run to build local binaries
# packageManager - will install packages from your distribution using yum/dnf/apt
source_type: localBuild
# will be used as the Internal dns domain name if DNS is enabled. Services
# will be discoverable under <service-name>.<namespace>.svc.<domainname>, e.g.
# myservice.default.svc.cluster.local

View File

@ -1,4 +1,9 @@
---
- name: reload systemd
command: /usr/bin/systemctl --system daemon-reload
notify:
- restart daemons
- name: restart daemons
command: /bin/true
notify:

View File

@ -0,0 +1,29 @@
---
- name: Copy master binaries
copy:
src: ../../_output/local/go/bin/{{ item }}
dest: /usr/bin/
mode: 755
with_items:
- kube-apiserver
- kube-scheduler
- kube-controller-manager
- kubectl
- name: Copy master service files
copy:
src: ../init/systemd/{{ item }}
dest: /etc/systemd/system/
mode: 644
with_items:
- kube-apiserver.service
- kube-scheduler.service
- kube-controller-manager.service
notify: reload systemd
- name: Copy systemd tmpfile for apiserver
copy:
src: ../init/systemd/tmpfiles.d/
dest: /etc/tmpfiles.d/
mode: 644
notify: reload systemd

View File

@ -1,9 +1,9 @@
---
- include: generic-install.yml
when: not is_atomic and not ansible_distribution == "CentOS"
- include: packageManagerInstall.yml
when: source_type == "packageManager"
- include: centos.yml
when: not is_atomic and ansible_distribution == "CentOS"
- include: localBuildInstall.yml
when: source_type == "localBuild"
- name: write the config file for the api server
template: src=apiserver.j2 dest={{ kube_config_dir }}/apiserver

View File

@ -0,0 +1,23 @@
---
- include: pkgMgrInstallers/centos-install.yml
when: ansible_distribution == "CentOS"
- name: Set fact saying we did CentOS package install
set_fact:
did_install: true
when: ansible_distribution == "CentOS"
- include: pkgMgrInstallers/fedora-install.yml
when: ansible_distribution == "Fedora" and ansible_distribution_release != "Rawhide"
- name: Set fact saying we did Fedora package install
set_fact:
did_install: true
when: ansible_distribution == "Fedora" and ansible_distribution_release != "Rawhide"
- include: pkgMgrInstallers/generic-install.yml
when: not did_install

View File

@ -1,8 +1,9 @@
---
- name: CentOS | Install kubernetes master
- name: CentOS | Install kubernetes master
yum:
pkg=kubernetes-master
state=latest
enablerepo=virt7-docker-common-candidate
notify:
- restart daemons
when: not is_atomic

View File

@ -0,0 +1,9 @@
- name: Fedora | Install kubernetes master
action: "{{ ansible_pkg_mgr }}"
args:
name: kubernetes-master
state: latest
enablerepo: "updates-testing"
notify:
- restart daemons
when: not is_atomic

View File

@ -1,7 +1,8 @@
- name: Install kubernetes
- name: Generic | Install kubernetes master
action: "{{ ansible_pkg_mgr }}"
args:
name: kubernetes-master
state: latest
notify:
- restart daemons
when: not is_atomic

View File

@ -1,4 +1,9 @@
---
- name: reload systemd
command: /usr/bin/systemctl --system daemon-reload
notify:
- restart daemons
- name: restart daemons
command: /bin/true
notify:

View File

@ -0,0 +1,25 @@
---
- name: Copy node binaries
copy:
src: ../../_output/local/go/bin/{{ item }}
dest: /usr/bin/
mode: 755
with_items:
- kubelet
- kube-proxy
- kubectl
- name: Copy node service files
copy:
src: ../init/systemd/{{ item }}
dest: /etc/systemd/system/
mode: 644
with_items:
- kube-proxy.service
- kubelet.service
notify: reload systemd
- name: Create the /var/lib/kubelet working directory
file:
path: /var/lib/kubelet
state: directory

View File

@ -8,11 +8,11 @@
selinux: state=permissive policy=targeted
when: "'Enforcing' in selinux.stdout"
- include: generic-install.yml
when: not is_atomic and not ansible_distribution == "CentOS"
- include: packageManagerInstall.yml
when: source_type == "packageManager"
- include: centos.yml
when: not is_atomic and ansible_distribution == "CentOS"
- include: localBuildInstall.yml
when: source_type == "localBuild"
- name: Make sure manifest directory exists
file: path={{ kube_manifest_dir }} state=directory

View File

@ -0,0 +1,23 @@
---
- include: pkgMgrInstallers/centos-install.yml
when: ansible_distribution == "CentOS"
- name: Set fact saying we did CentOS package install
set_fact:
did_install: true
when: ansible_distribution == "CentOS"
- include: pkgMgrInstallers/fedora-install.yml
when: ansible_distribution == "Fedora" and ansible_distribution_release != "Rawhide"
- name: Set fact saying we did Fedora package install
set_fact:
did_install: true
when: ansible_distribution == "Fedora" and ansible_distribution_release != "Rawhide"
- include: pkgMgrInstallers/generic-install.yml
when: not did_install

View File

@ -6,3 +6,4 @@
enablerepo=virt7-docker-common-candidate
notify:
- restart daemons
when: not is_atomic

View File

@ -0,0 +1,9 @@
- name: Fedora | Install kubernetes node
action: "{{ ansible_pkg_mgr }}"
args:
name: kubernetes-node
state: latest
enablerepo: "updates-testing"
notify:
- restart daemons
when: not is_atomic

View File

@ -1,7 +1,8 @@
- name: Install kubernetes
- name: Generic | Install kubernetes node
action: "{{ ansible_pkg_mgr }}"
args:
name: kubernetes-node
state: latest
notify:
- restart daemons
when: not is_atomic