DevOps/Ansible/Modules
< DevOps < 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_NAMEwill collect information from your systemansible -m setup SERVER_NAME -a 'filter=ansible_distribution'. Collect just OS.
Other common useful modules include:
- 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] andmailmodules, [6] see all of them by category: https://docs.ansible.com/ansible/latest/modules/modules_by_category.html
Modules
- apt_repository: DevOps/Ansible/Add a repository
- docker compose: New in version 2.1 and was call docker_service before Ansible 2.8
file, for managing files and directories: https://docs.ansible.com/ansible/latest/modules/file_module.htmlovirt_vm(KVM)
Module raw example
ansible -m raw DESTINATION_HOSTNAME -a uptime
See also
- DevOps/Ansible/Playbooks
- ansible-galaxy
- ↑ 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