加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
94-restore-cluster.yml 1.25 KB
一键复制 编辑 原始数据 按行查看 历史
setzero 提交于 2021-05-12 09:54 . [IMP]优化脚本默认值获取
- hosts: localhost
become: no
tasks:
- name: "校验 Ansible 版本"
assert:
msg: "Ansible 版本最低要求 2.8.0,当前版本为 {{ ansible_version.string }},请升级 Ansible 版本。"
that:
- ansible_version.string is version("2.8.0", ">=")
vars:
ansible_connection: local
- hosts:
- all
vars_prompt:
name: "restore_confirmation"
prompt: "确认要恢复群集吗? 输入“yes”确认恢复群集。"
default: "no"
private: no
pre_tasks:
- name: 恢复确认
fail:
msg: "恢复确认失败,取消恢复集群操作。"
when: restore_confirmation != "yes"
gather_facts: false
tasks:
- name: "设置代理服务器环境变量"
set_fact:
proxy_env:
http_proxy: "{{ http_proxy | default ('') }}"
HTTP_PROXY: "{{ http_proxy | default ('') }}"
https_proxy: "{{ https_proxy | default ('') }}"
HTTPS_PROXY: "{{ https_proxy | default ('') }}"
no_proxy: "{{ no_proxy | default ('') }}"
NO_PROXY: "{{ no_proxy | default ('') }}"
no_log: true
- hosts:
- all
roles:
- prepare/variables
- prepare/base
- prepare/container-engine
- prepare/kubernetes
- restore
environment: "{{ proxy_env }}"
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化