2016-04-16 4 views
9

प्रश्न सरल है: उत्तर में ansible_user (पूर्व ansible_ssh_user) और remote_user के बीच क्या अंतर है, इसके अलावा पहला सेट सेट किया गया है यदि कॉन्फ़िगरेशन फ़ाइल और बाद वाला एक नाटकों/भूमिकाओं में सेट है? वे -u/--user कमांड लाइन विकल्पों से कैसे संबंधित हैं?उत्तरदायी रिमोट_यूसर बनाम ansible_user

उत्तर

11

वे दोनों एक जैसा दिखते हैं। यहाँ एक नज़र डालें:

https://github.com/ansible/ansible/blob/devel/lib/ansible/playbook/play_context.py#L46

# the magic variable mapping dictionary below is used to translate 
# host/inventory variables to fields in the PlayContext 
# object. The dictionary values are tuples, to account for aliases 
# in variable names. 

MAGIC_VARIABLE_MAPPING = dict(
    connection  = ('ansible_connection',), 
    remote_addr  = ('ansible_ssh_host', 'ansible_host'), 
    remote_user  = ('ansible_ssh_user', 'ansible_user'), 
    port    = ('ansible_ssh_port', 'ansible_port'), 

इसके अलावा, ansible_user प्रयोग किया जाता है जब हम ansible मेजबान में डिफ़ॉल्ट SSH उपयोगकर्ता specifiy करना चाहते हैं फ़ाइल जहां के रूप में remote_userप्लेबुक संदर्भ में प्रयोग किया जाता है।

से https://github.com/ansible/ansible/blob/devel/docsite/rst/intro_inventory.rst

ansible_user उपयोग करने के लिए डिफ़ॉल्ट ssh उपयोगकर्ता नाम

और यहाँ ansible hosts फ़ाइल में ansible_user का उपयोग करने का एक उदाहरण है:

[targets] 

localhost    ansible_connection=local 
other1.example.com  ansible_connection=ssh  ansible_user=mpdehaan 
other2.example.com  ansible_connection=ssh  ansible_user=mdehaan 
+2

यह वास्तव में दुख की बात है कि वे कैसे एक ही विकल्प है और जो ssh उपयोगकर्ता में लॉग इन करने के रूप में ही उदाहरण नहीं है के लिए अलग-अलग नाम है है। चूंकि हमारे पाठ की पंक्ति में पहला सबक सीखता है कि कभी भी "पीछे की संगतता को तोड़ना" और खुद के बारे में सोचने के लिए नहीं है, इस तरह की चीजें केवल उत्पाद उपयोग को समझने के लिए बर्बाद प्रयासों में अनगिनत घंटे तक समुदाय को कम कर देगी। –

संबंधित मुद्दे