2016-12-04 10:02:05 +08:00
|
|
|
---
|
|
|
|
- hosts: all
|
|
|
|
gather_facts: true
|
|
|
|
become: yes
|
|
|
|
tasks:
|
|
|
|
|
2016-12-07 04:23:12 +08:00
|
|
|
- name: check if it is Atomic host
|
|
|
|
stat: path=/run/ostree-booted
|
|
|
|
register: stat_ostree
|
2017-10-25 22:53:34 +08:00
|
|
|
check_mode: no
|
2016-12-07 04:23:12 +08:00
|
|
|
|
|
|
|
- name: set fact for using Atomic host
|
|
|
|
set_fact:
|
|
|
|
is_atomic: '{{ stat_ostree.stat.exists }}'
|
|
|
|
|
2019-04-12 22:46:20 +08:00
|
|
|
- name: get root mount information
|
|
|
|
set_fact:
|
|
|
|
rootmount: "{{ ansible_mounts|json_query('[?mount==`/`]|[0]') }}"
|
|
|
|
|
2019-07-19 02:57:46 +08:00
|
|
|
# mount -o remount doesn't work on RHEL 8 for now
|
2019-04-12 22:46:20 +08:00
|
|
|
- name: add mount options to /
|
|
|
|
mount:
|
|
|
|
path: '{{ rootmount.mount }}'
|
|
|
|
src: '{{ rootmount.device }}'
|
2020-01-11 04:30:58 +08:00
|
|
|
opts: 'noatime,nodiratime{% if ansible_os_family == "RedHat" and ansible_distribution_major_version | int < 8 %},nobarrier{% endif %}'
|
2019-04-12 22:46:20 +08:00
|
|
|
fstype: '{{ rootmount.fstype }}'
|
|
|
|
state: mounted
|
|
|
|
|
2016-12-07 04:24:36 +08:00
|
|
|
# we need to install this so the Socket testinfra module
|
|
|
|
# can use netcat for testing
|
2016-12-07 04:23:12 +08:00
|
|
|
- name: install net-tools
|
|
|
|
package:
|
|
|
|
name: net-tools
|
|
|
|
state: present
|
2018-12-19 21:55:01 +08:00
|
|
|
register: result
|
|
|
|
until: result is succeeded
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not is_atomic | bool
|
2018-05-28 18:02:49 +08:00
|
|
|
|
2018-09-07 20:45:43 +08:00
|
|
|
- name: centos based systems - configure repos
|
|
|
|
block:
|
|
|
|
- name: disable fastest mirror detection
|
|
|
|
ini_file:
|
|
|
|
path: /etc/yum/pluginconf.d/fastestmirror.conf
|
|
|
|
section: main
|
|
|
|
option: enabled
|
|
|
|
value: 0
|
|
|
|
- name: install epel
|
|
|
|
package:
|
|
|
|
name: epel-release
|
|
|
|
state: present
|
2018-12-19 21:55:01 +08:00
|
|
|
register: result
|
|
|
|
until: result is succeeded
|
2018-09-07 20:45:43 +08:00
|
|
|
- name: enable local epel repository
|
|
|
|
ini_file:
|
|
|
|
path: /etc/yum.repos.d/epel.repo
|
|
|
|
section: epel
|
|
|
|
option: baseurl
|
|
|
|
value: http://apt-mirror.front.sepia.ceph.com/epel7/
|
|
|
|
- name: disable remote epel repository
|
|
|
|
ini_file:
|
|
|
|
path: /etc/yum.repos.d/epel.repo
|
|
|
|
section: epel
|
|
|
|
option: metalink
|
|
|
|
state: absent
|
2018-06-02 00:53:10 +08:00
|
|
|
when:
|
|
|
|
- ansible_distribution == 'CentOS'
|
2019-11-19 04:05:16 +08:00
|
|
|
- ansible_distribution_major_version | int == 7
|
2019-05-22 16:02:42 +08:00
|
|
|
- not is_atomic | bool
|
2018-06-02 00:53:10 +08:00
|
|
|
|
2018-05-30 15:17:09 +08:00
|
|
|
- name: resize logical volume for root partition to fill remaining free space
|
2018-06-01 17:32:00 +08:00
|
|
|
lvol:
|
|
|
|
lv: root
|
|
|
|
vg: atomicos
|
|
|
|
size: +100%FREE
|
|
|
|
resizefs: yes
|
2019-05-22 16:02:42 +08:00
|
|
|
when: is_atomic | bool
|
2020-07-30 00:23:06 +08:00
|
|
|
|
|
|
|
# https://tracker.ceph.com/issues/46759
|
|
|
|
- name: install pyyaml for ceph-volume
|
|
|
|
package:
|
|
|
|
name: "{{ 'python3-pyyaml' if ansible_distribution_major_version | int == 8 else 'python36-PyYAML' }}"
|
|
|
|
register: result
|
|
|
|
until: result is succeeded
|
|
|
|
when:
|
|
|
|
- not is_atomic | bool
|
|
|
|
- ansible_distribution == 'CentOS'
|
|
|
|
- inventory_hostname in groups.get('osds', [])
|
|
|
|
- not containerized_deployment | default(false) | bool
|