mirror of https://github.com/ceph/ceph-ansible.git
133 lines
4.5 KiB
YAML
133 lines
4.5 KiB
YAML
---
|
|
- hosts: all
|
|
gather_facts: true
|
|
become: yes
|
|
tasks:
|
|
|
|
- name: check if it is Atomic host
|
|
stat: path=/run/ostree-booted
|
|
register: stat_ostree
|
|
check_mode: no
|
|
|
|
- name: set fact for using Atomic host
|
|
set_fact:
|
|
is_atomic: '{{ stat_ostree.stat.exists }}'
|
|
|
|
# - name: List repo files
|
|
# find:
|
|
# paths: /etc/yum.repos.d/
|
|
# file_type: file
|
|
# patterns: 'CentOS-Stream-*.repo'
|
|
# register: pre_stream_repo_files
|
|
# when:
|
|
# - ansible_facts['distribution'] == 'CentOS'
|
|
# - ansible_facts['distribution_major_version'] | int > 7
|
|
# - not is_atomic | bool
|
|
#
|
|
# # From ansible docs: 'replace: If not set, matches are removed entirely.'
|
|
# - name: Remove all mirrorlists
|
|
# replace:
|
|
# path: "{{ item.path }}"
|
|
# regexp: '^mirrorlist=.*'
|
|
# with_items: "{{ pre_stream_repo_files.files }}"
|
|
# when:
|
|
# - ansible_facts['distribution'] == 'CentOS'
|
|
# - ansible_facts['distribution_major_version'] | int > 7
|
|
# - not is_atomic | bool
|
|
#
|
|
# - name: Uncomment baseurls
|
|
# replace:
|
|
# path: "{{ item.path }}"
|
|
# regexp: '^mirrorlist=.*'
|
|
# regexp: '^\s*#*\s*(baseurl=.*)'
|
|
# replace: '\1'
|
|
# with_items: "{{ pre_stream_repo_files.files }}"
|
|
# when:
|
|
# - ansible_facts['distribution'] == 'CentOS'
|
|
# - ansible_facts['distribution_major_version'] | int > 7
|
|
# - not is_atomic | bool
|
|
#
|
|
# - name: Point baseurls to archive server
|
|
# replace:
|
|
# path: "{{ item.path }}"
|
|
# regexp: 'mirror.centos.org/\$contentdir/\$stream'
|
|
# replace: 'apt-mirror.front.sepia.ceph.com/centos/8-stream'
|
|
# with_items: "{{ pre_stream_repo_files.files }}"
|
|
# when:
|
|
# - ansible_facts['distribution'] == 'CentOS'
|
|
# - ansible_facts['distribution_major_version'] | int > 7
|
|
# - not is_atomic | bool
|
|
|
|
- name: force rpm pkg upgrade
|
|
package:
|
|
name: rpm
|
|
state: latest
|
|
when: not is_atomic | bool
|
|
|
|
- name: update the system
|
|
command: dnf update -y
|
|
changed_when: false
|
|
when: not is_atomic | bool
|
|
|
|
- name: get root mount information
|
|
set_fact:
|
|
rootmount: "{{ ansible_facts['mounts']|json_query('[?mount==`/`]|[0]') }}"
|
|
|
|
# mount -o remount doesn't work on RHEL 8 for now
|
|
- name: add mount options to /
|
|
ansible.posix.mount:
|
|
path: '{{ rootmount.mount }}'
|
|
src: '{{ rootmount.device }}'
|
|
opts: "noatime,nodiratime{% if ansible_facts['os_family'] == 'RedHat' and ansible_facts['distribution_major_version'] | int < 8 %},nobarrier{% endif %}"
|
|
fstype: '{{ rootmount.fstype }}'
|
|
state: mounted
|
|
|
|
# we need to install this so the Socket testinfra module
|
|
# can use netcat for testing
|
|
- name: install net-tools
|
|
package:
|
|
name: net-tools
|
|
state: present
|
|
register: result
|
|
until: result is succeeded
|
|
when: not is_atomic | bool
|
|
|
|
- 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
|
|
register: result
|
|
until: result is succeeded
|
|
- 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
|
|
when:
|
|
- ansible_facts['distribution'] == 'CentOS'
|
|
- ansible_facts['distribution_major_version'] | int == 7
|
|
- not is_atomic | bool
|
|
|
|
- name: resize logical volume for root partition to fill remaining free space
|
|
lvol:
|
|
lv: root
|
|
vg: atomicos
|
|
size: +100%FREE
|
|
resizefs: yes
|
|
when: is_atomic | bool
|