First start ansible on macos

I installed the ansible via pip install, and there are several issues here:

where is the config

Here you should create a file ~/.ansible.cfg

[defaults]
inventory =~/.ansible/hosts
sudo_user=root
remote_port=22
host_key_checking=False
remote_user=root
log_path=~/.ansible/log/ansible.log
module_name=command
private_key_file=~/.ssh/id_rsa

Make a dir to store logs: mkdir ~/.ansible/log/

Need servers to run a test command

  1. I create a virtual server with VirtualBox and linux image with archlinux-2019.07.01-x86_64.iso
  2. Set the network to Bridged Adapter, which using the WiFi-AirPort in the Name selection.
  3. Then clone the server as a second server.
  4. Start the network service, and check the ip address. 192.168.0.102 and 192.168.0.103
  5. Change the root password with passwd
  6. Now on the MacOS, exec ssh-keygen -t rsa to generate a new ssh identity
  7. Exec ssh-copy-id root@192.168.0.102 store the server's password locally.
  8. vi ~/.ansible/hosts and put the content here.
[vmserver]
192.168.0.102
192.168.0.103

Let's run

ansible -m ping all, ignore the WARNING :)Screen Shot 2019-07-10 at 20.50.56.png