2016-09-06 22:04:41 +08:00
|
|
|
---
|
2018-10-11 14:32:10 +08:00
|
|
|
- name: Fetch /etc/os-release
|
|
|
|
raw: cat /etc/os-release
|
|
|
|
register: os_release
|
|
|
|
changed_when: false
|
2018-10-20 22:13:54 +08:00
|
|
|
environment: {}
|
2018-10-11 14:32:10 +08:00
|
|
|
|
2018-10-10 10:14:33 +08:00
|
|
|
- include_tasks: bootstrap-ubuntu.yml
|
2019-01-04 03:28:03 +08:00
|
|
|
when: '"Ubuntu" in os_release.stdout'
|
2017-10-03 15:30:45 +08:00
|
|
|
|
2018-10-10 10:14:33 +08:00
|
|
|
- include_tasks: bootstrap-debian.yml
|
2019-01-04 03:28:03 +08:00
|
|
|
when: '"Debian" in os_release.stdout'
|
2016-12-09 17:38:45 +08:00
|
|
|
|
2018-10-10 10:14:33 +08:00
|
|
|
- include_tasks: bootstrap-coreos.yml
|
2019-01-04 03:28:03 +08:00
|
|
|
when: '"CoreOS" in os_release.stdout'
|
2018-09-20 01:57:20 +08:00
|
|
|
|
2018-10-10 10:14:33 +08:00
|
|
|
- include_tasks: bootstrap-fedora.yml
|
2019-01-04 03:28:03 +08:00
|
|
|
when: '"Fedora" in os_release.stdout'
|
2016-12-08 00:16:06 +08:00
|
|
|
|
2018-10-10 10:14:33 +08:00
|
|
|
- include_tasks: bootstrap-centos.yml
|
2019-01-04 03:28:03 +08:00
|
|
|
when: '"CentOS" in os_release.stdout'
|
2018-04-26 17:52:06 +08:00
|
|
|
|
2018-10-10 10:14:33 +08:00
|
|
|
- include_tasks: bootstrap-opensuse.yml
|
2019-01-04 03:28:03 +08:00
|
|
|
when: '"OpenSUSE" in os_release.stdout'
|
2017-02-25 05:41:27 +08:00
|
|
|
|
2018-12-18 17:39:25 +08:00
|
|
|
- include_tasks: bootstrap-clearlinux.yml
|
2019-01-04 03:28:03 +08:00
|
|
|
when: '"Clear Linux OS" in os_release.stdout'
|
2018-12-18 17:39:25 +08:00
|
|
|
|
2018-10-10 10:14:33 +08:00
|
|
|
- import_tasks: setup-pipelining.yml
|
2017-03-27 18:27:15 +08:00
|
|
|
|
2018-10-18 03:27:11 +08: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 18:27:15 +08:00
|
|
|
- name: Gather nodes hostnames
|
|
|
|
setup:
|
|
|
|
gather_subset: '!all'
|
2017-09-06 20:10:52 +08:00
|
|
|
filter: ansible_*
|
2017-03-27 18:27:15 +08:00
|
|
|
|
2018-04-26 17:52:06 +08:00
|
|
|
- name: Assign inventory name to unconfigured hostnames (non-CoreOS and Tumbleweed)
|
2017-03-27 18:27:15 +08:00
|
|
|
hostname:
|
|
|
|
name: "{{inventory_hostname}}"
|
2018-04-26 17:52:06 +08:00
|
|
|
when:
|
|
|
|
- override_system_hostname
|
2018-12-18 17:39:25 +08:00
|
|
|
- ansible_os_family not in ['Suse', 'CoreOS', 'Container Linux by CoreOS', 'ClearLinux']
|
2017-09-06 20:10:52 +08:00
|
|
|
|
2018-04-26 17:52:06 +08:00
|
|
|
- name: Assign inventory name to unconfigured hostnames (CoreOS and Tumbleweed only)
|
2017-09-06 20:10:52 +08:00
|
|
|
command: "hostnamectl set-hostname {{inventory_hostname}}"
|
|
|
|
register: hostname_changed
|
2018-04-26 17:52:06 +08:00
|
|
|
when:
|
|
|
|
- override_system_hostname
|
2018-12-18 17:39:25 +08:00
|
|
|
- ansible_os_family in ['Suse', 'CoreOS', 'Container Linux by CoreOS', 'ClearLinux']
|
2017-09-06 20:10:52 +08:00
|
|
|
|
2018-04-26 17:52:06 +08:00
|
|
|
- name: Update hostname fact (CoreOS and Tumbleweed only)
|
2017-09-06 20:10:52 +08:00
|
|
|
setup:
|
|
|
|
gather_subset: '!all'
|
|
|
|
filter: ansible_hostname
|
2018-04-26 17:52:06 +08:00
|
|
|
when:
|
|
|
|
- hostname_changed.changed
|