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.

361 lines
15 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 {{ hostvars['bastion']['ansible_user'] }}@{{ hostvars['bastion']['ansible_host'] }} {% if ansible_ssh_private_key_file is defined %}-i {{ ansible_ssh_private_key_file }}{% endif %} ' {% endif %}"
  8. kube_api_anonymous_auth: false
  9. # Default value, but will be set to true automatically if detected
  10. is_atomic: false
  11. # optional disable the swap
  12. disable_swap: false
  13. ## Change this to use another Kubernetes version, e.g. a current beta release
  14. kube_version: v1.10.4
  15. ## Kube Proxy mode One of ['iptables','ipvs']
  16. kube_proxy_mode: iptables
  17. # Set to true to allow pre-checks to fail and continue deployment
  18. ignore_assert_errors: false
  19. # Directory where the binaries will be installed
  20. bin_dir: /usr/local/bin
  21. docker_bin_dir: /usr/bin
  22. etcd_data_dir: /var/lib/etcd
  23. # Where the binaries will be downloaded.
  24. # Note: ensure that you've enough disk space (about 1G)
  25. local_release_dir: "/tmp/releases"
  26. # Random shifts for retrying failed ops like pushing/downloading
  27. retry_stagger: 5
  28. # DNS configuration.
  29. # Kubernetes cluster name, also will be used as DNS domain
  30. cluster_name: cluster.local
  31. # Subdomains of DNS domain to be resolved via /etc/resolv.conf for hostnet pods
  32. ndots: 2
  33. # Can be dnsmasq_kubedns, kubedns, manual or none
  34. dns_mode: kubedns
  35. # Should be set to a cluster IP if using a custom cluster DNS
  36. # manual_dns_server: 10.x.x.x
  37. # Can be docker_dns, host_resolvconf or none
  38. resolvconf_mode: docker_dns
  39. # Deploy netchecker app to verify DNS resolve as an HTTP service
  40. deploy_netchecker: false
  41. # Ip address of the kubernetes skydns service
  42. skydns_server: "{{ kube_service_addresses|ipaddr('net')|ipaddr(3)|ipaddr('address') }}"
  43. skydns_server_secondary: "{{ kube_service_addresses|ipaddr('net')|ipaddr(4)|ipaddr('address') }}"
  44. dnsmasq_dns_server: "{{ kube_service_addresses|ipaddr('net')|ipaddr(2)|ipaddr('address') }}"
  45. dns_domain: "{{ cluster_name }}"
  46. # Kubernetes configuration dirs and system namespace.
  47. # Those are where all the additional config stuff goes
  48. # the kubernetes normally puts in /srv/kubernets.
  49. # This puts them in a sane location and namespace.
  50. # Editting those values will almost surely break something.
  51. kube_config_dir: /etc/kubernetes
  52. kube_script_dir: "{{ bin_dir }}/kubernetes-scripts"
  53. kube_manifest_dir: "{{ kube_config_dir }}/manifests"
  54. # This is where all the cert scripts and certs will be located
  55. kube_cert_dir: "{{ kube_config_dir }}/ssl"
  56. # This is where all of the bearer tokens will be stored
  57. kube_token_dir: "{{ kube_config_dir }}/tokens"
  58. # This is where to save basic auth file
  59. kube_users_dir: "{{ kube_config_dir }}/users"
  60. # This is the group that the cert creation scripts chgrp the
  61. # cert files to. Not really changable...
  62. kube_cert_group: kube-cert
  63. # Cluster Loglevel configuration
  64. kube_log_level: 2
  65. # Users to create for basic auth in Kubernetes API via HTTP
  66. kube_api_pwd: "changeme"
  67. kube_users:
  68. kube:
  69. pass: "{{kube_api_pwd}}"
  70. role: admin
  71. # Choose network plugin (cilium, calico, weave or flannel)
  72. # Can also be set to 'cloud', which lets the cloud provider setup appropriate routing
  73. kube_network_plugin: calico
  74. # Determines if calico-rr group exists
  75. peer_with_calico_rr: "{{ 'calico-rr' in groups and groups['calico-rr']|length > 0 }}"
  76. # Kubernetes internal network for services, unused block of space.
  77. kube_service_addresses: 10.233.0.0/18
  78. # internal network. When used, it will assign IP
  79. # addresses from this range to individual pods.
  80. # This network must be unused in your network infrastructure!
  81. kube_pods_subnet: 10.233.64.0/18
  82. # internal network node size allocation (optional). This is the size allocated
  83. # to each node on your network. With these defaults you should have
  84. # room for 64 nodes with 254 pods per node.
  85. # Example: Up to 256 nodes, 100 pods per node (/16 network):
  86. # - kube_service_addresses: 10.233.0.0/17
  87. # - kube_pods_subnet: 10.233.128.0/17
  88. # - kube_network_node_prefix: 25
  89. # Example: Up to 4096 nodes, 100 pods per node (/12 network):
  90. # - kube_service_addresses: 10.192.0.0/13
  91. # - kube_pods_subnet: 10.200.0.0/13
  92. # - kube_network_node_prefix: 25
  93. kube_network_node_prefix: 24
  94. # The virtual cluster IP, real host IPs and ports the API Server will be
  95. # listening on.
  96. # NOTE: loadbalancer_apiserver_localhost somewhat alters the final API enpdoint
  97. # access IP value (automatically evaluated below)
  98. kube_apiserver_ip: "{{ kube_service_addresses|ipaddr('net')|ipaddr(1)|ipaddr('address') }}"
  99. kube_apiserver_bind_address: 0.0.0.0
  100. # https
  101. kube_apiserver_port: 6443
  102. # http
  103. kube_apiserver_insecure_bind_address: 127.0.0.1
  104. kube_apiserver_insecure_port: 8080
  105. # Aggregator
  106. kube_api_aggregator_routing: false
  107. # Docker options
  108. # Optionally do not run docker role
  109. manage_docker: true
  110. # Path used to store Docker data
  111. docker_daemon_graph: "/var/lib/docker"
  112. # Docker log options
  113. # Rotate container stderr/stdout logs at 50m and keep last 5
  114. docker_log_opts: "--log-opt max-size=50m --log-opt max-file=5"
  115. ## A string of extra options to pass to the docker daemon.
  116. ## This string should be exactly as you wish it to appear.
  117. ## An obvious use case is allowing insecure-registry access
  118. ## to self hosted registries like so:
  119. docker_options: "--insecure-registry={{ kube_service_addresses }} --graph={{ docker_daemon_graph }} {{ docker_log_opts }}"
  120. ## If non-empty will override default system MounFlags value.
  121. ## This option takes a mount propagation flag: shared, slave
  122. ## or private, which control whether mounts in the file system
  123. ## namespace set up for docker will receive or propagate mounts
  124. ## and unmounts. Leave empty for system default
  125. docker_mount_flags:
  126. # Settings for containerized control plane (etcd/kubelet/secrets)
  127. etcd_deployment_type: docker
  128. kubelet_deployment_type: docker
  129. cert_management: script
  130. vault_deployment_type: docker
  131. helm_deployment_type: host
  132. # Enable kubeadm deployment (experimental)
  133. kubeadm_enabled: false
  134. # Make a copy of kubeconfig on the host that runs Ansible in {{ inventory_dir }}/artifacts
  135. kubeconfig_localhost: false
  136. # Download kubectl onto the host that runs Ansible in {{ bin_dir }}
  137. kubectl_localhost: false
  138. # K8s image pull policy (imagePullPolicy)
  139. k8s_image_pull_policy: IfNotPresent
  140. # Kubernetes dashboard
  141. # RBAC required. see docs/getting-started.md for access details.
  142. dashboard_enabled: true
  143. # Addons which can be enabled
  144. efk_enabled: false
  145. helm_enabled: false
  146. istio_enabled: false
  147. registry_enabled: false
  148. enable_network_policy: false
  149. local_volume_provisioner_enabled: "{{ local_volumes_enabled | default('false') }}"
  150. persistent_volumes_enabled: false
  151. cephfs_provisioner_enabled: false
  152. ingress_nginx_enabled: false
  153. cert_manager_enabled: false
  154. ## When OpenStack is used, Cinder version can be explicitly specified if autodetection fails (Fixed in 1.9: https://github.com/kubernetes/kubernetes/issues/50461)
  155. # openstack_blockstorage_version: "v1/v2/auto (default)"
  156. ## When OpenStack is used, if LBaaSv2 is available you can enable it with the following 2 variables.
  157. openstack_lbaas_enabled: false
  158. # openstack_lbaas_subnet_id: "Neutron subnet ID (not network ID) to create LBaaS VIP"
  159. ## To enable automatic floating ip provisioning, specify a subnet.
  160. # openstack_lbaas_floating_network_id: "Neutron network ID (not subnet ID) to get floating IP from, disabled by default"
  161. ## Override default LBaaS behavior
  162. # openstack_lbaas_use_octavia: False
  163. # openstack_lbaas_method: "ROUND_ROBIN"
  164. # openstack_lbaas_provider: "haproxy"
  165. openstack_lbaas_create_monitor: "yes"
  166. openstack_lbaas_monitor_delay: "1m"
  167. openstack_lbaas_monitor_timeout: "30s"
  168. openstack_lbaas_monitor_max_retries: "3"
  169. ## List of authorization modes that must be configured for
  170. ## the k8s cluster. Only 'AlwaysAllow', 'AlwaysDeny', 'Node' and
  171. ## 'RBAC' modes are tested. Order is important.
  172. authorization_modes: ['Node', 'RBAC']
  173. rbac_enabled: "{{ 'RBAC' in authorization_modes or kubeadm_enabled }}"
  174. # When enabled, API bearer tokens (including service account tokens) can be used to authenticate to the kubelet’s HTTPS endpoint
  175. kubelet_authentication_token_webhook: true
  176. # When enabled, access to the kubelet API requires authorization by delegation to the API server
  177. kubelet_authorization_mode_webhook: false
  178. ## List of key=value pairs that describe feature gates for
  179. ## the k8s cluster.
  180. kube_feature_gates:
  181. - "Initializers={{ istio_enabled | string }}"
  182. - "PersistentLocalVolumes={{ local_volume_provisioner_enabled | string }}"
  183. - "VolumeScheduling={{ local_volume_provisioner_enabled | string }}"
  184. - "MountPropagation={{ local_volume_provisioner_enabled | string }}"
  185. # Vault data dirs.
  186. vault_base_dir: /etc/vault
  187. vault_cert_dir: "{{ vault_base_dir }}/ssl"
  188. vault_config_dir: "{{ vault_base_dir }}/config"
  189. vault_roles_dir: "{{ vault_base_dir }}/roles"
  190. vault_secrets_dir: "{{ vault_base_dir }}/secrets"
  191. # Local volume provisioner dirs
  192. local_volume_provisioner_base_dir: /mnt/disks
  193. local_volume_provisioner_mount_dir: /mnt/disks
  194. ## Running on top of openstack vms with cinder enabled may lead to unschedulable pods due to NoVolumeZoneConflict restriction in kube-scheduler.
  195. ## See https://github.com/kubernetes-incubator/kubespray/issues/2141
  196. ## Set this variable to true to get rid of this issue
  197. volume_cross_zone_attachment: false
  198. # weave's network password for encryption
  199. # if null then no network encryption
  200. # you can use --extra-vars to pass the password in command line
  201. weave_password: EnterPasswordHere
  202. # Weave uses consensus mode by default
  203. # Enabling seed mode allow to dynamically add or remove hosts
  204. # https://www.weave.works/docs/net/latest/ipam/
  205. weave_mode_seed: false
  206. # This two variable are automatically changed by the weave's role in group_vars/k8s-cluster.yml.
  207. # Do not manually change these values
  208. weave_seed: uninitialized
  209. weave_peers: uninitialized
  210. ## Set no_proxy to all assigned cluster IPs and hostnames
  211. no_proxy: >-
  212. {%- if http_proxy is defined or https_proxy is defined %}
  213. {%- if loadbalancer_apiserver is defined -%}
  214. {{ apiserver_loadbalancer_domain_name| default('') }},
  215. {{ loadbalancer_apiserver.address | default('') }},
  216. {%- endif -%}
  217. {%- for item in (groups['k8s-cluster'] + groups['etcd'] + groups['calico-rr']|default([]))|unique -%}
  218. {{ hostvars[item]['access_ip'] | default(hostvars[item]['ip'] | default(hostvars[item]['ansible_default_ipv4']['address'])) }},
  219. {%- if (item != hostvars[item]['ansible_hostname']) -%}
  220. {{ hostvars[item]['ansible_hostname'] }},
  221. {{ hostvars[item]['ansible_hostname'] }}.{{ dns_domain }},
  222. {%- endif -%}
  223. {{ item }},{{ item }}.{{ dns_domain }},
  224. {%- endfor -%}
  225. 127.0.0.1,localhost
  226. {%- endif %}
  227. proxy_env:
  228. http_proxy: "{{ http_proxy| default ('') }}"
  229. https_proxy: "{{ https_proxy| default ('') }}"
  230. no_proxy: "{{ no_proxy| default ('') }}"
  231. ssl_ca_dirs: >-
  232. [
  233. {% if ansible_os_family in ['CoreOS', 'Container Linux by CoreOS'] -%}
  234. '/usr/share/ca-certificates',
  235. {% elif ansible_os_family == 'RedHat' -%}
  236. '/etc/pki/tls',
  237. '/etc/pki/ca-trust',
  238. {% elif ansible_os_family == 'Debian' -%}
  239. '/usr/share/ca-certificates',
  240. {% endif -%}
  241. ]
  242. # Vars for pointing to kubernetes api endpoints
  243. is_kube_master: "{{ inventory_hostname in groups['kube-master'] }}"
  244. kube_apiserver_count: "{{ groups['kube-master'] | length }}"
  245. kube_apiserver_address: "{{ ip | default(ansible_default_ipv4['address']) }}"
  246. kube_apiserver_access_address: "{{ access_ip | default(kube_apiserver_address) }}"
  247. 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'])) }}"
  248. loadbalancer_apiserver_localhost: "{{ loadbalancer_apiserver is not defined }}"
  249. # applied if only external loadbalancer_apiserver is defined, otherwise ignored
  250. apiserver_loadbalancer_domain_name: "lb-apiserver.kubernetes.local"
  251. kube_apiserver_endpoint: |-
  252. {% if not is_kube_master and loadbalancer_apiserver_localhost -%}
  253. https://localhost:{{ nginx_kube_apiserver_port|default(kube_apiserver_port) }}
  254. {%- elif is_kube_master -%}
  255. https://{{ kube_apiserver_bind_address | regex_replace('0\.0\.0\.0','127.0.0.1') }}:{{ kube_apiserver_port }}
  256. {%- else -%}
  257. {%- if loadbalancer_apiserver is defined and loadbalancer_apiserver.port is defined -%}
  258. https://{{ apiserver_loadbalancer_domain_name|default('lb-apiserver.kubernetes.local') }}:{{ loadbalancer_apiserver.port|default(kube_apiserver_port) }}
  259. {%- else -%}
  260. https://{{ first_kube_master }}:{{ kube_apiserver_port }}
  261. {%- endif -%}
  262. {%- endif %}
  263. kube_apiserver_insecure_endpoint: >-
  264. http://{{ kube_apiserver_insecure_bind_address | regex_replace('0\.0\.0\.0','127.0.0.1') }}:{{ kube_apiserver_insecure_port }}
  265. kube_apiserver_client_cert: |-
  266. {% if kubeadm_enabled -%}
  267. {{ kube_cert_dir }}/ca.crt
  268. {%- else -%}
  269. {{ kube_cert_dir }}/apiserver.pem
  270. {%- endif %}
  271. kube_apiserver_client_key: |-
  272. {% if kubeadm_enabled -%}
  273. {{ kube_cert_dir }}/ca.key
  274. {%- else -%}
  275. {{ kube_cert_dir }}/apiserver-key.pem
  276. {%- endif %}
  277. # Set to true to deploy etcd-events cluster
  278. etcd_events_cluster_enabled: false
  279. # Vars for pointing to etcd endpoints
  280. is_etcd_master: "{{ inventory_hostname in groups['etcd'] }}"
  281. etcd_address: "{{ ip | default(ansible_default_ipv4['address']) }}"
  282. etcd_access_address: "{{ access_ip | default(etcd_address) }}"
  283. etcd_events_access_address: "{{ access_ip | default(etcd_address) }}"
  284. etcd_peer_url: "https://{{ etcd_access_address }}:2380"
  285. etcd_client_url: "https://{{ etcd_access_address }}:2379"
  286. etcd_events_peer_url: "https://{{ etcd_access_address }}:2382"
  287. etcd_events_client_url: "https://{{ etcd_access_address }}:2381"
  288. etcd_access_addresses: |-
  289. {% for item in groups['etcd'] -%}
  290. https://{{ hostvars[item]['access_ip'] | default(hostvars[item]['ip'] | default(hostvars[item]['ansible_default_ipv4']['address'])) }}:2379{% if not loop.last %},{% endif %}
  291. {%- endfor %}
  292. etcd_events_access_addresses: |-
  293. {% for item in groups['etcd'] -%}
  294. https://{{ hostvars[item]['access_ip'] | default(hostvars[item]['ip'] | default(hostvars[item]['ansible_default_ipv4']['address'])) }}:2381{% if not loop.last %},{% endif %}
  295. {%- endfor %}
  296. etcd_member_name: |-
  297. {% for host in groups['etcd'] %}
  298. {% if inventory_hostname == host %}{{"etcd"+loop.index|string }}{% endif %}
  299. {% endfor %}
  300. etcd_peer_addresses: |-
  301. {% for item in groups['etcd'] -%}
  302. {{ "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 %}
  303. {%- endfor %}
  304. etcd_events_peer_addresses: |-
  305. {% for item in groups['etcd'] -%}
  306. {{ "etcd"+loop.index|string }}-events=https://{{ hostvars[item].access_ip | default(hostvars[item].ip | default(hostvars[item].ansible_default_ipv4['address'])) }}:2382{% if not loop.last %},{% endif %}
  307. {%- endfor %}