Automatically infer bootstrap_os (#3498)

* Automatically infer bootstrap_os

* Rename bootstrap os to os_family
This commit is contained in:
Giacomo Longo
2018-10-11 08:32:10 +02:00
committed by k8s-ci-robot
parent e813b26963
commit 3f786542d3
22 changed files with 31 additions and 43 deletions

View File

@@ -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
when: os_family == "ubuntu"

View File

@@ -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
# 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 %}"