Last active
June 1, 2022 18:48
-
-
Save SpikePy/19846d8b9050512c7f0ef83615fd34c3 to your computer and use it in GitHub Desktop.
playing with multiline commands in ansible
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env -S ansible-playbook --inventory=localhost, -v | |
# execute me by running `./multiline_commands.yaml` | |
--- | |
- name: Playground | |
hosts: localhost | |
connection: local | |
gather_facts: no | |
tasks: | |
- name: > | |
multiline command don't need `\` because | |
(I think) `command` implicates everything in the | |
key belongs to one command and could never be | |
interpreted as many commands unlike `shell` | |
command: | | |
date | |
--utc | |
- name: > | |
multiline shell needs `\` when using `|` so that ansible can | |
destinguish where another command starts (without `\` that would | |
not be possible) | |
shell: | | |
date \ | |
--utc | |
pwd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment