Rework inventory all by real groups' vars

* Leave all.yml to keep only optional vars
* Store groups' specific vars by existing group names
* Fix optional vars casted as mandatory (add default())
* Fix missing defaults for an optional IP var
* Relink group_vars for terraform to reflect changes

Signed-off-by: Bogdan Dobrelya <bogdando@mail.ru>
This commit is contained in:
Bogdan Dobrelya
2016-12-27 16:39:00 +01:00
parent 8cbf3fe5f8
commit 712872efba
17 changed files with 263 additions and 201 deletions

View File

@@ -1,4 +1,6 @@
---
kube_cert_group: kube-cert
addusers:
etcd:
name: etcd

View File

@@ -18,6 +18,7 @@ download_localhost: False
download_always_pull: False
# Versions
kube_version: v1.5.3
etcd_version: v3.0.6
#TODO(mattymo): Move calico versions to roles/network_plugins/calico/defaults
# after migration to container download

View File

@@ -4,7 +4,7 @@
name: "kpm"
state: "present"
version: "0.16.1"
when: kpm_packages | length > 0
when: kpm_packages|default([])| length > 0
- name: manage kubernetes applications
kpm:
@@ -14,7 +14,7 @@
version: "{{item.version | default(omit)}}"
variables: "{{item.variables | default(omit)}}"
name: "{{item.name}}"
with_items: "{{kpm_packages}}"
with_items: "{{kpm_packages|default([])}}"
register: kpmresults
environment:
PATH: "{{ ansible_env.PATH }}:{{ bin_dir }}"

View File

@@ -16,7 +16,7 @@ stream {
}
server {
listen 127.0.0.1:{{ nginx_kube_apiserver_port }};
listen 127.0.0.1:{{ nginx_kube_apiserver_port|default(kube_apiserver_port) }};
proxy_pass kube_apiserver;
proxy_timeout 10m;
proxy_connect_timeout 1s;

View File

@@ -17,6 +17,8 @@ common_required_pkgs:
# GCE docker repository
disable_ipv6_dns: false
kube_cert_group: kube-cert
kube_config_dir: /etc/kubernetes
# For the openstack integration kubelet will need credentials to access
# openstack apis like nova and cinder. Per default this values will be
@@ -27,9 +29,6 @@ openstack_password: "{{ lookup('env','OS_PASSWORD') }}"
openstack_region: "{{ lookup('env','OS_REGION_NAME') }}"
openstack_tenant_id: "{{ lookup('env','OS_TENANT_ID')|default(lookup('env','OS_PROJECT_ID'),true) }}"
# All clients access each node individually, instead of using a load balancer.
etcd_multiaccess: true
# Container Linux by CoreOS cloud init config file to define /etc/resolv.conf content
# for hostnet pods and infra needs
resolveconf_cloud_init_conf: /etc/resolveconf_cloud_init.conf

View File

@@ -20,8 +20,8 @@
- set_fact:
kube_apiserver_endpoint: |-
{% if not is_kube_master and loadbalancer_apiserver_localhost -%}
https://localhost:{{ nginx_kube_apiserver_port }}
{% if not is_kube_master and loadbalancer_apiserver_localhost|default(false) -%}
https://localhost:{{ nginx_kube_apiserver_port|default(kube_apiserver_port) }}
{%- elif is_kube_master and loadbalancer_apiserver is not defined -%}
http://127.0.0.1:{{ kube_apiserver_insecure_port }}
{%- else -%}
@@ -57,7 +57,7 @@
{%- endfor %}
- set_fact:
etcd_access_endpoint: "{% if etcd_multiaccess %}{{ etcd_access_addresses }}{% else %}{{ etcd_endpoint }}{% endif %}"
etcd_access_endpoint: "{% if etcd_multiaccess|default(true) %}{{ etcd_access_addresses }}{% else %}{{ etcd_endpoint }}{% endif %}"
- set_fact:
etcd_member_name: |-

View File

@@ -0,0 +1,2 @@
---
kube_cert_group: kube-cert

View File

@@ -223,7 +223,7 @@
"apiVersion": "v1",
"metadata": {"node": "{{ inventory_hostname }}",
"scope": "node",
"peerIP": "{{ hostvars[item]["calico_rr_ip"]|default(hostvars[item]["ip"]) }}"}
"peerIP": "{{ hostvars[item]["calico_rr_ip"]|default(hostvars[item]["ip"])|default(hostvars[item]["ansible_default_ipv4.address"]) }}"}
}'
| {{ bin_dir }}/calicoctl create --skip-exists -f -
with_items: "{{ groups['calico-rr'] | default([]) }}"
@@ -245,7 +245,7 @@
peer_with_router|default(false) and inventory_hostname in groups['k8s-cluster'])
- name: Calico (old) | Configure peering with route reflectors
shell: "{{ bin_dir }}/calicoctl node bgp peer add {{ hostvars[item]['calico_rr_ip']|default(hostvars[item]['ip']) }} as {{ local_as | default(global_as_num) }}"
shell: "{{ bin_dir }}/calicoctl node bgp peer add {{ hostvars[item]['calico_rr_ip']|default(hostvars[item]['ip'])|default(hostvars[item]['ansible_default_ipv4.address']) }} as {{ local_as | default(global_as_num) }}"
with_items: "{{ groups['calico-rr'] | default([]) }}"
when: (legacy_calicoctl and
peer_with_calico_rr|default(false) and inventory_hostname in groups['k8s-cluster']

View File

@@ -1,6 +1,6 @@
---
rkt_version: 1.12.0
rkt_version: 1.21.0
rkt_pkg_version: "{{ rkt_version }}-1"
rkt_download_src: https://github.com/coreos/rkt
rkt_download_url: "{{ rkt_download_src }}/releases/download/v{{ rkt_version }}"