Ansible trying to use "initctl" with CentOS 7

1,054 views
Skip to first unread message

RJ Nowling

unread,
Jan 20, 2015, 1:58:18 PM1/20/15
to ansible...@googlegroups.com
Hi all,

I'm using Ansible with CentOS 7 images in Vagrant. 

I have the following task:

- name: restart iptables
  action: service name=iptables state=restarted
  when: is_centos

When it is run on the images, I get:

failed: [slave0] => {"failed": true, "parsed": false}
SUDO-SUCCESS-vukmjpqjkiplzemawuntmvtspyydtpot
{"msg": "[Errno 2] No such file or directory", "failed": true, "cmd": "initctl version", "rc": 2}
{"msg": "[Errno 2] No such file or directory", "failed": true, "cmd": "None show None", "rc": 2}

CentOS 6 used upstart (initctl) but CentOS 7 uses systemd (systemctl).  I'm not sure why Ansible is picking the wrong method.  I'm using Ansible 1.8.2 (from the CentOS RPMs.).

Has anyone seen anything like this?  Any tips on getting Ansible to identify the right service method?

Thanks,
RJ

Brian Coca

unread,
Jan 21, 2015, 9:41:46 AM1/21/15
to ansible...@googlegroups.com
can you try using current devel, many fixes on detection were made there.


--
Brian Coca

RJ Nowling

unread,
Jan 21, 2015, 11:36:56 AM1/21/15
to ansible...@googlegroups.com
Thanks, Brian!

Problem seems to be solved in the devel branch.

Jeremy Eder

unread,
Mar 4, 2015, 12:31:19 AM3/4/15
to ansible...@googlegroups.com
yep fixed in dev.  this means that the version in epel7 cannot actually manage rhel7 machines :-)

Toshio Kuratomi

unread,
Mar 5, 2015, 10:22:11 AM3/5/15
to ansible...@googlegroups.com

Hmm.. I'll talk to nirik ( Kevin Fenzi, the EPEL maintainer) about whether it makes sense to backport the module to the EPEL package.

-Toshio

--
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/936ffc63-ce55-4f64-901d-3e6225a39853%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

RJ Nowling

unread,
Mar 5, 2015, 10:38:25 AM3/5/15
to ansible...@googlegroups.com
Part of the issue was that I was trying to manage a service that was in CentOS 6, but not CentOS 7.  (Firewall services were changed.) When it failed to find the service in systemd and couldn't, it fell back to initctl.  When I updated to devel, this was caught and handled correctly. 

So, the older version of ansible works with CentOS 7 / RHEL 7 -- it's just that the detection mechanisms are leaky.

--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/a1oVxM1Ye9s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.

To post to this group, send email to ansible...@googlegroups.com.

Toshio Kuratomi

unread,
Mar 5, 2015, 11:31:08 AM3/5/15
to ansible...@googlegroups.com
Ah I see -- yeah, if it's just the error reporting is wrong it might
not be worthwhile to backport a change in the EPEL package.

-Toshio
> https://groups.google.com/d/msgid/ansible-project/CADtDQQKzWJURHrp9JYj-mQOmOO9We2FsPtf2ygw9dB6%2BaRb6yg%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages