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, 2019 in Ansible by Donna
111 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, 2019 by Tariq

Related Questions In Ansible

0 votes
1 answer

How to see any module details in Ansible from the command line?

Hi@akhtar, Ansible has a very attractive command named ...READ MORE

answered Aug 11 in Ansible by MD
• 66,500 points
71 views
0 votes
1 answer

How to login to Ansible Galaxy from command line?

Hi@akhtar, To login to Ansible Galaxy, you need ...READ MORE

answered Aug 28 in Ansible by MD
• 66,500 points
73 views
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, 2019 in Ansible by anonymous
1,524 views
+15 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,450 points
731 views
+2 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, 2019 in Ansible by Kavya
168 views
+1 vote
3 answers