Bug 1543434 - [RFE][CEE/SD] create new or adjust existing ceph-ansible playbook to only push ceph.conf on nodes, similar to "ceph-deploy config push"
Summary: [RFE][CEE/SD] create new or adjust existing ceph-ansible playbook to only pus...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Ceph Storage
Classification: Red Hat Storage
Component: Ceph-Ansible
Version: 3.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: 3.*
Assignee: Sébastien Han
QA Contact: ceph-qe-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-02-08 13:15 UTC by Tomas Petr
Modified: 2021-03-11 17:09 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-01-10 16:45:05 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github ceph ceph-ansible pull 2381 0 None closed default: define 'osd_scenario' variable 2020-07-23 08:29:59 UTC
Github ceph ceph-ansible pull 2383 0 None closed site: ability to only generate a ceph.conf on the machines 2020-07-23 08:29:59 UTC
Red Hat Knowledge Base (Solution) 3356011 0 None None None 2018-02-16 11:54:35 UTC

Description Tomas Petr 2018-02-08 13:15:35 UTC
Description of problem:
We would like to have option to use ceph-ansible to only push the updated ceph.conf to the ceph nodes without performing any other action then update of ceph.conf.
similar to "ceph-deploy config push"


Version-Release number of selected component (if applicable):
RHCS 3

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 3 Tomas Petr 2018-02-08 13:20:15 UTC
editing site.yml and only playing ceph-defaults and ceph-config failed:

TASK [ceph-defaults : resolve device link(s)] *********************************************************************************************************************************************************************
fatal: [10.10.94.90]: FAILED! => {"failed": true, "msg": "The conditional check 'osd_scenario != 'lvm'' failed. The error was: error while evaluating conditional (osd_scenario != 'lvm'): 'osd_scenario' is undefined\n\nThe error appears to have been in '/usr/share/ceph-ansible/roles/ceph-defaults/tasks/facts.yml': line 128, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: resolve device link(s)\n  ^ here\n"}

I suppose there is missing part which loads the osds.yml configuration with proper osd scenario.

---------------------------------

scenario with tags, replace 
- role:ceph-defaults
- role:ceph-config
By
- {role:ceph-defaults, tags: ['update_config'] }
- {role:ceph-config, tags: ['update_config']}
And then running :
ansible-playbook site.yml --tags= 'update_config'
----------

#ansible-playbook  tag.test.site.yml --tags='update_config'

I have have tested the tag scenario and it looks working for the first glance, but it has its limitations:

1. I tried run it on deployed working Ceph just to check if it will distribute the changes to ceph.conf - passed

2. I have tested if it can be used to push ceph.conf on "new node"/"existing node added to new role - first run" - failed
 -  it fails with the same error as in above

# cat tag.test.site.yml 
---
# Defines deployment design and assigns role to server groups

- hosts:
  - mons
  - agents
  - osds
  - mdss
  - rgws
  - nfss
  - restapis
  - rbdmirrors
  - clients
  - mgrs
  - iscsi-gws

  gather_facts: false

  tags:
    - always

  tasks:
    # If we can't get python2 installed before any module is used we will fail
    # so just try what we can to get it installed
    - name: check for python2
      stat:
        path: /usr/bin/python
      ignore_errors: yes
      register: systempython2

    - name: install python2 for debian based systems
      raw: sudo apt-get -y install python-simplejson
      ignore_errors: yes
      when:
        - systempython2.stat.exists is undefined or systempython2.stat.exists == false

    - name: install python2 for fedora
      raw: sudo dnf -y install python creates=/usr/bin/python
      ignore_errors: yes
      when:
        - systempython2.stat.exists is undefined or systempython2.stat.exists == false

    - name: gather and delegate facts
      setup:
      delegate_to: "{{ item }}"
      delegate_facts: True
      with_items: "{{ groups['all'] }}"

    - name: install required packages for fedora > 23
      raw: sudo dnf -y install python2-dnf libselinux-python ntp
      when:
        - ansible_distribution == 'Fedora'
        - ansible_distribution_major_version|int >= 23

- hosts: mons
  gather_facts: false
  become: True
  roles:
    - {role: ceph-defaults, tags: ['update_config']}
    - ceph-common
    - {role: ceph-config, tags: ['update_config']}
    - ceph-mon

- hosts: mgrs
  gather_facts: false
  become: True
  roles:
    - {role: ceph-defaults, tags: ['update_config']}
    - ceph-common
    - { role: ceph-config, when: "ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous" }
    - { role: ceph-mgr, when: "ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous" }

- hosts: agents
  gather_facts: false
  become: True
  roles:
    - {role: ceph-defaults, tags: ['update_config']}
    - ceph-common
    - {role: ceph-config, tags: ['update_config']}
    - ceph-agent

- hosts: osds
  gather_facts: false
  become: True
  roles:
    - {role: ceph-defaults, tags: ['update_config']}
    - ceph-common
    - {role: ceph-config, tags: ['update_config']}
    - ceph-osd

- hosts: mdss
  gather_facts: false
  become: True
  roles:
    - {role: ceph-defaults, tags: ['update_config']}
    - ceph-common
    - {role: ceph-config, tags: ['update_config']}
    - ceph-mds

- hosts: rgws
  gather_facts: false
  become: True
  roles:
    - {role: ceph-defaults, tags: ['update_config']}
    - ceph-common
    - {role: ceph-config, tags: ['update_config']}
    - ceph-rgw

- hosts: nfss
  gather_facts: false
  become: True
  roles:
    - { role: ceph-defaults, tags: ['update_config']}
    - ceph-common
    - { role: ceph-config, when: "ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous", tags: ['update_config'] }
    - { role: ceph-nfs, when: "ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous" }

- hosts: restapis
  gather_facts: false
  become: True
  roles:
    - {role: ceph-defaults, tags: ['update_config']}
    - ceph-common
    - {role: ceph-config, tags: ['update_config']}
    - ceph-restapi

- hosts: rbdmirrors
  gather_facts: false
  become: True
  roles:
    - {role: ceph-defaults, tags: ['update_config']}
    - ceph-common
    - {role: ceph-config, tags: ['update_config']}
    - ceph-rbd-mirror

- hosts: clients
  gather_facts: false
  become: True
  roles:
    - {role: ceph-defaults, tags: ['update_config']}
    - ceph-common
    - {role: ceph-config, tags: ['update_config']}
    - ceph-client

- hosts: iscsi-gws
  gather_facts: false
  become: True
  roles:
    - {role: ceph-defaults, tags: ['update_config']}
    - ceph-common
    - { role: ceph-config, when: "ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous", tags: ['update_config']}
    - { role: ceph-iscsi-gw, when: "ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous" }
------------------------------

Comment 4 Tomas Petr 2018-02-08 14:48:50 UTC
tested with changes introduced in:
https://github.com/ceph/ceph-ansible/pull/2381/files

tag.test.site.yml from comment #3 passed

test with ceph-config and ceph-default in site.yml passed too


# cat defcon_only.test.site.yml 
---
# Defines deployment design and assigns role to server groups

- hosts:
  - mons
  - agents
  - osds
  - mdss
  - rgws
  - nfss
  - restapis
  - rbdmirrors
  - clients
  - mgrs
  - iscsi-gws

  gather_facts: false

  tags:
    - always

  tasks:
    # If we can't get python2 installed before any module is used we will fail
    # so just try what we can to get it installed
    - name: check for python2
      stat:
        path: /usr/bin/python
      ignore_errors: yes
      register: systempython2

    - name: install python2 for debian based systems
      raw: sudo apt-get -y install python-simplejson
      ignore_errors: yes
      when:
        - systempython2.stat.exists is undefined or systempython2.stat.exists == false

    - name: install python2 for fedora
      raw: sudo dnf -y install python creates=/usr/bin/python
      ignore_errors: yes
      when:
        - systempython2.stat.exists is undefined or systempython2.stat.exists == false

    - name: gather and delegate facts
      setup:
      delegate_to: "{{ item }}"
      delegate_facts: True
      with_items: "{{ groups['all'] }}"

    - name: install required packages for fedora > 23
      raw: sudo dnf -y install python2-dnf libselinux-python ntp
      when:
        - ansible_distribution == 'Fedora'
        - ansible_distribution_major_version|int >= 23

- hosts: mons
  gather_facts: false
  become: True
  roles:
    - ceph-defaults
    - ceph-config

- hosts: mgrs
  gather_facts: false
  become: True
  roles:
    - ceph-defaults
    - { role: ceph-config, when: "ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous" }

- hosts: agents
  gather_facts: false
  become: True
  roles:
    - ceph-defaults
    - ceph-config

- hosts: osds
  gather_facts: false
  become: True
  roles:
    - ceph-defaults
    - ceph-config

- hosts: mdss
  gather_facts: false
  become: True
  roles:
    - ceph-defaults
    - ceph-config

- hosts: rgws
  gather_facts: false
  become: True
  roles:
    - ceph-defaults
    - ceph-config

- hosts: nfss
  gather_facts: false
  become: True
  roles:
    - ceph-defaults
    - { role: ceph-config, when: "ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous" }

- hosts: restapis
  gather_facts: false
  become: True
  roles:
    - ceph-defaults
    - ceph-config

- hosts: rbdmirrors
  gather_facts: false
  become: True
  roles:
    - ceph-defaults
    - ceph-config

- hosts: clients
  gather_facts: false
  become: True
  roles:
    - ceph-defaults
    - ceph-config

- hosts: iscsi-gws
  gather_facts: false
  become: True
  roles:
    - ceph-defaults
    - { role: ceph-config, when: "ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous" }


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