Score:0

How can I save in Ansible variable the output from a bash command?

fr flag

I would like to store the content of a step of my Azure pipeline into a variable:

steps:
- task: UsePythonVersion@0
  inputs:
    versionSpec: '$(python.version)'
  displayName: 'Use Python $(python.version)'
- script: |
    echo 'hi'
  displayName: 'Salute'
- name: Save output to variable
  shell: echo 'hi'
  register: salute

But what I get is: Unexpected value 'name'.

I also tried set_fact but what I get is:

Unexpected value 'set_fact'

How can I solve this?

Score:2
jp flag

Azure Pipeline is not Ansible. Refer to Azure Pipeline documentation on how to set variables in scripts

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.