git version 1.8.3.1
ansible 2.2.0.0
CentOS 7.3
When i run config.yaml,the installation failed with error:
the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'dict object' has no attribute 'openshift'\n\nThe error appears to have been in '/etc/ansible/openshift-ansible/playbooks/common/openshift-cluster/initialize_facts.yml
If i modified initialize_facts.yml and delete openshift,it will pop "'dict object' has no attribute 'common"
openshift_docker_hosted_registry_network: "{{ hostvars[groups.oo_first_master.0].**openshift**.common.portal_net }}"
[Your inventory file]
[OSEv3:vars]
deployment_type=origin
openshift_release=v1.3
ansible_ssh_user="root"
# Native high availbility cluster method with optional load balancer.
# If no lb group is defined installer assumes that a load balancer has
# been preconfigured. For installation the value of
# openshift_master_cluster_hostname must resolve to the load balancer
# or to one or all of the masters defined in the inventory if no load
# balancer is present.
openshift_master_cluster_method=native
openshift_master_cluster_hostname=lb1.paastest.cn
#openshift_master_cluster_public_hostname=openshift-cluster.paastest.cn
# apply updated node defaults
#openshift_node_kubelet_args={'pods-per-core': ['10'], 'max-pods': ['250'], 'image-gc-high-threshold': ['90'], 'image-gc-low-threshold': ['80']}
# override the default controller lease ttl
#osm_controller_lease_ttl=30
# enable ntp on masters to ensure proper failover
openshift_clock_enabled=true
# host group for masters
[masters]
master1.paastest.cn
master2.paastest.cn
master3.paastest.cn
# host group for etcd
[etcd]
etcd1.paastest.cn
etcd2.paastest.cn
etcd3.paastest.cn
# Specify load balancer host
[lb]
lb1.paastest.cn
#lb2.paastest.cn
# host group for nodes, includes region info
[nodes]
master[1:3].paastest.cn openshift_node_labels="{'region': 'infra', 'zone': 'default'}"
node1.paastest.cn openshift_node_labels="{'region': 'primary', 'zone': 'east'}"
node2.paastest.cn openshift_node_labels="{'region': 'primary', 'zone': 'west'}"
node3.paastest.cn openshift_node_labels="{'region': 'primary', 'zone': 'west'}"
Anyone can help on this?
Appreciate!
Hey @J0hnson, were there any other errors in your log prior to this error message?
This task occurs after running the openshift_facts role against all hosts which should set the openshift.common.portal_net fact. The openshift_facts role is applied here so I would expect an error to have halted facts collection for the first master host, making it unavailable when we reference it below.
@abutcher
Thanks for your information.Please close this ticket.
It works fine now. Not sure why,i just run twice installation.
I encountered this very same error and took me awhile to figure out the root cause. I ran ansible-playbook as a non-root user that didn't have permissions to create /etc/ansible/facts.d dir hence openshift_facts didn't get set. Sharing this in case it may save someone time.
Clarification: The user invoking ansible-playbook is non-root on ansible host. ssh user in my playbook is root.
Hey @vnugent,
is the non-root user on the nodes or on the ansible host? Can you give a little more detail on that?
@bahho I added a clarification to my previous comment https://github.com/openshift/openshift-ansible/issues/3034#issuecomment-308857120
running into this exact same issue. can anyone help with a resolution. none of the above worked for me
any update on this issue ?
We usually see errors like this when facts could not be accessed due to an error which occurred earlier in the playbook run.
If you're hitting this issue please check your logs for any errors that occurred prior to 'dict object' has no attribute 'openshift'. Any errors encountered by a host will cause that host to skip all subsequent tasks and openshift-ansible might be trying to access a fact for a host that never got set. If there aren't any previous errors please post the final error message and we can dig into what's going on.
Come across this in an OCP 3.7 install on AWS:
Failure summary:
1. Hosts: ose-master01.openshift.studio
Play: Initialize host facts
Task: Gather Cluster facts and set is_containerized if needed
Message: MODULE FAILURE
2. Hosts: ose-app-node01.openshift.studio, ose-app-node02.openshift.studio, ose-infra-node01.openshift.studio
Play: Initialize host facts
Task: initialize_facts set_fact on openshift_docker_hosted_registry_network
Message: The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'openshift'
The error appears to have been in '/usr/share/ansible/openshift-ansible/playbooks/common/openshift-cluster/initialize_facts.yml': line 167, column 5, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: initialize_facts set_fact on openshift_docker_hosted_registry_network
^ here
exception type: <class 'ansible.errors.AnsibleUndefinedVariable'>
exception: 'dict object' has no attribute 'openshift'
Earlier in the output:
TASK [initialize_facts set_fact on openshift_docker_hosted_registry_network] *************************
fatal: [ose-infra-node01.openshift.studio]: FAILED! => {"failed": true, "msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'openshift'\n\nThe error appears to have been in '/usr/share/ansible/openshift-ansible/playbooks/common/openshift-cluster/initialize_facts.yml': line 167, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: initialize_facts set_fact on openshift_docker_hosted_registry_network\n ^ here\n\nexception type: <class 'ansible.errors.AnsibleUndefinedVariable'>\nexception: 'dict object' has no attribute 'openshift'"}
fatal: [ose-app-node01.openshift.studio]: FAILED! => {"failed": true, "msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'openshift'\n\nThe error appears to have been in '/usr/share/ansible/openshift-ansible/playbooks/common/openshift-cluster/initialize_facts.yml': line 167, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: initialize_facts set_fact on openshift_docker_hosted_registry_network\n ^ here\n\nexception type: <class 'ansible.errors.AnsibleUndefinedVariable'>\nexception: 'dict object' has no attribute 'openshift'"}
fatal: [ose-app-node02.openshift.studio]: FAILED! => {"failed": true, "msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'openshift'\n\nThe error appears to have been in '/usr/share/ansible/openshift-ansible/playbooks/common/openshift-cluster/initialize_facts.yml': line 167, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: initialize_facts set_fact on openshift_docker_hosted_registry_network\n ^ here\n\nexception type: <class 'ansible.errors.AnsibleUndefinedVariable'>\nexception: 'dict object' has no attribute 'openshift'"}
[WARNING]: Could not create retry file '/usr/share/ansible/openshift-
ansible/playbooks/byo/config.retry'. [Errno 13] Permission denied: u'/usr/share/ansible
/openshift-ansible/playbooks/byo/config.retry'
I am also receiving the same issue while trying to run the OCP 3.7 install. Has a cause been found ?
same issue on 3.9
I encountered this very same error and took me awhile to figure out the root cause. I ran ansible-playbook as a non-root user that didn't have permissions to create
/etc/ansible/facts.ddir henceopenshift_factsdidn't get set. Sharing this in case it may save someone time.Clarification: The user invoking ansible-playbook is non-root on ansible host. ssh user in my playbook is root.
issue got fixed after renaming openshift_facts which present under the folder /etc/ansible/facts.d.
Most helpful comment
I encountered this very same error and took me awhile to figure out the root cause. I ran ansible-playbook as a non-root user that didn't have permissions to create
/etc/ansible/facts.ddir henceopenshift_factsdidn't get set. Sharing this in case it may save someone time.Clarification: The user invoking ansible-playbook is non-root on ansible host. ssh user in my playbook is root.