Clean up some tasks during bootstrap; parallel PVC

This commit is contained in:
Joshua Boniface 2023-09-01 15:42:20 -04:00
parent 218cec1126
commit a19d9c77ad
4 changed files with 32 additions and 43 deletions

View File

@ -51,13 +51,16 @@
- ceph.osd.bootstrap.keyring - ceph.osd.bootstrap.keyring
- monmap - monmap
- name: create monitor data directory - name: create monitor and manager data directories
file: file:
dest: /var/lib/ceph/mon/ceph-{{ ansible_hostname }} dest: /var/lib/ceph/{{ item }}/ceph-{{ ansible_hostname }}
state: directory state: directory
owner: ceph owner: ceph
group: ceph group: ceph
mode: 0750 mode: 0750
with_items:
- mon
- mgr
when: newhost is defined and newhost when: newhost is defined and newhost
- name: populate monitor with map and keys - name: populate monitor with map and keys
@ -65,11 +68,14 @@
become_user: ceph become_user: ceph
when: newhost is defined and newhost when: newhost is defined and newhost
- name: touch monitor done file - name: touch monitor and manager done files
file: file:
dest: /var/lib/ceph/mon/ceph-{{ ansible_hostname }}/done dest: /var/lib/ceph/{{ item }}/ceph-{{ ansible_hostname }}/done
state: touch state: touch
become_user: ceph become_user: ceph
with_items:
- mon
- mgr
when: newhost is defined and newhost when: newhost is defined and newhost
- name: start and enable daemons - name: start and enable daemons

View File

@ -1,16 +1,20 @@
--- ---
- name: add IP addresses to cluster interfaces - name: create cluster bridge interface
command: ip address add {{ item.cluster_ip }}/{{ item.cluster_cidr }} dev {{ pvc_cluster_device }} command: brctl addbr brcluster
delegate_to: "{{ item.hostname }}" ignore_errors: yes
run_once: yes
- name: add underlying interface to bridge
command: brctl addif brcluster {{ pvc_cluster_device }}
ignore_errors: yes
- name: set brcluster up
command: ip link set brcluster up
ignore_errors: yes
- name: add IP addresses to cluster interfaces
command: ip address add {% for node in pvc_nodes if node.hostname == ansible_hostname %}{{ node.cluster_ip }}/{{ node.cluster_cidr }}{% endfor %} dev brcluster
ignore_errors: yes ignore_errors: yes
with_items:
- "{{ pvc_nodes }}"
- name: add IP addresses to storage interfaces - name: add IP addresses to storage interfaces
command: ip address add {{ item.storage_ip }}/{{ item.storage_cidr }} dev {{ pvc_storage_device }} command: ip address add {% for node in pvc_nodes if node.hostname == ansible_hostname %}{{ node.storage_ip }}/{{ node.storage_cidr }}{% endfor %} dev {{ pvc_storage_device }}
delegate_to: "{{ item.hostname }}"
run_once: yes
ignore_errors: yes ignore_errors: yes
with_items:
- "{{ pvc_nodes }}"

View File

@ -1,17 +0,0 @@
---
- name: remove IP addresses from cluster interfaces before starting PVC
command: ip address delete {{ item.cluster_ip }}/{{ item.cluster_cidr }} dev {{ pvc_cluster_device }}
delegate_to: "{{ item.hostname }}"
run_once: yes
ignore_errors: yes
with_items:
- "{{ pvc_nodes }}"
- name: remove IP addresses from storage interfaces before starting PVC
command: ip address delete {{ item.storage_ip }}/{{ item.storage_cidr }} dev {{ pvc_storage_device }}
delegate_to: "{{ item.hostname }}"
run_once: yes
ignore_errors: yes
with_items:
- "{{ pvc_nodes }}"

View File

@ -41,21 +41,17 @@
- include: frr/main.yml - include: frr/main.yml
tags: pvc-frr tags: pvc-frr
# Install PVC sequentially # Install PVC daemon
- include: pvc/main.yml - include: pvc/main.yml
tags: pvc-daemon tags: pvc-daemon
run_once: true # run_once: true
delegate_to: "{{ play_host }}" # delegate_to: "{{ play_host }}"
with_items: "{{ play_hosts }}" # with_items: "{{ play_hosts }}"
loop_control: # loop_control:
loop_var: play_host # loop_var: play_host
- include: common/remove_cluster_ips.yml
when: newhost is defined and newhost
tags: always
- name: restart server on first install - name: restart server on first install
shell: 'sleep 1 && shutdown -r now "Ansible updates triggered"' shell: 'sleep 3 && shutdown -r now "Ansible updates triggered"'
async: 1 async: 1
poll: 0 poll: 0
ignore_errors: yes ignore_errors: yes