extract: https://ansible-book.gitbooks.io/ansible-first-book/content/yong_ming_ling_xing_chuan_di_can_shu.html
= ansible-books.io/ansible-first-book/content/yong_ming_ling_xing_chuan_di_can_shu.html
passes the parameter
from the command line
defines the command line variable
in the release.yml file, hosts and user are defined as variables that need to be passed from the command line.
-
hosts: ‘{{host}}
remote_user:’ {{user}} p>the tasks: p>
- …
USES the command line variable
- …
to pass value on the command line:
ansible-playbook e33_var_in_command.yml --extra-vars "hosts=web user=root"
The
parameter can also be passed in json format:
ansible-playbook e33_var_in_command.yml --extra-vars "{'hosts':'vm-rhel7-1', 'user':'root'}"
can also put parameters in the file:
ansible-playbook e33_var_in_command.yml --extra-vars "@vars.json"
div>
Read More:
- Condition judgment and error handling in ansible playbook (fail module failed_when changed_when keyword)
- An error occurs when pymysql uses% d to pass in parameters
- ansible Q&A: Failed to connect to the host via ssh: ssh_exchange_identification and Authentication or per
- Springboot modifies the reference of the application.yml or. Properties file to report an error after startup
- Ansible Failed – apt lock
- Idea has no code prompt solution when writing YML file
- FTP use get command 550 failed to open file, but use the put command to solve the problem
- Moveit configuration manipulator error: kin.parameters file
- Quartus ii 13.1 compilation does not pass: Error (119013): Current license file does not support the EP4CE10F17C8 device
- Mybatis passes in multiple parameters to mapper. And uses @param details to report an error
- C#: How to Use Httpclient to upload files with other parameters
- Four ways to get Django parameters in request
- Vue calculates attributes and passes parameters to the computed method
- Linux remote copy command and not a regular file solution
- Idea for Mac setting JVM running parameters to solve running stuck problem
- Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters:
- When docker creates a container command: Error response from daemon: No command specified
- Solution to command line option syntax error. Type command /? For help
- Jstack command execution error: unable to open socket file: target process not responding or hotspot VM not loaded
- Solution to the problem of multiple parameters when using pipeline under Linux