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
|
2019-02-12 06:04:27 +08:00
|
|
|
# This command should always run, even in check mode
|
|
|
|
check_mode: false
|
2018-10-11 14:32:10 +08:00
|
|
|
|
2019-04-24 06:46:02 +08:00
|
|
|
- include_tasks: bootstrap-centos.yml
|
2020-11-25 00:33:00 +08:00
|
|
|
when: '"CentOS" in os_release.stdout or "Oracle" in os_release.stdout'
|
|
|
|
|
|
|
|
- include_tasks: bootstrap-redhat.yml
|
2021-02-09 02:25:37 +08:00
|
|
|
when: '"Red Hat Enterprise Linux" in os_release.stdout and "CentOS" not in os_release.stdout'
|
2017-10-03 15:30:45 +08:00
|
|
|
|
2019-04-24 06:46:02 +08:00
|
|
|
- include_tasks: bootstrap-clearlinux.yml
|
|
|
|
when: '"Clear Linux OS" in os_release.stdout'
|
2016-12-09 17:38:45 +08:00
|
|
|
|
2020-03-17 18:12:21 +08:00
|
|
|
- include_tasks: bootstrap-fedora-coreos.yml
|
|
|
|
when: '"ID=fedora" in os_release.stdout and "VARIANT_ID=coreos" in os_release.stdout'
|
|
|
|
|
2020-08-28 17:28:53 +08:00
|
|
|
- include_tasks: bootstrap-flatcar.yml
|
2020-03-17 18:12:21 +08:00
|
|
|
when:
|
2020-08-28 17:28:53 +08:00
|
|
|
- '"Flatcar" in os_release.stdout'
|
2020-03-17 18:12:21 +08:00
|
|
|
- '"ID=fedora" not in os_release.stdout'
|
2018-09-20 01:57:20 +08:00
|
|
|
|
2019-04-24 06:46:02 +08:00
|
|
|
- include_tasks: bootstrap-debian.yml
|
|
|
|
when: '"Debian" in os_release.stdout or "Ubuntu" in os_release.stdout'
|
|
|
|
|
2018-10-10 10:14:33 +08:00
|
|
|
- include_tasks: bootstrap-fedora.yml
|
2020-03-17 18:12:21 +08:00
|
|
|
when:
|
|
|
|
- '"Fedora" in os_release.stdout'
|
|
|
|
- '"VARIANT_ID=coreos" not in os_release.stdout'
|
2016-12-08 00:16:06 +08:00
|
|
|
|
2018-10-10 10:14:33 +08:00
|
|
|
- include_tasks: bootstrap-opensuse.yml
|
2019-04-09 15:17:05 +08:00
|
|
|
when: '"openSUSE" in os_release.stdout'
|
2017-02-25 05:41:27 +08:00
|
|
|
|
2018-10-18 03:27:11 +08:00
|
|
|
- name: Create remote_tmp for it is used by another module
|
|
|
|
file:
|
2019-03-28 21:24:43 +08:00
|
|
|
path: "{{ ansible_remote_tmp | default('~/.ansible/tmp') }}"
|
2018-10-18 03:27:11 +08:00
|
|
|
state: directory
|
|
|
|
mode: 0700
|
|
|
|
|
2019-04-24 06:46:02 +08:00
|
|
|
# Workaround for https://github.com/ansible/ansible/issues/42726
|
|
|
|
# (1/3)
|
|
|
|
- name: Gather host facts to get ansible_os_family
|
2017-03-27 18:27:15 +08:00
|
|
|
setup:
|
|
|
|
gather_subset: '!all'
|
2017-09-06 20:10:52 +08:00
|
|
|
filter: ansible_*
|
2017-03-27 18:27:15 +08:00
|
|
|
|
2020-02-18 16:15:29 +08:00
|
|
|
- name: Assign inventory name to unconfigured hostnames (non-CoreOS, non-Flatcar, Suse and ClearLinux)
|
2017-03-27 18:27:15 +08:00
|
|
|
hostname:
|
2019-02-12 06:04:27 +08:00
|
|
|
name: "{{ inventory_hostname }}"
|
2018-04-26 17:52:06 +08:00
|
|
|
when:
|
|
|
|
- override_system_hostname
|
2020-08-28 17:28:53 +08:00
|
|
|
- ansible_os_family not in ['Suse', 'Flatcar Container Linux by Kinvolk', 'ClearLinux'] and not is_fedora_coreos
|
2017-09-06 20:10:52 +08:00
|
|
|
|
2019-04-24 06:46:02 +08:00
|
|
|
# (2/3)
|
2020-08-28 17:28:53 +08:00
|
|
|
- name: Assign inventory name to unconfigured hostnames (CoreOS, Flatcar, Suse and ClearLinux only)
|
2019-02-12 06:04:27 +08:00
|
|
|
command: "hostnamectl set-hostname {{ inventory_hostname }}"
|
2017-09-06 20:10:52 +08:00
|
|
|
register: hostname_changed
|
2020-04-08 22:37:44 +08:00
|
|
|
become: true
|
2019-04-24 06:46:02 +08:00
|
|
|
changed_when: false
|
2018-04-26 17:52:06 +08:00
|
|
|
when:
|
|
|
|
- override_system_hostname
|
2020-08-28 17:28:53 +08:00
|
|
|
- ansible_os_family in ['Suse', 'Flatcar Container Linux by Kinvolk', 'ClearLinux'] or is_fedora_coreos
|
2017-09-06 20:10:52 +08:00
|
|
|
|
2019-04-24 06:46:02 +08:00
|
|
|
# (3/3)
|
2020-02-18 16:15:29 +08:00
|
|
|
- name: Update hostname fact (CoreOS, Flatcar, Suse and ClearLinux 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:
|
2019-04-24 06:46:02 +08:00
|
|
|
- override_system_hostname
|
2020-08-28 17:28:53 +08:00
|
|
|
- ansible_os_family in ['Suse', 'Flatcar Container Linux by Kinvolk', 'ClearLinux'] or is_fedora_coreos
|
2019-04-17 14:14:02 +08:00
|
|
|
|
|
|
|
- name: "Install ceph-commmon package"
|
|
|
|
package:
|
|
|
|
name:
|
|
|
|
- ceph-common
|
2019-04-19 04:45:25 +08:00
|
|
|
state: present
|
2019-04-17 14:14:02 +08:00
|
|
|
when: rbd_provisioner_enabled|default(false)
|
2019-08-05 09:15:48 +08:00
|
|
|
|
|
|
|
- name: Ensure bash_completion.d folder exists
|
|
|
|
file:
|
|
|
|
name: /etc/bash_completion.d/
|
|
|
|
state: directory
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0755
|