ceph-rollout/pre-deploy.yml
2024-10-26 14:37:32 +03:00

94 lines
2.5 KiB
YAML

---
- name: deploy all the needed tools for ceph
hosts: all
become: true
gather_facts: true
diff: true
vars:
ceph_repo: "https://download.ceph.com/debian-reef"
ntp_server: "ntp.int.nt-com.ru"
first_mon_ip: "10.63.1.19"
cluster_network: "10.63.0.0/24"
public_network: "10.63.1.0/24"
CEPH_RELEASE: '19.2.0'
initial_dashboard_user: 'admin'
initial_dashboard_password: 'qweqwe'
allow_fqdn_hostname: 'true'
tasks:
- name: download asc from ceph
get_url:
url: https://download.ceph.com/keys/release.asc
dest: /tmp
- name: Delete previously install ceph.gpg
file:
path: /usr/share/keyrings/ceph.gpg
state: absent
- name: import downloaded asc
shell:
chdir: /tmp
cmd: echo y | gpg -o /usr/share/keyrings/ceph.gpg --dearmor release.asc;
- name: Add ceph repo
apt_repository:
filename: ceph
repo: "deb [signed-by=/usr/share/keyrings/ceph.gpg] {{ ceph_repo }} {{ ansible_distribution_release }} main"
state: present
# - name: here bootstrap the the first node
# block:
# - name: download cephadm bootstrapper
# get_url:
# url: https://download.ceph.com/rpm-{{CEPH_RELEASE}}/el9/noarch/cephadm
# dest: /tmp
# mode: '777'
- name: Prepare customized ceph.conf
template:
src: ceph.conf.j2
dest: /root/ceph.conf
- name: install packages
apt:
pkg:
- ceph-common
- cephadm
- lvm2
- podman
- chrony
- mc
state: present
- name: Setup ntp client
template:
src: chrony.yaml.j2
dest: /etc/chrony/chrony.conf
notify:
- ceph-rollout:restart
- name: Templating cluster-spec
template:
src: cluster_spec.yml.j2
dest: /root/cluster_spec.yml
trim_blocks: true
lstrip_blocks: true
run_once: true
delegate_to: ceph01
- name: Flush restart handlers
meta: flush_handlers
- name: running ceph bootstrap
pause:
prompt: RUN THIS TO BOOTSTRAP THE CLUSTER "cephadm bootstrap --mon-ip {{ first_mon_ip }} --cluster-network {{ cluster_network }}
--initial-dashboard-user {{ initial_dashboard_user }} --initial-dashboard-password {{ initial_dashboard_password }} --apply-spec /root/cluster_spec.yml"
handlers:
- name: ceph-rollout:restart
ansible.builtin.systemd_service:
state: restarted
name: chronyd
listen: "restart chronyd service"