Multilines in shell script inside Ansible playbook

0 votes
I have added shell script in my playbook but it look very untidy and I would like to make it more readable and have my shell commands written in multiple lines.

How do i do this?
Jan 24 in Ansible by Steven
59 views

1 answer to this question.

0 votes

You could write your playbook in this manner

---
- hosts: all
  tasks:
    - name: multiline shell command
      shell: >
        ls --color
        /home
      register: stdout

    - name: debug output
      debug: msg={{ stdout }}
answered Jan 24 by Donna

Related Questions In Ansible

0 votes
1 answer

How do I execute a shell script and then use the result in ansible

This can work out for you: - name: ...READ MORE

answered Apr 11, 2018 in Ansible by shubham
• 6,890 points
745 views
0 votes
1 answer
0 votes
1 answer

ansible playbook: using multiple variables in loops

Use an indexed hostname, and then define ...READ MORE

answered Jul 16, 2018 in Ansible by DareDev
• 6,810 points
4,334 views
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
145 views
0 votes
1 answer
0 votes
1 answer

Is it possible to run an Ansible Playbook in python script?

Hey @Cerci, Of course its possible. You ...READ MORE

answered Jan 17 in Ansible by Nicolas
1,842 views
0 votes
1 answer

Role of subelement module in an Ansible playbook

Hey @Rahul thanks for a better question ...READ MORE

answered Jan 16 in Ansible by Emily
110 views