Ansible Module shell: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 11: Line 11:
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
ansible -i ./hosts -b --become-user=root all -m shell -a 'ls -al'
ansible -i ./hosts -b --become-user=root all -m shell -a 'ls -al'
</syntaxhighlight>
<syntaxhighlight lang='yaml'>
- name: IDEA application histories
  shell: "cat \"{{ item.path }}\""
  with_items: "{{ some_var | list }}"
  register: some_other_var
  changed_when: false
</syntaxhighlight>
</syntaxhighlight>

Revision as of 05:07, 2 July 2021

External

Internal

Example

ansible -i ./hosts -b --become-user=root all -m shell -a 'ls -al'
- name: IDEA application histories
  shell: "cat \"{{ item.path }}\""
  with_items: "{{ some_var | list }}"
  register: some_other_var
  changed_when: false