c12s-kubespray/roles/bootstrap-os/tasks/main.yml

44 lines
1.2 KiB
YAML
Raw Normal View History

---
- import_tasks: bootstrap-ubuntu.yml
2016-09-07 18:19:46 +00:00
when: bootstrap_os == "ubuntu"
- import_tasks: bootstrap-debian.yml
2017-10-03 07:30:45 +00:00
when: bootstrap_os == "debian"
- import_tasks: bootstrap-coreos.yml
when: bootstrap_os == "coreos"
- import_tasks: bootstrap-centos.yml
when: bootstrap_os == "centos"
- import_tasks: setup-pipelining.yml
- name: check if atomic host
stat:
path: /run/ostree-booted
register: ostree
- set_fact:
is_atomic: "{{ ostree.stat.exists }}"
- name: Gather nodes hostnames
setup:
gather_subset: '!all'
filter: ansible_*
2018-04-23 11:28:24 +00:00
- name: Assign inventory name to unconfigured hostnames (non-CoreOS)
hostname:
name: "{{inventory_hostname}}"
2018-04-23 11:28:24 +00:00
when: ansible_os_family not in ['CoreOS', 'Container Linux by CoreOS'] and override_system_hostname
2018-04-23 11:28:24 +00:00
- name: Assign inventory name to unconfigured hostnames (CoreOS only)
command: "hostnamectl set-hostname {{inventory_hostname}}"
register: hostname_changed
2018-04-23 11:28:24 +00:00
when: ansible_hostname == 'localhost' and ansible_os_family in ['CoreOS', 'Container Linux by CoreOS'] and override_system_hostname
2018-04-23 11:28:24 +00:00
- name: Update hostname fact (CoreOS only)
setup:
gather_subset: '!all'
filter: ansible_hostname
2018-04-23 11:28:24 +00:00
when: ansible_os_family in ['CoreOS', 'Container Linux by CoreOS'] and hostname_changed.changed