Difference between revisions of "Ansible modules"
Jump to navigation
Jump to search
↑ https://docs.ansible.com/ansible/latest/modules/modules_by_category.html
↑ https://docs.ansible.com/ansible/latest/modules/setup_module.html
↑ https://www.unixarena.com/2018/07/ansible-command-vs-shell-vs-raw-modules.html/
↑ https://docs.ansible.com/ansible/2.6/modules/docker_module.html
↑ https://docs.ansible.com/ansible/latest/modules/docker_compose_module.html
↑ https://medium.com/@tcij1013/ten-useful-ansible-modules-83fb6fb2d45e
Line 2: | Line 2: | ||
* <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. | ||
− | + | ||
+ | |||
+ | ==Modules== | ||
+ | * <code>apt_repository</code>: [[Ansible playbook: Add a crepository]] | ||
+ | * <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>ovirt_vm</code> ([[KVM]]) | ||
+ | |||
* Execution modules: | * Execution modules: | ||
** <code>command</code>, default for ad-hoc commands, bypasses the shell so won’t be impacted by local shell variables. | ** <code>command</code>, default for ad-hoc commands, bypasses the shell so won’t be impacted by local shell variables. | ||
Line 9: | Line 16: | ||
* <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 | * <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 | ||
− | |||
− | |||
− | |||
− | |||
− | |||
== Examples of execution modules == | == Examples of execution modules == |
Revision as of 07:08, 20 January 2020
Ansible modules[1] 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: ansible-doc --list
. For example you can manage AWS infrastructure using Ansible, execute commands with shell
module or collect information using setup
[2] module.
ansible -m setup SERVER_NAME
will collect information from your systemansible -m setup SERVER_NAME -a 'filter=ansible_distribution'
. Collect just OS.
Modules
apt_repository
: Ansible playbook: Add a crepositorydocker compose
: New in version 2.1 and was call docker_service before Ansible 2.8file
, for managing files and directories: https://docs.ansible.com/ansible/latest/modules/file_module.htmlovirt_vm
(KVM)
- Execution modules:
command
, default for ad-hoc commands, bypasses the shell so won’t be impacted by local shell variables.shell
, allow to use shell functionalities such as redirection.raw
, do not require python on remote system[3]
gather_facts
,lineinfile
,user
,group
,mount
,git
,docker
[4],docker_compose
[5] andmail
modules, [6] see all of them by category: https://docs.ansible.com/ansible/latest/modules/modules_by_category.html
Examples of execution modules
ansible -m raw DESTINATION_HOSTNAME -a uptime
ansible -m shell DESTINATION_HOSTNAME -a uptime
ansible -m command DESTINATION_HOSTNAME -a uptime
See also
- Ansible: modules, plugins, Playbooks (examples)
ansible-playbook
,ansible-vault
,ansible-inventory
,ansible-config
, Ansible Tower, Ansible Galaxy (Roles) (ansible-galaxy
),ansible-cmdb
,gather facts
,ansible.cfg
,Ansible Molecule
, Ansible collections,register
,template
,--ask-pass
,--ask-become-pass
,remote_user:
,/etc/ansible/hosts
,ansible-doc
,ansible-lint
,.ansible/
,--forks
,--start-at-task
,changelog
,inventory
,Notify:
,ansible HOSTNAME -m ping
,gathering
,/usr/bin/ansible
,ansible -m ping
,ansible.builtin
,hosts: (Ansible)
,set fact:
,when:
,blockinfile:
,become method:
,include:
,git:
, AWX,ansible --help
, Tags, Ansible variables, versions
Advertising: