Flaxplax

Personal documentation

Inventory

The inventory file contains hosts.

The inventory file is a text file

  touch inventory.txt
  #sample for linux target
  web1 ansible_host=server1.company.com ansible_connection=ssh ansible_user=root ansible_ssh_pass=password
  #sample for windows target
  db1 ansible_host=server2.company.com ansible_connection=winrm ansible_user=administrator ansible_password=password
  web1 #is an alias.
  ansible_host=192.168.1.123 #is the target machine.
  ansible_connection=ssh/winrm #ssh for Linux target. winrm for windows target.
  ansible_user=root #target machine user with administrator privileges.
  ansible_ssh_pass=password #Linux ssh password.
  ansible_password=password #Windows user password.

You can group the targets

  [web_servers]
  web1
  web2
  [db_servers]
  db1
  db2
  #you can group the groups.
  [all_servers:children]
  web_servers
  db_servers
Last updated on 13 Jul 2020
Published on 13 Jul 2020