getting ERROR: hosts declaration is required

1,083 views
Skip to first unread message

thomas farah

unread,
Apr 30, 2014, 1:35:16 PM4/30/14
to ansible...@googlegroups.com
getting ERROR: hosts declaration is required
and i  have changed  lineinfile: to action: lineinfile

---
 - hosts: webservers
   remote_user: xyz
   sudo: true
   vars:
    Myname: ${ansible_fqdn}
   tasks:
 - name: copy postfix1 files to servers
 - lineinfile: dest=/etc/postfix/main.cf regexp="^#myorigin = $mydomain" line="myorigin = $mydomain" state=present
 - name: copy postfix2 files to servers
 - lineinfile: dest=/etc/postfix/main.cf regexp="^#myhostname = host.domain.tld" line="#myhostname = {{ Myname }}" state=present
 - name: copy postfix3 files to servers
 - lineinfile: dest=/etc/postfix/main.cf regexp="^#relayhost = [an.ip.add.ress]" line="relayhost = mailroute.corpr.jjkeller.local" state=present
 - name: copy postfix4 files to servers
 - lineinfile: dest=/etc/postfix/main.cf regexp="^#mynetworks = 168.100.189.0/28, 127.0.0.0/8 " line="mynetworks = 101.0.0.0/8, 10.0.0.0/8, 127.0.0.0/8" state=present
 - name: copy postfix5 files to servers
 - lineinfile: dest=/etc/postfix/main.cf regexp="^#myhostname = host.domain.tld" line="#myhostname = {{ Myname }}" state=present
 - name: restart postfix servers
   service: name=postfix state=reloaded  enabled=yes

Michael DeHaan

unread,
May 1, 2014, 5:24:23 PM5/1/14
to ansible...@googlegroups.com
Looks like your indentation in your playbook is off.

Also, name should be set per task, not as a task that is just called name.




--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/3c30b7ff-1657-424d-9915-abb78fcec00c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages