Standing on the shoulders of Giants
hadoop distcp使用filters参数排除指定文件
ansible学习之十:Error Handling In Playbooks
Jul 22, 2014 • ansible
---
- hosts: 127.0.0.1
vars_prompt:
name: "what is your name?"
quest: "what is your quest?"
favcolor: "what is your favorite color?"
tasks:
- debug: msg="name - {{name}} quest - {{quest}} favcolor - {{favcolor}}"
执行:
$ ansible-playbook prompt.yml
what is your favorite color?: : red #注意问题提示的顺序是反过来的
what is your quest?: : ansible
what is your name?: : sapser
PLAY [127.0.0.1] **************************************************************
TASK: [debug msg="name - sapser quest - ansible favcolor - red"] *********
ok: [127.0.0.1] => {
"msg": "name - sapser quest - ansible favcolor - red"
}
PLAY RECAP ********************************************************************
127.0.0.1 : ok=2 changed=0 unreachable=0 failed=0
---
- hosts: 127.0.0.1
gather_facts: no
vars_prompt:
- name: "release_version" #变量名
prompt: "product release version" #提示
default: "1.0" #默认值
tasks:
- debug: msg="release_version - {{release_version}}"
执行:
$ ansible-playbook prompt.yml
product release version [1.0]: 1.2
PLAY [127.0.0.1] **************************************************************
TASK: [debug msg="release_version - 1.2"] *************************************
ok: [127.0.0.1] => {
"msg": "release_version - 1.2"
}
PLAY RECAP ********************************************************************
127.0.0.1 : ok=1 changed=0 unreachable=0 failed=0
---
- hosts: 127.0.0.1
gather_facts: no
vars_prompt:
- name: "release_version"
prompt: "product release version"
default: "1.0"
private: no
- name: "passwd"
prompt: "Enter password"
private: yes
tasks:
- debug: msg="release_version - {{release_version}} passwd - {{passwd}}"
执行:
$ ansible-playbook prompt.yml
product release version [1.0]: 2.5
Enter password:
PLAY [127.0.0.1] **************************************************************
TASK: [debug msg="release_version - 2.5 passwd - sdjflskdfjsd"] **********
ok: [127.0.0.1] => {
"msg": "release_version - 2.5 passwd - sdjflskdfjsd"
}
PLAY RECAP ********************************************************************
127.0.0.1 : ok=1 changed=0 unreachable=0 failed=0
vars_prompt:
- name: "my_password2"
prompt: "Enter password2"
private: yes
encrypt: "md5_crypt"
confirm: yes
salt_size: 7
Passlib支持多种加密方式:
上一篇:ansible学习之十:Error Handling In Playbooks
下一篇:ansible学习之十二:Using Lookups