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.

306 lines
12 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.9.2
  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, manual or none
  30. dns_mode: kubedns
  31. # Should be set to a cluster IP if using a custom cluster DNS
  32. # manual_dns_server: 10.x.x.x
  33. # Can be docker_dns, host_resolvconf or none
  34. resolvconf_mode: docker_dns
  35. # Deploy netchecker app to verify DNS resolve as an HTTP service
  36. deploy_netchecker: false
  37. # Ip address of the kubernetes skydns service
  38. skydns_server: "{{ kube_service_addresses|ipaddr('net')|ipaddr(3)|ipaddr('address') }}"
  39. dnsmasq_dns_server: "{{ kube_service_addresses|ipaddr('net')|ipaddr(2)|ipaddr('address') }}"
  40. dns_domain: "{{ cluster_name }}"
  41. # Kubernetes configuration dirs and system namespace.
  42. # Those are where all the additional config stuff goes
  43. # the kubernetes normally puts in /srv/kubernets.
  44. # This puts them in a sane location and namespace.
  45. # Editting those values will almost surely break something.
  46. kube_config_dir: /etc/kubernetes
  47. kube_script_dir: "{{ bin_dir }}/kubernetes-scripts"
  48. kube_manifest_dir: "{{ kube_config_dir }}/manifests"
  49. system_namespace: kube-system
  50. # This is where all the cert scripts and certs will be located
  51. kube_cert_dir: "{{ kube_config_dir }}/ssl"
  52. # This is where all of the bearer tokens will be stored
  53. kube_token_dir: "{{ kube_config_dir }}/tokens"
  54. # This is where to save basic auth file
  55. kube_users_dir: "{{ kube_config_dir }}/users"
  56. # This is the group that the cert creation scripts chgrp the
  57. # cert files to. Not really changable...
  58. kube_cert_group: kube-cert
  59. # Cluster Loglevel configuration
  60. kube_log_level: 2
  61. # Users to create for basic auth in Kubernetes API via HTTP
  62. kube_api_pwd: "changeme"
  63. kube_users:
  64. kube:
  65. pass: "{{kube_api_pwd}}"
  66. role: admin
  67. # Choose network plugin (calico, weave or flannel)
  68. # Can also be set to 'cloud', which lets the cloud provider setup appropriate routing
  69. kube_network_plugin: calico
  70. # Determines if calico-rr group exists
  71. peer_with_calico_rr: "{{ 'calico-rr' in groups and groups['calico-rr']|length > 0 }}"
  72. # Kubernetes internal network for services, unused block of space.
  73. kube_service_addresses: 10.233.0.0/18
  74. # internal network. When used, it will assign IP
  75. # addresses from this range to individual pods.
  76. # This network must be unused in your network infrastructure!
  77. kube_pods_subnet: 10.233.64.0/18
  78. # internal network node size allocation (optional). This is the size allocated
  79. # to each node on your network. With these defaults you should have
  80. # room for 64 nodes with 254 pods per node.
  81. # Example: Up to 256 nodes, 100 pods per node (/16 network):
  82. # - kube_service_addresses: 10.233.0.0/17
  83. # - kube_pods_subnet: 10.233.128.0/17
  84. # - kube_network_node_prefix: 25
  85. # Example: Up to 4096 nodes, 100 pods per node (/12 network):
  86. # - kube_service_addresses: 10.192.0.0/13
  87. # - kube_pods_subnet: 10.200.0.0/13
  88. # - kube_network_node_prefix: 25
  89. kube_network_node_prefix: 24
  90. # The virtual cluster IP, real host IPs and ports the API Server will be
  91. # listening on.
  92. # NOTE: loadbalancer_apiserver_localhost somewhat alters the final API enpdoint
  93. # access IP value (automatically evaluated below)
  94. kube_apiserver_ip: "{{ kube_service_addresses|ipaddr('net')|ipaddr(1)|ipaddr('address') }}"
  95. kube_apiserver_bind_address: 0.0.0.0
  96. # https
  97. kube_apiserver_port: 6443
  98. # http
  99. kube_apiserver_insecure_bind_address: 127.0.0.1
  100. kube_apiserver_insecure_port: 8080
  101. # Aggregator
  102. kube_api_aggregator_routing: true
  103. # Path used to store Docker data
  104. docker_daemon_graph: "/var/lib/docker"
  105. # Docker log options
  106. # Rotate container stderr/stdout logs at 50m and keep last 5
  107. docker_log_opts: "--log-opt max-size=50m --log-opt max-file=5"
  108. ## A string of extra options to pass to the docker daemon.
  109. ## This string should be exactly as you wish it to appear.
  110. ## An obvious use case is allowing insecure-registry access
  111. ## to self hosted registries like so:
  112. docker_options: "--insecure-registry={{ kube_service_addresses }} --graph={{ docker_daemon_graph }} {{ docker_log_opts }}"
  113. # Settings for containerized control plane (etcd/kubelet/secrets)
  114. etcd_deployment_type: docker
  115. kubelet_deployment_type: docker
  116. cert_management: script
  117. vault_deployment_type: docker
  118. helm_deployment_type: host
  119. # Enable kubeadm deployment (experimental)
  120. kubeadm_enabled: false
  121. kubeadm_token: "abcdef.0123456789abcdef"
  122. # Make a copy of kubeconfig on the host that runs Ansible in GITDIR/artifacts
  123. kubeconfig_localhost: false
  124. # Download kubectl onto the host that runs Ansible in GITDIR/artifacts
  125. kubectl_localhost: false
  126. # K8s image pull policy (imagePullPolicy)
  127. k8s_image_pull_policy: IfNotPresent
  128. # Kubernetes dashboard
  129. # RBAC required. see docs/getting-started.md for access details.
  130. dashboard_enabled: true
  131. # Addons which can be enabled
  132. efk_enabled: false
  133. helm_enabled: false
  134. istio_enabled: false
  135. registry_enabled: false
  136. enable_network_policy: false
  137. local_volume_provisioner_enabled: false
  138. persistent_volumes_enabled: false
  139. cephfs_provisioner_enabled: false
  140. # Base path for local volume provisioner addon
  141. local_volume_base_dir: /mnt/disks
  142. local_volume_mount_dir: /local-disks
  143. local_volume_storage_class: local-storage
  144. ## When OpenStack is used, Cinder version can be explicitly specified if autodetection fails (Fixed in 1.9: https://github.com/kubernetes/kubernetes/issues/50461)
  145. # openstack_blockstorage_version: "v1/v2/auto (default)"
  146. ## When OpenStack is used, if LBaaSv2 is available you can enable it with the following 2 variables.
  147. openstack_lbaas_enabled: false
  148. # openstack_lbaas_subnet_id: "Neutron subnet ID (not network ID) to create LBaaS VIP"
  149. ## To enable automatic floating ip provisioning, specify a subnet.
  150. # openstack_lbaas_floating_network_id: "Neutron network ID (not subnet ID) to get floating IP from, disabled by default"
  151. ## Override default LBaaS behavior
  152. # openstack_lbaas_use_octavia: False
  153. # openstack_lbaas_method: "ROUND_ROBIN"
  154. # openstack_lbaas_provider: "haproxy"
  155. openstack_lbaas_create_monitor: "yes"
  156. openstack_lbaas_monitor_delay: "1m"
  157. openstack_lbaas_monitor_timeout: "30s"
  158. openstack_lbaas_monitor_max_retries: "3"
  159. ## List of authorization modes that must be configured for
  160. ## the k8s cluster. Only 'AlwaysAllow', 'AlwaysDeny', 'Node' and
  161. ## 'RBAC' modes are tested. Order is important.
  162. authorization_modes: ['Node', 'RBAC']
  163. rbac_enabled: "{{ 'RBAC' in authorization_modes or kubeadm_enabled }}"
  164. ## List of key=value pairs that describe feature gates for
  165. ## the k8s cluster.
  166. kube_feature_gates: ['Initializers={{ istio_enabled|string }}', 'PersistentLocalVolumes={{ local_volume_provisioner_enabled|string }}']
  167. # Vault data dirs.
  168. vault_base_dir: /etc/vault
  169. vault_cert_dir: "{{ vault_base_dir }}/ssl"
  170. vault_config_dir: "{{ vault_base_dir }}/config"
  171. vault_roles_dir: "{{ vault_base_dir }}/roles"
  172. vault_secrets_dir: "{{ vault_base_dir }}/secrets"
  173. ## Running on top of openstack vms with cinder enabled may lead to unschedulable pods due to NoVolumeZoneConflict restriction in kube-scheduler.
  174. ## See https://github.com/kubernetes-incubator/kubespray/issues/2141
  175. ## Set this variable to true to get rid of this issue
  176. volume_cross_zone_attachment: false
  177. # weave's network password for encryption
  178. # if null then no network encryption
  179. # you can use --extra-vars to pass the password in command line
  180. weave_password: EnterPasswordHere
  181. # Weave uses consensus mode by default
  182. # Enabling seed mode allow to dynamically add or remove hosts
  183. # https://www.weave.works/docs/net/latest/ipam/
  184. weave_mode_seed: false
  185. # This two variable are automatically changed by the weave's role in group_vars/k8s-cluster.yml.
  186. # Do not manually change these values
  187. weave_seed: uninitialized
  188. weave_peers: uninitialized
  189. ## Set no_proxy to all assigned cluster IPs and hostnames
  190. no_proxy: >-
  191. {%- if loadbalancer_apiserver is defined -%}
  192. {{ apiserver_loadbalancer_domain_name| default('') }},
  193. {{ loadbalancer_apiserver.address | default('') }},
  194. {%- endif -%}
  195. {%- for item in (groups['k8s-cluster'] + groups['etcd'] + groups['calico-rr']|default([]))|unique -%}
  196. {{ hostvars[item]['access_ip'] | default(hostvars[item]['ip'] | default(hostvars[item]['ansible_default_ipv4']['address'])) }},
  197. {%- if (item != hostvars[item]['ansible_hostname']) -%}
  198. {{ hostvars[item]['ansible_hostname'] }},
  199. {{ hostvars[item]['ansible_hostname'] }}.{{ dns_domain }},
  200. {%- endif -%}
  201. {{ item }},{{ item }}.{{ dns_domain }},
  202. {%- endfor -%}
  203. 127.0.0.1,localhost
  204. proxy_env:
  205. http_proxy: "{{ http_proxy| default ('') }}"
  206. https_proxy: "{{ https_proxy| default ('') }}"
  207. no_proxy: "{{ no_proxy }}"
  208. # Vars for pointing to kubernetes api endpoints
  209. is_kube_master: "{{ inventory_hostname in groups['kube-master'] }}"
  210. kube_apiserver_count: "{{ groups['kube-master'] | length }}"
  211. kube_apiserver_address: "{{ ip | default(ansible_default_ipv4['address']) }}"
  212. kube_apiserver_access_address: "{{ access_ip | default(kube_apiserver_address) }}"
  213. 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'])) }}"
  214. loadbalancer_apiserver_localhost: "{{ loadbalancer_apiserver is not defined }}"
  215. # applied if only external loadbalancer_apiserver is defined, otherwise ignored
  216. apiserver_loadbalancer_domain_name: "lb-apiserver.kubernetes.local"
  217. kube_apiserver_endpoint: |-
  218. {% if not is_kube_master and loadbalancer_apiserver_localhost -%}
  219. https://localhost:{{ nginx_kube_apiserver_port|default(kube_apiserver_port) }}
  220. {%- elif is_kube_master -%}
  221. https://{{ kube_apiserver_bind_address | regex_replace('0\.0\.0\.0','127.0.0.1') }}:{{ kube_apiserver_port }}
  222. {%- else -%}
  223. {%- if loadbalancer_apiserver is defined and loadbalancer_apiserver.port is defined -%}
  224. https://{{ apiserver_loadbalancer_domain_name|default('lb-apiserver.kubernetes.local') }}:{{ loadbalancer_apiserver.port|default(kube_apiserver_port) }}
  225. {%- else -%}
  226. https://{{ first_kube_master }}:{{ kube_apiserver_port }}
  227. {%- endif -%}
  228. {%- endif %}
  229. kube_apiserver_insecure_endpoint: >-
  230. http://{{ kube_apiserver_insecure_bind_address | regex_replace('0\.0\.0\.0','127.0.0.1') }}:{{ kube_apiserver_insecure_port }}
  231. kube_apiserver_client_cert: |-
  232. {% if kubeadm_enabled -%}
  233. {{ kube_cert_dir }}/ca.crt
  234. {%- else -%}
  235. {{ kube_cert_dir }}/apiserver.pem
  236. {%- endif %}
  237. kube_apiserver_client_key: |-
  238. {% if kubeadm_enabled -%}
  239. {{ kube_cert_dir }}/ca.key
  240. {%- else -%}
  241. {{ kube_cert_dir }}/apiserver-key.pem
  242. {%- endif %}
  243. # Vars for pointing to etcd endpoints
  244. is_etcd_master: "{{ inventory_hostname in groups['etcd'] }}"
  245. etcd_address: "{{ ip | default(ansible_default_ipv4['address']) }}"
  246. etcd_access_address: "{{ access_ip | default(etcd_address) }}"
  247. etcd_peer_url: "https://{{ etcd_access_address }}:2380"
  248. etcd_client_url: "https://{{ etcd_access_address }}:2379"
  249. etcd_access_addresses: |-
  250. {% for item in groups['etcd'] -%}
  251. https://{{ hostvars[item]['access_ip'] | default(hostvars[item]['ip'] | default(hostvars[item]['ansible_default_ipv4']['address'])) }}:2379{% if not loop.last %},{% endif %}
  252. {%- endfor %}
  253. etcd_member_name: |-
  254. {% for host in groups['etcd'] %}
  255. {% if inventory_hostname == host %}{{"etcd"+loop.index|string }}{% endif %}
  256. {% endfor %}
  257. etcd_peer_addresses: |-
  258. {% for item in groups['etcd'] -%}
  259. {{ "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 %}
  260. {%- endfor %}