host = host_vars['ansible_hostname']
mode = self._task.args.get('mode', 'permissive')
- print host_vars['groups']
-
self._supports_check_mode = False # XXX ?
self._supports_async = True
result['_ansible_verbose_always'] = True
try:
+ notario_store["groups"] = host_vars["groups"]
notario.validate(host_vars, install_options, defined_keys=True)
if host_vars["ceph_origin"] == "repository":
notario.validate(host_vars, monitor_options, defined_keys=True)
+ notario_store["radosgw_address"] = host_vars.get("radosgw_address", None)
+ notario_store["radosgw_address_block"] = host_vars.get("radosgw_address_block", None)
+ notario_store["radosgw_interface"] = host_vars.get("radosgw_interface", None)
+
+ if host_vars["rgw_group_name"] in host_vars["groups"]:
+ notario.validate(host_vars, rados_options, defined_keys=True)
+
# validate osd scenario setup
notario.validate(host_vars, osd_options, defined_keys=True)
notario_store['osd_objectstore'] = host_vars["osd_objectstore"]
assert value in ['jewel', 'kraken', 'luminous', 'mimic'], "ceph_stable_release must be set to 'jewel', 'kraken', 'lumious' or 'mimic'"
+def validate_rados_options(value):
+ """
+ Either radosgw_interface, radosgw_address or radosgw_address_block must
+ be defined.
+ """
+ radosgw_address_given = notario_store["radosgw_address"] != "address"
+ radosgw_address_block_given = notario_store["radosgw_address_block"] != "subnet"
+ radosgw_interface_given = notario_store["radosgw_interface"] != "interface"
+
+ msg = "Either radosgw_address, radosgw_address_block or radosgw_interface must be provided"
+
+ assert any([radosgw_address_given, radosgw_address_block_given, radosgw_interface_given]), msg
+
+
install_options = (
("ceph_origin", ceph_origin_choices),
('osd_objectstore', osd_objectstore_choices),
("public_network", types.string),
)
+rados_options = (
+ ("radosgw_address", validate_rados_options),
+ ("radosgw_address_block", validate_rados_options),
+ ("radosgw_interface", validate_rados_options),
+)
+
osd_options = (
(optional("dmcrypt"), types.boolean),
("osd_scenario", validate_osd_scenarios),
- name: validate provided configuration
validate:
- mode: permissive
+ mode: strict
- name: fail if local scenario is enabled on debian
fail:
- osd_group_name in group_names
- osd_objectstore == 'bluestore'
- ceph_release_num[ceph_release] < ceph_release_num.luminous
-
-- name: make sure radosgw_interface, radosgw_address or radosgw_address_block is defined
- fail:
- msg: "you must set radosgw_interface, radosgw_address or radosgw_address_block"
- when:
- - rgw_group_name in group_names
- - radosgw_interface == 'interface'
- - radosgw_address == 'address'
- - radosgw_address_block == 'subnet'