YOHO ANSIBLE ROLES
更新代码
git pull --recurse-submodules
git submodule foreach --recursive git pull origin master
ansible
的环境
准备1.创建用户:
useradd ansible -g root -d /home/ansible
.2.安装
ansible
3.将被管理的服务器的
private key
copy 到~/.ssh/
4.
git clone
本项目即可
playbook
介绍
playbook | 说明 |
---|---|
authkey | copy 公钥到目标机器ssh 的 authorized_keys 中。 -- 建立信任关系 |
vault-test | 测试hashicorp vault的集成。-- 避免将敏感信息写入到配置中 |
java.health_check | 通过http接口检查java服务的健康情况 |
lb-manager | 修改qcloud 负载均衡器的权重 |
java-loglevel | 修改java服务的日志级别 |
java-nginx | 同步java nginx的配置 |
java-restart-service | 重启java服务 |
ping | ping, 测试用 |
java-resolv | 修改目标机器的/etc/resolv文件 |
ufo-nginx | 同步ufo的nginx配置 |
Roles
openresty
: 同步JAVA NGINX的配置
java nginx
静态文件位置: http://git.yoho.cn/ops/yoho-ansible-roles/tree/master/roles/openresty/files如何同步
java nginx
的配置?ansible-playbook playbooks/java-nginx.yml -i inventories/az2/hosts
rsyslog
: rsyslog
的配置
resolv
: 配置服务器的'/etc/resolv.conf'
How to Run
jump to server: ansible@10.66.233.9
Default inventory file in [ansible.cfg] is : [./inventories/test]
You should identify inventory file by [-i]
ansible-playbook site.yml -i inventories/az3/hosts
ansible-playbook site.yml --limit nginx -i inventories/az3/hosts
# run playbooks
ansible-playbook playbooks/nginx.yml -i inventories/az3/hosts
# run shell
ansible all -m shell -a "cat /etc/resolv.conf" -i inventories/az3/hosts