playbook

来源:互联网 发布:沃尔沃卡车刹车知乎 编辑:程序博客网 时间:2024/05/31 13:14
使用 playbook 来创建一个文件
1、cd /etc/ansible
2、vim test.yml
---
- hosts: testhosts
  remote_user: root
  tasks:
      - name: test_playbook
        shell: touch /tmp/test.txt
3、执行
ansible-playbook test.yml

使用 playbook 来创建一个用户
1、cd /etc/ansible
2、vim create.yml
---
- name: create_user
  hosts: testhosts
  user: root
  gather_facts: false
  vars:
    - user: "test"
  tasks:
    - name: create user
      user: name="{{ user }}"

ansible slave-puppet.zjcap.cn -m setup  获取 主机的信息


0 0
原创粉丝点击