Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
jijisa
/
porch
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
96f48a34
authored
Apr 13, 2017
by
Heechul Kim
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
ucim-minion app template added
parent
8d2405f2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
238 additions
and
0 deletions
porch/templates/ucim-minion_main.j2
porch/templates/ucim-minion_site.j2
porch/templates/ucim-minion_main.j2
0 → 100644
View file @
96f48a34
{% raw %}
---
- name: Disable and stop firewalld
service: name=firewalld state=stopped enabled=no
- name: Disable selinux
selinux: state=disabled
- name: Ensure the required packages are installed.
yum: name={{ item }} state=latest update_cache=yes
with_items:
- lvm2
- parted
- ntp
- bind-utils
- epel-release
- name: Set timezone to {{ timezone }}
timezone: name={{ timezone }}
- name: Enable and Start ntpd
service: name=ntpd state=restarted enabled=yes
- name: Stop containers if running.
shell: docker stop $(docker ps -q)
ignore_errors: yes
- name: Stop docker engine if it is running.
service:
name: docker
state: stopped
ignore_errors: yes
- name: Delete /var/lib/docker
file:
path: /var/lib/docker
state: absent
- name: Delete /etc/sysconfig/docker-storage
file:
path: /etc/sysconfig/docker-storage
state: absent
- name: Delete docker/docker-pool
lvol:
vg: docker
lv: docker-pool
state: absent
force: yes
- name: Install docker container engine package
yum:
name: "{{ item }}"
state: latest
with_items:
- docker
- python-pip
- name: Put /etc/sysconfig/docker file.
template:
src: docker.j2
dest: /etc/sysconfig/docker
- name: Check for {{ docker_devs }}
command: parted -s {{ docker_devs }} print {{ docker_devs_partno }}
register: docker_lvm
failed_when: docker_lvm.rc is not defined
changed_when: >
docker_lvm.stdout == "Error: partition does not exists."
- name: Get the free space for {{ docker_devs }}
shell: "parted -m {{ docker_devs }} unit s print free|grep 'free;' |tail -1 |cut -f2 -d':'"
register: mkpart_start
- name: Create {{ docker_devs }}{{ docker_devs_partno }}
command: parted -s {{ docker_devs }} mkpart primary {{ mkpart_start.stdout }} 100%
when: docker_lvm.rc != 0
- name: Add LVM flag to {{ docker_devs}}{{ docker_devs_partno }}
command: parted -s {{ docker_devs}} set {{ docker_devs_partno }} lvm on
when: docker_lvm.rc != 0
- name: Create VG docker with PV {{ docker_devs }}{{ docker_devs_partno }}
lvg:
vg: docker
pvs: "{{ docker_devs }}{{ docker_devs_partno }}"
- name: Put /etc/sysconfig/docker-storage-setup file.
template:
src: docker-storage-setup.j2
dest: /etc/sysconfig/docker-storage-setup
- name: Run docker-storage-setup
command: docker-storage-setup
- name: Enable and Start docker
service:
name: docker
state: restarted
enabled: yes
- name: Set up the operator user '{{ kubic_user }}'
user:
name: "{{ kubic_user }}"
comment: "KUBIC user"
groups: wheel,dockerroot
append: yes
password: "{{ kubic_password }}"
- name: Install docker-py module.
shell: /usr/bin/pip install docker-py
- name: Install flannel overlay network package
yum:
name: flannel
state: latest
- name: Create a directory for etcd certs
file:
path: /etc/ssl/etcd
state: directory
- name: Copy etcd certificate.
copy:
src: etcd-certs/
dest: /etc/ssl/etcd/
force: yes
- name: Configure flannel
template:
src: flanneld.j2
dest: /etc/sysconfig/flanneld
- name: Enable and start flanneld
service:
name: flanneld
state: restarted
enabled: yes
- name: Install kubernetes node package
yum:
name: kubernetes-node
state: latest
- name: Create a directory for k8s certs
file:
path: /etc/ssl/k8s
state: directory
mode: 0755
owner: kube
group: kube
- name: Copy k8s cert files into /etc/ssl/k8s/
copy:
src: k8s-certs/
dest: /etc/ssl/k8s/
mode: 0600
owner: kube
group: kube
force: yes
- name: Delete kubeconfig if exists.
file:
path: "{{ kubeconfig }}"
state: absent
- name: Set cluster on kubeconfig
shell: >
kubectl config --kubeconfig={{ kubeconfig }} \
set-cluster {{ kubic_user }} \
--server=https://{{ master_ip }}:{{ master_port }} \
--certificate-authority=/etc/ssl/k8s/ca.pem \
--embed-certs=true
- name: Set credential on kubeconfig
shell: >
kubectl config --kubeconfig={{ kubeconfig }} \
set-credentials kubelet \
--client-certificate=/etc/ssl/k8s/client.pem \
--client-key=/etc/ssl/k8s/client-key.pem \
--embed-certs=true \
--token=$(cut -d',' -f1 /etc/ssl/k8s/tokens.csv)
- name: Set context on kubeconfig
shell: >
kubectl config --kubeconfig={{ kubeconfig }} \
set-context kubelet-context \
--cluster={{ kubic_user }} \
--user=kubelet
- name: Use context on kubeconfig
shell: >
kubectl config --kubeconfig={{ kubeconfig }} \
use-context kubelet-context
- name: Configure kubelet
template:
src: "{{ item }}.j2"
dest: "/etc/kubernetes/{{ item }}"
with_items:
- config
- kubelet
- proxy
- name: Stop minion dynamic duo
service:
name: "{{ item }}"
state: stopped
enabled: yes
with_items: "{{ dynamic_duo }}"
- name: Copy kube{let,-proxy} lastest binaries
copy:
src: "/usr/local/bin/{{ item }}"
dest: "/usr/bin/{{ item }}"
mode: 0755
with_items: "{{ dynamic_duo }}"
- name: Enable and start minion dynamic duo
service:
name: "{{ item }}"
state: restarted
enabled: yes
with_items: "{{ dynamic_duo }}"
...
{% endraw %}
porch/templates/ucim-minion_site.j2
0 → 100644
View file @
96f48a34
---
# This playbook deploys kubernetes minion stack on centos 7.
- name: Install kubernetes minion.
hosts: all
roles:
- ucim-minion
environment:
http_proxy: http://{{ d['proxy_url'] }}:{{ d['proxy_port'] }}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment