playbook的目录结构
ansible-playbook -i 127.0.0.1, deploy.yml --vault-password-file "./secrets" --extra-vars "host=all app_name=app_zrpp_bjl" ################################################### hobor-file ├── deploy.retry ├── deploy.yml ├── go.yml ├── group_vars │ └── all ├── host ├── roles │ └── role-app-deploy │ └── task │ └── main.yml └── secrets ##################################################### 文件all中除了有加密后的信息意外,还要有登录远程机器用户名
cat group_vars/all
ansible_ssh_user: ansibleadmin ansible_ssh_pass: !vault | $ANSIBLE_VAULT;1.1;AES256 30626666326336663462333761633162323565343235356336653733356131626538323434303530 3535356532306364633930643664323766333231353431340a653765656630363131333239313662 32646165346566633434666437666665633534653231313533333235653062363837383431393239 6633613265316164350a646331373364336662333963303635366434386364303164353030343134 3464 ansible_become_password: !vault | $ANSIBLE_VAULT;1.1;AES256 31356331633663353038303130326138353334313864313231663664393963376566393330663439 3463373238666631653535303836376666633233666138310a643461393030353131353237343931 37623232376362396663613637616162363135623664633961396438303136626331626661626666 6662356637376635620a386133336538386262306265666633333735663265663461343530633364 3839 ###########################################################
cat deploy.yml --- - name: Linux Base Configuration hosts: "{{ host }}" serial: 5 roles: - role-oracle-jdk - role-confluence-deploy