I think I'll open a new question for better visibility.

On Thursday, December 3, 2015 at 12:41:07 AM UTC-5, Suryaveer Chauhan wrote:
>
> Thanks for the reply.
>
> How can I check which user is logging into the remote?
>
> Below are the config parameters which has user details:
> *Ansible vars:*
>
>     [OSEv3:vars]
> *    ansible_ssh_user=centos*
> *    ansible_sudo=true*
>
> *Ansible.cfg*
>
>     [defaults]
>     hostfile = ansible_hosts
> *    remote_user = centos*
>     host_key_checking = False
>
> Is it something different from this? Sorry, this is first time I am using 
> ansible.
>
> I can ssh into the target system as "*ssh centos@192.168.144.132 
> <centos@192.168.144.132>*" and I can then create files in /etc/ansible 
> folders.
>
> Meanwhile, I added sudo =yes and sudo_user = centos in the .cfg and 
> installation went ahead but now new error. Below is the log:
>
> TASK: [openshift_facts | Gather Cluster facts] 
> ******************************** 
> changed: [192.168.144.132]
>
> TASK: [openshift_facts ] 
> ****************************************************** 
> changed: [192.168.144.132] => (item={'local_facts': {'public_ip': 
> u'192.168.144.132', 'ip': u'10.0.1.163', 'public_hostname': u'master', 
> 'hostname': u'', 'deployment_type': u'{# deployment_type #}'}, 'role': 
> 'common'})
> changed: [192.168.144.132] => (item={'local_facts': {'console_url': u'', 
> 'api_url': u'', 'cluster_public_hostname': u'', 'public_api_url': u'', 
> 'public_console_url': u'', 'api_use_ssl': u'', 'api_port': u'', 
> 'console_port': u'', 'console_path': u'', 'cluster_hostname': u'', 
> 'console_use_ssl': u''}, 'role': 'master'})
>
> TASK: [Check status of external etcd certificatees] 
> *************************** 
> ok: [192.168.144.132] => (item=master.etcd-client.crt)
> ok: [192.168.144.132] => (item=master.etcd-ca.crt)
>
> TASK: [set_fact ] 
> ************************************************************* 
> skipping: [192.168.144.132]
>
> PLAY [Create temp directory for syncing certs] 
> ******************************** 
>
> TASK: [Create local temp directory for syncing certs] 
> ************************* 
> ok: [localhost -> 127.0.0.1]
>
> PLAY [Configure etcd certificates] 
> ******************************************** 
> skipping: no hosts matched
>
> PLAY [Copy the external etcd certs to the masters] 
> **************************** 
>
> GATHERING FACTS 
> *************************************************************** 
> ok: [192.168.144.132]
>
> TASK: [Ensure certificate directory exists] 
> *********************************** 
> skipping: [192.168.144.132]
>
> TASK: [Unarchive the tarball on the master] 
> *********************************** 
> skipping: [192.168.144.132]
>
> TASK: [file ] 
> ***************************************************************** 
> skipping: [192.168.144.132] => (item=master.etcd-client.crt)
> skipping: [192.168.144.132] => (item=master.etcd-client.key)
> skipping: [192.168.144.132] => (item=master.etcd-ca.crt)
>
> PLAY [Determine if master certificates need to be generated] 
> ****************** 
>
> GATHERING FACTS 
> *************************************************************** 
> ok: [192.168.144.132]
>
> TASK: [set_fact ] 
> ************************************************************* 
> ok: [192.168.144.132]
>
> TASK: [set_fact ] 
> ************************************************************* 
> ok: [192.168.144.132]
>
> TASK: [Check status of master certificates] 
> *********************************** 
> ok: [192.168.144.132] => (item=admin.crt)
> ok: [192.168.144.132] => (item=master.kubelet-client.crt)
> ok: [192.168.144.132] => (item=master.proxy-client.crt)
> ok: [192.168.144.132] => (item=master.server.crt)
> ok: [192.168.144.132] => (item=openshift-master.crt)
> ok: [192.168.144.132] => (item=openshift-registry.crt)
> ok: [192.168.144.132] => (item=openshift-router.crt)
> ok: [192.168.144.132] => (item=etcd.server.crt)
>
> TASK: [set_fact ] 
> ************************************************************* 
> ok: [192.168.144.132]
>
> PLAY [Configure master certificates] 
> ****************************************** 
>
> GATHERING FACTS 
> *************************************************************** 
> ok: [192.168.144.132]
>
> TASK: [openshift_facts | Verify Ansible version is greater than 1.8.0 and 
> not 1.9.0 and not 1.9.0.1] *** 
> ok: [192.168.144.132]
>
> TASK: [openshift_facts | Ensure PyYaml is installed] 
> ************************** 
> ok: [192.168.144.132] => (item=PyYAML)
>
> TASK: [openshift_facts | Gather Cluster facts] 
> ******************************** 
> ok: [192.168.144.132]
>
> TASK: [openshift_repos | assert ] 
> ********************************************* 
> failed: [192.168.144.132] => {"assertion": 
> "openshift.common.deployment_type in known_openshift_deployment_types", 
> "evaluated_to": false, "failed": true}
>
> FATAL: all hosts have already failed -- aborting
>
> PLAY RECAP 
> ******************************************************************** 
>            to retry, use: --limit @/home/suryaveer/config.retry
>
> 192.168.144.132            : ok=20   changed=2    unreachable=0   
>  failed=1   
> localhost                  : ok=8    changed=0    unreachable=0   
>  failed=0   
>
> Thanks a lot for your comment, at least, I moved further.
>
> Regards,
>
> On Wednesday, December 2, 2015 at 7:09:34 PM UTC-5, Andrew Edelstein wrote:
>>
>> It's not giving an error on your local system. That's telling you that 
>> whatever file your task is touching on the remote ("managed") system, the 
>> user that is running the command doesn't have permission to modify the 
>> file. So what this is telling you is that the user that is running the 
>> specific task (the user that logged into the remote machine, not the user 
>> that is running the ansible playbook) does not have permission to write to 
>> /etc/ansible. Check what user is making the connection on the remote system 
>> / what user it is logging INTO that system as, and if you need to add 
>> "sudo: yes" and/or "sudo_user: username" to the play. This applies EVEN IF 
>> THE REMOTE MANAGED MACHINE IS THE SAME MACHINE FROM WHICH YOU ARE RUNNING 
>> ANSIBLE. IE: If you're running a play on "localhost", running ansible 
>> inside sudo doesn't change the user you're logging into localhost with, and 
>> thus what permissions that user has on localhost.
>>
>> On Wed, Dec 2, 2015 at 5:57 PM, Suryaveer Chauhan <chauhan....@gmail.com> 
>> wrote:
>>
>>> Hi All,
>>>
>>> I am a newbie to ansible.
>>>
>>> I am following this blog 
>>> <https://albertomolina.wordpress.com/2015/10/13/openshift-3-on-openstack/> 
>>> to install OpenShift Origin V3 on OpenStack using ansible. But I am getting 
>>> error as below:
>>>
>>> * "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'*
>>>
>>> The target system is Centos and I can do passwordless sudo on the target 
>>> systems. I even added in /etc/sudoers
>>>
>>>  centos All=(ALL) NOPASSWD:ALL
>>>
>>> to all the nodes and also on the system from which I am running ansible.
>>>
>>> From the system I run ansible, I tried executing as sudo, as root but 
>>> same results.
>>>
>>> I am not sure where it faces permission denied, I mean on the host or 
>>> the target systems.
>>>
>>> *Ansible vars:*
>>>
>>>     [OSEv3:vars]
>>>     ansible_ssh_user=centos
>>>     ansible_sudo=true
>>>
>>> *Ansible.cfg*
>>>
>>>     [defaults]
>>>     hostfile = ansible_hosts
>>>     remote_user = centos
>>>     host_key_checking = False
>>>
>>> Below is the full log:
>>>
>>>     root@ubuntu:/home/suryaveer# ansible all -m ping
>>>     192.168.144.129 | success >> {
>>>         "changed": false, 
>>>         "ping": "pong"
>>>     }
>>>     
>>>     192.168.144.128 | success >> {
>>>         "changed": false, 
>>>         "ping": "pong"
>>>     }
>>>     
>>>     192.168.144.132 | success >> {
>>>         "changed": false, 
>>>         "ping": "pong"
>>>     }
>>>     
>>>     root@ubuntu:/home/suryaveer# ansible-playbook 
>>> openshift-ansible/playbooks/byo/config.yml
>>>     
>>>     PLAY [Populate config host groups] 
>>> ******************************************** 
>>>     
>>>     TASK: [fail ] 
>>> ***************************************************************** 
>>>     skipping: [localhost]
>>>     
>>>     TASK: [fail ] 
>>> ***************************************************************** 
>>>     skipping: [localhost]
>>>     
>>>     TASK: [fail ] 
>>> ***************************************************************** 
>>>     skipping: [localhost]
>>>     
>>>     TASK: [fail ] 
>>> ***************************************************************** 
>>>     skipping: [localhost]
>>>     
>>>     TASK: [Evaluate oo_etcd_to_config] 
>>> ******************************************** 
>>>     skipping: [localhost]
>>>     
>>>     TASK: [Evaluate oo_masters_to_config] 
>>> ***************************************** 
>>>     ok: [localhost] => (item=192.168.144.132)
>>>     
>>>     TASK: [set_fact ] 
>>> ************************************************************* 
>>>     ok: [localhost]
>>>     
>>>     TASK: [Evaluate oo_nodes_to_config] 
>>> ******************************************* 
>>>     ok: [localhost] => (item=192.168.144.128)
>>>     ok: [localhost] => (item=192.168.144.129)
>>>     
>>>     TASK: [Evaluate oo_nodes_to_config] 
>>> ******************************************* 
>>>     skipping: [localhost] => (item=192.168.144.132)
>>>     
>>>     TASK: [Evaluate oo_first_etcd] 
>>> ************************************************ 
>>>     skipping: [localhost]
>>>     
>>>     TASK: [Evaluate oo_first_master] 
>>> ********************************************** 
>>>     ok: [localhost]
>>>     
>>>     TASK: [Evaluate oo_lb_to_config] 
>>> ********************************************** 
>>>     skipping: [localhost]
>>>     
>>>     PLAY [Set etcd facts needed for generating certs] 
>>> ***************************** 
>>>     skipping: no hosts matched
>>>     
>>>     PLAY [Create temp directory for syncing certs] 
>>> ******************************** 
>>>     
>>>     TASK: [Create local temp directory for syncing certs] 
>>> ************************* 
>>>     ok: [localhost -> 127.0.0.1]
>>>     
>>>     PLAY [Configure etcd certificates] 
>>> ******************************************** 
>>>     skipping: no hosts matched
>>>     
>>>     PLAY [Configure etcd hosts] 
>>> *************************************************** 
>>>     skipping: no hosts matched
>>>     
>>>     PLAY [Delete temporary directory on localhost] 
>>> ******************************** 
>>>     
>>>     TASK: [file name={{ g_etcd_mktemp.stdout }} state=absent] 
>>> ********************* 
>>>     ok: [localhost]
>>>     
>>>     PLAY [Set master facts and determine if external etcd certs need to 
>>> be generated] *** 
>>>     
>>>     GATHERING FACTS 
>>> *************************************************************** 
>>>     ok: [192.168.144.132]
>>>     
>>>     TASK: [Check for RPM generated config marker file .config_managed] 
>>> ************ 
>>>     ok: [192.168.144.132]
>>>     
>>>     TASK: [Remove RPM generated config files if present] 
>>> ************************** 
>>>     skipping: [192.168.144.132] => (item=master)
>>>     skipping: [192.168.144.132] => (item=node)
>>>     skipping: [192.168.144.132] => (item=.config_managed)
>>>     
>>>     TASK: [set_fact ] 
>>> ************************************************************* 
>>>     ok: [192.168.144.132]
>>>     
>>>     TASK: [openshift_facts | Verify Ansible version is greater than 
>>> 1.8.0 and not 1.9.0 and not 1.9.0.1] *** 
>>>     ok: [192.168.144.132]
>>>     
>>>     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   
>>>
>>> I have no prior experience with ansible, therefore I am unable to debug 
>>> more.
>>>
>>>
>>> Thanks
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Ansible Project" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to ansible-proje...@googlegroups.com.
>>> To post to this group, send email to ansible...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/ansible-project/18ef1889-3e01-42c1-bf32-7c8785201877%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/ansible-project/18ef1889-3e01-42c1-bf32-7c8785201877%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/18fdc89d-14dc-4838-bbd8-56c972bb9f93%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to