Modules """"""" About Modules ============= * changes with Ansible are done by modules * Ansible provides a lot of common modules (called the **module library**) * common modules are written in Python * you can write your own modules in any language * Core Modules shipped with Ansible Core * Extra Modules via github, new also as own package * modules can be used to only check a state without executing * some modules can also be used to compare the state and show the differences * every module has a documentation with examples * `Online Docs `_ * ``ansible-doc`` Binary .. hint:: If you're familiar with role/profiles design pattern in Puppet, keep in mind there is no such thing in Ansible. Ansible modules are roles. .. important:: Use modules, they are tested, often used and idempotent. Links ----- * http://docs.ansible.com/ansible/modules_extra.html Popular Modules =============== There are modules for almost everything: * Package Management (like ``yum``, ``apt``) * Remote Execution (``command``, ``shell``) * Service Management (like ``service``) * File Handling (``copy``, ``template``) * SCM (like ``git``, ``subversion``) * User / Group Handling (like ``user``, ``group``) * Web / Database Management * Cloud Services * Network Services And there are many more, checkout the links below with all the categories. Links ----- * http://docs.ansible.com/ansible/modules_by_category.html * http://docs.ansible.com/ansible/list_of_all_modules.html * http://docs.ansible.com/ansible/modules.html * https://github.com/ansible/ansible-modules-core * https://github.com/ansible/ansible-modules-extras Run a modul as ad-hoc command ============================= .. code-block:: bash ansible -m -a # install tree package on db hosts ansible -m package -a "name=tree state=present" db