From dfd8f4d96e4dfb68674430538d77476ac32d3a2d Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Han?= Date: Tue, 11 Apr 2017 14:20:11 +0200 Subject: [PATCH] test: add mgr section to the host inventory file MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Without this, we don't test the mgr role so we need to add it. Co-Authored-by: Guillaume Abrioux Signed-off-by: Sébastien Han --- infrastructure-playbooks/rolling_update.yml | 1 + roles/ceph-mon/tasks/ceph_keys.yml | 2 +- roles/ceph-mon/tasks/docker/main.yml | 44 ++++++++++++++----- site-docker.yml.sample | 13 +++++- tests/functional/centos/7/cluster/hosts | 3 ++ .../centos/7/docker-cluster/group_vars/all | 1 + .../functional/centos/7/docker-cluster/hosts | 3 ++ tests/functional/ubuntu/16.04/cluster/hosts | 3 ++ 8 files changed, 58 insertions(+), 12 deletions(-) diff --git a/infrastructure-playbooks/rolling_update.yml b/infrastructure-playbooks/rolling_update.yml index 3e6cf6886..1853b80a1 100644 --- a/infrastructure-playbooks/rolling_update.yml +++ b/infrastructure-playbooks/rolling_update.yml @@ -40,6 +40,7 @@ - "{{ osd_group_name|default('osds') }}" - "{{ mds_group_name|default('mdss') }}" - "{{ rgw_group_name|default('rgws') }}" + - "{{ mgr_group_name|default('mgrs') }}" become: True tasks: diff --git a/roles/ceph-mon/tasks/ceph_keys.yml b/roles/ceph-mon/tasks/ceph_keys.yml index b54d07122..17f4c2e30 100644 --- a/roles/ceph-mon/tasks/ceph_keys.yml +++ b/roles/ceph-mon/tasks/ceph_keys.yml @@ -52,7 +52,7 @@ - cephx - groups.get(mgr_group_name, []) | length > 0 - inventory_hostname == groups[mon_group_name]|last - with_items: "{{ groups[mgr_group_name] }}" + with_items: "{{ groups.get(mgr_group_name, []) }}" - include: set_osd_pool_default_pg_num.yml diff --git a/roles/ceph-mon/tasks/docker/main.yml b/roles/ceph-mon/tasks/docker/main.yml index 57d69b7fe..566ba5616 100644 --- a/roles/ceph-mon/tasks/docker/main.yml +++ b/roles/ceph-mon/tasks/docker/main.yml @@ -89,15 +89,39 @@ - openstack_config - "{{ inventory_hostname == groups[mon_group_name] | last }}" -- name: create ceph mgr keyring(s) when mon is containerized - command: docker exec ceph-mon-{{ ansible_hostname }} ceph --cluster {{ cluster }} auth get-or-create mgr.{{ hostvars[item]['ansible_hostname'] }} mon 'allow *' -o /etc/ceph/{{ cluster }}.mgr.{{ hostvars[item]['ansible_hostname'] }}.keyring - args: - creates: /etc/ceph/{{ cluster }}.mgr.{{ hostvars[item]['ansible_hostname'] }}.keyring - changed_when: false +- block: + - name: create ceph mgr keyring(s) when mon is containerized + command: docker exec ceph-mon-{{ ansible_hostname }} ceph --cluster {{ cluster }} auth get-or-create mgr.{{ hostvars[item]['ansible_hostname'] }} mon 'allow *' -o /etc/ceph/{{ cluster }}.mgr.{{ hostvars[item]['ansible_hostname'] }}.keyring + args: + creates: /etc/ceph/{{ cluster }}.mgr.{{ hostvars[item]['ansible_hostname'] }}.keyring + changed_when: false + when: + - cephx + - mon_containerized_deployment + - "{{ groups.get(mgr_group_name, []) | length > 0 }}" + - not mon_containerized_deployment_with_kv + with_items: "{{ groups.get(mgr_group_name, []) }}" + + - name: stat for ceph mgr key(s) + stat: + path: /etc/ceph/{{ cluster }}.mgr.{{ hostvars[item]['ansible_hostname'] }}.keyring + with_items: "{{ groups.get(mgr_group_name, []) }}" + changed_when: false + become: false + failed_when: false + register: stat_mgr_keys + always_run: true + when: + - "{{ groups.get(mgr_group_name, []) | length > 0 }}" + + - name: push ceph mgr key(s) + fetch: + src: "/etc/ceph/{{ cluster }}.mgr.{{ hostvars[item.item]['ansible_hostname'] }}.keyring" + dest: "{{ fetch_directory }}/docker_mon_files/{{ item.stat.path }}" + flat: yes + with_items: + - "{{ stat_mgr_keys.results }}" + when: + - item.stat.exists == true when: - - cephx - - mon_containerized_deployment - - "{{ groups.get(mgr_group_name, []) | length > 0 }}" - inventory_hostname == groups[mon_group_name]|last - - not mon_containerized_deployment_with_kv - with_items: "{{ groups[mgr_group_name] }}" diff --git a/site-docker.yml.sample b/site-docker.yml.sample index 167d8f2c4..4ba025fc7 100644 --- a/site-docker.yml.sample +++ b/site-docker.yml.sample @@ -1,7 +1,18 @@ --- # Defines deployment design and assigns role to server groups -- hosts: mons # gather mon facts first before we process ceph-mon serially +- hosts: + - mons + - agents + - osds + - mdss + - rgws + - nfss + - restapis + - rbdmirrors + - clients + - iscsigws + - mgrs tasks: [] - hosts: mons diff --git a/tests/functional/centos/7/cluster/hosts b/tests/functional/centos/7/cluster/hosts index d060209c9..008f2cb56 100644 --- a/tests/functional/centos/7/cluster/hosts +++ b/tests/functional/centos/7/cluster/hosts @@ -14,3 +14,6 @@ rgw0 [clients] client0 + +[mgrs] +mgr0 diff --git a/tests/functional/centos/7/docker-cluster/group_vars/all b/tests/functional/centos/7/docker-cluster/group_vars/all index 56cf5cbde..6f27d57fc 100644 --- a/tests/functional/centos/7/docker-cluster/group_vars/all +++ b/tests/functional/centos/7/docker-cluster/group_vars/all @@ -8,6 +8,7 @@ mon_containerized_deployment: True osd_containerized_deployment: True mds_containerized_deployment: True rgw_containerized_deployment: True +mgr_containerized_deployment: True cluster: test ceph_mon_docker_interface: eth1 ceph_mon_docker_subnet: "{{ public_network }}" diff --git a/tests/functional/centos/7/docker-cluster/hosts b/tests/functional/centos/7/docker-cluster/hosts index bdbfb5cdd..2d684367d 100644 --- a/tests/functional/centos/7/docker-cluster/hosts +++ b/tests/functional/centos/7/docker-cluster/hosts @@ -11,3 +11,6 @@ mds0 [rgws] rgw0 + +[mgrs] +mgr0 diff --git a/tests/functional/ubuntu/16.04/cluster/hosts b/tests/functional/ubuntu/16.04/cluster/hosts index e361015a0..1b3673102 100644 --- a/tests/functional/ubuntu/16.04/cluster/hosts +++ b/tests/functional/ubuntu/16.04/cluster/hosts @@ -14,3 +14,6 @@ rgw0 [clients] client0 + +[mgrs] +mgr0 -- 2.39.5