rhel.cc
域名年龄: 11年1个月17天HTTP/1.1 200 OK 服务器:GitHub.com 访问时间:2019年06月21日 16:33:06 类型:text/html; charset=utf-8 Transfer-Encoding: chunked 修改日期:2017年05月23日 14:23:43 动作:Accept-Encoding 网页标记:W/"5923d56f-d33c" Access-Control-Allow-Origin: * 过期时间:2019年06月21日 16:43:06 缓存控制:max-age=600 Content-Encoding: gzip X-GitHub-Request-Id: D2B2:4CBE:485988:5F2393:5D0C9642 网站编码:utf-8
MonkeyThink! And Think Again首页分类关于归档标签站点地图公益404搜索未命名发表于2017-05-23|ansible-consoleetcd 动态Inventoryhttps://gist.github.com/justenwalker/09698cfd6c3a6a49075betcd + ansible = crazy delicious未命名发表于2017-05-23|ansible delegate_to 任务委派任务委派就是 在playbook中指定 某任务只在指定的主机上执行比如 我要在192.168.1.1 服务器添加一个hosts 记录 “1.1.1.1 www.abc.com” ,同时也要把这个hosts 记录写到192.168.1.2ansible hosts 192.168.1.1 文件内容[all]192.168.1.1ansible task 文件内容(192.168.1.1.yml):name: add host recordshell: “echo “1.1.1.1 www.abc.com” >> /etc/hosts”name: add host recordshell: “echo “1.1.1.1 www.abc.com” >> /etc/hosts”delegate_to: 192.168.1.2添加上面这一行,就可以了如果是委派给localhost 请使用local_action如下结果一样tasks:name: Get configget_url: dest=configs/ force=yes url=http:///diagnostic/configdelegate_to: localhost当你委派给本机的时候,还可以使用更快捷的方法local_action,代码如下:name: Fetch configuration from all webservershosts: webserverstasks:name: Get configlocal_action: get_url dest=configs/.cfg url=http:///diagnostic/config未命名发表于2017-05-23|ansible group_by 对所有主机 分组Example playbook to demonstrate the group_by action plugin.#as we know, the setup module will automatically run in each play, and sets up variousfacts. We can then create temporary (in memory only) groups based on those facts, whichare useful ways of selecting similar sets of hosts.#Additionally, we can use the ‘register’ keyword in Ansible to set similar variablesand use those for grouping. This is not shown in this example.hosts: alltasks:name: Create a group of all hosts by operating systemaction: group_by key=${ansible_distribution}-${ansible_distribution_version}the following host group does not exist in inventory and was created by the group_bymodule.hosts: CentOS-6.2tasks:name: ping all CentOS 6.2 hostsaction: pinghosts: CentOS-6.3tasks:name: ping all CentOS 6.3 hostsaction: ping未命名发表于2017-05-23|ansible lookup 模块可以直接调用自己写的模块具体可参考这里:https://github.com/ansible/lightbulb/tree/master/workshops/developer/lookup_plugins这个方法 只在ansible2 中可用自己可以写本地的模块,在ansible中调用自定义的本地模块,可以把本地的值传给远程未命名发表于2017-05-23|loop_plugins 可以实现 模糊 copy这个模块 其实依赖于 lookup_pluginsin addition to loop_with_items, the loop that works over a variable, ansible can do more sophisticated looping.developer types: these are powered by ‘lookup_plugins’ should you ever decide to write your ownsee lib/ansible/runner/lookup_plugins/fileglob.py – they can do basically anything!hosts: allgather_facts: notasks:this will copy a bunch of config files over – dir must be created firstfile: dest=/etc/fooapp state=directorycopy: src=$item dest=/etc/fooapp/ owner=root mode=600with_fileglob: /playbooks/files/fooapp/*未命名发表于2017-05-23|ansible-playbook 动态添加主机add_host模块 ansible 2.0---- name: launch instancesos_server:name: "{{ prefix }}-{{ item.name }}"state: presentkey_name: "{{ item.key }}"availability_zone: "{{ item.availability_zone }}"nics: "{{ item.nics }}"image: "{{ item.image }}"flavor: "{{ item.flavor }}"with_items: "{{ servers }}"register: "os_
© 2010 - 2020 网站综合信息查询 同IP网站查询 相关类似网站查询 网站备案查询网站地图 最新查询 最近更新 优秀网站 热门网站 全部网站 同IP查询 备案查询
2025-08-09 23:24, Process in 0.0091 second.