Skip to content
Snippets Groups Projects
0040-set_facts.yml 5.38 KiB
---
- set_fact:
    architecture_groups:
      x86_64: amd64
      aarch64: arm64

- name: ansible_architecture_rename
  set_fact:
    host_architecture: >-
      {%- if ansible_architecture in architecture_groups -%}
      {{architecture_groups[ansible_architecture]}}
      {%- else -%}
       {{ansible_architecture}}
      {% endif %}

- name: Force binaries directory for Container Linux by CoreOS
  set_fact:
    bin_dir: "/opt/bin"
  when: ansible_os_family in ["CoreOS", "Container Linux by CoreOS"]
  tags:
    - facts

- name: check if atomic host
  stat:
    path: /run/ostree-booted
  register: ostree

- set_fact:
    is_atomic: "{{ ostree.stat.exists }}"

- set_fact:
    kube_cert_group: "kube"
  when: is_atomic

- name: check resolvconf
  shell: which resolvconf
  register: resolvconf
  failed_when: false
  changed_when: false
  check_mode: no

- set_fact:
    resolvconf: >-
      {%- if resolvconf.rc == 0 -%}true{%- else -%}false{%- endif -%}

- set_fact:
    bogus_domains: |-
      {% for d in [ 'default.svc.' + dns_domain, 'svc.' + dns_domain ] + searchdomains|default([]) -%}
      {{dns_domain}}.{{d}}./{{d}}.{{d}}./com.{{d}}./
      {%- endfor %}
    cloud_resolver: >-
      {%- if cloud_provider is defined and cloud_provider == 'gce' -%}
        ['169.254.169.254']
      {%- elif cloud_provider is defined and cloud_provider == 'aws' -%}
        ['169.254.169.253']
      {%- else -%}
        []
      {%- endif -%}

- name: check if kubelet is configured
  stat:
    path: "{{ kube_config_dir }}/kubelet.env"
  register: kubelet_configured
  changed_when: false

- name: check if early DNS configuration stage
  set_fact:
    dns_early: >-
      {%- if kubelet_configured.stat.exists -%}false{%- else -%}true{%- endif -%}