Bug 1635303 - ceph.conf generation fails when mixing monitor_address / monitor_address_block / monitor_interface
Summary: ceph.conf generation fails when mixing monitor_address / monitor_address_bloc...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Ceph Storage
Classification: Red Hat Storage
Component: Ceph-Ansible
Version: 3.1
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: z1
: 3.1
Assignee: Guillaume Abrioux
QA Contact: subhash
Bara Ancincova
URL:
Whiteboard:
Depends On:
Blocks: 1584264
TreeView+ depends on / blocked
 
Reported: 2018-10-02 14:49 UTC by Guillaume Abrioux
Modified: 2018-11-09 01:01 UTC (History)
10 users (show)

Fixed In Version: RHEL: ceph-ansible-3.1.8-1.el7cp Ubuntu: ceph-ansible_3.1.8-2redhat1
Doc Type: Bug Fix
Doc Text:
.Ansible handles using multiple ways to set Monitor addresses as expected Previously the `ceph.conf.j2` template used an incorrect path to detect if the `monitor_address_block` setting was defined in the Ansible playbook. As a consequence, when using multiple ways to set a Monitor address by using the `monitor_address`, `monitor_address_block`, or `monitor_interface` in the inventory file, Ansible failed to generate the Ceph configuration file and returned the following error: ---- 'ansible.vars.hostvars.HostVarsVars object' has no attribute u'ansible_interface' ---- With this update, the template now uses a correct path to detect the value of `monitor_address_block`, and Ansible handles using multiple ways to set Monitor addresses as expected.
Clone Of:
Environment:
Last Closed: 2018-11-09 01:00:57 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github ceph ceph-ansible pull 3183 0 None closed config: look up for monitor_address_block in hostvars 2020-11-26 17:32:50 UTC
Github ceph ceph-ansible pull 3185/files 0 None None None 2020-07-17 17:36:25 UTC
Red Hat Product Errata RHBA-2018:3530 0 None None None 2018-11-09 01:01:18 UTC

Description Guillaume Abrioux 2018-10-02 14:49:30 UTC
Description of problem:

Let's assume we have the inventory:

[mons]
ceph-mon0 monitor_address=192.168.1.10
ceph-mon1 monitor_interface=eth1
ceph-mon2 monitor_address_block=192.168.1.0/24


the ceph.conf generation task will end up with:


fatal: [ceph-mon0]: FAILED! => {}

MSG:

'ansible.vars.hostvars.HostVarsVars object' has no attribute u'ansible_interface'



the reason is that it will assume monitor_address_block isn't defined even on
ceph-mon2 because looking for monitor_address_block instead of
hostvars[host]['monitor_address_block'], therefore it enters in the condition as default value:


    {%- else -%}
      {% set interface = 'ansible_' + (monitor_interface | replace('-', '_')) %}
      {% if ip_version == 'ipv4' -%}
        {{ hostvars[host][interface][ip_version]['address'] }}
      {%- elif ip_version == 'ipv6' -%}
        [{{ hostvars[host][interface][ip_version][0]['address'] }}]
      {%- endif %}
    {%- endif %}


monitor_interface is set with default value 'interface' so the interface
variable is built with 'ansible_' + 'interface'. It makes ansible throwing a
confusing message about 'ansible_interface'.


Steps to Reproduce:
1. Mix multiple monitor_address / monitor_address_block / monitor_interface on different mons in your inventory
2. Launch the deployment

Actual results:

ceph.conf generation task fails


Expected results:

ceph.conf is properly generated on all nodes.

Comment 4 Sébastien Han 2018-10-03 14:17:14 UTC
Present in https://github.com/ceph/ceph-ansible/releases/tag/v3.1.8

Comment 15 errata-xmlrpc 2018-11-09 01:00:57 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/RHBA-2018:3530


Note You need to log in before you can comment on or make changes to this bug.