Unused playlist handlers do not start service through notification

I don’t understand and don’t see what I am doing wrong, but it looks like I can’t get my boot book to start the rng-tools service on the ubuntu server.

environment: remote server (configured): Ubuntu 14.04.1 LTS server with playbook: Debian GNU/Linux 7.6 (wheezy) > apt-cache policy ansible ansible: Installed: 1.7-0.git201406241728~unstable Candidate: 1.7-0.git201406241728~unstable Version table: *** 1.7-0.git201406241728~unstable 0 100 /var/lib/dpkg/status 

My folder structure is as follows:

 tasks/main.yml tasks/packages.yml that is included from the main.yml file handlers/main.yml files/rng-tools 

I install the rng tools package using my playbook and installs after execution.

 - name: install common packages apt: name={{ item }} state=present with_items: - gnupg - rng-tools - reprepro - dpkg-sig - nginx 

Yes. I install packages with several types, but they are all installed correctly.

Once it is installed, I will copy the file / etc / default / rng -tools with:

 - name: copy urandom default conf file copy: src="rng-tools" dest="/etc/default/rng-tools" notify: start rng-tools 

You may notice that I wrote notify: restart rng-tools to start the service.

My main.yml handler / file looks like this:

 --- # Handler for rng-tools - name: start rng-tools service: name=rng-tools state=started - name: restart rng-tools service: name=rng-tools state=restarted - name: stop rng-tools service: name=rng-tools state=stopped - name: reload rng-tools service: name=rng-tools state=reloaded 

In the log of a running playbook, the following is displayed:

 TASK: [debian-repository | install common packages] *************************** ok: [debian.home.dr] => (item=gnupg,rng-tools,reprepro,dpkg-sig,nginx) => {"changed": false, "item": "gnupg,rng-tools,reprepro,dpkg-sig,nginx"} TASK: [debian-repository | copy urandom default conf file] ******************** ok: [debian.home.dr] => {"changed": false, "dest": "/etc/default/rng-tools", "gid": 0, "group": "root", "md5sum": "45ed1b1ee174494442296fdd262f3b09", "mode": "0644", "owner": "root", "path": "/etc/default/rng-tools", "size": 815, "state": "file", "uid": 0} PLAY RECAP ******************************************************************** debian.home.dr : ok=12 changed=2 unreachable=0 failed=0 

The problem is that the service never starts, and I check this with

 sudo ps aux | grep rng root 29392 0.0 0.0 11740 884 pts/1 S+ 22:45 0:00 grep rng 

While I am doing sudo service rng-tools start , it starts, and I see that the process is working fine.

 ~:sudo service rng-tools start Starting Hardware RNG entropy gatherer daemon: rngd. ~:sudo ps aux | grep rng root 29431 0.0 0.0 8964 336 ? Ss 22:47 0:00 /usr/sbin/rngd -r /dev/urandom root 29433 0.0 0.0 11740 880 pts/1 S+ 22:47 0:00 grep rng 

I have tried many things, such as commenting out all but one of the handlers. If I placed the type of command after the file is copied, and that the command starts the service launched by the service, so it does not seem to be a permission problem, but for some reason I cannot figure it out. Plus, using the /main.yml handlers is in the best practice guide , so I figured I was doing it right.

Do you have any ideas why I cannot start using this book?

+7
ansible
source share
1 answer

changed:false is the key to uncovering this mystery:

 TASK: [debian-repository | copy urandom default conf file] ******************** ok: [debian.home.dr] => {"changed": false, "dest": "/etc/default/rng-tools", "gid": 0, "group": "root", "md5sum": "45ed1b1ee174494442296fdd262f3b09", "mode": "0644", "owner": "root", "path": "/etc/default/rng-tools", "size": 815, "state": "file", "uid": 0} 

"notify: started" only starts when copying a file.

+14
source share

All Articles