Can Ansible modules be used from the command line?

0 votes

I have a module that needs to be executed but only for this one time of playbook execution as I'm trying to experiment something. My doubt is, can I execute a module through command line instead of adding it on the playbook?

Feb 11 in Ansible by Donna
55 views

1 answer to this question.

0 votes

Yes @Donna, you can execute a module through playbook. You can do something like this:

ansible webservers -m service -a "name=httpd state=started"

ansible webservers -m command -a "/sbin/reboot -t now"

Each module supports taking arguments. Nearly all modules take key=value arguments, space delimited. Some modules take no arguments, and the command/shell modules simply take the string of the command you want to run

answered Feb 11 by Tariq

Related Questions In Ansible

0 votes
1 answer
0 votes
2 answers

How do you stop Ansible from creating .retry files in the home directory?

[defaults] ... retry_files_enabled = True # Create them ...READ MORE

answered Apr 5 in Ansible by anonymous
885 views
0 votes
1 answer

stopping different hosts from reading the same value when usign ansible in loop

Try using this. Create a new directory ...READ MORE

answered Jul 27, 2018 in Ansible by DareDev
• 6,810 points
44 views
+1 vote
4 answers

Pass variable to ansible playbook through command line

ansible-playbook test.yml --extra-vars "arg1=${var1} arg2=${var2}" Use is like ...READ MORE

answered May 7 in Ansible by Bobin
4,825 views
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
254 views
0 votes
1 answer
0 votes
1 answer

What files can be encrypted using the Ansible Vault?

Yes @Umang, Ansible Vault is used to ...READ MORE

answered Jan 29 in Ansible by Kavya
76 views
0 votes
3 answers