in Education by
I'm just getting my feet wet with Ansible 2.2 and Devops and I've run into the following problem. I have a host test-host to which I deployed a MySQL server (using geerlingguy.mysql). The role uses the following handler to restart the service: --- - name: restart MySQL service: "name={{ mysql_daemon }} state=restarted sleep=5" Which, I thought, uses the Ansibles service module to restart the server. However, that fails So just to rule out any weirdness with that custom role, I've tried to execute the module directly like so: unsupported parameter for module:sleep ansible test-host -b -m service -a 'name=mysql sleep=5 state=restarted' With the same result Running Ansible with more verbose output shows (among other things): Running systemd Using module file /usr/local/lib/python2.7/site-packages/ansible-2.2.0-py2.7.egg/ansible/modules/core/system/systemd.py So it appears that the systemd module is used instead of service (looking into the module shows that it is indeed aliased to service). And, lo and behold, systemd does not support the sleep parameter. How to fix this? Select the correct answer from above options

1 Answer

0 votes
by
 
Best answer
For this type of issue, you just add the following snippet to your playbook which will enable ansible to use service module instead of systemd. - name: restart MySQL service: "name={{ mysql_daemon }} state=restarted" register: mysql_service - name: pause after MySQL restart pause: "seconds=5" when: mysql_service.changed Add this to your play-book then you can see the ansible working from the service module.

Related questions

0 votes
    My git workspace is dirty, there are some local modifications. When I use the command git pull origin master it ... Ansible git module? Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    I am new at using Ansible. I tried to create directories and download files using Ansible. Should I use shell ... module is available? Select the correct answer from above options...
asked Jan 22, 2022 in Education by JackTerrance
0 votes
    If I have to build an infrastructure stack in the cloud using a tool like Ansible. Is it necessary to have the ... the best to use? Select the correct answer from above options...
asked Jan 25, 2022 in Education by JackTerrance
0 votes
    I have a playbook that looks like the following. It is supposed to install python onto the remote machine ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 14, 2022 in Education by JackTerrance
0 votes
    I want to implement Web sockets for a couple of Web services. How will the stateful HTTP connections impact Blue- ... . Please help. Select the correct answer from above options...
asked Jan 25, 2022 in Education by JackTerrance
0 votes
    I am trying to start the redis service on the Redis Server on Unbuntu 16.04 and I am facing this error: Failed ... you please help me? Select the correct answer from above options...
asked Jan 25, 2022 in Education by JackTerrance
0 votes
    My docker-compose file has some running docker files to create my containers. I don't want the docker files ... docker-compose syntax? Select the correct answer from above options...
asked Jan 25, 2022 in Education by JackTerrance
0 votes
    Using which module can you see the list of all the ansible variables? (i)ping (ii)fetch (iii)setup (iv)copy...
asked Jan 25, 2023 in Technology by JackTerrance
0 votes
    Using which module can you see the list of all the Ansible variables? (1)copy (2)setup (3)ping (4)fetch...
asked Jul 4, 2021 in Education by JackTerrance
0 votes
    I am setting up a common standalone-full.xml file for all server environments, and therefore need to have ... is greatly appreciated. Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    Let's say I have one variable, directory_list, which I define and set in a ruby_block named get_directory_list. Can ... woohoo" end end Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    Now that links are deprecated in docker-compose.yml (and were able to use the new networking feature to ... docker-compose.yml? Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    I am successfully able to connect to a remote machine using SSH but when I am launching the agent from Jenkins ... overcome this issue? Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    I am successfully able to connect to a remote machine using SSH but when I am launching the agent from Jenkins ... overcome this issue? Select the correct answer from above options...
asked Feb 5, 2022 in Education by JackTerrance
0 votes
    I have deleted a folder containing a running Vagrant box before realizing it was still running. How can I delete ... the Virtualbox VM. Select the correct answer from above options...
asked Feb 2, 2022 in Education by JackTerrance
...