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.

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