2019-06-12 21:06:06 -04:00
|
|
|
---
|
|
|
|
- name: install packages
|
|
|
|
apt:
|
|
|
|
name:
|
|
|
|
- ceph-osd
|
|
|
|
- ceph-mds
|
|
|
|
- ceph-mon
|
|
|
|
- ceph-mgr
|
|
|
|
- radosgw
|
|
|
|
state: latest
|
|
|
|
|
|
|
|
- name: install sysctl tweaks
|
|
|
|
template:
|
|
|
|
src: ceph/sysctl.conf.j2
|
|
|
|
dest: /etc/sysctl.d/pvc-ceph.conf
|
|
|
|
|
|
|
|
- name: activate sysctl tweaks
|
|
|
|
command: sysctl -p /etc/sysctl.d/pvc-ceph.conf
|
|
|
|
|
|
|
|
- name: install user limits overrides
|
|
|
|
template:
|
|
|
|
src: ceph/limits.conf.j2
|
|
|
|
dest: /etc/security/limits.d/99-pvc-ceph.conf
|
|
|
|
|
|
|
|
- name: install ceph default config
|
|
|
|
template:
|
|
|
|
src: ceph/default.conf.j2
|
|
|
|
dest: /etc/default/ceph
|
|
|
|
|
|
|
|
- name: create ceph configuration directory
|
|
|
|
file:
|
|
|
|
dest: /etc/ceph
|
|
|
|
state: directory
|
|
|
|
|
|
|
|
- include: ceph/bootstrap.yml
|
|
|
|
when: bootstrap is defined and bootstrap
|
|
|
|
run_once: yes
|
|
|
|
|
|
|
|
- name: install configurations
|
|
|
|
copy:
|
2020-08-06 13:20:14 -04:00
|
|
|
src: ceph/{{ cluster_group }}/ceph/{{ item }}
|
2019-06-12 21:06:06 -04:00
|
|
|
dest: /etc/ceph/{{ item }}
|
|
|
|
owner: ceph
|
|
|
|
group: ceph
|
|
|
|
mode: 0640
|
2019-06-18 21:37:42 -04:00
|
|
|
notify:
|
|
|
|
- restart ceph-mon
|
|
|
|
- restart ceph-mgr
|
2019-06-12 21:06:06 -04:00
|
|
|
with_items:
|
|
|
|
- ceph.conf
|
|
|
|
- ceph.mon.keyring
|
|
|
|
- ceph.client.admin.keyring
|
|
|
|
- ceph.osd.bootstrap.keyring
|
|
|
|
- monmap
|
|
|
|
|
2019-06-16 19:17:41 -04:00
|
|
|
- name: create monitor and manager data directories
|
2019-06-12 21:06:06 -04:00
|
|
|
file:
|
2019-06-16 19:17:41 -04:00
|
|
|
dest: /var/lib/ceph/{{ item }}/ceph-{{ ansible_hostname }}
|
2019-06-12 21:06:06 -04:00
|
|
|
state: directory
|
|
|
|
owner: ceph
|
|
|
|
group: ceph
|
|
|
|
mode: 0750
|
2019-06-16 19:17:41 -04:00
|
|
|
with_items:
|
|
|
|
- mon
|
|
|
|
- mgr
|
2019-06-12 21:06:06 -04:00
|
|
|
when: newhost is defined and newhost
|
|
|
|
|
|
|
|
- name: populate monitor with map and keys
|
2019-06-12 23:22:47 -04:00
|
|
|
command: ceph-mon --cluster ceph --mkfs -i {{ ansible_hostname }} --monmap /etc/ceph/monmap --keyring /etc/ceph/ceph.mon.keyring
|
2019-06-12 21:06:06 -04:00
|
|
|
become_user: ceph
|
|
|
|
when: newhost is defined and newhost
|
|
|
|
|
2019-06-16 19:17:41 -04:00
|
|
|
- name: touch monitor and manager done files
|
2019-06-12 21:06:06 -04:00
|
|
|
file:
|
2019-06-16 19:17:41 -04:00
|
|
|
dest: /var/lib/ceph/{{ item }}/ceph-{{ ansible_hostname }}/done
|
2019-06-12 21:06:06 -04:00
|
|
|
state: touch
|
|
|
|
become_user: ceph
|
2019-06-16 19:17:41 -04:00
|
|
|
with_items:
|
|
|
|
- mon
|
|
|
|
- mgr
|
2019-06-12 21:06:06 -04:00
|
|
|
when: newhost is defined and newhost
|
|
|
|
|
2019-06-24 09:52:53 -04:00
|
|
|
- name: start monitor daemon
|
|
|
|
service:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: started
|
|
|
|
with_items:
|
|
|
|
- ceph-mon@{{ ansible_hostname }}
|
|
|
|
when: newhost is defined and newhost
|
|
|
|
|
2019-12-30 09:13:50 -05:00
|
|
|
- name: set msgr2 enabled
|
|
|
|
command: ceph mon enable-msgr2
|
|
|
|
run_once: true
|
2021-01-27 14:13:09 -05:00
|
|
|
retries: 6
|
|
|
|
delay: 5
|
|
|
|
register: result
|
|
|
|
until: result.rc == 0
|
2019-12-30 09:13:50 -05:00
|
|
|
|
2019-06-24 09:52:53 -04:00
|
|
|
- name: create mgr auth keyring
|
|
|
|
command: ceph auth get-or-create mgr.{{ ansible_hostname }} mon 'allow profile mgr' osd 'allow *' mds 'allow *' --out-file /var/lib/ceph/mgr/ceph-{{ ansible_hostname }}/keyring
|
|
|
|
become_user: ceph
|
|
|
|
args:
|
|
|
|
creates: /var/lib/ceph/mgr/ceph-{{ ansible_hostname }}/keyring
|
|
|
|
|
2019-06-18 19:39:01 -04:00
|
|
|
- name: install OSD bootstrap keyring
|
|
|
|
file:
|
|
|
|
dest: /var/lib/ceph/bootstrap-osd/ceph.keyring
|
|
|
|
src: /etc/ceph/ceph.osd.bootstrap.keyring
|
|
|
|
state: link
|
|
|
|
|
2019-06-17 10:28:18 -04:00
|
|
|
- name: start but disable daemons
|
2019-06-12 21:06:06 -04:00
|
|
|
service:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: started
|
2019-06-17 10:28:18 -04:00
|
|
|
enabled: no
|
2019-06-12 21:06:06 -04:00
|
|
|
with_items:
|
|
|
|
- ceph-mon@{{ ansible_hostname }}
|
|
|
|
- ceph-mgr@{{ ansible_hostname }}
|
|
|
|
|
2021-09-29 10:21:47 -04:00
|
|
|
# This is separate from the block to allow *disabling* of the config without removing it
|
|
|
|
- name: install ceph-osd-cpuset controller config
|
|
|
|
template:
|
|
|
|
src: ceph/ceph-osd-cpuset-enable.j2
|
|
|
|
dest: /etc/default/ceph-osd-cpuset
|
|
|
|
when:
|
|
|
|
- pvc_shield_osds_enable is defined
|
|
|
|
|
2021-09-26 14:49:22 -04:00
|
|
|
# System OSD CPU shielding activation
|
|
|
|
- block:
|
|
|
|
- name: install packages
|
|
|
|
apt:
|
|
|
|
name:
|
|
|
|
- cpuset
|
|
|
|
- numactl
|
|
|
|
state: latest
|
|
|
|
|
|
|
|
- name: install ceph-osd-cpuset script
|
|
|
|
template:
|
|
|
|
src: ceph/ceph-osd-cpuset.j2
|
|
|
|
dest: /usr/local/sbin/ceph-osd-cpuset
|
|
|
|
mode: 0755
|
|
|
|
|
|
|
|
- name: install ceph-osd-cpuset service unit
|
|
|
|
template:
|
|
|
|
src: ceph/ceph-osd-cpuset.service.j2
|
|
|
|
dest: /etc/systemd/system/ceph-osd-cpuset.service
|
|
|
|
register: systemd_file_cpuset
|
|
|
|
|
|
|
|
- name: create ceph-osd override dropin directory
|
|
|
|
file:
|
|
|
|
dest: /etc/systemd/system/ceph-osd@.service.d
|
|
|
|
state: directory
|
|
|
|
|
|
|
|
- name: install ceph-osd override dropin
|
|
|
|
template:
|
|
|
|
src: ceph/ceph-osd-cpuset.conf.j2
|
|
|
|
dest: /etc/systemd/system/ceph-osd@.service.d/cpuset.conf
|
|
|
|
register: systemd_file_osd
|
|
|
|
|
|
|
|
- name: reload systemd to apply previous changes
|
|
|
|
command: "systemctl daemon-reload"
|
|
|
|
when: systemd_file_cpuset.changed or systemd_file_osd.changed
|
|
|
|
|
|
|
|
- name: enable ceph-osd-cpuset service
|
|
|
|
service:
|
|
|
|
name: ceph-osd-cpuset
|
|
|
|
enabled: yes
|
|
|
|
|
|
|
|
- debug:
|
|
|
|
msg: "NOTICE: cpuset configs have NOT been applied to the running system. This node must be rebooted to apply these changes."
|
|
|
|
when: systemd_file_cpuset.changed or systemd_file_osd.changed
|
|
|
|
tags: pvc-ceph-cpuset
|
|
|
|
when:
|
|
|
|
- pvc_shield_osds_enable is defined
|
|
|
|
- pvc_shield_osds_cset is defined
|
|
|
|
- pvc_shield_osds_cset | selectattr('hostname', 'equalto', inventory_hostname) | list | count > 0
|
|
|
|
|
2019-06-12 21:06:06 -04:00
|
|
|
- meta: flush_handlers
|