replace lineinfile with template