Blockinfile module not in the right place?

37 views
Skip to first unread message

Clifford Trueman

unread,
Sep 20, 2016, 2:31:47 PM9/20/16
to Ansible Project
So running into a few issues running blockinfile for a few tests.

I created a really basic playbook literally form the ansible doc example

- name: insert/update eth0 configuration stanza in /etc/network/interfaces
        (it might be better to copy files into /etc/network/interfaces.d/)
  blockinfile:
    dest: /etc/network/interfaces
    block: |
      iface eth0 inet static
          address 192.0.2.23
          netmask 255.255.255.0



when I run it it throws a syntax error pointing to the blockinfile line


So I'm curious if it's not finding the module or I really have a syntax issue, so the reason I think that is that i had ansible-19.4-1.el6.noarch installed and it had no files for
blockinfile at all. I upgraded it to 2.1.10-1.el6.noarch and it added /usr/lib/python2.6/site-packages/ansible/modules/extras/files/blockinfile.py I even used the --module-path flag and still no joy.

It says the default module path is /usr/share/my_modules but that directory was never created by the RPM. However, other functions like passwd change works fine.

So is my install messed up or am I building playbooks incorrectly?

Brian Coca

unread,
Sep 26, 2016, 6:46:54 PM9/26/16
to Ansible Project
Look at the output of ansible --version, check the ansible.cfg file in use, it probably is pointing at that directory.

--------------
Brian Coca
Reply all
Reply to author
Forward
0 new messages