随笔分类 - ansible
摘要:https://www.cnblogs.com/machangwei-8/p/15686096.html
阅读全文
摘要:首先需要创建host_vars.yml文件(可以根据需要建在任意位置) /home/ops/ansible/vars/host_vars.yml # vars file for node_exporter hosts: - busi: zhudong machines: - ip: '10.96.1
阅读全文
摘要:https://www.junmajinlong.com/ansible/8_learn_back/ https://www.zsythink.net/archives/category/%e8%bf%90%e7%bb%b4%e7%9b%b8%e5%85%b3/ansible/
阅读全文
摘要:1. ansible通过通配符从多个远端服务器fetch日志文件[root@localhost data]# cat ../playbook/fetch.yml - hosts: all tasks: - name: find_file find: paths: /root/netqps/files
阅读全文
摘要:1. 配置免密登陆: ansible -i costome_hosts all -m authorized_key -a "user=root key='{{ lookup('file', '/root/.ssh/id_rsa.pub')}}' path='/root/.ssh/authorized
阅读全文
摘要:ansible中变量的优先级: 命令行中的变量 > yml文件中的变量 > roles目录下vars目录中的变量 > roles目录下default目录中的变量 变量写法: 1. 命令行变量: ansible-playbook -i hosts/host playbooks/echo.yml -e
阅读全文
摘要:1.安装最新版python 2.安装最新版docker 设置国内docker镜像源 curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io 重启docker (ubu
阅读全文
摘要:https://www.u3v3.com/ar/1421 https://serversforhackers.com/c/running-ansible-2-programmatically
阅读全文
摘要:host_list=C.DEFAULT_HOST_LIST, # ex: /etc/ansible/hosts, legacy usage #执行host清单,如果不指定文件,会读取ansible.cfg文件的inventory = xx字段。 module_path=None, # ex: /us
阅读全文
摘要:1. 在低版本系统机器上,编译python: cd Python-2.7.15/Modules vim Setup.dist 修改下述代码: ########### sed -i 's/#SSL=\/usr\/local\/ssl/SSL=\/usr\/local\/ansible_python\/
阅读全文
摘要:hosts文件配置参数介绍 1, ansible_ssh_host : 指定主机别名对应的真实 IP,如:100 ansible_ssh_host=192.168.1.100,随后连接该主机无须指定完整 IP,只需指定 251 就行 2, ansible_ssh_port : 指定连接到这个主机的 ssh 端口,默认 22 3, ansible_ssh_user: 连接到该主机的 ssh 用户 ...
阅读全文
摘要:我的ansible roles项目的目录结构: 以下内容来自于: ansible安装配置及最佳实践roles 配置ssh密钥认证 1 2 ssh-keygen -t rsa ssh-copy-id -i ~/.ssh/id_rsa.pub root@172.16.1.10 1 2 ssh-keyge
阅读全文