Commit 5d71c26a authored by Wen Wei Li's avatar Wen Wei Li

initial commit & need to validate

parents
hosts
inventory.ini
---
- name: Install K8S
hosts: cp
remote_user: prlab
become: true
become_user: root
tasks:
- name: update system
apt:
update_cache: yes
cache_valid_time: 3600
- name: install git
apt:
name: git
state: present
- name: git clone k8s installer
git:
repo: https://git.prlab.io/andrewli315/k8s-install
dest: /home/prlab/k8s/k8s-install
- name: copy hosts file
copy:
src: ./hosts
dest: /home/prlab/k8s/k8s-install
- name: install k8s CP and helm chart
shell: |
./k8s-install.sh ./hosts cp
./helm-install.sh
- name: execute k8s cmd
shell: |
echo "$(kubeadm token create --print-join-command)" > /tmp/join.sh
chmod +x /tmp/join.sh
- name: copy file
fetch:
src: '/tmp/join.sh'
dest: '/tmp/'
- name: get the result
hosts: localhost
tasks:
- name: cat
shell: |
cat /tmp/192.168.88.104/tmp/join.sh
- name: put the join.sh
hosts: nodes
remote_user: prlab
become: true
become_user: root
tasks:
- name: apt update
apt:
update_cache: yes
cache_valid_time: 3600
- name: install git
apt:
name: git
state: present
- name: git clone
ansible.builtin.git:
repo: https://git.prlab.io/andrewli315/k8s-install
dest: /home/prlab/k8s/k8s-install
- name: copy
copy:
src: ./hosts
dest: /home/prlab/k8s/k8s-install/hosts
- name: install k8s
shell: |
./k8s-install.sh hosts
echo "Install finish"
args:
chdir: /home/prlab/k8s/k8s-install
- name: copy join.sh
copy:
src: /tmp/192.168.88.104/tmp/join.sh
dest: /tmp/join.sh
- name: execute
shell: |
sh /tmp/join.sh
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment