Visibility of facts/variables when using "become"

瀏覽次數:11 次
跳到第一則未讀訊息

thok...@gmail.com

未讀,
2016年10月13日 上午11:10:322016/10/13
收件者:Ansible Project
Hi, 
I ran into the issue that I wanted to include a role based on a fact.
Specifically, I wanted the firewall role (configuring iptables) to not be included when the playbook is run locally against a Vagrant VM.

I noticed that the facts are not available (= empty string) when I do it like that, i.e. using become. Is this by design?

Closely related question: The variable ansible_hostname is available. In which way is it different from the other facts?

Thanks and regards, 
Thomas

Brian Coca

未讀,
2016年10月13日 晚上8:15:172016/10/13
收件者:ansible...@googlegroups.com
The only difference with become, is the user the facts are gathered as. Without become, the login user gathers facts and if there are ones that require privileges that user lacks, those won't be populated. 

With become, you turn into another user and the same things apply, you can gather the facts you have privileges to see.


----------
Brian Coca
回覆所有人
回覆作者
轉寄
0 則新訊息