]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
ceph_key: set state as optional
authorDimitri Savineau <dsavinea@redhat.com>
Fri, 11 Sep 2020 13:34:05 +0000 (09:34 -0400)
committerDimitri Savineau <savineau.dimitri@gmail.com>
Tue, 1 Dec 2020 14:53:26 +0000 (09:53 -0500)
Most ansible module using a state parameter default to the present
value (when available) instead of using it as a mandatory option.

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit abb4023d762305c368facd3fab5a5b7e3a839d66)

infrastructure-playbooks/ceph-keys.yml
infrastructure-playbooks/rolling_update.yml
library/ceph_key.py
roles/ceph-crash/tasks/main.yml
roles/ceph-mgr/tasks/common.yml
roles/ceph-mon/tasks/deploy_monitors.yml
roles/ceph-osd/tasks/openstack_config.yml

index f08076b485033af182e248fcb273c2a32e52a9bc..24235e49c89a18e8107c380cc67f4ee5536e8bc9 100644 (file)
@@ -25,7 +25,6 @@
     - name: create ceph key(s) module
       ceph_key:
         name: "{{ item.name }}"
-        state: present
         caps: "{{ item.caps }}"
         cluster: "{{ cluster }}"
         secret: "{{ item.key | default('') }}"
index 4dfc798d0f003cbe40207d326892d235ba6475b6..ae5ece12158f1e7661e7c1d61524f67536dd8ce4 100644 (file)
     - name: create potentially missing keys (rbd and rbd-mirror)
       ceph_key:
         name: "client.{{ item.0 }}"
-        state: present
         dest: "/var/lib/ceph/{{ item.0 }}/"
         caps:
           mon: "allow profile {{ item.0 }}"
index 73bbf5598804e6cb037027459eeff5e9d4e3b8cf..989e0eb9900ea2394358cbe51678afca88168979 100644 (file)
@@ -70,9 +70,9 @@ options:
             return a json output.
             If 'info' is used, the module will return in a json format the
             description of a given keyring.
-        required: true
-        choices: ['present', 'absent', 'list', 'info']
-        default: list
+        required: false
+        choices: ['present', 'update', 'absent', 'list', 'info', 'fetch_initial_keys']
+        default: present
     caps:
         description:
             - CephX key capabilities
@@ -506,7 +506,7 @@ def run_module():
     module_args = dict(
         cluster=dict(type='str', required=False, default='ceph'),
         name=dict(type='str', required=False),
-        state=dict(type='str', required=True),
+        state=dict(type='str', required=False, default='present', choices=['present', 'update', 'absent', 'list', 'info', 'fetch_initial_keys']),
         caps=dict(type='dict', required=False, default=None),
         secret=dict(type='str', required=False, default=None, no_log=True),
         import_key=dict(type='bool', required=False, default=True),
index c4d9eb51ec9abf38d68a6a598520b93da01a0812..4bcb62274b789fd065ef091583506f014ccd47d7 100644 (file)
@@ -4,7 +4,6 @@
   block:
     - name: create client.crash keyring
       ceph_key:
-        state: present
         name: "client.crash"
         caps:
           mon: 'allow profile crash'
index ae47440344890fc764da91d13b54054840ab1a08..e924dcac2a56172cb5fdd159541b64573a207eb7 100644 (file)
@@ -10,7 +10,6 @@
 - name: fetch ceph mgr keyring
   ceph_key:
     name: "mgr.{{ ansible_hostname }}"
-    state: present
     caps:
       mon: allow profile mgr
       osd: allow *
@@ -32,7 +31,6 @@
     - name: create ceph mgr keyring(s) on a mon node
       ceph_key:
         name: "mgr.{{ hostvars[item]['ansible_hostname'] }}"
-        state: present
         caps:
           mon: allow profile mgr
           osd: allow *
index 5ede5f6317b7430067017e5f290e4c9f5886bb58..3c3e28b1306d61f762410e344b929a4b9635011a 100644 (file)
@@ -30,7 +30,6 @@
 - name: create monitor initial keyring
   ceph_key:
     name: mon.
-    state: present
     dest: "/var/lib/ceph/tmp/"
     secret: "{{ monitor_keyring }}"
     cluster: "{{ cluster }}"
@@ -75,7 +74,6 @@
 - name: create custom admin keyring
   ceph_key:
     name: client.admin
-    state: present
     secret: "{{ admin_secret }}"
     caps: "{{ client_admin_ceph_authtool_cap }}"
     import_key: False
index 64ea152a13eb051af820ff0cae569c44a428b71e..43be57b238f9c6bea2e275c95b12c47f83448075 100644 (file)
@@ -92,7 +92,6 @@
   block:
     - name: generate keys
       ceph_key:
-        state: present
         name: "{{ item.name }}"
         caps: "{{ item.caps }}"
         secret: "{{ item.key | default('') }}"