]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
tests: set copy_admin_key at group_vars level
authorGuillaume Abrioux <gabrioux@redhat.com>
Tue, 24 Sep 2019 17:13:31 +0000 (19:13 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Thu, 26 Sep 2019 14:21:54 +0000 (16:21 +0200)
setting it at extra vars level prevent from setting it per node.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 5bb6a4da4267b987aec6e20a8d09b18eebc2c693)

roles/ceph-client/tasks/pre_requisite.yml
tests/functional/shrink_mds/container/group_vars/all
tests/functional/shrink_osd/container/group_vars/all
tests/functional/shrink_osd/group_vars/all
tests/functional/shrink_rbdmirror/container/group_vars/all
tests/functional/shrink_rgw/container/group_vars/all
tox-podman.ini
tox-update.ini
tox.ini

index 582fb2f60eb2f3802af79ee930ec7108e68af0b4..a05a91d377399998ecf2433816ebbf33c6287a65 100644 (file)
@@ -1,11 +1,24 @@
 ---
 - name: copy ceph admin keyring
-  copy:
-    src: "{{ fetch_directory }}/{{ fsid }}/etc/ceph/{{ cluster }}.client.admin.keyring"
-    dest: "/etc/ceph/"
-    owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
-    group: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
-    mode: "{{ ceph_keyring_permissions }}"
-  when:
-    - cephx | bool
-    - copy_admin_key | bool
+  block:
+    - name: get keys from monitors
+      command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} auth get {{ item.name }}"
+      register: _client_keys
+      with_items:
+        - { name: "client.admin", path: "/etc/ceph/{{ cluster }}.client.admin.keyring", copy_key: "{{ copy_admin_key }}" }
+      delegate_to: "{{ groups.get(mon_group_name)[0] }}"
+      when:
+        - cephx | bool
+        - item.copy_key | bool
+
+    - name: copy ceph key(s) if needed
+      copy:
+        dest: "{{ item.item.path }}"
+        content: "{{ item.stdout + '\n' }}"
+        owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
+        group: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
+        mode: "{{ ceph_keyring_permissions }}"
+      with_items: "{{ _client_keys.results }}"
+      when:
+        - item.item.copy_key | bool
+  when: cephx | bool
index cab6357556779077223bcf27b3c094fbd89fccfc..306cf41a036c0a3dc7711803a7487332dc1e7d7d 100644 (file)
@@ -13,4 +13,5 @@ ceph_conf_overrides:
   global:
     osd_pool_default_size: 1
 openstack_config: False
-dashboard_enabled: False
\ No newline at end of file
+dashboard_enabled: False
+copy_admin_key: True
\ No newline at end of file
index c9f7e998300f8f53086e103e23c8a92550d48b44..bc458f80ab20cad59e1d1214572c9e93925a877a 100644 (file)
@@ -13,4 +13,5 @@ ceph_conf_overrides:
   global:
     osd_pool_default_size: 1
 openstack_config: False
-dashboard_enabled: False
\ No newline at end of file
+dashboard_enabled: False
+copy_admin_key: True
\ No newline at end of file
index 6cc7c95da41e2ab4ae720018cc6e55c2b52d0e84..d6999b17eea53f856b389eea108718dabae9f8f4 100644 (file)
@@ -7,4 +7,5 @@ ceph_conf_overrides:
   global:
     osd_pool_default_size: 3
 openstack_config: False
-dashboard_enabled: False
\ No newline at end of file
+dashboard_enabled: False
+copy_admin_key: True
\ No newline at end of file
index f380626a66b77b1ec4c94055846b175f567d0209..0594e228e44e7c80e594493aba9274c3a32aa714 100644 (file)
@@ -12,4 +12,5 @@ ceph_conf_overrides:
   global:
     osd_pool_default_size: 1
 openstack_config: False
-dashboard_enabled: False
\ No newline at end of file
+dashboard_enabled: False
+copy_admin_key: True
\ No newline at end of file
index d51eb5e9cd587e7a4d18006159bc0ff5e29b784a..1b376c9ca3985a77f2e01709445ae6939dd3ed94 100644 (file)
@@ -15,3 +15,4 @@ ceph_conf_overrides:
     osd_pool_default_size: 1
 openstack_config: False
 dashboard_enabled: False
+copy_admin_key: True
\ No newline at end of file
index a801d54e1721f2466a76785bfd969343791482d1..017ffcd18f6a0e1deefe8964f49b0e8336afc71b 100644 (file)
@@ -51,7 +51,6 @@ commands=
       ceph_docker_registry={env:CEPH_DOCKER_REGISTRY:docker.io} \
       ceph_docker_image={env:CEPH_DOCKER_IMAGE:ceph/daemon} \
       ceph_docker_image_tag={env:CEPH_DOCKER_IMAGE_TAG:latest-nautilus} \
-      copy_admin_key={env:COPY_ADMIN_KEY:False} \
       container_binary=podman \
       container_package_name=podman \
       container_service_name=podman \
@@ -71,4 +70,4 @@ commands=
   # retest to ensure cluster came back up correctly after rebooting
   py.test --reruns 5 --reruns-delay 1 -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/{env:INVENTORY} --ssh-config={changedir}/vagrant_ssh_config {toxinidir}/tests/functional/tests
 
-  vagrant destroy -f
\ No newline at end of file
+  vagrant destroy -f
index b6b7642b2a1788f582dca5567e618762b89327fc..079a81c32144fb978a620ddb99e8e663d0599a88 100644 (file)
@@ -61,7 +61,6 @@ commands=
       ceph_docker_registry={env:CEPH_DOCKER_REGISTRY:docker.io} \
       ceph_docker_image={env:CEPH_DOCKER_IMAGE:ceph/daemon} \
       ceph_docker_image_tag={env:CEPH_DOCKER_IMAGE_TAG:latest-luminous} \
-      copy_admin_key={env:COPY_ADMIN_KEY:False} \
   "'
 
   pip install -r {toxinidir}/tests/requirements.txt
diff --git a/tox.ini b/tox.ini
index 36cbaa4bf3ca0879f424209a1500381d0ed6e03d..405f2186870fc74efff1a67b8b5d4975d3067712 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -44,7 +44,6 @@ commands=
       ceph_docker_registry={env:CEPH_DOCKER_REGISTRY:docker.io} \
       ceph_docker_image={env:CEPH_DOCKER_IMAGE:ceph/daemon} \
       ceph_docker_image_tag={env:CEPH_DOCKER_IMAGE_TAG:latest-master} \
-      copy_admin_key={env:COPY_ADMIN_KEY:False} \
   "
 
   # wait 30sec for services to be ready
@@ -378,14 +377,9 @@ setenv=
   container: CONTAINER_DIR = /container
   container: PLAYBOOK = site-docker.yml.sample
   container: PURGE_PLAYBOOK = purge-docker-cluster.yml
-  storage_inventory: COPY_ADMIN_KEY = True
   non_container: PLAYBOOK = site.yml.sample
   shrink_mon: MON_TO_KILL = mon2
-  shrink_osd: COPY_ADMIN_KEY = True
   shrink_mgr: MGR_TO_KILL = mgr1
-  shrink_mds: COPY_ADMIN_KEY = True
-  shrink_rbdmirror: COPY_ADMIN_KEY = True
-  shrink_rgw: COPY_ADMIN_KEY = True
 
   rhcs: CEPH_STABLE_RELEASE = luminous
   lvm_osds: CEPH_STABLE_RELEASE = nautilus
@@ -444,8 +438,7 @@ commands=
       ceph_stable_release={env:CEPH_STABLE_RELEASE:nautilus} \
       ceph_docker_registry={env:CEPH_DOCKER_REGISTRY:docker.io} \
       ceph_docker_image={env:CEPH_DOCKER_IMAGE:ceph/daemon} \
-      ceph_docker_image_tag={env:CEPH_DOCKER_IMAGE_TAG:latest-master} \
-      copy_admin_key={env:COPY_ADMIN_KEY:False} \
+      ceph_docker_image_tag={env:CEPH_DOCKER_IMAGE_TAG:latest-nautilus} \
   "
 
   # wait 30sec for services to be ready
@@ -462,7 +455,7 @@ commands=
   all_daemons: py.test --reruns 5 --reruns-delay 1 -n 8 --durations=0 --sudo -v --connection=ansible --ansible-inventory={changedir}/{env:INVENTORY} --ssh-config={changedir}/vagrant_ssh_config {toxinidir}/tests/functional/tests
 
   # handlers/idempotency test
-  all_daemons: ansible-playbook -vv -i {changedir}/{env:INVENTORY} {toxinidir}/{env:PLAYBOOK:site.yml.sample} --extra-vars "delegate_facts_host={env:DELEGATE_FACTS_HOST:True} fetch_directory={env:FETCH_DIRECTORY:{changedir}/fetch} ceph_stable_release={env:CEPH_STABLE_RELEASE:nautilus} ceph_docker_registry={env:CEPH_DOCKER_REGISTRY:docker.io} ceph_docker_image={env:CEPH_DOCKER_IMAGE:ceph/daemon} ceph_docker_image_tag={env:CEPH_DOCKER_IMAGE_TAG_BIS:latest-bis-master} copy_admin_key={env:COPY_ADMIN_KEY:False} " --extra-vars @ceph-override.json
+  all_daemons: ansible-playbook -vv -i {changedir}/{env:INVENTORY} {toxinidir}/{env:PLAYBOOK:site.yml.sample} --extra-vars "delegate_facts_host={env:DELEGATE_FACTS_HOST:True} fetch_directory={env:FETCH_DIRECTORY:{changedir}/fetch} ceph_stable_release={env:CEPH_STABLE_RELEASE:nautilus} ceph_docker_registry={env:CEPH_DOCKER_REGISTRY:docker.io} ceph_docker_image={env:CEPH_DOCKER_IMAGE:ceph/daemon} ceph_docker_image_tag={env:CEPH_DOCKER_IMAGE_TAG_BIS:latest-bis-nautilus} " --extra-vars @ceph-override.json
 
   purge: {[purge]commands}
   switch_to_containers: {[switch-to-containers]commands}