Software >> Automation >> Ansible >> Modules >> shell >> Examples

 

shell

online help: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/shell_module.html
offline help: ansible-doc shell
 


## PLAYBOOK

shell1.yml

---
- name: ansible shell module - example 1
  hosts: all
  become: True
  tasks:

  - name: Show uptime
    shell: uptime
    register: results1
  - debug: msg="{{ results1.stdout_lines }}"



## OUTPUT


 
 

 

 

 

References

  1. ansible.builtin plugins and modules index
  2. ansible collections index
  3. ansible loops
  4. ansible conditionals
  5. ansible playbook error handling
  6. ansible playbook tests
  7. ansible playbook blocks
  8. ansible playbook roles
  9. ansible playbook files