Permalink
Fetching contributors…
Cannot retrieve contributors at this time
69 lines (60 sloc) 1.7 KB
- name: Install k8s APT repo GPG key
apt_key:
url: 'https://packages.cloud.google.com/apt/doc/apt-key.gpg'
state: present
- name: Install Docker APT repo GPG key
apt_key:
id: F76221572C52609D
keyserver: keyserver.ubuntu.com
state: present
- name: Setup k8s APT repo
apt_repository:
repo: deb http://apt.kubernetes.io/ kubernetes-xenial main
state: present
- name: Setup Docker APT repo
apt_repository:
repo: deb http://apt.dockerproject.org/repo ubuntu-xenial main
state: present
- name: Install docker and kubernetes packages
apt:
name: "{{item}}"
state: installed
update_cache: yes
with_items:
- docker-engine=1.12.6-0~ubuntu-xenial
- kubelet=1.10.0-00
- kubeadm=1.10.0-00
- kubectl=1.10.0-00
- kubernetes-cni=0.6.0-00
- name: configure docker to use journald
copy:
content: |
{
"log-driver": "journald"
}
dest: /etc/docker/daemon.json
owner: root
group: root
mode: 0644
notify:
- Restart docker
- name: add hosts
lineinfile:
dest: "/etc/hosts"
regexp: ".*{{ hostvars[item].ansible_hostname }}$"
line: "{{ hostvars[item].ansible_default_ipv4.address }} {{ hostvars[item].ansible_hostname }}"
state: present
when: hostvars[item].ansible_hostname is defined
with_items: "{{groups['all'] | default([])}}"
- name: Create OpenStack cloud configuration
template:
src: files/cloud-config.j2
dest: /etc/kubernetes/cloud-config
mode: 0600
- name: Override default kubeadm configuration to use the OpenStack cloud configuration
copy:
src: files/10-kubeadm.conf
dest: /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
mode: 0600
notify:
- Restart kubelet