我正在關注this blog以便在OpenStack上安裝OpenShift Origin V3。但我得到錯誤Ansible:無法創建/etc/ansible/facts.d/openshift.fact,權限被拒絕
"Could not create fact file: %s, error: %s" % (filename, ex) main.OpenShiftFactsFileWriteError: Could not create fact file: /etc/ansible/facts.d/openshift.fact, error: [Errno 13] Permission denied: '/etc/ansible/facts.d'
目標系統是CentOS,我可以在目標系統上執行無密碼sudo。我甚至在/etc/sudoers
centos All=(ALL) NOPASSWD:ALL
添加到所有節點,也從我的計算機運行ansible系統。
從系統運行ansible,我嘗試作爲sudo執行,作爲根,但結果相同。
我不知道它面臨的權限被拒絕,我的意思是在主機或目標系統上。
Ansible主機:
[OSEv3:children"]
masters
nodes
[OSEv3:vars]
ansible_ssh_user=centos
ansible_sudo=true
#ansible_ssh_user=root
product_type=openshift
deployment_type=origin
[masters]
192.168.144.132 openshift_public_hostname=master.novalocal openshift_ip=10.0.1.163 openshift_public_ip=192.168.144.132
[nodes]
192.168.144.128 openshift_public_hostname=node1.novalocal openshift_ip=10.0.1.164 openshift_public_ip=192.168.144.128 openshift_node_labels="{'region': 'primary', 'zone': 'east'}"
192.168.144.129 openshift_public_hostname=node2.novalocal openshift_ip=10.0.1.165 openshift_public_ip=192.168.144.129 openshift_node_labels="{'region': 'primary', 'zone': 'west'}"
Ansible.cfg
[defaults]
hostfile = ansible_hosts
remote_user = centos
host_key_checking = False
下面是日誌:
TASK: [openshift_facts | Ensure PyYaml is installed] **************************
ok: [192.168.144.132] => (item=PyYAML)
TASK: [openshift_facts | Gather Cluster facts] ********************************
failed: [192.168.144.132] => {"failed": true, "parsed": false}
Traceback (most recent call last):
File "/home/centos/.ansible/tmp/ansible-tmp-1449035570.03-273189812167365/openshift_facts", line 6355, in <module>
main()
File "/home/centos/.ansible/tmp/ansible-tmp-1449035570.03-273189812167365/openshift_facts", line 1222, in main
openshift_facts = OpenShiftFacts(role, fact_file, local_facts, additive_facts_to_overwrite)
File "/home/centos/.ansible/tmp/ansible-tmp-1449035570.03-273189812167365/openshift_facts", line 999, in __init__
self.facts = self.generate_facts(local_facts, additive_facts_to_overwrite)
File "/home/centos/.ansible/tmp/ansible-tmp-1449035570.03-273189812167365/openshift_facts", line 1013, in generate_facts
local_facts = self.init_local_facts(local_facts, additive_facts_to_overwrite)
File "/home/centos/.ansible/tmp/ansible-tmp-1449035570.03-273189812167365/openshift_facts", line 1194, in init_local_facts
save_local_facts(self.filename, new_local_facts)
File "/home/centos/.ansible/tmp/ansible-tmp-1449035570.03-273189812167365/openshift_facts", line 924, in save_local_facts
"Could not create fact file: %s, error: %s" % (filename, ex)
__main__.OpenShiftFactsFileWriteError: Could not create fact file: /etc/ansible/facts.d/openshift.fact, error: [Errno 13] Permission denied: '/etc/ansible'
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: auto-mux: Trying existing master
debug1: mux_client_request_session: master session id: 2
Shared connection to 192.168.144.132 closed.
FATAL: all hosts have already failed -- aborting
PLAY RECAP ********************************************************************
to retry, use: --limit @/root/config.retry
192.168.144.132 : ok=6 changed=0 unreachable=0 failed=1
localhost : ok=7 changed=0 unreachable=0 failed=0
我有ansible沒有現成的經驗,因此我無法調試mor即
該錯誤表明openshift_facts模塊無法寫入遠程主機上的/etc/ansible/facts.d目錄。 通常,我只在沒有使用sudo的情況下以非root用戶身份運行時纔看到此錯誤,但是從您提供的庫存片段中看到此錯誤,但在此情況下似乎不是這樣。 如果你手動ssh到192.168.144.132作爲centos用戶並且試圖運行以下命令:'sudo touch/etc/ansible/facts.d/openshift.fact'。如果失敗了,那麼無論什麼原因導致root無法解決/etc/ansible/facts.d需要在繼續之前解決。 – detiber
@detiber'sudo touch /etc/ansible/ facts.d/openshift.fact'給出**沒有這樣的文件或目錄**錯誤,可能是因爲facts.d文件夾不存在。但是我可以在'/ etc/ansible'文件夾中創建一個隨機文件。 – user3275095
您使用的是什麼版本的軟件? – detiber