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