ansible-vault 示例示例-1交互式密码[root@test01 ansible-test]# cat test-vault.yml- hosts: tagather_facts: notasks:- debug:msg: "test ansible-vault"[root@test01 ansible-test]#[root@test01 ansible-test]# ansible-playbook test-vault.ymlPLAY [ta] *********************************************************************************************************************************************************************************************TASK [debug] ******************************************************************************************************************************************************************************************ok: [172.20.8.247] => {"msg": "test ansible-vault"}PLAY RECAP ********************************************************************************************************************************************************************************************172.20.8.247: ok=1changed=0unreachable=0failed=0skipped=0rescued=0ignored=0[root@test01 ansible-test]#[root@test01 ansible-test]# ansible-vault encrypt test-vault.ymlNew Vault password:Confirm New Vault password:Encryption successful[root@test01 ansible-test]#[root@test01 ansible-test]# cat test-vault.yml$ANSIBLE_VAULT;1.1;AES256326562396436326461396339386134303261396366363332353463616431613931313966613665346636386331316239616632316137316266316266646432360a366366643232313033343835346638386163316366396437316337663333356137636236363333633362383539316162633136373138343135656632343034340a316238656238336432386638373236653738306530383232626231333438386663383461303335613165353536376162306336343461623037303931663962306165333964353834653630643365356637343830356537303666313836633031383635666665663939343839613435333465623365636531653562363366323065316238333333353863376236373362373832633636626137326662633065316532313539313266353035336239346332353962396138386132303238623134[root@test01 ansible-test]#[root@test01 ansible-test]# ansible-vault view test-vault.ymlVault password:- hosts: tagather_facts: notasks:- debug:msg: "test ansible-vault"[root@test01 ansible-test]#[root@test01 ansible-test]# ansible-playbook --ask-vault-pass test-vault.ymlVault password: PLAY [ta] *********************************************************************************************************************************************************************************************TASK [debug] ******************************************************************************************************************************************************************************************ok: [172.20.8.247] => {"msg": "test ansible-vault"}PLAY RECAP ********************************************************************************************************************************************************************************************172.20.8.247: ok=1changed=0unreachable=0failed=0skipped=0rescued=0ignored=0[root@test01 ansible-test]#[root@test01 ansible-test]# ansible-vault decrypt test-vault.ymlVault password:Decryption successful[root@test01 ansible-test]#[root@test01 ansible-test]# cat test-vault.yml- hosts: tagather_facts: notasks:- debug:msg: "test ansible-vault"[root@test01 ansible-test]#
示例-2密码文件[root@test01 ansible-test]# echo "This-is_a#Test!2o22" > pwdfileecho "This-is_a#Testhistoryo22" > pwdfile[root@test01 ansible-test]#[root@test01 ansible-test]# cat pwdfileThis-is_a#Testhistoryo22[root@test01 ansible-test]#[root@test01 ansible-test]# ansible-vault encrypt test-vault.yml --vault-password-file pwdfileEncryption successful[root@test01 ansible-test]#[root@test01 ansible-test]# cat test-vault.yml$ANSIBLE_VAULT;1.1;AES256633430303766616432376532663661333137353636303535643636313765636132363838633462646163303562643831636237633038373265616334343234630a613466663138396334303463623665303536323962363064356330623838646464666162613930643136333736353536336561613932663234326635323438610a376631323634316663313130356466306238306638613261663138333663303634616164336435306565623131393038313463653465313035306662363730383064356363383966643232646531383461316435643665336665613861363430333934613035303331333030373330643934383363333261646366396330343164393236633138383137316166643966393838396464643238633065393335346639383939623262313731376136306236353135343561633632616262623765[root@test01 ansible-test]#[root@test01 ansible-test]# ansible-vault viewtest-vault.yml --vault-password-file pwdfile- hosts: tagather_facts: notasks:- debug:msg: "test ansible-vault"[root@test01 ansible-test]#[root@test01 ansible-test]# ansible-playbook test-vault.yml --vault-password-file pwdfilePLAY [ta] *********************************************************************************************************************************************************************************************TASK [debug] ******************************************************************************************************************************************************************************************ok: [172.20.8.247] => {"msg": "test ansible-vault"}PLAY RECAP ********************************************************************************************************************************************************************************************172.20.8.247: ok=1changed=0unreachable=0failed=0skipped=0rescued=0ignored=0[root@test01 ansible-test]#[root@test01 ansible-test]# ansible-vault decrypt test-vault.yml --vault-password-file pwdfileDecryption successful[root@test01 ansible-test]#[root@test01 ansible-test]# cat test-vault.yml- hosts: tagather_facts: notasks:- debug:msg: "test ansible-vault"[root@test01 ansible-test]#
推荐阅读
- Web自动化---解决登录页面随机验证码问题
- 小样本利器4. 正则化+数据增强 Mixup Family代码实现
- 从0搭建vue3组件库:自动化发布、管理版本号、生成 changelog、tag
- ansible使用临时命令通过模块来执行任务
- Ansible 批处理实战
- ansible应用之安装elk框架
- app自动化测试环境安装
- reportportal 集成 robotframework 自动化执行及结果可视化
- Android自动化测试工具调研
- 五 微软出品自动化神器【Playwright+Java】系列 之常见点击事件操作