Skip to content
Snippets Groups Projects
  • spaced's avatar
    876d4de6
    Fedora CoreOS support (#5657) · 876d4de6
    spaced authored
    * fedora coreos support
    - bootstrap and new fact for
    
    * fedora coreos support
    - fix bootstrap condition
    
    * fedora coreos support
    - allow customize packages for fedora coreos bootstrap
    
    * fedora coreos support
    - prevent install ptyhon3 and epel via dnf for fedora coreos
    
    * fedora coreos support
    - handle all ostree like os in same way
    
    * fedora coreos support
    - handle all ostree like os in same way for crio
    
    * fedora coreos support
    - add fcos documentations
    Fedora CoreOS support (#5657)
    spaced authored
    * fedora coreos support
    - bootstrap and new fact for
    
    * fedora coreos support
    - fix bootstrap condition
    
    * fedora coreos support
    - allow customize packages for fedora coreos bootstrap
    
    * fedora coreos support
    - prevent install ptyhon3 and epel via dnf for fedora coreos
    
    * fedora coreos support
    - handle all ostree like os in same way
    
    * fedora coreos support
    - handle all ostree like os in same way for crio
    
    * fedora coreos support
    - add fcos documentations
main.yml 2.74 KiB
---
- name: Fetch /etc/os-release
  raw: cat /etc/os-release
  register: os_release
  changed_when: false
  # This command should always run, even in check mode
  check_mode: false
  environment: {}

- include_tasks: bootstrap-centos.yml
  when: '"CentOS" in os_release.stdout or "Red Hat Enterprise Linux" in os_release.stdout or "Oracle" in os_release.stdout'

- include_tasks: bootstrap-clearlinux.yml
  when: '"Clear Linux OS" in os_release.stdout'

- include_tasks: bootstrap-fedora-coreos.yml
  when: '"ID=fedora" in os_release.stdout and "VARIANT_ID=coreos" in os_release.stdout'

- include_tasks: bootstrap-coreos.yml
  when:
    - '"CoreOS" in os_release.stdout or "Flatcar" in os_release.stdout'
    - '"ID=fedora" not in os_release.stdout'

- include_tasks: bootstrap-debian.yml
  when: '"Debian" in os_release.stdout or "Ubuntu" in os_release.stdout'

- include_tasks: bootstrap-fedora.yml
  when:
    - '"Fedora" in os_release.stdout'
    - '"VARIANT_ID=coreos" not in os_release.stdout'

- include_tasks: bootstrap-opensuse.yml
  when: '"openSUSE" in os_release.stdout'

- name: Create remote_tmp for it is used by another module
  file:
    path: "{{ ansible_remote_tmp | default('~/.ansible/tmp') }}"
    state: directory
    mode: 0700

# Workaround for https://github.com/ansible/ansible/issues/42726
# (1/3)
- name: Gather host facts to get ansible_os_family
  setup:
    gather_subset: '!all'
    filter: ansible_*

- name: Assign inventory name to unconfigured hostnames (non-CoreOS, non-Flatcar, Suse and ClearLinux)
  hostname:
    name: "{{ inventory_hostname }}"
  when:
    - override_system_hostname
    - ansible_os_family not in ['Suse', 'Container Linux by CoreOS', 'Flatcar Container Linux by Kinvolk', 'ClearLinux'] and not is_fedora_coreos

# (2/3)
- name: Assign inventory name to unconfigured hostnames (CoreOS, non-Flatcar, Suse and ClearLinux only)
  command: "hostnamectl set-hostname {{ inventory_hostname }}"
  register: hostname_changed
  changed_when: false
  when:
    - override_system_hostname
    - ansible_os_family in ['Suse', 'Container Linux by CoreOS', 'Flatcar Container Linux by Kinvolk', 'ClearLinux'] or is_fedora_coreos

# (3/3)
- name: Update hostname fact (CoreOS, Flatcar, Suse and ClearLinux only)
  setup:
    gather_subset: '!all'
    filter: ansible_hostname
  when:
    - override_system_hostname