Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
438 views
in Technique[技术] by (71.8m points)

ansible script module: what is `cmd` for?

I'm just reading the script module documentation, and I don't understand what the cmd property is good for. The documentation states that script:

The script module takes the script name followed by a list of space-delimited arguments.

Where cmd also takes a script followed by a list of arguments.

Can someone explain the difference?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It is just a formatting option. The following two tasks are functionally identical:

- name: Run a script with arguments (using 'cmd' parameter)
  script:
    cmd: /some/local/script.sh --some-argument 1234

- name: Run a script with arguments (freeform)
  script: /some/local/create_file.sh --some-argument 1234

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...