kubekey/builtin/core/playbooks/hook/post_install.yaml
liujian fb474bde50
feat: change builtin defined variable (#2561)
* feat: change inventory_hosts to hostvars

Signed-off-by: joyceliu <joyceliu@yunify.com>

* feat: change inventory_hosts to hostvars

Signed-off-by: joyceliu <joyceliu@yunify.com>

---------

Signed-off-by: joyceliu <joyceliu@yunify.com>
2025-05-13 06:40:01 +00:00

26 lines
675 B
YAML

---
- name: Execute post install scripts
hosts:
- all
tasks:
- name: Copy post install scripts to remote
ignore_errors: true
copy:
src: |
{{ .scripts_dir }}/post_install_{{ .inventory_hostname }}.sh
dest: |
/etc/kubekey/scripts/post_install_{{ .inventory_hostname }}.sh
mode: 0755
register: execute_result
- name: Execute post install scripts
when: .execute_result.stderr | eq ""
command: |
for file in /etc/kubekey/scripts/post_install_*.sh; do
if [ -f $file ]; then
# execute file
chmod +x $file
$file
fi
done