Browse Source

Set project that owns managed resources

This change allow deployer to set project that will be owner of managed
resources like auto-created records and zones.
The owner is specified using project name and defaults to service
tenant.

Depends-On: https://review.openstack.org/628979
Change-Id: I620be82d890aaa547decc59f81f55345f7177900
Damian Cikowski 3 months ago
parent
commit
8facdee36c
3 changed files with 23 additions and 2 deletions
  1. 3
    0
      defaults/main.yml
  2. 19
    0
      tasks/designate_post_install.yml
  3. 1
    2
      templates/designate.conf.j2

+ 3
- 0
defaults/main.yml View File

@@ -162,6 +162,9 @@ designate_role_name: admin
162 162
 #     algorithm: "hmac-md5"
163 163
 #     secret: "<key>"
164 164
 
165
+# Owner of all managed resources - like auto-created records etc.
166
+designate_managed_resource_project_name: "{{ designate_service_project_name }}"
167
+
165 168
 ## Service Type and Data
166 169
 designate_service_region: RegionOne
167 170
 designate_service_endpoint_type: internalURL

+ 19
- 0
tasks/designate_post_install.yml View File

@@ -13,6 +13,25 @@
13 13
 # See the License for the specific language governing permissions and
14 14
 # limitations under the License.
15 15
 
16
+- name: Get project id for managed resources
17
+  delegate_to: "{{ designate_service_setup_host }}"
18
+  vars:
19
+    ansible_python_interpreter: >-
20
+      {{ (designate_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_python['executable']) }}
21
+  os_project_facts:
22
+    cloud: default
23
+    name: "{{ designate_managed_resource_project_name }}"
24
+    interface: internal
25
+    validate_certs: "{{ not (keystone_service_internaluri_insecure | bool) }}"
26
+  register: _get_managed_resource_project
27
+  until: _get_managed_resource_project is success
28
+  retries: 5
29
+  delay: 15
30
+
31
+- name: Store project id for managed resources
32
+  set_fact:
33
+    designate_managed_resource_tenant_id: "{{ ansible_facts.openstack_projects[0].id }}"
34
+
16 35
 - name: Copy designate config
17 36
   config_template:
18 37
     src: "{{ item.src }}"

+ 1
- 2
templates/designate.conf.j2 View File

@@ -66,8 +66,7 @@ transport_url = {{ designate_oslomsg_notify_transport }}://{% for host in design
66 66
 #managed_resource_email = hostmaster@example.com.
67 67
 
68 68
 # Tenant ID to own all managed resources - like auto-created records etc.
69
-# TODO(odyssey4me) - Check on whether this should be set to something
70
-#managed_resource_tenant_id = 123456
69
+managed_resource_tenant_id = {{ designate_managed_resource_tenant_id }}
71 70
 
72 71
 #-----------------------
73 72
 # API Service

Loading…
Cancel
Save