variable rename and comment

This commit is contained in:
Tim 2017-07-05 11:41:10 +02:00
parent beb2a1304f
commit faed1a7b02
5 changed files with 34 additions and 31 deletions

View file

@ -1,5 +1,5 @@
# Valid bootstrap options (required): ubuntu, coreos, centos, none # Valid bootstrap options (required): ubuntu, coreos, centos, none
bootstrap_os: ubuntu bootstrap_os: none
#Directory where etcd data stored #Directory where etcd data stored
etcd_data_dir: /var/lib/etcd etcd_data_dir: /var/lib/etcd

View file

@ -69,14 +69,24 @@ kube_users:
# Choose network plugin (calico, weave or flannel) # Choose network plugin (calico, weave or flannel)
# Can also be set to 'cloud', which lets the cloud provider setup appropriate routing # Can also be set to 'cloud', which lets the cloud provider setup appropriate routing
kube_network_plugin: weave kube_network_plugin: calico
# weave's network password for encryption # weave's network password for encryption
# if null then no network encryption # if null then no network encryption
# you can use --extra-vars to pass the password in command line
weave_password: ~t94S:mweJN}32-K weave_password: ~t94S:mweJN}32-K
# Set true for use weave's seed mode # Weave uses consensus mode by default
weave_mode_seed: true # Enabling seed mode allow to dynamically add or remove hosts
# https://www.weave.works/docs/net/latest/ipam/
weave_mode_seed: false
# This two variable are automatically changed by the weave's role, do not manually change these values
# To reset values :
# seed: unset
# peers: unset
weave_seed: unset
weave_peers: unset
# Enable kubernetes network policies # Enable kubernetes network policies
enable_network_policy: false enable_network_policy: false

View file

@ -1,7 +0,0 @@
# This file is use to save seed and peers values for weave's seed mode
# This two variable are automatically changed by the weave's role
# For reset values :
# seed: unset
# peers: unset
seed: fa:16:3e:b5:ea:aa,fa:16:3e:47:29:c6
peers: 192.168.208.13 192.168.208.9

View file

@ -1,37 +1,37 @@
- name: Weave seed | Set seed first time - name: Weave seed | Set seed if first time
set_fact: set_fact:
weave_seed: '{% for host in groups["k8s-cluster"] %}{{ hostvars[host]["ansible_default_ipv4"]["macaddress"] }}{% if not loop.last %},{% endif %}{% endfor %}' seed: '{% for host in groups["k8s-cluster"] %}{{ hostvars[host]["ansible_default_ipv4"]["macaddress"] }}{% if not loop.last %},{% endif %}{% endfor %}'
when: "seed == 'unset'" when: "weave_seed == 'unset'"
run_once: true run_once: true
tags: confweave tags: confweave
- name: Weave seed | Set seed - name: Weave seed | Set seed if not first time
set_fact: set_fact:
weave_seed: '{{ seed }}' seed: '{{ weave_seed }}'
when: "seed != 'unset'" when: "weave_seed != 'unset'"
run_once: true run_once: true
tags: confweave tags: confweave
- name: Weave seed | Set peers fist time - name: Weave seed | Set peers if fist time
set_fact: set_fact:
weave_peers: '{{ weave_ip_current_cluster }}' peers: '{{ weave_ip_current_cluster }}'
when: "peers == 'unset'" when: "weave_peers == 'unset'"
run_once: true run_once: true
tags: confweave tags: confweave
- name: Weave seed | Set peers with existing peers - name: Weave seed | Set peers if existing peers
set_fact: set_fact:
weave_peers: '{{ peers }}{% if weave_ip_current_cluster not in peers %} {{ weave_ip_current_cluster }}{% endif %}' peers: '{{ weave_peers }}{% if weave_ip_current_cluster not in peers %} {{ weave_ip_current_cluster }}{% endif %}'
when: "peers != 'unset'" when: "weave_peers != 'unset'"
run_once: true run_once: true
tags: confweave tags: confweave
- name: Weave seed | Save seed - name: Weave seed | Save seed
lineinfile: lineinfile:
dest: "./inventory/group_vars/k8s-fede.yml" dest: "./inventory/group_vars/k8s-cluster.yml"
state: present state: present
regexp: '^seed:' regexp: '^weave_seed:'
line: 'seed: {{ weave_seed }}' line: 'weave_seed: {{ seed }}'
become_user: $USER become_user: $USER
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
run_once: true run_once: true
@ -39,10 +39,10 @@
- name: Weave seed | Save peers - name: Weave seed | Save peers
lineinfile: lineinfile:
dest: "./inventory/group_vars/k8s-fede.yml" dest: "./inventory/group_vars/k8s-cluster.yml"
state: present state: present
regexp: '^peers:' regexp: '^weave_peers:'
line: 'peers: {{ weave_peers }}' line: 'weave_peers: {{ peers }}'
become_user: $USER become_user: $USER
delegate_to: 127.0.0.1 delegate_to: 127.0.0.1
run_once: true run_once: true

View file

@ -82,9 +82,9 @@ items:
value: {{ kube_pods_subnet }} value: {{ kube_pods_subnet }}
{% if weave_mode_seed == true %} {% if weave_mode_seed == true %}
- name: KUBE_PEERS - name: KUBE_PEERS
value: {{ weave_peers }} value: {{ peers }}
- name: IPALLOC_INIT - name: IPALLOC_INIT
value: seed={{ weave_seed }} value: seed={{ seed }}
{% endif %} {% endif %}
- name: WEAVE_PASSWORD - name: WEAVE_PASSWORD
value: {{ weave_password }} value: {{ weave_password }}