Editing Ansible modules

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
[[Ansible]] modules<ref>https://docs.ansible.com/ansible/latest/modules/modules_by_category.html</ref> add new capabilities to Ansible and is a core component of the software, as of September 2019 there are more than 2.800 modules available: <code>[[ansible-doc --list]]</code>. For example you can [[manage AWS infrastructure using Ansible]], execute commands with <code>shell</code> module or collect information using <code>setup</code><ref>https://docs.ansible.com/ansible/latest/modules/setup_module.html</ref> module.
+
[[Ansible]] modules<ref>https://docs.ansible.com/ansible/latest/modules/modules_by_category.html</ref> add new capabilities to Ansible and is a core component of the software, as of September 2019 there are more than 2.800 modules available: <code>ansible-doc --list</code>. For example you can [[manage AWS infrastructure using Ansible]], execute commands with <code>shell</code> module or collect information using <code>setup</code><ref>https://docs.ansible.com/ansible/latest/modules/setup_module.html</ref> module.
 
* <code>ansible -m setup SERVER_NAME</code> will collect information from your system
 
* <code>ansible -m setup SERVER_NAME</code> will collect information from your system
 
* <code>ansible -m setup SERVER_NAME -a 'filter=ansible_distribution'</code>. Collect just OS.
 
* <code>ansible -m setup SERVER_NAME -a 'filter=ansible_distribution'</code>. Collect just OS.
 +
Other common useful modules include:
 +
* Execution modules:
 +
** <code>command</code>, default for ad-hoc commands, bypasses the shell so won’t be impacted by local shell variables.
 +
** <code>shell</code>, allow to use shell functionalities such as redirection.
 +
** <code>raw</code>, do not require python on remote system<ref>https://www.unixarena.com/2018/07/ansible-command-vs-shell-vs-raw-modules.html/</ref>
 +
* <code>[[gather_facts]]</code>, <code>[[lineinfile]]</code>, <code>user</code>, <code>group</code>, <code>mount</code>, <code>git</code>, <code>[[docker]]</code><ref>https://docs.ansible.com/ansible/2.6/modules/docker_module.html</ref>, <code>[[docker_compose]]</code> <ref>https://docs.ansible.com/ansible/latest/modules/docker_compose_module.html</ref> and <code>mail</code> modules, <ref>https://medium.com/@tcij1013/ten-useful-ansible-modules-83fb6fb2d45e</ref> see all of them by category: https://docs.ansible.com/ansible/latest/modules/modules_by_category.html
  
 
+
==Modules==
== Modules ==
+
* apt_repository: [[Ansible playbook: Add a repository]]
* <code>apt_repository</code>: [[Ansible playbook: Add a repository]]
+
* docker compose: New in version 2.1 and was call docker_service before [[Ansible 2.8]]
* <code>[[docker compose]]</code>: New in version 2.1 and was call docker_service before [[Ansible 2.8]]
+
* <code>file</code>, for managing files and directories: https://docs.ansible.com/ansible/latest/modules/file_module.html
* <code>[[docker_container]]</code>: New in [[version 2.1]]
 
* <code>[[file]]</code>, for managing files and directories: https://docs.ansible.com/ansible/latest/modules/file_module.html
 
 
* <code>ovirt_vm</code> ([[KVM]])
 
* <code>ovirt_vm</code> ([[KVM]])
  
* Execution modules:
+
== Examples of execution modules ==
** <code>[[command:]]</code>, default for ad-hoc commands, bypasses the shell so won’t be impacted by local shell variables.
+
* <code>ansible -m raw DESTINATION_HOSTNAME -a uptime</code>
** <code>[[shell:]]</code>, allow to use shell functionalities such as redirection.
+
* <code>ansible -m shell DESTINATION_HOSTNAME -a uptime</code>
** <code>[[raw:]]</code>, do not require python on remote system<ref>https://www.unixarena.com/2018/07/ansible-command-vs-shell-vs-raw-modules.html/</ref>
+
* <code>ansible -m command DESTINATION_HOSTNAME -a uptime</code>
 
 
* <code>[[gather_facts]]</code>, <code>[[lineinfile]]</code>, <code>[[package]]</code>, <code>[[user:]]</code>, <code>group</code>, <code>mount</code>, <code>git</code>, <code>[[docker]]</code><ref>https://docs.ansible.com/ansible/2.6/modules/docker_module.html</ref>, <code>[[docker_compose]]</code> <ref>https://docs.ansible.com/ansible/latest/modules/docker_compose_module.html</ref> and <code>mail</code> modules, <ref>https://medium.com/@tcij1013/ten-useful-ansible-modules-83fb6fb2d45e</ref> see all of them by category: https://docs.ansible.com/ansible/latest/modules/modules_by_category.html
 
 
 
* <code>[[package:]]</code>
 
* <code>[[apt:]]</code>
 
* [[service:]]
 
* [[Ansible module: archive]]
 
* <code>[[community.general.filesystem]]</code>
 
* <code>[[community.general.postgresql_db_module]]</code>
 
 
 
* [[copy]]
 
 
 
== [[Examples of Ansible execution modules]] ==
 
* <code>[[ansible -m raw]] DESTINATION_HOSTNAME -a uptime</code>
 
* <code>[[ansible -m shell]] DESTINATION_HOSTNAME -a uptime</code>
 
* <code>[[ansible -m command]] DESTINATION_HOSTNAME -a uptime</code> (Do not support some characters as: "|")
 
 
 
== Related terms ==
 
* [[Terraform modules]]
 
* [[Ansible plugins]]
 
* <code>[[ansible-galaxy collection install]]</code>
 
* <code>[[boto3 required for this module]]</code>
 
* <code>[[copy (Windows)]]</code>
 
* <code>[[amazon.aws]]</code>
 
  
 
== See also ==
 
== See also ==
* {{Ansible modules}}
+
* {{Ansible}}
 
 
[[Category:Ansible]]
 

Please note that all contributions to wikieduonline may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Wikieduonline:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)

Template used on this page:

Advertising: