[英]Ansible won't register variable from shell module
I am using register
in other plays and its working fine. 我在其他剧本中使用了
register
,其工作正常。 The main issue seems to be when using it with the shell
module. 主要问题似乎是与
shell
模块一起使用时。
here is my current playbook 这是我目前的剧本
- name: Execute create-auth-key.sql
shell: echo exit | sqlplus -l {{ data_security_schema_username }}/{{ data_security_schema_password }}@\(DESCRIPTION=\(ADDRESS=\(PROTOCOL=TCP\)\(HOST={{ data_security_schema_hostname }}\)\(PORT={{ data_security_schema_port }}\)\)\(CONNECT_DATA=\(SERVER=dedicated\)\(SERVICE_NAME={{ data_security_schema_service_name }}\)\)\) @/tmp/create-auth-key.sql;
register: sqlplus-stdout
- name: Set Fact aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
set_fact:
checking: "{{ sqlplus-stdout.stdout }}"
- name: print aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
debug:
msg: "{{ checking }}"
sqlplus is running the transaction correctly however I want to filter the output of the transaction to grab the generated auth key. sqlplus正在正确运行事务,但是我想过滤事务的输出以获取生成的身份验证密钥。 To do this I need the output of sqlplus in a var.
为此,我需要var中sqlplus的输出。 Here is the error being thrown.
这是抛出的错误。
FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'sqlplus' is undefined\n\nThe error appears to have been in '/var/lib/jenkins/.ansible/roles/test.auth-transaction/tasks/create-auth-key-and-obc.yml
Why is my set fact
play failing to recognise sqlplus-stdout
? 为什么我的
set fact
播放无法识别sqlplus-stdout
?
You can't use -
in python vars.. 您不能在python vars中使用
-
。
- name: Execute create-auth-key.sql
shell: echo exit | sqlplus -l {{ data_security_schema_username }}/{{ data_security_schema_password }}@\(DESCRIPTION=\(ADDRESS=\(PROTOCOL=TCP\)\(HOST={{ data_security_schema_hostname }}\)\(PORT={{ data_security_schema_port }}\)\)\(CONNECT_DATA=\(SERVER=dedicated\)\(SERVICE_NAME={{ data_security_schema_service_name }}\)\)\) @/tmp/create-auth-key.sql;
register: sqlplusstdout
- name: Set Fact aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
set_fact:
checking: "{{ sqlplusstdout.stdout }}"
- name: print aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
debug:
msg: "{{ checking }}"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.