service: ... state=started always shows "changed"

243 views
Skip to first unread message

Randy Syring

unread,
Aug 23, 2013, 10:15:20 AM8/23/13
to ansible...@googlegroups.com
I have a couple Ubuntu 12.04 LTS machines.  Both have been configured through ansible with the following:

- name: install ntp
  apt: pkg=ntp state=latest
  tags: ntp

- name: configure ntp file
  template: src=ntp.conf.j2 dest=/etc/ntp.conf
  tags: ntp
  notify: restart ntp

- name: start the ntp service
  service: name=ntp state=started enabled=true
  tags: ntp


However, when I run ansible, it always shows starting the ntp service as "changed":

(ansible)rsyring@antec:~/dev/3in1-internal/ansible-src$ ansible-playbook -i hosts officevms.yaml
sudo password:

PLAY [apply common configuration to all nodes] ********************************

GATHERING FACTS ***************************************************************
ok: [lmachen]
ok: [lbeza]

TASK: [install ntp] ***********************************************************
ok: [lmachen]
ok: [lbeza]

TASK: [configure ntp file] ****************************************************
ok: [lbeza]
ok: [lmachen]

TASK: [start the ntp service] *************************************************
changed: [lbeza]
changed: [lmachen]

PLAY RECAP ********************************************************************
lbeza                      : ok=4    changed=1    unreachable=0    failed=0  
lmachen                    : ok=4    changed=1    unreachable=0    failed=0

However, I have verified the NTP service is running before I run ansible:

rsyring@lmachen:~$ service ntp status
 * NTP server is running
rsyring@lmachen:~$

Ideas?

James Cammarata

unread,
Aug 23, 2013, 11:33:59 AM8/23/13
to ansible...@googlegroups.com
If you run "service ntpd status", what is the exit code?

--
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.
For more options, visit https://groups.google.com/groups/opt_out.



--

James Cammarata <jcamm...@ansibleworks.com>
Sr. Software Engineer, AnsibleWorks, Inc.
http://www.ansibleworks.com/
Reply all
Reply to author
Forward
0 new messages