Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1776931

Summary: Undercloud minion installation fails due to undefined role_networks variable
Product: Red Hat OpenStack Reporter: Dan Macpherson <dmacpher>
Component: tripleo-ansibleAssignee: RHOS Maint <rhos-maint>
Status: CLOSED ERRATA QA Contact: Sasha Smolyak <ssmolyak>
Severity: medium Docs Contact:
Priority: medium    
Version: 16.0 (Train)CC: aschultz, bfournie, dsneddon, hjensas, mburns
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tripleo-ansible-0.4.1-0.20191212203202.62bce8e.el8ost Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-02-06 14:42:58 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dan Macpherson 2019-11-26 15:28:50 UTC
Description of problem:

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

Comment 1 Dan Macpherson 2019-11-26 17:00:05 UTC
Followed Alex's advice to test modifying the conditional check in the relevant task in /usr/share/ansible/roles/tripleo-ssh-known-hosts/tasks/main.yml

    - name: Set ssh_known_hosts fact
      run_once: true
      set_fact:
        ssh_known_hosts_lines: |-
          {%- for host in groups['overcloud'] | intersect(play_hosts) %}
          [{{ ctlplane_ip }}]*,[{{ host }}.{{ cloud_domain }}]*,[{{ host }}]*
          {%- if enabled_networks | length > 0 and role_networks is defined and role_networks | length > 0 %},
          {%- for network in enabled_networks %}
          {%- if role_networks is defined and network in role_networks %}
          [{{ hostvars[host][networks[network]['name'] ~ '_ip'] }}]*,[{{ host }}.{{ network.lower() }}]*,{% if 1 %}{% endif %}
          [{{ host }}.{{ network.lower() }}.{{ cloud_domain }}]*{% if not loop.last %},{% endif %}
          {%- endif -%}
          {%- endfor -%}
          {%- endif -%}
          {{ ' ssh-rsa ' ~ hostvars[host]['ansible_ssh_host_key_rsa_public'] }}
          {% endfor %}


That seemed to make progress but encountered another error due to undefined vars:

    TASK [tripleo-hieradata : Render hieradata from template] *******************************************************************************************************************
    Tuesday 26 November 2019  16:49:16 +0000 (0:00:00.072)       0:00:14.804 ******
    changed: [ccsosp-minion] => (item=bootstrap_node)
    changed: [ccsosp-minion] => (item=all_nodes)
    changed: [ccsosp-minion] => (item=vip_data)
    failed: [ccsosp-minion] (item=net_ip_map) => {"ansible_loop_var": "item", "changed": false, "item": "net_ip_map", "msg": "AnsibleUndefinedVariable: 'ctlplane_subnet_cidr' is undefined"}
    changed: [ccsosp-minion] => (item=cloud_domain)
    failed: [ccsosp-minion] (item=fqdn) => {"ansible_loop_var": "item", "changed": false, "item": "fqdn", "msg": "AnsibleUndefinedVariable: 'role_networks' is undefined"}
    changed: [ccsosp-minion] => (item=service_configs)
    changed: [ccsosp-minion] => (item=extraconfig)
    changed: [ccsosp-minion] => (item=role_extraconfig)

Comment 2 Bob Fournier 2019-12-02 17:46:31 UTC
Dan - have you tried this with Alex's fix https://review.opendev.org/#/c/696586/?

If its still failing can we get logs and templates?

Comment 3 Alex Schultz 2019-12-02 18:00:53 UTC
We also need https://review.opendev.org/#/c/696275/

Comment 5 Dan Macpherson 2019-12-03 06:53:48 UTC
So I applied 696586 and 696968 (696275 looks like the same patch). It passed the tripleo-ssh-known-hosts issue but then hit a new undefined variable issue regarding ctlplane_subnet_cidr in tripleo-hieradata:

TASK [tripleo-hieradata : Render hieradata from template] *******************************************************************************************************************
Tuesday 03 December 2019  04:01:05 +0000 (0:00:00.071)       0:00:15.683 ******
ok: [ccsosp-minion] => (item=bootstrap_node)
changed: [ccsosp-minion] => (item=all_nodes)
ok: [ccsosp-minion] => (item=vip_data)
failed: [ccsosp-minion] (item=net_ip_map) => {"ansible_loop_var": "item", "changed": false, "item": "net_ip_map", "msg": "AnsibleUndefinedVariable: 'ctlplane_subnet_cidr' is undefined"}
ok: [ccsosp-minion] => (item=cloud_domain)
ok: [ccsosp-minion] => (item=fqdn)
ok: [ccsosp-minion] => (item=service_configs)
ok: [ccsosp-minion] => (item=extraconfig)
ok: [ccsosp-minion] => (item=role_extraconfig)

My minion.conf definitely has a cidr value:

minion_local_ip = 192.0.2.6/24

Comment 8 Alex Schultz 2019-12-03 22:23:25 UTC
https://review.opendev.org/697191 should address that error

Comment 9 Alex Schultz 2019-12-03 22:48:26 UTC
Once I fixed that error it exposed https://bugs.launchpad.net/tripleo/+bug/1855010

Comment 10 Dan Macpherson 2019-12-04 05:15:33 UTC
Confirmed. I've hit that issue too.

Comment 14 errata-xmlrpc 2020-02-06 14:42:58 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2020:0283