Difference between revisions of "Shell: (Ansible module)"

From wikieduonline
Jump to navigation Jump to search
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
{{lowercase}}
 
  #!/usr/bin/env ansible-playbook
 
  #!/usr/bin/env ansible-playbook
 
 
  - hosts: localhost
 
  - hosts: localhost
 
   become: yes
 
   become: yes
Line 9: Line 9:
  
  
 
+
#!/usr/bin/env ansible-playbook
 
  - hosts: localhost
 
  - hosts: localhost
 
   become: yes
 
   become: yes
 
   
 
   
 
   tasks:
 
   tasks:
     - shell:
+
     - shell: [[uptime]]
          [[uptime]]
+
      [[register:]] my_shell_output
      register: my_shell_output
 
 
   
 
   
     - debug: my_var=my_shell_output.stdout_lines
+
     - debug: var=my_shell_output.stdout_lines
  
 +
== Related ==
 +
* <code>[[command:]]</code>
 +
* [[shell: GitHub actions]]
  
 
== See also ==
 
== See also ==
 
* {{Ansible modules}}
 
* {{Ansible modules}}
* {{Ansible}}
 
  
 
[[Category:Ansible]]
 
[[Category:Ansible]]

Latest revision as of 11:50, 23 August 2024

#!/usr/bin/env ansible-playbook
- hosts: localhost
  become: yes

  tasks:
    - shell:
          uptime


#!/usr/bin/env ansible-playbook
- hosts: localhost
  become: yes

  tasks:
    - shell: uptime
      register: my_shell_output

    - debug: var=my_shell_output.stdout_lines

Related[edit]

See also[edit]

Advertising: