Ansible config file - lj198851/ansible GitHub Wiki

Ansible base config

configfile: ansible.cfg

[defaults]
invnetory = ./inventory
remote_user = root
ask_pass = true
host_key_checking = False

关于iventory的文件写法

[hadoop]
master
hadoop1
hadoop2

[hadoopgroup]
hadoop[3:10]

[linux]
192.168.2.[10:21]

[allhost:children]
hadoop
linux

用于免登陆的update.yml

- name : Root auto login
  hosts: hadoop2
  
  tasks:
    - name: root pu.key is in?
      authorized_key:
        user: root
        state: present
        key: '{{ item }}'
      with_file:
        - ~/.ssh/id_dsa.pub