2016-09-06 14:04:41 +00:00
|
|
|
---
|
2018-10-11 06:32:10 +00:00
|
|
|
- name: Fetch /etc/os-release
|
|
|
|
raw: cat /etc/os-release
|
|
|
|
register: os_release
|
|
|
|
changed_when: false
|
2018-10-20 14:13:54 +00:00
|
|
|
environment: {}
|
2018-10-11 06:32:10 +00:00
|
|
|
|
|
|
|
- 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
|
2018-12-18 09:39:25 +00:00
|
|
|
{%- elif 'Clear Linux OS' in os_release.stdout -%}
|
|
|
|
clearlinux
|
2018-10-29 08:37:30 +00:00
|
|
|
{%- endif -%}
|
2016-09-07 18:19:46 +00:00
|
|
|
|
2018-10-10 02:14:33 +00:00
|
|
|
- include_tasks: bootstrap-ubuntu.yml
|
|
|
|
when: os_family == "ubuntu"
|
2017-10-03 07:30:45 +00:00
|
|
|
|
2018-10-10 02:14:33 +00:00
|
|
|
- include_tasks: bootstrap-debian.yml
|
|
|
|
when: os_family == "debian"
|
2016-12-09 09:38:45 +00:00
|
|
|
|
2018-10-10 02:14:33 +00:00
|
|
|
- include_tasks: bootstrap-coreos.yml
|
|
|
|
when: os_family == "coreos"
|
2018-09-19 17:57:20 +00:00
|
|
|
|
2018-10-10 02:14:33 +00:00
|
|
|
- include_tasks: bootstrap-fedora.yml
|
|
|
|
when: os_family == "fedora"
|
2016-12-07 16:16:06 +00:00
|
|
|
|
2018-10-10 02:14:33 +00:00
|
|
|
- include_tasks: bootstrap-centos.yml
|
|
|
|
when: os_family == "centos"
|
2018-04-26 09:52:06 +00:00
|
|
|
|
2018-10-10 02:14:33 +00:00
|
|
|
- include_tasks: bootstrap-opensuse.yml
|
|
|
|
when: os_family == "opensuse"
|
2017-02-24 21:41:27 +00:00
|
|
|
|
2018-12-18 09:39:25 +00:00
|
|
|
- include_tasks: bootstrap-clearlinux.yml
|
|
|
|
when: os_family == "clearlinux"
|
|
|
|
|
2018-10-10 02:14:33 +00:00
|
|
|
- import_tasks: setup-pipelining.yml
|
2017-03-27 10:27:15 +00:00
|
|
|
|
2018-10-17 19:27:11 +00:00
|
|
|
- name: Create remote_tmp for it is used by another module
|
|
|
|
file:
|
|
|
|
path: "{{ lookup('config', 'DEFAULT_REMOTE_TMP', on_missing='skip', wantlist=True) | first | default('~/.ansible/tmp') }}"
|
|
|
|
state: directory
|
|
|
|
mode: 0700
|
|
|
|
|
2017-03-27 10:27:15 +00:00
|
|
|
- name: Gather nodes hostnames
|
|
|
|
setup:
|
|
|
|
gather_subset: '!all'
|
2017-09-06 12:10:52 +00:00
|
|
|
filter: ansible_*
|
2017-03-27 10:27:15 +00:00
|
|
|
|
2018-04-26 09:52:06 +00:00
|
|
|
- name: Assign inventory name to unconfigured hostnames (non-CoreOS and Tumbleweed)
|
2017-03-27 10:27:15 +00:00
|
|
|
hostname:
|
|
|
|
name: "{{inventory_hostname}}"
|
2018-04-26 09:52:06 +00:00
|
|
|
when:
|
|
|
|
- override_system_hostname
|
2018-12-18 09:39:25 +00:00
|
|
|
- ansible_os_family not in ['Suse', 'CoreOS', 'Container Linux by CoreOS', 'ClearLinux']
|
2017-09-06 12:10:52 +00:00
|
|
|
|
2018-04-26 09:52:06 +00:00
|
|
|
- name: Assign inventory name to unconfigured hostnames (CoreOS and Tumbleweed only)
|
2017-09-06 12:10:52 +00:00
|
|
|
command: "hostnamectl set-hostname {{inventory_hostname}}"
|
|
|
|
register: hostname_changed
|
2018-04-26 09:52:06 +00:00
|
|
|
when:
|
|
|
|
- override_system_hostname
|
2018-12-18 09:39:25 +00:00
|
|
|
- ansible_os_family in ['Suse', 'CoreOS', 'Container Linux by CoreOS', 'ClearLinux']
|
2017-09-06 12:10:52 +00:00
|
|
|
|
2018-04-26 09:52:06 +00:00
|
|
|
- name: Update hostname fact (CoreOS and Tumbleweed only)
|
2017-09-06 12:10:52 +00:00
|
|
|
setup:
|
|
|
|
gather_subset: '!all'
|
|
|
|
filter: ansible_hostname
|
2018-04-26 09:52:06 +00:00
|
|
|
when:
|
|
|
|
- hostname_changed.changed
|