tripleo-ssh-known-hosts fails if roles_network is not set

Bug #1837644 reported by Alex Schultz
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Fix Released
Medium
Piotr Kopec

Bug Description

If the role_networks is unset, the "Set ssh_known_hosts fact" fails like:

TASK [tripleo-ssh-known-hosts : groups var] *******************************************************************************************************************
ok: [minion] => {
    "groups['overcloud']": [
        "minion"
    ]
}

TASK [tripleo-ssh-known-hosts : enabled_networks] *************************************************************************************************************
ok: [minion] => {
    "enabled_networks": [
        "External"
    ]
}

TASK [tripleo-ssh-known-hosts : role_networks] ****************************************************************************************************************
ok: [minion] => {
    "role_networks": null
}

TASK [tripleo-ssh-known-hosts : Set ssh_known_hosts fact] *****************************************************************************************************
fatal: [minion]: FAILED! => {"msg": "Unexpected templating type error occurred on ({%- for host in groups['overcloud'] | intersect(play_hosts) %}\n[{{ ctlplane_ip }}]*,[{{ host }}.{{ cloud_domain }}]*,[{{ host }}]*{%- if enabled_networks | length > 0 %},{% endif %}\n{%- for network in enabled_networks | default([]) %}\n{%- if network in role_networks %}\n[{{ hostvars[host][networks[network]['name'] ~ '_ip'] }}]*,[{{ host }}.{{ networks[network]['name'] }}]*,{% if 1 %}{% endif %}\n[{{ host }}.{{ networks[network]['name'] }}.{{ cloud_domain }}]*{% if not loop.last %},{% endif %}\n{%- endif -%}\n{%- endfor -%}\n{{ ' ssh-rsa ' ~ hostvars[host]['ansible_ssh_host_key_rsa_public'] }}\n{% endfor %}): argument of type 'NoneType' is not iterable"}

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-ansible (master)

Fix proposed to branch: master
Review: https://review.opendev.org/672326

Changed in tripleo:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-common (master)

Fix proposed to branch: master
Review: https://review.opendev.org/672328

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-ansible (master)

Reviewed: https://review.opendev.org/672326
Committed: https://git.openstack.org/cgit/openstack/tripleo-ansible/commit/?id=d5dac71c8213d65e013b79535586a6c65c9f444a
Submitter: Zuul
Branch: master

commit d5dac71c8213d65e013b79535586a6c65c9f444a
Author: Alex Schultz <email address hidden>
Date: Tue Jul 23 10:31:26 2019 -0600

    Skip processing role_networks if not defined

    If role_networks is not defined, the jinja parsing fails because
    NoneType is not iterable when doing a 'if value in none_type_var'

    Change-Id: Ie89e6f914f11ad337e79b7af89568fd1a74568d1
    Closes-Bug: #1837644

Changed in tripleo:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-common (master)

Reviewed: https://review.opendev.org/672328
Committed: https://git.openstack.org/cgit/openstack/tripleo-common/commit/?id=81738cda4d02d7fc953b921f9dfa84900e299b21
Submitter: Zuul
Branch: master

commit 81738cda4d02d7fc953b921f9dfa84900e299b21
Author: Alex Schultz <email address hidden>
Date: Tue Jul 23 10:47:02 2019 -0600

    Skip processing network info if not defined

    If role_networks or network_cidrs is not defined, the jinja parsing
    fails because NoneType is not iterable when doing a
    'if value in none_type_var'

    Change-Id: I477f0b840b2a0d2646ba947a88f5264d330ea4eb
    Closes-Bug: #1837644

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-ansible 0.3.0

This issue was fixed in the openstack/tripleo-ansible 0.3.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-common 11.2.0

This issue was fixed in the openstack/tripleo-common 11.2.0 release.

Revision history for this message
Alex Schultz (alex-schultz) wrote :

This is back

Tried deploying a minion but hit an Ansible error during configuration:

2019-11-26 14:15:46,457 p=9629 u=root | Tuesday 26 November 2019 14:15:46 +0000 (0:00:00.041) 0:01:06.928 ******
2019-11-26 14:15:46,476 p=9629 u=root | fatal: [ccsosp-minion]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'role_networks' is undefined\n\nThe error appears to be in '/usr/share/ansible/roles/tripleo-ssh-known-hosts/tasks/main.yml': line 46, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: Set ssh_known_hosts fact\n ^ here\n"}

Tried adding the following 'networks' section to the UndercloudMinion.yaml role file but it didn't work when rerunning the command:

  networks:
    External:
      subnet: external_subnet

Version-Release number of selected component (if applicable):
openstack-tripleo-heat-templates-11.3.1-0.20191121202536.333e4f5.el8ost.noarch

How reproducible:
Always

Steps to Reproduce:
1. Deploy Minion with the latest rhos-release version
2. Copy and configure files as per instructions
3. Run 'openstack undercloud minion install'
4. Wait for failure message during Ansible config

Changed in tripleo:
status: Fix Released → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-ansible (master)

Fix proposed to branch: master
Review: https://review.opendev.org/696126

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.opendev.org/696275

Changed in tripleo:
assignee: Alex Schultz (alex-schultz) → Piotr Kopec (pkopec)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on tripleo-ansible (master)

Change abandoned by Alex Schultz (<email address hidden>) on branch: master
Review: https://review.opendev.org/696126

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-ansible (master)

Reviewed: https://review.opendev.org/696275
Committed: https://git.openstack.org/cgit/openstack/tripleo-ansible/commit/?id=b3985983110b97948b4060ee888c27495558f809
Submitter: Zuul
Branch: master

commit b3985983110b97948b4060ee888c27495558f809
Author: Piotr Kopec <email address hidden>
Date: Wed Nov 27 11:26:10 2019 +0100

    Fix for Ansible playbook error, variable is undefined

    This fixes the variable is undefined problem when deploying minions.

    Change-Id: I2893b77bb1c7811fbdbf0426e0a09f80b2179f54
    Closes-Bug: #1837644

Changed in tripleo:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-ansible (stable/train)

Fix proposed to branch: stable/train
Review: https://review.opendev.org/696968

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-ansible (stable/train)

Reviewed: https://review.opendev.org/696968
Committed: https://git.openstack.org/cgit/openstack/tripleo-ansible/commit/?id=df9858fd890474f2452a1765c7c3a6ac9b436881
Submitter: Zuul
Branch: stable/train

commit df9858fd890474f2452a1765c7c3a6ac9b436881
Author: Piotr Kopec <email address hidden>
Date: Wed Nov 27 11:26:10 2019 +0100

    Fix for Ansible playbook error, variable is undefined

    This fixes the variable is undefined problem when deploying minions.

    Change-Id: I2893b77bb1c7811fbdbf0426e0a09f80b2179f54
    Closes-Bug: #1837644
    (cherry picked from commit b3985983110b97948b4060ee888c27495558f809)

tags: added: in-stable-train
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-ansible (master)

Fix proposed to branch: master
Review: https://review.opendev.org/697191

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-ansible (master)

Reviewed: https://review.opendev.org/697191
Committed: https://git.openstack.org/cgit/openstack/tripleo-ansible/commit/?id=0dba52d59390ee60ec387a434ef4789fc104a389
Submitter: Zuul
Branch: master

commit 0dba52d59390ee60ec387a434ef4789fc104a389
Author: Alex Schultz <email address hidden>
Date: Tue Dec 3 15:19:01 2019 -0700

    Optionally add ctlplane vips

    If the OS::TripleO::Network::Ports::ControlPlaneVipPort is not
    configured, as done on an undercloud minion, the ctlplane_subnet_cidr is
    never configured. We shouldn't assume it's available so let's check that
    it exists first.

    Change-Id: I154e6ffdeec86b13bc7e586154909c3ff41f8d58
    Closes-Bug: #1837644

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-ansible (stable/train)

Fix proposed to branch: stable/train
Review: https://review.opendev.org/697400

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-ansible (stable/train)

Reviewed: https://review.opendev.org/697400
Committed: https://git.openstack.org/cgit/openstack/tripleo-ansible/commit/?id=b4fdd85de2212145ce6d0746fb07bb7bc60bcb33
Submitter: Zuul
Branch: stable/train

commit b4fdd85de2212145ce6d0746fb07bb7bc60bcb33
Author: Alex Schultz <email address hidden>
Date: Tue Dec 3 15:19:01 2019 -0700

    Optionally add ctlplane vips

    If the OS::TripleO::Network::Ports::ControlPlaneVipPort is not
    configured, as done on an undercloud minion, the ctlplane_subnet_cidr is
    never configured. We shouldn't assume it's available so let's check that
    it exists first.

    Change-Id: I154e6ffdeec86b13bc7e586154909c3ff41f8d58
    Closes-Bug: #1837644
    (cherry picked from commit 0dba52d59390ee60ec387a434ef4789fc104a389)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to tripleo-ansible (master)

Reviewed: https://review.opendev.org/699502
Committed: https://git.openstack.org/cgit/openstack/tripleo-ansible/commit/?id=0a87cadd277bf116013f573fd4f82edf220ec597
Submitter: Zuul
Branch: master

commit 0a87cadd277bf116013f573fd4f82edf220ec597
Author: Kevin Carter <email address hidden>
Date: Tue Dec 17 15:05:22 2019 -0600

    Programatically generate ssh hosts lines

    This change will ensure that the ssh hosts lines we create are
    programatically generated. This will ensure we're not running
    into errors caused by missing or bad facts or generating lines
    that do not make sense caused by bad string slicing or one off
    jinja errors.

    Related-Bug: #1837644
    Related-Bug: #1855149
    Closes-Bug: #1856893
    Change-Id: I3696238b26d8567bc3145a22b2b9ec944cb14d13
    Signed-off-by: Kevin Carter <email address hidden>

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-ansible 0.4.1

This issue was fixed in the openstack/tripleo-ansible 0.4.1 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to tripleo-ansible (master)

Related fix proposed to branch: master
Review: https://review.opendev.org/704880

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-ansible 1.1.0

This issue was fixed in the openstack/tripleo-ansible 1.1.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.