码迷,mamicode.com
首页 > 其他好文 > 详细

ansible

时间:2018-07-31 13:23:09      阅读:183      评论:0      收藏:0      [点我收藏+]

标签:load   ems   ansible   reserve   rsync   serve   roo   pack   ipv4   

打印debug信息

- hosts: all
  user: root
  tasks:
  - name: show ip
    debug: msg="{{ ansible_all_ipv4_addresses }}"

  

分发文件

---
- hosts: all
  tasks:
    - name: rsync venus new
      synchronize:
        src: /root/tcollector.tar
        dest: /export/servers/
        owner: yes
        group: yes

  

端口预留、yum包

playbook

---
- name: common install
  hosts: all
  roles:
    - common

  

role

---
- name: set ip local reserved ports
  sysctl:
    name: net.ipv4.ip_local_reserved_ports
    value: "{{common[‘port‘]}}"
    state: present
    reload: yes
    ignoreerrors: yes
  when: "common[‘port‘]"

- name: ensure packages exist
  yum:
    pkg: "{{ item }}"
    state: present
  with_items: "{{common[‘yum_pkgs‘]}}"
  when: "common[‘yum_pkgs‘]"

  

ansible

标签:load   ems   ansible   reserve   rsync   serve   roo   pack   ipv4   

原文地址:https://www.cnblogs.com/hongpeng0209/p/9395105.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!