]> git.apps.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>
Mon, 14 Sep 2020 19:37:56 +0000 (15:37 -0400)
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
library/ceph_pool.py
roles/ceph-client/tasks/create_users_keys.yml
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 cfa7e6ea8cbefc2ba061bbadaf3936086509697f..d03c37d59233de3a38e5b2ce9336992efce0ed79 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 092d57926e310fd34aaa1b5be34cf3dc425f05dd..62b95c13fd22ad816d7fe6ed094662d9557f76e5 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 851bee7035b1d88d1c804c735e356f8aa7e9a674..d6b99ea09074bea83441ea8ef68371b3eb2ffcec 100644 (file)
@@ -59,9 +59,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
@@ -498,7 +498,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),
         import_key=dict(type='bool', required=False, default=True),
index f61e39fd64831aa04af72e317068025d073f2c7b..77cbf280d18f539eaa5bb3c22ae01b5caffcd173 100644 (file)
@@ -52,9 +52,9 @@ options:
             If 'absent' is used, the module will simply delete the pool.
             If 'list' is used, the module will return all details about the existing pools
             (json formatted).
-        required: true
+        required: false
         choices: ['present', 'absent', 'list']
-        default: list
+        default: present
     size:
         description:
             - set the replica size of the pool.
index bb48000e19b78ff618d68912cf1fde9991ea51fc..e65341339911c712bc131a68286227a2392ca7de 100644 (file)
@@ -75,7 +75,6 @@
     - name: create ceph pool(s)
       ceph_pool:
         name: "{{ item.name }}"
-        state: present
         cluster: "{{ cluster }}"
         pg_num: "{{ item.pg_num | default(osd_pool_default_pg_num) if not item.0.pg_autoscale_mode | default(False) | bool else 16 }}"
         pgp_num: "{{ item.pgp_num | default(item.pg_num) | default(osd_pool_default_pg_num) if not item.pg_autoscale_mode | default(False) | bool else omit }}"
index 2b360a65ec03b3b7b8a7b928841f81451ad1b62d..e27bc796584b4d808d9b60c7067c14727f4b24ac 100644 (file)
@@ -4,7 +4,6 @@
   block:
     - name: create client.crash keyring
       ceph_key:
-        state: present
         name: "client.crash"
         caps: "{{ {'mon': 'allow profile crash', 'mgr': 'allow profile crash'} }}"
         cluster: "{{ cluster }}"
index fac0a7ff08543afc943e15e90e363b87213b6e4c..8f94c8b9cfdf181f0376c2d3d6e551fa5a83fd45 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 6edd7685834503f48a9b1f0d46cbd430a7934519..4f9ee58f5951844db8e9f9be2c9521dc1c0730d8 100644 (file)
@@ -29,7 +29,6 @@
 - name: create monitor initial keyring
   ceph_key:
     name: mon.
-    state: present
     dest: "/var/lib/ceph/tmp/"
     secret: "{{ monitor_keyring }}"
     cluster: "{{ cluster }}"
@@ -62,7 +61,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 d239e5ea37834580e709c71be724e344ddd553c0..6f31754d2e3ffa88eaa7b31038ee5860c867de4c 100644 (file)
@@ -25,7 +25,6 @@
   block:
     - name: generate keys
       ceph_key:
-        state: present
         name: "{{ item.name }}"
         caps: "{{ item.caps }}"
         secret: "{{ item.key | default('') }}"