Skip to content

Commit

Permalink
docker proxy, specify k3s version
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffkight committed Nov 18, 2019
1 parent f36d631 commit e075be7
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 5 deletions.
9 changes: 9 additions & 0 deletions hosts-example.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
all:
hosts:
localhost:
# necessary for MacOS using venv
ansible_python_interpreter: /Users/jeff/venv/bin/python
kubeconfig: credentials/k3s.yaml
node-19:
node-21:
node-22:
Expand All @@ -24,20 +27,25 @@ all:
k3s_workers:
rancher:
vars:
# use centos or ubuntu as appropriate for ansible_user
ansible_user: ubuntu
env_proxy: no
proxy: "http://proxy.kightlabs.net:8080"
no_proxy: "localhost,127.0.0.1,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"
wipe_disks: yes
wipe_disks_list:
- /dev/sdb
kubeconfig: credentials/k3s.yaml
k3s_version: "v1.0.0-rc5"
k3s_exec: "--disable-agent --write-kubeconfig-mode 644"


k3s_masters:
hosts:
node-19:
vars:


k3s_workers:
hosts:
node-21:
Expand All @@ -48,6 +56,7 @@ all:
node-30:
vars:


rancher:
hosts:
node-3:
Expand Down
2 changes: 1 addition & 1 deletion roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
# tasks file for common

- name: wipe disks
- name: wipe disks GPT partition tables
shell: sgdisk --zap-all {{ item }}
when: wipe_disks
loop: "{{ wipe_disks_list }}"
Expand Down
3 changes: 3 additions & 0 deletions roles/docker/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
- name: install docker python library
pip:
name: docker
environment:
http_proxy: "{{ proxy }}"
https_proxy: "{{ proxy }}"
become: yes

- name: create systemd directory for docker proxy
Expand Down
2 changes: 1 addition & 1 deletion roles/docker/templates/http-proxy.conf.j2
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[Service]
Environment="HTTP_PROXY={{ proxy }}/"
Environment="HTTP_PROXY={{ proxy }}/" "HTTPS_PROXY={{ proxy }}/" "NO_PROXY={{ no_proxy }}"
3 changes: 2 additions & 1 deletion roles/k3s-master/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
- name: install k3s on master without agent
shell: >
curl -sfL https://get.k3s.io |
INSTALL_K3S_EXEC="--disable-agent --write-kubeconfig-mode 644"
INSTALL_K3S_EXEC="{{ k3s_exec }}"
INSTALL_K3S_VERSION="{{ k3s_version }}"
sh -
args:
creates: /usr/local/bin/k3s
Expand Down
5 changes: 3 additions & 2 deletions roles/k3s-workers/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
- name: install k3s on workers
shell: >
curl -sfL https://get.k3s.io |
K3S_URL=https://{{ master_ip }}:6443
K3S_TOKEN={{ node_token }}
INSTALL_K3S_VERSION="{{ k3s_version }}"
K3S_URL="https://{{ master_ip }}:6443"
K3S_TOKEN="{{ node_token }}"
sh -
args:
creates: /usr/local/bin/k3s
Expand Down

0 comments on commit e075be7

Please sign in to comment.