Automatically infer bootstrap_os (#3498)
* Automatically infer bootstrap_os * Rename bootstrap os to os_family
This commit is contained in:
parent
e813b26963
commit
3f786542d3
22 changed files with 31 additions and 43 deletions
19
Vagrantfile
vendored
19
Vagrantfile
vendored
|
@ -13,15 +13,15 @@ COREOS_URL_TEMPLATE = "https://storage.googleapis.com/%s.release.core-os.net/amd
|
||||||
DISK_UUID = Time.now.utc.to_i
|
DISK_UUID = Time.now.utc.to_i
|
||||||
|
|
||||||
SUPPORTED_OS = {
|
SUPPORTED_OS = {
|
||||||
"coreos-stable" => {box: "coreos-stable", bootstrap_os: "coreos", user: "core", box_url: COREOS_URL_TEMPLATE % ["stable"]},
|
"coreos-stable" => {box: "coreos-stable", user: "core", box_url: COREOS_URL_TEMPLATE % ["stable"]},
|
||||||
"coreos-alpha" => {box: "coreos-alpha", bootstrap_os: "coreos", user: "core", box_url: COREOS_URL_TEMPLATE % ["alpha"]},
|
"coreos-alpha" => {box: "coreos-alpha", user: "core", box_url: COREOS_URL_TEMPLATE % ["alpha"]},
|
||||||
"coreos-beta" => {box: "coreos-beta", bootstrap_os: "coreos", user: "core", box_url: COREOS_URL_TEMPLATE % ["beta"]},
|
"coreos-beta" => {box: "coreos-beta", user: "core", box_url: COREOS_URL_TEMPLATE % ["beta"]},
|
||||||
"ubuntu1604" => {box: "generic/ubuntu1604", bootstrap_os: "ubuntu", user: "vagrant"},
|
"ubuntu1604" => {box: "generic/ubuntu1604", user: "vagrant"},
|
||||||
"ubuntu1804" => {box: "generic/ubuntu1804", bootstrap_os: "ubuntu", user: "vagrant"},
|
"ubuntu1804" => {box: "generic/ubuntu1804", user: "vagrant"},
|
||||||
"centos" => {box: "centos/7", bootstrap_os: "centos", user: "vagrant"},
|
"centos" => {box: "centos/7", user: "vagrant"},
|
||||||
"fedora" => {box: "fedora/28-cloud-base", bootstrap_os: "fedora", user: "vagrant"},
|
"fedora" => {box: "fedora/28-cloud-base", user: "vagrant"},
|
||||||
"opensuse" => {box: "opensuse/openSUSE-42.3-x86_64", bootstrap_os: "opensuse", use: "vagrant"},
|
"opensuse" => {box: "opensuse/openSUSE-42.3-x86_64", use: "vagrant"},
|
||||||
"opensuse-tumbleweed" => {box: "opensuse/openSUSE-Tumbleweed-x86_64", bootstrap_os: "opensuse", use: "vagrant"},
|
"opensuse-tumbleweed" => {box: "opensuse/openSUSE-Tumbleweed-x86_64", use: "vagrant"},
|
||||||
}
|
}
|
||||||
|
|
||||||
# Defaults for config options defined in CONFIG
|
# Defaults for config options defined in CONFIG
|
||||||
|
@ -138,7 +138,6 @@ Vagrant.configure("2") do |config|
|
||||||
ip = "#{$subnet}.#{i+100}"
|
ip = "#{$subnet}.#{i+100}"
|
||||||
host_vars[vm_name] = {
|
host_vars[vm_name] = {
|
||||||
"ip": ip,
|
"ip": ip,
|
||||||
"bootstrap_os": SUPPORTED_OS[$os][:bootstrap_os],
|
|
||||||
"local_release_dir" => $local_release_dir,
|
"local_release_dir" => $local_release_dir,
|
||||||
"download_run_once": "False",
|
"download_run_once": "False",
|
||||||
"kube_network_plugin": $network_plugin
|
"kube_network_plugin": $network_plugin
|
||||||
|
|
|
@ -43,7 +43,7 @@ ssh -F ./ssh-bastion.conf user@$ip
|
||||||
|
|
||||||
Example (this one assumes you are using CoreOS)
|
Example (this one assumes you are using CoreOS)
|
||||||
```commandline
|
```commandline
|
||||||
ansible-playbook -i ./inventory/hosts ./cluster.yml -e ansible_user=core -e bootstrap_os=coreos -b --become-user=root --flush-cache
|
ansible-playbook -i ./inventory/hosts ./cluster.yml -e ansible_user=core -b --become-user=root --flush-cache
|
||||||
```
|
```
|
||||||
***Using other distrib than CoreOs***
|
***Using other distrib than CoreOs***
|
||||||
If you want to use another distribution than CoreOS, you can modify the search filters of the 'data "aws_ami" "distro"' in variables.tf.
|
If you want to use another distribution than CoreOS, you can modify the search filters of the 'data "aws_ami" "distro"' in variables.tf.
|
||||||
|
|
|
@ -341,11 +341,6 @@ If it fails try to connect manually via SSH. It could be something as simple as
|
||||||
### Configure cluster variables
|
### Configure cluster variables
|
||||||
|
|
||||||
Edit `inventory/$CLUSTER/group_vars/all.yml`:
|
Edit `inventory/$CLUSTER/group_vars/all.yml`:
|
||||||
- Set variable **bootstrap_os** appropriately for your desired image:
|
|
||||||
```
|
|
||||||
# Valid bootstrap options (required): ubuntu, coreos, centos, none
|
|
||||||
bootstrap_os: coreos
|
|
||||||
```
|
|
||||||
- **bin_dir**:
|
- **bin_dir**:
|
||||||
```
|
```
|
||||||
# Directory where the binaries will be installed
|
# Directory where the binaries will be installed
|
||||||
|
|
|
@ -6,7 +6,6 @@ Example with Ansible:
|
||||||
Before running the cluster playbook you must satisfy the following requirements:
|
Before running the cluster playbook you must satisfy the following requirements:
|
||||||
|
|
||||||
General CoreOS Pre-Installation Notes:
|
General CoreOS Pre-Installation Notes:
|
||||||
- You should set the bootstrap_os variable to `coreos`
|
|
||||||
- Ensure that the bin_dir is set to `/opt/bin`
|
- Ensure that the bin_dir is set to `/opt/bin`
|
||||||
- ansible_python_interpreter should be `/opt/bin/python`. This will be laid down by the bootstrap task.
|
- ansible_python_interpreter should be `/opt/bin/python`. This will be laid down by the bootstrap task.
|
||||||
- The default resolvconf_mode setting of `docker_dns` **does not** work for CoreOS. This is because we do not edit the systemd service file for docker on CoreOS nodes. Instead, just use the `host_resolvconf` mode. It should work out of the box.
|
- The default resolvconf_mode setting of `docker_dns` **does not** work for CoreOS. This is because we do not edit the systemd service file for docker on CoreOS nodes. Instead, just use the `host_resolvconf` mode. It should work out of the box.
|
||||||
|
|
|
@ -1,9 +1,3 @@
|
||||||
## Valid bootstrap options (required): ubuntu, coreos, centos, none
|
|
||||||
## If the OS is not listed here, it means it doesn't require extra/bootstrap steps.
|
|
||||||
## In example, python is not available on 'coreos' so it must be installed before
|
|
||||||
## anything else. In the opposite, Debian has already all its dependencies fullfiled, then bootstrap_os should be set to `none`.
|
|
||||||
bootstrap_os: none
|
|
||||||
|
|
||||||
## Directory where etcd data stored
|
## Directory where etcd data stored
|
||||||
etcd_data_dir: /var/lib/etcd
|
etcd_data_dir: /var/lib/etcd
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,25 @@
|
||||||
---
|
---
|
||||||
|
- name: Fetch /etc/os-release
|
||||||
|
raw: cat /etc/os-release
|
||||||
|
register: os_release
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- name: Set bootstrap_os
|
||||||
|
set_fact:
|
||||||
|
os_family: >-
|
||||||
|
{%- if 'Ubuntu' in os_release.stdout -%}
|
||||||
|
ubuntu
|
||||||
|
{%- elif 'Debian' in os_release.stdout -%}
|
||||||
|
debian
|
||||||
|
{%- elif 'CoreOS' in os_release.stdout -%}
|
||||||
|
coreos
|
||||||
|
{%- elif 'Fedora' in os_release.stdout -%}
|
||||||
|
fedora
|
||||||
|
{%- elif 'CentOS' in os_release.stdout -%}
|
||||||
|
centos
|
||||||
|
{%- elif 'OpenSUSE' in os_release.stdout -%}
|
||||||
|
opensuse
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
- include_tasks: bootstrap-ubuntu.yml
|
- include_tasks: bootstrap-ubuntu.yml
|
||||||
when: os_family == "ubuntu"
|
when: os_family == "ubuntu"
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
---
|
---
|
||||||
## Required for bootstrap-os/preinstall/download roles and setting facts
|
|
||||||
# Valid bootstrap options (required): ubuntu, coreos, centos, none
|
|
||||||
bootstrap_os: none
|
|
||||||
|
|
||||||
# Use proxycommand if bastion host is in group all
|
# Use proxycommand if bastion host is in group all
|
||||||
# This change obseletes editing ansible.cfg file depending on bastion existance
|
# This change obseletes editing ansible.cfg file depending on bastion existance
|
||||||
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 %}"
|
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 %}"
|
||||||
|
|
|
@ -3,7 +3,6 @@ cloud_region: nyc3
|
||||||
mode: ha
|
mode: ha
|
||||||
|
|
||||||
# Deployment settings
|
# Deployment settings
|
||||||
bootstrap_os: ubuntu
|
|
||||||
kube_network_plugin: canal
|
kube_network_plugin: canal
|
||||||
deploy_netchecker: true
|
deploy_netchecker: true
|
||||||
kubedns_min_replicas: 1
|
kubedns_min_replicas: 1
|
||||||
|
|
|
@ -7,7 +7,6 @@ startup_script: 'systemctl disable locksmithd && systemctl stop locksmithd'
|
||||||
|
|
||||||
# Deployment settings
|
# Deployment settings
|
||||||
kube_network_plugin: weave
|
kube_network_plugin: weave
|
||||||
bootstrap_os: coreos
|
|
||||||
resolvconf_mode: host_resolvconf # this is required as long as the coreos stable channel uses docker < 1.12
|
resolvconf_mode: host_resolvconf # this is required as long as the coreos stable channel uses docker < 1.12
|
||||||
deploy_netchecker: true
|
deploy_netchecker: true
|
||||||
kubedns_min_replicas: 1
|
kubedns_min_replicas: 1
|
||||||
|
|
|
@ -8,7 +8,6 @@ startup_script: 'systemctl disable locksmithd && systemctl stop locksmithd'
|
||||||
|
|
||||||
# Deployment settings
|
# Deployment settings
|
||||||
no_group_vars: true
|
no_group_vars: true
|
||||||
bootstrap_os: coreos
|
|
||||||
kube_network_plugin: calico
|
kube_network_plugin: calico
|
||||||
resolvconf_mode: host_resolvconf # this is required as long as the coreos stable channel uses docker < 1.12
|
resolvconf_mode: host_resolvconf # this is required as long as the coreos stable channel uses docker < 1.12
|
||||||
deploy_netchecker: true
|
deploy_netchecker: true
|
||||||
|
|
|
@ -6,7 +6,6 @@ startup_script: 'systemctl disable locksmithd && systemctl stop locksmithd'
|
||||||
|
|
||||||
# Deployment settings
|
# Deployment settings
|
||||||
kube_network_plugin: canal
|
kube_network_plugin: canal
|
||||||
bootstrap_os: coreos
|
|
||||||
resolvconf_mode: host_resolvconf # this is required as long as the coreos stable channel uses docker < 1.12
|
resolvconf_mode: host_resolvconf # this is required as long as the coreos stable channel uses docker < 1.12
|
||||||
deploy_netchecker: true
|
deploy_netchecker: true
|
||||||
kubedns_min_replicas: 1
|
kubedns_min_replicas: 1
|
||||||
|
|
|
@ -6,7 +6,6 @@ startup_script: 'systemctl disable locksmithd && systemctl stop locksmithd'
|
||||||
|
|
||||||
# Deployment settings
|
# Deployment settings
|
||||||
kube_network_plugin: cilium
|
kube_network_plugin: cilium
|
||||||
bootstrap_os: coreos
|
|
||||||
resolvconf_mode: host_resolvconf # this is required as long as the coreos stable channel uses docker < 1.12
|
resolvconf_mode: host_resolvconf # this is required as long as the coreos stable channel uses docker < 1.12
|
||||||
deploy_netchecker: true
|
deploy_netchecker: true
|
||||||
enable_network_policy: true
|
enable_network_policy: true
|
||||||
|
|
|
@ -5,7 +5,6 @@ cloud_region: us-central1-b
|
||||||
mode: aio
|
mode: aio
|
||||||
|
|
||||||
# Instance settings
|
# Instance settings
|
||||||
bootstrap_os: coreos
|
|
||||||
cert_management: vault
|
cert_management: vault
|
||||||
kube_network_plugin: flannel
|
kube_network_plugin: flannel
|
||||||
deploy_netchecker: true
|
deploy_netchecker: true
|
||||||
|
|
|
@ -5,7 +5,6 @@ mode: default
|
||||||
|
|
||||||
# Deployment settings
|
# Deployment settings
|
||||||
kube_network_plugin: calico
|
kube_network_plugin: calico
|
||||||
bootstrap_os: debian
|
|
||||||
deploy_netchecker: true
|
deploy_netchecker: true
|
||||||
kubedns_min_replicas: 1
|
kubedns_min_replicas: 1
|
||||||
cloud_provider: gce
|
cloud_provider: gce
|
||||||
|
|
|
@ -4,7 +4,6 @@ cloud_region: us-central1-c
|
||||||
mode: default
|
mode: default
|
||||||
|
|
||||||
# Deployment settings
|
# Deployment settings
|
||||||
bootstrap_os: opensuse
|
|
||||||
kube_network_plugin: canal
|
kube_network_plugin: canal
|
||||||
deploy_netchecker: true
|
deploy_netchecker: true
|
||||||
kubedns_min_replicas: 1
|
kubedns_min_replicas: 1
|
||||||
|
|
|
@ -4,7 +4,6 @@ cloud_region: us-central1-c
|
||||||
mode: ha
|
mode: ha
|
||||||
|
|
||||||
# Deployment settings
|
# Deployment settings
|
||||||
bootstrap_os: ubuntu
|
|
||||||
kube_network_plugin: canal
|
kube_network_plugin: canal
|
||||||
deploy_netchecker: true
|
deploy_netchecker: true
|
||||||
kubedns_min_replicas: 1
|
kubedns_min_replicas: 1
|
||||||
|
|
|
@ -5,7 +5,6 @@ cloud_region: us-central1-c
|
||||||
mode: ha
|
mode: ha
|
||||||
|
|
||||||
# Deployment settings
|
# Deployment settings
|
||||||
bootstrap_os: ubuntu
|
|
||||||
kube_network_plugin: canal
|
kube_network_plugin: canal
|
||||||
kubeadm_enabled: true
|
kubeadm_enabled: true
|
||||||
dynamic_kubelet_configuration: true
|
dynamic_kubelet_configuration: true
|
||||||
|
|
|
@ -4,7 +4,6 @@ cloud_region: us-central1-a
|
||||||
mode: separate
|
mode: separate
|
||||||
|
|
||||||
# Deployment settings
|
# Deployment settings
|
||||||
bootstrap_os: ubuntu
|
|
||||||
kube_network_plugin: flannel
|
kube_network_plugin: flannel
|
||||||
deploy_netchecker: true
|
deploy_netchecker: true
|
||||||
kubedns_min_replicas: 1
|
kubedns_min_replicas: 1
|
||||||
|
|
|
@ -4,7 +4,6 @@ cloud_region: us-central1-c
|
||||||
mode: separate
|
mode: separate
|
||||||
|
|
||||||
# Deployment settings
|
# Deployment settings
|
||||||
bootstrap_os: ubuntu
|
|
||||||
kube_network_plugin: flannel
|
kube_network_plugin: flannel
|
||||||
etcd_deployment: rkt
|
etcd_deployment: rkt
|
||||||
kubelet_deployment: rkt
|
kubelet_deployment: rkt
|
||||||
|
|
|
@ -5,7 +5,6 @@ cloud_region: us-central1-b
|
||||||
mode: separate
|
mode: separate
|
||||||
|
|
||||||
# Instance settings
|
# Instance settings
|
||||||
bootstrap_os: ubuntu
|
|
||||||
cert_management: vault
|
cert_management: vault
|
||||||
kube_network_plugin: canal
|
kube_network_plugin: canal
|
||||||
deploy_netchecker: true
|
deploy_netchecker: true
|
||||||
|
|
|
@ -4,7 +4,6 @@ cloud_region: us-central1-c
|
||||||
mode: separate
|
mode: separate
|
||||||
|
|
||||||
# Deployment settings
|
# Deployment settings
|
||||||
bootstrap_os: ubuntu
|
|
||||||
kube_network_plugin: weave
|
kube_network_plugin: weave
|
||||||
deploy_netchecker: true
|
deploy_netchecker: true
|
||||||
kubedns_min_replicas: 1
|
kubedns_min_replicas: 1
|
||||||
|
|
|
@ -5,8 +5,6 @@ cloud_machine_type: "n1-standard-1"
|
||||||
mode: aio
|
mode: aio
|
||||||
|
|
||||||
# Deployment settings
|
# Deployment settings
|
||||||
kubeadm_enabled: false
|
|
||||||
bootstrap_os: ubuntu
|
|
||||||
kube_network_plugin: flannel
|
kube_network_plugin: flannel
|
||||||
dynamic_kubelet_configuration: true
|
dynamic_kubelet_configuration: true
|
||||||
deploy_netchecker: true
|
deploy_netchecker: true
|
||||||
|
|
Loading…
Reference in a new issue