4

When I try to create ansible host file as follows:

sudo vi /usr/local/etc/ansible/hosts

When I try to save the file I get following error:

"/usr/local/etc/ansible/hosts" E212: Can't open file for writing

2 Answers2

3

Run:

$ sudo touch /usr/local/etc/ansible/hosts
$ sudo vi /usr/local/etc/ansible/hosts

To create a file and then open it.

junkgui
  • 31
  • 2
0

The issue was that the host file did not exist. So, first I created the host file at the location: /usr/local/etc/ansible/hosts Then after that i could add the hosts to this file.