You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

245 lines
10 KiB

  1. ---
  2. ## Required for bootstrap-os/preinstall/download roles and setting facts
  3. # Valid bootstrap options (required): ubuntu, coreos, centos, none
  4. bootstrap_os: none
  5. # Use proxycommand if bastion host is in group all
  6. # This change obseletes editing ansible.cfg file depending on bastion existance
  7. ansible_ssh_common_args: "{% if 'bastion' in groups['all'] %} -o ProxyCommand='ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -W %h:%p {{ ansible_user }}@{{hostvars['bastion']['ansible_host']}} ' {% endif %}"
  8. kube_api_anonymous_auth: false
  9. # Default value, but will be set to true automatically if detected
  10. is_atomic: false
  11. ## Change this to use another Kubernetes version, e.g. a current beta release
  12. kube_version: v1.8.4
  13. # Set to true to allow pre-checks to fail and continue deployment
  14. ignore_assert_errors: false
  15. # Directory where the binaries will be installed
  16. bin_dir: /usr/local/bin
  17. docker_bin_dir: /usr/bin
  18. etcd_data_dir: /var/lib/etcd
  19. # Where the binaries will be downloaded.
  20. # Note: ensure that you've enough disk space (about 1G)
  21. local_release_dir: "/tmp/releases"
  22. # Random shifts for retrying failed ops like pushing/downloading
  23. retry_stagger: 5
  24. # DNS configuration.
  25. # Kubernetes cluster name, also will be used as DNS domain
  26. cluster_name: cluster.local
  27. # Subdomains of DNS domain to be resolved via /etc/resolv.conf for hostnet pods
  28. ndots: 2
  29. # Can be dnsmasq_kubedns, kubedns or none
  30. dns_mode: kubedns
  31. # Can be docker_dns, host_resolvconf or none
  32. resolvconf_mode: docker_dns
  33. # Deploy netchecker app to verify DNS resolve as an HTTP service
  34. deploy_netchecker: false
  35. # Ip address of the kubernetes skydns service
  36. skydns_server: "{{ kube_service_addresses|ipaddr('net')|ipaddr(3)|ipaddr('address') }}"
  37. dnsmasq_dns_server: "{{ kube_service_addresses|ipaddr('net')|ipaddr(2)|ipaddr('address') }}"
  38. dns_domain: "{{ cluster_name }}"
  39. # Kubernetes configuration dirs and system namespace.
  40. # Those are where all the additional config stuff goes
  41. # the kubernetes normally puts in /srv/kubernets.
  42. # This puts them in a sane location and namespace.
  43. # Editting those values will almost surely break something.
  44. kube_config_dir: /etc/kubernetes
  45. kube_script_dir: "{{ bin_dir }}/kubernetes-scripts"
  46. kube_manifest_dir: "{{ kube_config_dir }}/manifests"
  47. system_namespace: kube-system
  48. # This is where all the cert scripts and certs will be located
  49. kube_cert_dir: "{{ kube_config_dir }}/ssl"
  50. # This is where all of the bearer tokens will be stored
  51. kube_token_dir: "{{ kube_config_dir }}/tokens"
  52. # This is where to save basic auth file
  53. kube_users_dir: "{{ kube_config_dir }}/users"
  54. # This is the group that the cert creation scripts chgrp the
  55. # cert files to. Not really changable...
  56. kube_cert_group: kube-cert
  57. # Cluster Loglevel configuration
  58. kube_log_level: 2
  59. # Users to create for basic auth in Kubernetes API via HTTP
  60. kube_api_pwd: "changeme"
  61. kube_users:
  62. kube:
  63. pass: "{{kube_api_pwd}}"
  64. role: admin
  65. # Choose network plugin (calico, weave or flannel)
  66. # Can also be set to 'cloud', which lets the cloud provider setup appropriate routing
  67. kube_network_plugin: calico
  68. # Determines if calico-rr group exists
  69. peer_with_calico_rr: "{{ 'calico-rr' in groups and groups['calico-rr']|length > 0 }}"
  70. # Kubernetes internal network for services, unused block of space.
  71. kube_service_addresses: 10.233.0.0/18
  72. # internal network. When used, it will assign IP
  73. # addresses from this range to individual pods.
  74. # This network must be unused in your network infrastructure!
  75. kube_pods_subnet: 10.233.64.0/18
  76. # internal network node size allocation (optional). This is the size allocated
  77. # to each node on your network. With these defaults you should have
  78. # room for 4096 nodes with 254 pods per node.
  79. kube_network_node_prefix: 24
  80. # The virtual cluster IP, real host IPs and ports the API Server will be
  81. # listening on.
  82. # NOTE: loadbalancer_apiserver_localhost somewhat alters the final API enpdoint
  83. # access IP value (automatically evaluated below)
  84. kube_apiserver_ip: "{{ kube_service_addresses|ipaddr('net')|ipaddr(1)|ipaddr('address') }}"
  85. kube_apiserver_bind_address: 0.0.0.0
  86. # https
  87. kube_apiserver_port: 6443
  88. # http
  89. kube_apiserver_insecure_bind_address: 127.0.0.1
  90. kube_apiserver_insecure_port: 8080
  91. # Path used to store Docker data
  92. docker_daemon_graph: "/var/lib/docker"
  93. # Docker log options
  94. # Rotate container stderr/stdout logs at 50m and keep last 5
  95. docker_log_opts: "--log-opt max-size=50m --log-opt max-file=5"
  96. ## A string of extra options to pass to the docker daemon.
  97. ## This string should be exactly as you wish it to appear.
  98. ## An obvious use case is allowing insecure-registry access
  99. ## to self hosted registries like so:
  100. docker_options: "--insecure-registry={{ kube_service_addresses }} --graph={{ docker_daemon_graph }} {{ docker_log_opts }}"
  101. # Settings for containerized control plane (etcd/kubelet/secrets)
  102. etcd_deployment_type: docker
  103. kubelet_deployment_type: docker
  104. cert_management: script
  105. vault_deployment_type: docker
  106. helm_deployment_type: host
  107. # Enable kubeadm deployment (experimental)
  108. kubeadm_enabled: false
  109. kubeadm_token: "abcdef.0123456789abcdef"
  110. # Make a copy of kubeconfig on the host that runs Ansible in GITDIR/artifacts
  111. kubeconfig_localhost: false
  112. # Download kubectl onto the host that runs Ansible in GITDIR/artifacts
  113. kubectl_localhost: false
  114. # K8s image pull policy (imagePullPolicy)
  115. k8s_image_pull_policy: IfNotPresent
  116. # Addons which can be enabled
  117. efk_enabled: false
  118. helm_enabled: false
  119. istio_enabled: false
  120. enable_network_policy: false
  121. local_volumes_enabled: false
  122. # Base path for local volume provisioner addon
  123. local_volume_base_dir: /mnt/disks
  124. ## When OpenStack is used, Cinder version can be explicitly specified if autodetection fails (https://github.com/kubernetes/kubernetes/issues/50461)
  125. # openstack_blockstorage_version: "v1/v2/auto (default)"
  126. ## When OpenStack is used, if LBaaSv2 is available you can enable it with the following variables.
  127. openstack_lbaas_enabled: false
  128. # openstack_lbaas_subnet_id: "Neutron subnet ID (not network ID) to create LBaaS VIP"
  129. # openstack_lbaas_floating_network_id: "Neutron network ID (not subnet ID) to get floating IP from, disabled by default"
  130. # openstack_lbaas_create_monitor: "yes"
  131. # openstack_lbaas_monitor_delay: false
  132. # openstack_lbaas_monitor_timeout: false
  133. # openstack_lbaas_monitor_max_retries: false
  134. ## List of authorization modes that must be configured for
  135. ## the k8s cluster. Only 'AlwaysAllow', 'AlwaysDeny', 'Node' and
  136. ## 'RBAC' modes are tested. Order is important.
  137. authorization_modes: ['Node', 'RBAC']
  138. rbac_enabled: "{{ 'RBAC' in authorization_modes or kubeadm_enabled }}"
  139. ## List of key=value pairs that describe feature gates for
  140. ## the k8s cluster.
  141. kube_feature_gates: ['Initializers={{ istio_enabled|string }}', 'PersistentLocalVolumes={{ local_volumes_enabled|string }}']
  142. # Vault data dirs.
  143. vault_base_dir: /etc/vault
  144. vault_cert_dir: "{{ vault_base_dir }}/ssl"
  145. vault_config_dir: "{{ vault_base_dir }}/config"
  146. vault_roles_dir: "{{ vault_base_dir }}/roles"
  147. vault_secrets_dir: "{{ vault_base_dir }}/secrets"
  148. ## Set no_proxy to all assigned cluster IPs and hostnames
  149. no_proxy: >-
  150. {%- if loadbalancer_apiserver is defined -%}
  151. {{ apiserver_loadbalancer_domain_name| default('') }},
  152. {{ loadbalancer_apiserver.address | default('') }},
  153. {%- endif -%}
  154. {%- for item in (groups['k8s-cluster'] + groups['etcd'] + groups['calico-rr']|default([]))|unique -%}
  155. {{ hostvars[item]['access_ip'] | default(hostvars[item]['ip'] | default(hostvars[item]['ansible_default_ipv4']['address'])) }},
  156. {%- if (item != hostvars[item]['ansible_hostname']) -%}
  157. {{ hostvars[item]['ansible_hostname'] }},
  158. {{ hostvars[item]['ansible_hostname'] }}.{{ dns_domain }},
  159. {%- endif -%}
  160. {{ item }},{{ item }}.{{ dns_domain }},
  161. {%- endfor -%}
  162. 127.0.0.1,localhost
  163. proxy_env:
  164. http_proxy: "{{ http_proxy| default ('') }}"
  165. https_proxy: "{{ https_proxy| default ('') }}"
  166. no_proxy: "{{ no_proxy }}"
  167. # Vars for pointing to kubernetes api endpoints
  168. is_kube_master: "{{ inventory_hostname in groups['kube-master'] }}"
  169. kube_apiserver_count: "{{ groups['kube-master'] | length }}"
  170. kube_apiserver_address: "{{ ip | default(ansible_default_ipv4['address']) }}"
  171. kube_apiserver_access_address: "{{ access_ip | default(kube_apiserver_address) }}"
  172. first_kube_master: "{{ hostvars[groups['kube-master'][0]]['access_ip'] | default(hostvars[groups['kube-master'][0]]['ip'] | default(hostvars[groups['kube-master'][0]]['ansible_default_ipv4']['address'])) }}"
  173. loadbalancer_apiserver_localhost: "{{ loadbalancer_apiserver is not defined }}"
  174. # applied if only external loadbalancer_apiserver is defined, otherwise ignored
  175. apiserver_loadbalancer_domain_name: "lb-apiserver.kubernetes.local"
  176. kube_apiserver_endpoint: |-
  177. {% if not is_kube_master and loadbalancer_apiserver_localhost -%}
  178. https://localhost:{{ nginx_kube_apiserver_port|default(kube_apiserver_port) }}
  179. {%- elif is_kube_master -%}
  180. https://{{ kube_apiserver_bind_address | regex_replace('0\.0\.0\.0','127.0.0.1') }}:{{ kube_apiserver_port }}
  181. {%- else -%}
  182. {%- if loadbalancer_apiserver is defined and loadbalancer_apiserver.port is defined -%}
  183. https://{{ apiserver_loadbalancer_domain_name|default('lb-apiserver.kubernetes.local') }}:{{ loadbalancer_apiserver.port|default(kube_apiserver_port) }}
  184. {%- else -%}
  185. https://{{ first_kube_master }}:{{ kube_apiserver_port }}
  186. {%- endif -%}
  187. {%- endif %}
  188. kube_apiserver_insecure_endpoint: >-
  189. http://{{ kube_apiserver_insecure_bind_address | regex_replace('0\.0\.0\.0','127.0.0.1') }}:{{ kube_apiserver_insecure_port }}
  190. # Vars for pointing to etcd endpoints
  191. is_etcd_master: "{{ inventory_hostname in groups['etcd'] }}"
  192. etcd_address: "{{ ip | default(ansible_default_ipv4['address']) }}"
  193. etcd_access_address: "{{ access_ip | default(etcd_address) }}"
  194. etcd_peer_url: "https://{{ etcd_access_address }}:2380"
  195. etcd_client_url: "https://{{ etcd_access_address }}:2379"
  196. etcd_access_addresses: |-
  197. {% for item in groups['etcd'] -%}
  198. https://{{ hostvars[item]['access_ip'] | default(hostvars[item]['ip'] | default(hostvars[item]['ansible_default_ipv4']['address'])) }}:2379{% if not loop.last %},{% endif %}
  199. {%- endfor %}
  200. etcd_member_name: |-
  201. {% for host in groups['etcd'] %}
  202. {% if inventory_hostname == host %}{{"etcd"+loop.index|string }}{% endif %}
  203. {% endfor %}
  204. etcd_peer_addresses: |-
  205. {% for item in groups['etcd'] -%}
  206. {{ "etcd"+loop.index|string }}=https://{{ hostvars[item].access_ip | default(hostvars[item].ip | default(hostvars[item].ansible_default_ipv4['address'])) }}:2380{% if not loop.last %},{% endif %}
  207. {%- endfor %}