ceph_pool: set state as optional

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>
pull/5768/head
Dimitri Savineau 2020-09-09 20:44:54 -04:00 committed by Guillaume Abrioux
parent ee6f0547ba
commit 3a05aeb6cb
5 changed files with 1 additions and 5 deletions

View File

@ -457,7 +457,7 @@ def run_module():
module_args = dict( module_args = dict(
cluster=dict(type='str', required=False, default='ceph'), cluster=dict(type='str', required=False, default='ceph'),
name=dict(type='str', required=True), name=dict(type='str', required=True),
state=dict(type='str', required=True, choices=['present', 'absent', 'list']), state=dict(type='str', required=False, default='present', choices=['present', 'absent', 'list']),
details=dict(type='bool', required=False, default=False), details=dict(type='bool', required=False, default=False),
size=dict(type='str', required=False), size=dict(type='str', required=False),
min_size=dict(type='str', required=False), min_size=dict(type='str', required=False),

View File

@ -32,7 +32,6 @@
- name: create cephx key(s) - name: create cephx key(s)
ceph_key: ceph_key:
state: present
name: "{{ item.name }}" name: "{{ item.name }}"
caps: "{{ item.caps }}" caps: "{{ item.caps }}"
secret: "{{ item.key | default('') }}" secret: "{{ item.key | default('') }}"

View File

@ -55,7 +55,6 @@
- name: create iscsi pool - name: create iscsi pool
ceph_pool: ceph_pool:
name: "{{ iscsi_pool_name }}" name: "{{ iscsi_pool_name }}"
state: present
cluster: "{{ cluster }}" cluster: "{{ cluster }}"
pg_num: "{{ osd_pool_default_pg_num }}" pg_num: "{{ osd_pool_default_pg_num }}"
size: "{{ iscsi_pool_size | default(osd_pool_default_size) }}" size: "{{ iscsi_pool_size | default(osd_pool_default_size) }}"

View File

@ -12,7 +12,6 @@
- name: create filesystem pools - name: create filesystem pools
ceph_pool: ceph_pool:
name: "{{ item.name }}" name: "{{ item.name }}"
state: present
cluster: "{{ cluster }}" 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 }}" 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 }}" 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 }}"

View File

@ -4,7 +4,6 @@
- name: create openstack pool(s) - name: create openstack pool(s)
ceph_pool: ceph_pool:
name: "{{ item.name }}" name: "{{ item.name }}"
state: present
cluster: "{{ cluster }}" 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 }}" 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 }}" 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 }}"