openshift / openshift-ansible

Install and config an OpenShift 3.x cluster
https://try.openshift.com
Apache License 2.0
2.18k stars 2.31k forks source link

Strange YAML syntax issue with openshift inventory file #5918

Closed abisek9186 closed 6 years ago

abisek9186 commented 6 years ago
[k5user@master1 openshift-ansible]$ ansible-playbook /etc/ansible/inventory_to_install_openshift_logging playbooks/byo/openshift-cluster/openshift-logging.yml
ERROR! Syntax Error while loading YAML.

The error appears to have been in '/etc/ansible/inventory_to_install_openshift_logging': line 4, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

# Comment lb out if your load balancer is pre-configured.
[OSEv3:children]
      ^ here

My inventory file is below

# Create an OSEv3 group that contains the master, nodes, etcd, and lb groups.
# The lb group lets Ansible configure HAProxy as the load balancing solution.
# Comment lb out if your load balancer is pre-configured.
[OSEv3:children]
masters
nodes
etcd
lb

# Set variables common for all OSEv3 hosts
ansible_ssh_user=k5user
ansible_become=true
deployment_type=origin
openshift_release=v1.5

# Uncomment the following to enable htpasswd authentication; defaults to
# DenyAllPasswordIdentityProvider.
#openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider', 'filename': '/etc/origin/master/htpasswd'}]

# 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_logging_install_logging=true
openshift_logging_master_url=lb1.containerlab.local

openshift_logging_kibana_hostname=kibana.containerlab.local

openshift_logging_es_nodeselector: {'logging-es'='true'}
openshift_logging_es_memory_limit=2G
openshift_logging_es_cluster_size=3

openshift_logging_curator_default_days=7
openshift_logging_curator_run_hour=23
openshift_logging_curator_run_minute=55
openshift_logging_curator_run_timezone=UTC

# 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.containerlab.local connection_type=local
master2.containerlab.local
master3.containerlab.local

# host group for etcd
[etcd]
etcd1.containerlab.local
etcd2.containerlab.local
etcd3.containerlab.local

# Specify load balancer host
[lb]
lb1.containerlab.local

# host group for nodes, includes region info
[nodes]
master[1:3].containerlab.local
worker1.containerlab.local openshift_node_labels="{'region': 'primary', 'zone': 'east'}"
worker2.containerlab.local openshift_node_labels="{'region': 'primary', 'zone': 'east'}"
worker3.containerlab.local openshift_node_labels="{'region': 'primary', 'zone': 'east'}"
infra1.containerlab.local openshift_node_labels="{'region': 'infra', 'zone': 'default'}"
infra2.containerlab.local openshift_node_labels="{'region': 'infra', 'zone': 'default'}"
abutcher commented 6 years ago

@abisek9186 Looks like a missing [OSEv3:vars] tag above variables.

https://github.com/openshift/openshift-ansible/blob/master/inventory/byo/hosts.example#L12

abisek9186 commented 6 years ago

[k5user@master1 openshift-ansible]$ ansible-playbook /etc/ansible/inventory_to_install_openshift_logging playbooks/byo/openshift-cluster/openshift-logging.yml ERROR! Syntax Error while loading YAML.

The error appears to have been in '/etc/ansible/inventory_to_install_openshift_logging': line 4, column 7, but may be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

Comment lb out if your load balancer is pre-configured.

[OSEv3:children] ^ here

exception type: <class 'yaml.scanner.ScannerError'> exception: while scanning a plain scalar in "", line 4, column 2 found unexpected ':' in "", line 4, column 7

Still fails for updated inventory file.

[k5user@master1 openshift-ansible]$ sudo cat /etc/ansible/inventory_to_install_openshift_logging

Create an OSEv3 group that contains the master, nodes, etcd, and lb groups.

The lb group lets Ansible configure HAProxy as the load balancing solution.

Comment lb out if your load balancer is pre-configured.

[OSEv3:children] masters nodes etcd lb

Set variables common for all OSEv3 hosts

[OSEv3:vars] ansible_ssh_user=k5user ansible_become=true deployment_type=origin openshift_release=v1.5

Uncomment the following to enable htpasswd authentication; defaults to

DenyAllPasswordIdentityProvider.

openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider', 'filename': '/etc/origin/master/htpasswd'}]

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_logging_install_logging=true openshift_logging_master_url=lb1.containerlab.local

openshift_logging_kibana_hostname=kibana.containerlab.local

openshift_logging_es_nodeselector={'logging-es'='true'} openshift_logging_es_memory_limit=2G openshift_logging_es_cluster_size=3

openshift_logging_curator_default_days=7 openshift_logging_curator_run_hour=23 openshift_logging_curator_run_minute=55 openshift_logging_curator_run_timezone=UTC

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.containerlab.local connection_type=local master2.containerlab.local master3.containerlab.local

host group for etcd

[etcd] etcd1.containerlab.local etcd2.containerlab.local etcd3.containerlab.local

Specify load balancer host

[lb] lb1.containerlab.local

host group for nodes, includes region info

[nodes] master[1:3].containerlab.local worker1.containerlab.local openshift_node_labels="{'region': 'primary', 'zone': 'east'}" worker2.containerlab.local openshift_node_labels="{'region': 'primary', 'zone': 'east'}" worker3.containerlab.local openshift_node_labels="{'region': 'primary', 'zone': 'east'}" infra1.containerlab.local openshift_node_labels="{'region': 'infra', 'zone': 'default'}" infra2.containerlab.local openshift_node_labels="{'region': 'infra', 'zone': 'default'}"

abisek9186 commented 6 years ago

Oh..gosh..my bad. I was missing -i in ansible-playbook command.