mirror of
https://github.com/kubesphere/kubekey.git
synced 2025-12-26 01:22:51 +00:00
37 lines
1.3 KiB
YAML
37 lines
1.3 KiB
YAML
---
|
|
- name: Pre | Run Pre-Installation Scripts
|
|
hosts:
|
|
- all
|
|
tasks:
|
|
- name: Pre | Copy pre-installation scripts to remote hosts
|
|
ignore_errors: true
|
|
copy:
|
|
src: >-
|
|
{{ .work_dir }}/scripts/pre_install_{{ .inventory_hostname }}.sh
|
|
dest: >-
|
|
/etc/kubekey/scripts/pre_install_{{ .inventory_hostname }}.sh
|
|
mode: 0755
|
|
register: pre_install_copy_result
|
|
|
|
- name: Pre | Copy pre-installation config scripts to remote hosts
|
|
copy:
|
|
src: >-
|
|
{{ .work_dir }}/scripts/{{ .item.script }}
|
|
dest: >-
|
|
/etc/kubekey/scripts/pre_install_{{ .item.script }}
|
|
mode: 0755
|
|
loop: "{{ .pre_install | toJson }}"
|
|
when: "{{ getStringSlice .groups .item.group | default list | has .inventory_hostname }}"
|
|
register: pre_install_config_copy_result
|
|
|
|
- name: Pre | Execute pre-installation scripts on remote hosts
|
|
when: or (.pre_install_copy_result.error | empty) (and .pre_install_config_copy_result (.pre_install_config_copy_result.error | empty))
|
|
command: |
|
|
for file in /etc/kubekey/scripts/pre_install_*.sh; do
|
|
if [ -f "$file" ]; then
|
|
# Make the script executable and run it
|
|
chmod +x "$file"
|
|
"$file"
|
|
fi
|
|
done
|