Skip to content
  • Guillaume Abrioux's avatar
    47b25184
    config: look up for monitor_address_block in hostvars · 47b25184
    Guillaume Abrioux authored
    `monitor_address_block` should be read from hostvars[host] instead of
    current node being played.
    
    eg:
    
    Let's assume we have:
    
    ```
    [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'`.
    
    Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1635303
    
    
    
    Signed-off-by: default avatarGuillaume Abrioux <gabrioux@redhat.com>
    47b25184
    config: look up for monitor_address_block in hostvars
    Guillaume Abrioux authored
    `monitor_address_block` should be read from hostvars[host] instead of
    current node being played.
    
    eg:
    
    Let's assume we have:
    
    ```
    [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'`.
    
    Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1635303
    
    
    
    Signed-off-by: default avatarGuillaume Abrioux <gabrioux@redhat.com>
Loading