Browse Source

Merge "Add cyborg to kolla-ansible"

tags/8.0.0.0rc1
Zuul 1 month ago
parent
commit
03d3885a56
38 changed files with 678 additions and 0 deletions
  1. 1
    0
      README.rst
  2. 3
    0
      ansible/group_vars/all.yml
  3. 14
    0
      ansible/inventory/all-in-one
  4. 14
    0
      ansible/inventory/multinode
  5. 1
    0
      ansible/roles/common/tasks/config.yml
  6. 1
    0
      ansible/roles/common/templates/conf/filter/01-rewrite-0.12.conf.j2
  7. 5
    0
      ansible/roles/common/templates/conf/filter/01-rewrite-0.14.conf.j2
  8. 1
    0
      ansible/roles/common/templates/conf/input/00-global.conf.j2
  9. 3
    0
      ansible/roles/common/templates/cron-logrotate-cyborg.conf.j2
  10. 1
    0
      ansible/roles/common/templates/cron.json.j2
  11. 77
    0
      ansible/roles/cyborg/defaults/main.yml
  12. 72
    0
      ansible/roles/cyborg/handlers/main.yml
  13. 3
    0
      ansible/roles/cyborg/meta/main.yml
  14. 36
    0
      ansible/roles/cyborg/tasks/bootstrap.yml
  15. 19
    0
      ansible/roles/cyborg/tasks/bootstrap_service.yml
  16. 1
    0
      ansible/roles/cyborg/tasks/check.yml
  17. 7
    0
      ansible/roles/cyborg/tasks/clone.yml
  18. 128
    0
      ansible/roles/cyborg/tasks/config.yml
  19. 14
    0
      ansible/roles/cyborg/tasks/deploy.yml
  20. 7
    0
      ansible/roles/cyborg/tasks/loadbalancer.yml
  21. 2
    0
      ansible/roles/cyborg/tasks/main.yml
  22. 17
    0
      ansible/roles/cyborg/tasks/precheck.yml
  23. 11
    0
      ansible/roles/cyborg/tasks/pull.yml
  24. 2
    0
      ansible/roles/cyborg/tasks/reconfigure.yml
  25. 32
    0
      ansible/roles/cyborg/tasks/register.yml
  26. 6
    0
      ansible/roles/cyborg/tasks/stop.yml
  27. 7
    0
      ansible/roles/cyborg/tasks/upgrade.yml
  28. 24
    0
      ansible/roles/cyborg/templates/cyborg-agent.json.j2
  29. 19
    0
      ansible/roles/cyborg/templates/cyborg-api-paste.ini.j2
  30. 30
    0
      ansible/roles/cyborg/templates/cyborg-api.json.j2
  31. 24
    0
      ansible/roles/cyborg/templates/cyborg-conductor.json.j2
  32. 45
    0
      ansible/roles/cyborg/templates/cyborg.conf.j2
  33. 12
    0
      ansible/roles/haproxy/tasks/precheck.yml
  34. 17
    0
      ansible/site.yml
  35. 1
    0
      etc/kolla/globals.yml
  36. 3
    0
      etc/kolla/passwords.yml
  37. 3
    0
      releasenotes/notes/add-cyborg-c7ee957a2cbe8e99.yaml
  38. 15
    0
      tests/templates/inventory.j2

+ 1
- 0
README.rst View File

@@ -50,6 +50,7 @@ Kolla-Ansible deploys containers for the following OpenStack projects:
50 50
 - `Cinder <https://docs.openstack.org/cinder/latest/>`__
51 51
 - `CloudKitty <https://docs.openstack.org/cloudkitty/latest/>`__
52 52
 - `Congress <https://docs.openstack.org/congress/latest/>`__
53
+- `Cyborg <https://docs.openstack.org/cyborg/latest/>`__
53 54
 - `Designate <https://docs.openstack.org/designate/latest/>`__
54 55
 - `Freezer <https://docs.openstack.org/freezer/latest/>`__
55 56
 - `Glance <https://docs.openstack.org/glance/latest/>`__

+ 3
- 0
ansible/group_vars/all.yml View File

@@ -209,6 +209,8 @@ cloudkitty_api_port: "8889"
209 209
 
210 210
 collectd_udp_port: "25826"
211 211
 
212
+cyborg_api_port: "6666"
213
+
212 214
 designate_internal_fqdn: "{{ kolla_internal_fqdn }}"
213 215
 designate_external_fqdn: "{{ kolla_external_fqdn }}"
214 216
 designate_api_port: "9001"
@@ -527,6 +529,7 @@ enable_cinder_backend_zfssa_iscsi: "no"
527 529
 enable_cinder_backend_quobyte: "no"
528 530
 enable_cloudkitty: "no"
529 531
 enable_congress: "no"
532
+enable_cyborg: "no"
530 533
 enable_designate: "no"
531 534
 enable_etcd: "no"
532 535
 enable_fluentd: "yes"

+ 14
- 0
ansible/inventory/all-in-one View File

@@ -187,6 +187,10 @@ control
187 187
 [aodh:children]
188 188
 control
189 189
 
190
+[cyborg:children]
191
+control
192
+compute
193
+
190 194
 [congress:children]
191 195
 control
192 196
 
@@ -549,6 +553,16 @@ aodh
549 553
 [aodh-notifier:children]
550 554
 aodh
551 555
 
556
+# Cyborg
557
+[cyborg-api:children]
558
+cyborg
559
+
560
+[cyborg-agent:children]
561
+compute
562
+
563
+[cyborg-conductor:children]
564
+cyborg
565
+
552 566
 # Panko
553 567
 [panko-api:children]
554 568
 panko

+ 14
- 0
ansible/inventory/multinode View File

@@ -200,6 +200,10 @@ control
200 200
 [aodh:children]
201 201
 control
202 202
 
203
+[cyborg:children]
204
+control
205
+compute
206
+
203 207
 [congress:children]
204 208
 control
205 209
 
@@ -578,6 +582,16 @@ aodh
578 582
 [aodh-notifier:children]
579 583
 aodh
580 584
 
585
+# Cyborg
586
+[cyborg-api:children]
587
+cyborg
588
+
589
+[cyborg-agent:children]
590
+compute
591
+
592
+[cyborg-conductor:children]
593
+cyborg
594
+
581 595
 # Congress
582 596
 [congress-api:children]
583 597
 congress

+ 1
- 0
ansible/roles/common/tasks/config.yml View File

@@ -249,6 +249,7 @@
249 249
     - { name: "cloudkitty", enabled: "{{ enable_cloudkitty }}" }
250 250
     - { name: "collectd", enabled: "{{ enable_collectd }}" }
251 251
     - { name: "congress", enabled: "{{ enable_congress }}" }
252
+    - { name: "cyborg", enabled: "{{ enable_cyborg }}" }
252 253
     - { name: "designate", enabled: "{{ enable_designate }}" }
253 254
     - { name: "elasticsearch", enabled: "{{ enable_elasticsearch }}" }
254 255
     - { name: "etcd", enabled: "{{ enable_etcd }}" }

+ 1
- 0
ansible/roles/common/templates/conf/filter/01-rewrite-0.12.conf.j2 View File

@@ -33,4 +33,5 @@
33 33
     rewriterule30 programname ^(tacker-server|tacker-conductor)$ openstack_python
34 34
     rewriterule31 programname ^(vitrage-ml|vitrage-notifier|vitrage-graph)$ openstack_python
35 35
     rewriterule32 programname ^(blazar-api|blazar-manager)$ openstack_python
36
+    rewriterule33 programname ^(cyborg-api|cyborg-conductor|cyborg-agent)$ openstack_python
36 37
 </match>

+ 5
- 0
ansible/roles/common/templates/conf/filter/01-rewrite-0.14.conf.j2 View File

@@ -66,6 +66,11 @@
66 66
     pattern ^(aodh-notifier|aodh-listener|aodh-evaluator|aodh-dbsync)$
67 67
     tag openstack_python
68 68
   </rule>
69
+  <rule>
70
+    key     programname
71
+    pattern ^(cyborg-api|cyborg-conductor|cyborg-agent)$
72
+    tag openstack_python
73
+  </rule>
69 74
   <rule>
70 75
     key     programname
71 76
     pattern ^(cinder-api|cinder-scheduler|cinder-manage|cinder-volume|cinder-backup|privsep-helper)$

+ 1
- 0
ansible/roles/common/templates/conf/input/00-global.conf.j2 View File

@@ -7,6 +7,7 @@
7 7
     ( 'cinder', enable_cinder ),
8 8
     ( 'cloudkitty', enable_cloudkitty ),
9 9
     ( 'congress', enable_congress ),
10
+    ( 'cyborg', enable_cyborg ),
10 11
     ( 'designate', enable_designate ),
11 12
     ( 'freezer', enable_freezer ),
12 13
     ( 'glance', enable_glance ),

+ 3
- 0
ansible/roles/common/templates/cron-logrotate-cyborg.conf.j2 View File

@@ -0,0 +1,3 @@
1
+"/var/log/kolla/cyborg/*.log"
2
+{
3
+}

+ 1
- 0
ansible/roles/common/templates/cron.json.j2 View File

@@ -11,6 +11,7 @@
11 11
     ( 'cloudkitty', enable_cloudkitty ),
12 12
     ( 'collectd', enable_collectd ),
13 13
     ( 'congress', enable_congress ),
14
+    ( 'cyborg', enable_cyborg ),
14 15
     ( 'designate', enable_designate ),
15 16
     ( 'elasticsearch', enable_elasticsearch ),
16 17
     ( 'etcd', enable_etcd ),

+ 77
- 0
ansible/roles/cyborg/defaults/main.yml View File

@@ -0,0 +1,77 @@
1
+---
2
+project_name: "cyborg"
3
+
4
+cyborg_services:
5
+  cyborg-api:
6
+    container_name: cyborg_api
7
+    group: cyborg-api
8
+    enabled: true
9
+    image: "{{ cyborg_api_image_full }}"
10
+    volumes:
11
+      - "{{ node_config_directory }}/cyborg-api/:{{ container_config_directory }}/:ro"
12
+      - "/etc/localtime:/etc/localtime:ro"
13
+      - "cyborg:/var/lib/cyborg/"
14
+      - "kolla_logs:/var/log/kolla/"
15
+    dimensions: "{{ cyborg_api_dimensions }}"
16
+  cyborg-agent:
17
+    container_name: cyborg_agent
18
+    group: cyborg-agent
19
+    enabled: true
20
+    image: "{{ cyborg_agent_image_full }}"
21
+    volumes:
22
+      - "{{ node_config_directory }}/cyborg-agent/:{{ container_config_directory }}/:ro"
23
+      - "/etc/localtime:/etc/localtime:ro"
24
+      - "kolla_logs:/var/log/kolla/"
25
+    dimensions: "{{ cyborg_agent_dimensions }}"
26
+  cyborg-conductor:
27
+    container_name: cyborg_conductor
28
+    group: cyborg-conductor
29
+    enabled: true
30
+    image: "{{ cyborg_conductor_image_full }}"
31
+    volumes:
32
+      - "{{ node_config_directory }}/cyborg-conductor/:{{ container_config_directory }}/:ro"
33
+      - "/etc/localtime:/etc/localtime:ro"
34
+      - "kolla_logs:/var/log/kolla/"
35
+    dimensions: "{{ cyborg_conductor_dimensions }}"
36
+
37
+####################
38
+# Database
39
+####################
40
+cyborg_database_name: "cyborg"
41
+cyborg_database_user: "{% if use_preconfigured_databases | bool and use_common_mariadb_user | bool %}{{ database_user }}{% else %}cyborg{% endif %}"
42
+cyborg_database_address: "{{ database_address }}:{{ database_port }}"
43
+
44
+####################
45
+# Docker
46
+####################
47
+cyborg_install_type: "{{ kolla_install_type }}"
48
+cyborg_tag: "{{ openstack_release }}"
49
+
50
+cyborg_api_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ cyborg_install_type }}-cyborg-api"
51
+cyborg_api_tag: "{{ cyborg_tag }}"
52
+cyborg_api_image_full: "{{ cyborg_api_image }}:{{ cyborg_api_tag }}"
53
+
54
+cyborg_agent_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ cyborg_install_type }}-cyborg-agent"
55
+cyborg_agent_tag: "{{ cyborg_tag }}"
56
+cyborg_agent_image_full: "{{ cyborg_agent_image }}:{{ cyborg_agent_tag }}"
57
+
58
+cyborg_conductor_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ cyborg_install_type }}-cyborg-conductor"
59
+cyborg_conductor_tag: "{{ cyborg_tag }}"
60
+cyborg_conductor_image_full: "{{ cyborg_conductor_image }}:{{ cyborg_conductor_tag }}"
61
+
62
+cyborg_api_dimensions: "{{ default_container_dimensions }}"
63
+cyborg_agent_dimensions: "{{ default_container_dimensions }}"
64
+cyborg_conductor_dimensions: "{{ default_container_dimensions }}"
65
+
66
+####################
67
+# OpenStack
68
+####################
69
+cyborg_admin_endpoint: "{{ admin_protocol }}://{{ kolla_internal_fqdn }}:{{ cyborg_api_port }}"
70
+cyborg_internal_endpoint: "{{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ cyborg_api_port }}"
71
+cyborg_public_endpoint: "{{ public_protocol }}://{{ kolla_external_fqdn }}:{{ cyborg_api_port }}"
72
+
73
+cyborg_logging_debug: "{{ openstack_logging_debug }}"
74
+
75
+cyborg_keystone_user: "cyborg"
76
+
77
+openstack_cyborg_auth: "{{ openstack_auth }}"

+ 72
- 0
ansible/roles/cyborg/handlers/main.yml View File

@@ -0,0 +1,72 @@
1
+---
2
+- name: Restart cyborg-api container
3
+  vars:
4
+    service_name: "cyborg-api"
5
+    service: "{{ cyborg_services[service_name] }}"
6
+    config_json: "{{ cyborg_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
7
+    cyborg_conf: "{{ cyborg_confs.results|selectattr('item.key', 'equalto', service_name)|first }}"
8
+    policy_overwriting: "{{ cyborg_policy_overwriting.results|selectattr('item.key', 'equalto', service_name)|first }}"
9
+    cyborg_api_container: "{{ check_cyborg_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
10
+  kolla_docker:
11
+    action: "recreate_or_restart_container"
12
+    common_options: "{{ docker_common_options }}"
13
+    name: "{{ service.container_name }}"
14
+    image: "{{ service.image }}"
15
+    volumes: "{{ service.volumes }}"
16
+    dimensions: "{{ service.dimensions }}"
17
+  when:
18
+    - action != "config"
19
+    - inventory_hostname in groups[service.group]
20
+    - service.enabled | bool
21
+    - config_json.changed | bool
22
+      or cyborg_conf.changed | bool
23
+      or policy_overwriting.changed | bool
24
+      or cyborg_api_container.changed | bool
25
+
26
+- name: Restart cyborg-conductor container
27
+  vars:
28
+    service_name: "cyborg-conductor"
29
+    service: "{{ cyborg_services[service_name] }}"
30
+    config_json: "{{ cyborg_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
31
+    cyborg_conf: "{{ cyborg_confs.results|selectattr('item.key', 'equalto', service_name)|first }}"
32
+    policy_overwriting: "{{ cyborg_policy_overwriting.results|selectattr('item.key', 'equalto', service_name)|first }}"
33
+    cyborg_conductor_container: "{{ check_cyborg_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
34
+  kolla_docker:
35
+    action: "recreate_or_restart_container"
36
+    common_options: "{{ docker_common_options }}"
37
+    name: "{{ service.container_name }}"
38
+    image: "{{ service.image }}"
39
+    volumes: "{{ service.volumes }}"
40
+    dimensions: "{{ service.dimensions }}"
41
+  when:
42
+    - action != "config"
43
+    - inventory_hostname in groups[service.group]
44
+    - service.enabled | bool
45
+    - config_json.changed | bool
46
+      or cyborg_conf.changed | bool
47
+      or policy_overwriting.changed | bool
48
+      or cyborg_conductor_container.changed | bool
49
+
50
+- name: Restart cyborg-agent container
51
+  vars:
52
+    service_name: "cyborg-agent"
53
+    service: "{{ cyborg_services[service_name] }}"
54
+    config_json: "{{ cyborg_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
55
+    cyborg_conf: "{{ cyborg_confs.results|selectattr('item.key', 'equalto', service_name)|first }}"
56
+    policy_overwriting: "{{ cyborg_policy_overwriting.results|selectattr('item.key', 'equalto', service_name)|first }}"
57
+    cyborg_agent_container: "{{ check_cyborg_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
58
+  kolla_docker:
59
+    action: "recreate_or_restart_container"
60
+    common_options: "{{ docker_common_options }}"
61
+    name: "{{ service.container_name }}"
62
+    image: "{{ service.image }}"
63
+    volumes: "{{ service.volumes }}"
64
+    dimensions: "{{ service.dimensions }}"
65
+  when:
66
+    - action != "config"
67
+    - inventory_hostname in groups[service.group]
68
+    - service.enabled | bool
69
+    - config_json.changed | bool
70
+      or cyborg_conf.changed | bool
71
+      or policy_overwriting.changed | bool
72
+      or cyborg_agent_container.changed | bool

+ 3
- 0
ansible/roles/cyborg/meta/main.yml View File

@@ -0,0 +1,3 @@
1
+---
2
+dependencies:
3
+  - { role: common }

+ 36
- 0
ansible/roles/cyborg/tasks/bootstrap.yml View File

@@ -0,0 +1,36 @@
1
+---
2
+- name: Creating cyborg database
3
+  kolla_toolbox:
4
+    module_name: mysql_db
5
+    module_args:
6
+      login_host: "{{ database_address }}"
7
+      login_port: "{{ database_port }}"
8
+      login_user: "{{ database_user }}"
9
+      login_password: "{{ database_password }}"
10
+      name: "{{ cyborg_database_name }}"
11
+  register: database
12
+  run_once: True
13
+  delegate_to: "{{ groups['cyborg-api'][0] }}"
14
+  when:
15
+    - not use_preconfigured_databases | bool
16
+
17
+- name: Creating cyborg database user and setting permissions
18
+  kolla_toolbox:
19
+    module_name: mysql_user
20
+    module_args:
21
+      login_host: "{{ database_address }}"
22
+      login_port: "{{ database_port }}"
23
+      login_user: "{{ database_user }}"
24
+      login_password: "{{ database_password }}"
25
+      name: "{{ cyborg_database_user }}"
26
+      password: "{{ cyborg_database_password }}"
27
+      host: "%"
28
+      priv: "{{ cyborg_database_name }}.*:ALL"
29
+      append_privs: "yes"
30
+  run_once: True
31
+  delegate_to: "{{ groups['cyborg-api'][0] }}"
32
+  when:
33
+    - not use_preconfigured_databases | bool
34
+
35
+- include_tasks: bootstrap_service.yml
36
+  when: database.changed or use_preconfigured_databases | bool

+ 19
- 0
ansible/roles/cyborg/tasks/bootstrap_service.yml View File

@@ -0,0 +1,19 @@
1
+---
2
+- name: Running cyborg bootstrap container
3
+  vars:
4
+    cyborg_api: "{{ cyborg_services['cyborg-api'] }}"
5
+  kolla_docker:
6
+    action: "start_container"
7
+    common_options: "{{ docker_common_options }}"
8
+    detach: False
9
+    environment:
10
+      KOLLA_BOOTSTRAP:
11
+      KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
12
+    image: "{{ cyborg_api.image }}"
13
+    labels:
14
+      BOOTSTRAP:
15
+    name: "bootstrap_cyborg"
16
+    restart_policy: "never"
17
+    volumes: "{{ cyborg_api.volumes }}"
18
+  run_once: True
19
+  delegate_to: "{{ groups[cyborg_api.group][0] }}"

+ 1
- 0
ansible/roles/cyborg/tasks/check.yml View File

@@ -0,0 +1 @@
1
+---

+ 7
- 0
ansible/roles/cyborg/tasks/clone.yml View File

@@ -0,0 +1,7 @@
1
+---
2
+- name: Cloning cyborg source repository for development
3
+  git:
4
+    repo: "{{ cyborg_git_repository }}"
5
+    dest: "{{ kolla_dev_repos_directory }}/{{ project_name }}"
6
+    update: "{{ cyborg_dev_repos_pull }}"
7
+    version: "{{ cyborg_source_version }}"

+ 128
- 0
ansible/roles/cyborg/tasks/config.yml View File

@@ -0,0 +1,128 @@
1
+---
2
+- name: Ensuring config directories exist
3
+  file:
4
+    path: "{{ node_config_directory }}/{{ item.key }}"
5
+    state: "directory"
6
+    owner: "{{ config_owner_user }}"
7
+    group: "{{ config_owner_group }}"
8
+    mode: "0770"
9
+  become: true
10
+  when:
11
+    - item.value.enabled | bool
12
+    - inventory_hostname in groups[item.value.group]
13
+  with_dict: "{{ cyborg_services }}"
14
+
15
+- name: Check if policies shall be overwritten
16
+  local_action: stat path="{{ item }}"
17
+  run_once: True
18
+  register: cyborg_policy
19
+  with_first_found:
20
+    - files: "{{ supported_policy_format_list }}"
21
+      paths:
22
+        - "{{ node_custom_config }}/cyborg/"
23
+      skip: true
24
+
25
+- name: Set cyborg policy file
26
+  set_fact:
27
+    cyborg_policy_file: "{{ cyborg_policy.results.0.stat.path | basename }}"
28
+    cyborg_policy_file_path: "{{ cyborg_policy.results.0.stat.path }}"
29
+  when:
30
+    - cyborg_policy.results
31
+
32
+- name: Copying over existing policy file
33
+  template:
34
+    src: "{{ cyborg_policy_file_path }}"
35
+    dest: "{{ node_config_directory }}/{{ item.key }}/{{ cyborg_policy_file }}"
36
+    mode: "0660"
37
+  become: true
38
+  register: cyborg_policy_overwriting
39
+  when:
40
+    - cyborg_policy_file is defined
41
+    - inventory_hostname in groups[item.value.group]
42
+    - item.value.enabled | bool
43
+  with_dict: "{{ cyborg_services }}"
44
+  notify:
45
+    - Restart cyborg-api container
46
+    - Restart cyborg-agent container
47
+    - Restart cyborg-conductor container
48
+
49
+- name: Copying over config.json files for services
50
+  template:
51
+    src: "{{ item.key }}.json.j2"
52
+    dest: "{{ node_config_directory }}/{{ item.key }}/config.json"
53
+    mode: "0660"
54
+  become: true
55
+  register: cyborg_config_jsons
56
+  when:
57
+    - item.value.enabled | bool
58
+    - inventory_hostname in groups[item.value.group]
59
+  with_dict: "{{ cyborg_services }}"
60
+  notify:
61
+    - Restart cyborg-api container
62
+    - Restart cyborg-agent container
63
+    - Restart cyborg-conductor container
64
+
65
+- name: Copying over cyborg.conf
66
+  vars:
67
+    service_name: "{{ item.key }}"
68
+  merge_configs:
69
+    sources:
70
+      - "{{ role_path }}/templates/cyborg.conf.j2"
71
+      - "{{ node_custom_config }}/global.conf"
72
+      - "{{ node_custom_config }}/cyborg.conf"
73
+      - "{{ node_custom_config }}/cyborg/{{ item.key }}.conf"
74
+      - "{{ node_custom_config }}/cyborg/{{ inventory_hostname }}/cyborg.conf"
75
+    dest: "{{ node_config_directory }}/{{ item.key }}/cyborg.conf"
76
+    mode: "0660"
77
+  become: true
78
+  register: cyborg_confs
79
+  when:
80
+    - item.value.enabled | bool
81
+    - inventory_hostname in groups[item.value.group]
82
+  with_dict: "{{ cyborg_services }}"
83
+  notify:
84
+    - Restart cyborg-api container
85
+    - Restart cyborg-agent container
86
+    - Restart cyborg-conductor container
87
+
88
+- name: Checking whether cyborg-api-paste.ini file exists
89
+  vars:
90
+    service: "{{ cyborg_services['cyborg-api'] }}"
91
+  local_action: stat path="{{ node_custom_config }}/cyborg/cyborg-api-paste.ini"
92
+  run_once: True
93
+  register: check_cyborg_api_paste_ini
94
+  when:
95
+    - service.enabled | bool
96
+
97
+- name: Copying over cyborg-api-paste.ini
98
+  vars:
99
+    service: "{{ cyborg_services['cyborg-api'] }}"
100
+  template:
101
+    src: "{{ node_custom_config }}/cyborg/cyborg-api-paste.ini"
102
+    dest: "{{ node_config_directory }}/cyborg-api/api-paste.ini"
103
+  when:
104
+    - inventory_hostname in groups['cyborg-api']
105
+    - service.enabled | bool
106
+    - check_cyborg_api_paste_ini.stat.exists
107
+  register: cyborg_api_paste
108
+  notify:
109
+    - Restart cyborg-api container
110
+
111
+- name: Check cyborg containers
112
+  kolla_docker:
113
+    action: "compare_container"
114
+    common_options: "{{ docker_common_options }}"
115
+    name: "{{ item.value.container_name }}"
116
+    image: "{{ item.value.image }}"
117
+    volumes: "{{ item.value.volumes }}"
118
+    dimensions: "{{ item.value.dimensions }}"
119
+  register: check_cyborg_containers
120
+  when:
121
+    - action != "config"
122
+    - inventory_hostname in groups[item.value.group]
123
+    - item.value.enabled | bool
124
+  with_dict: "{{ cyborg_services }}"
125
+  notify:
126
+    - Restart cyborg-api container
127
+    - Restart cyborg-agent container
128
+    - Restart cyborg-conductor container

+ 14
- 0
ansible/roles/cyborg/tasks/deploy.yml View File

@@ -0,0 +1,14 @@
1
+---
2
+- include_tasks: register.yml
3
+  when: inventory_hostname in groups['cyborg-api']
4
+
5
+- include_tasks: config.yml
6
+  when: inventory_hostname in groups['cyborg-api'] or
7
+        inventory_hostname in groups['cyborg-conductor'] or
8
+        inventory_hostname in groups['cyborg-agent']
9
+
10
+- include_tasks: bootstrap.yml
11
+  when: inventory_hostname in groups['cyborg-api']
12
+
13
+- name: Flush handlers
14
+  meta: flush_handlers

+ 7
- 0
ansible/roles/cyborg/tasks/loadbalancer.yml View File

@@ -0,0 +1,7 @@
1
+---
2
+- name: "Configure haproxy for {{ project_name }}"
3
+  import_role:
4
+    role: haproxy-config
5
+  vars:
6
+    project_services: "{{ cyborg_services }}"
7
+  tags: always

+ 2
- 0
ansible/roles/cyborg/tasks/main.yml View File

@@ -0,0 +1,2 @@
1
+---
2
+- include_tasks: "{{ kolla_action }}.yml"

+ 17
- 0
ansible/roles/cyborg/tasks/precheck.yml View File

@@ -0,0 +1,17 @@
1
+---
2
+- name: Get container facts
3
+  kolla_container_facts:
4
+    name:
5
+      - cyborg_api
6
+  register: container_facts
7
+
8
+- name: Checking free port for cyborg API
9
+  wait_for:
10
+    host: "{{ api_interface_address }}"
11
+    port: "{{ cyborg_api_port }}"
12
+    connect_timeout: 1
13
+    timeout: 1
14
+    state: stopped
15
+  when:
16
+    - container_facts['cyborg_api'] is not defined
17
+    - inventory_hostname in groups['cyborg-api']

+ 11
- 0
ansible/roles/cyborg/tasks/pull.yml View File

@@ -0,0 +1,11 @@
1
+---
2
+- name: Pulling cyborg images
3
+  become: true
4
+  kolla_docker:
5
+    action: "pull_image"
6
+    common_options: "{{ docker_common_options }}"
7
+    image: "{{ item.value.image }}"
8
+  when:
9
+    - inventory_hostname in groups[item.value.group]
10
+    - item.value.enabled | bool
11
+  with_dict: "{{ cyborg_services }}"

+ 2
- 0
ansible/roles/cyborg/tasks/reconfigure.yml View File

@@ -0,0 +1,2 @@
1
+---
2
+- include_tasks: deploy.yml

+ 32
- 0
ansible/roles/cyborg/tasks/register.yml View File

@@ -0,0 +1,32 @@
1
+---
2
+- name: Creating the cyborg service and endpoint
3
+  kolla_toolbox:
4
+    module_name: "kolla_keystone_service"
5
+    module_args:
6
+      service_name: "cyborg"
7
+      service_type: "cyborg"
8
+      description: "OpenStack Cyborg Service"
9
+      endpoint_region: "{{ openstack_region_name }}"
10
+      url: "{{ item.url }}"
11
+      interface: "{{ item.interface }}"
12
+      region_name: "{{ openstack_region_name }}"
13
+      auth: "{{ openstack_cyborg_auth }}"
14
+      endpoint_type: "{{ openstack_interface }}"
15
+  run_once: True
16
+  with_items:
17
+    - {'interface': 'admin', 'url': '{{ cyborg_admin_endpoint }}'}
18
+    - {'interface': 'internal', 'url': '{{ cyborg_internal_endpoint }}'}
19
+    - {'interface': 'public', 'url': '{{ cyborg_public_endpoint }}'}
20
+
21
+- name: Creating the cyborg project, user, and role
22
+  kolla_toolbox:
23
+    module_name: "kolla_keystone_user"
24
+    module_args:
25
+      project: "service"
26
+      user: "{{ cyborg_keystone_user }}"
27
+      password: "{{ cyborg_keystone_password }}"
28
+      role: "admin"
29
+      region_name: "{{ openstack_region_name }}"
30
+      auth: "{{ openstack_cyborg_auth }}"
31
+      endpoint_type: "{{ openstack_interface }}"
32
+  run_once: True

+ 6
- 0
ansible/roles/cyborg/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ cyborg_services }}"
6
+    service_name: "{{ project_name }}"

+ 7
- 0
ansible/roles/cyborg/tasks/upgrade.yml View File

@@ -0,0 +1,7 @@
1
+---
2
+- include_tasks: config.yml
3
+
4
+- include_tasks: bootstrap_service.yml
5
+
6
+- name: Flush handlers
7
+  meta: flush_handlers

+ 24
- 0
ansible/roles/cyborg/templates/cyborg-agent.json.j2 View File

@@ -0,0 +1,24 @@
1
+{
2
+    "command": "cyborg-agent --config-file /etc/cyborg/cyborg.conf",
3
+    "config_files": [
4
+        {
5
+            "source": "{{ container_config_directory }}/cyborg.conf",
6
+            "dest": "/etc/cyborg/cyborg.conf",
7
+            "owner": "cyborg",
8
+            "perm": "0600"
9
+        }{% if cyborg_policy_file is defined %},
10
+        {
11
+            "source": "{{ container_config_directory }}/{{ cyborg_policy_file }}",
12
+            "dest": "/etc/cyborg/{{ cyborg_policy_file }}",
13
+            "owner": "cyborg",
14
+            "perm": "0600"
15
+        }{% endif %}
16
+    ],
17
+    "permissions": [
18
+        {
19
+            "path": "/var/log/kolla/cyborg",
20
+            "owner": "cyborg:cyborg",
21
+            "recurse": true
22
+        }
23
+    ]
24
+}

+ 19
- 0
ansible/roles/cyborg/templates/cyborg-api-paste.ini.j2 View File

@@ -0,0 +1,19 @@
1
+[pipeline:main]
2
+pipeline = cors request_id authtoken api_v1
3
+
4
+[app:api_v1]
5
+paste.app_factory = cyborg.api.app:app_factory
6
+
7
+[filter:authtoken]
8
+acl_public_routes = /, /v1
9
+paste.filter_factory = cyborg.api.middleware.auth_token:AuthTokenMiddleware.factory
10
+
11
+[filter:osprofiler]
12
+paste.filter_factory = cyborg.common.profiler:WsgiMiddleware.factory
13
+
14
+[filter:request_id]
15
+paste.filter_factory = oslo_middleware:RequestId.factory
16
+
17
+[filter:cors]
18
+paste.filter_factory =  oslo_middleware.cors:filter_factory
19
+oslo_config_project = cyborg

+ 30
- 0
ansible/roles/cyborg/templates/cyborg-api.json.j2 View File

@@ -0,0 +1,30 @@
1
+{
2
+    "command": "cyborg-api --config-file /etc/cyborg/cyborg.conf",
3
+    "config_files": [
4
+        {
5
+            "source": "{{ container_config_directory }}/cyborg.conf",
6
+            "dest": "/etc/cyborg/cyborg.conf",
7
+            "owner": "cyborg",
8
+            "perm": "0600"
9
+        },
10
+        {
11
+            "source": "{{ container_config_directory }}/api-paste.ini",
12
+            "dest": "/etc/cyborg/api-paste.ini",
13
+            "owner": "cyborg",
14
+            "perm": "0600"
15
+        }{% if cyborg_policy_file is defined %},
16
+        {
17
+            "source": "{{ container_config_directory }}/{{ cyborg_policy_file }}",
18
+            "dest": "/etc/cyborg/{{ cyborg_policy_file }}",
19
+            "owner": "cyborg",
20
+            "perm": "0600"
21
+        }{% endif %}
22
+    ],
23
+    "permissions": [
24
+        {
25
+            "path": "/var/log/kolla/cyborg",
26
+            "owner": "cyborg:cyborg",
27
+            "recurse": true
28
+        }
29
+    ]
30
+}

+ 24
- 0
ansible/roles/cyborg/templates/cyborg-conductor.json.j2 View File

@@ -0,0 +1,24 @@
1
+{
2
+    "command": "cyborg-conductor --config-file /etc/cyborg/cyborg.conf",
3
+    "config_files": [
4
+        {
5
+            "source": "{{ container_config_directory }}/cyborg.conf",
6
+            "dest": "/etc/cyborg/cyborg.conf",
7
+            "owner": "cyborg",
8
+            "perm": "0600"
9
+        }{% if cyborg_policy_file is defined %},
10
+        {
11
+            "source": "{{ container_config_directory }}/{{ cyborg_policy_file }}",
12
+            "dest": "/etc/cyborg/{{ cyborg_policy_file }}",
13
+            "owner": "cyborg",
14
+            "perm": "0600"
15
+        }{% endif %}
16
+    ],
17
+    "permissions": [
18
+        {
19
+            "path": "/var/log/kolla/cyborg",
20
+            "owner": "cyborg:cyborg",
21
+            "recurse": true
22
+        }
23
+    ]
24
+}

+ 45
- 0
ansible/roles/cyborg/templates/cyborg.conf.j2 View File

@@ -0,0 +1,45 @@
1
+[DEFAULT]
2
+auth_strategy = keystone
3
+log_dir = /var/log/kolla/cyborg
4
+debug = {{ cyborg_logging_debug }}
5
+notification_topics = notifications
6
+
7
+transport_url = {{ rpc_transport_url }}
8
+
9
+[api]
10
+port = {{ cyborg_api_port }}
11
+host = {{ api_interface_address }}
12
+
13
+[database]
14
+connection = mysql+pymysql://{{ cyborg_database_user }}:{{ cyborg_database_password }}@{{ cyborg_database_address }}/{{ cyborg_database_name }}
15
+
16
+[keystone_authtoken]
17
+memcache_security_strategy = ENCRYPT
18
+memcache_secret_key = {{ memcache_secret_key }}
19
+memcache_servers = {% for host in groups['memcached'] %}{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ memcached_port }}{% if not loop.last %},{% endif %}{% endfor %}
20
+auth_uri = {{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ keystone_public_port }}
21
+project_domain_name = {{ default_project_domain_name }}
22
+project_name = service
23
+user_domain_name = {{ default_user_domain_name }}
24
+username = {{ cyborg_keystone_user }}
25
+password = {{ cyborg_keystone_password }}
26
+auth_url = {{ admin_protocol }}://{{ kolla_internal_fqdn }}:{{ keystone_admin_port }}
27
+auth_type = password
28
+
29
+{% if cyborg_policy_file is defined %}
30
+[oslo_policy]
31
+policy_file = {{ cyborg_policy_file }}
32
+{% endif %}
33
+
34
+[service_credentials]
35
+auth_url = {{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ keystone_public_port }}/v3
36
+region_name = {{ openstack_region_name }}
37
+password = {{ cyborg_keystone_password }}
38
+username = {{ cyborg_keystone_user }}
39
+project_name = service
40
+project_domain_id = {{ default_project_domain_id }}
41
+user_domain_id = {{ default_user_domain_id }}
42
+auth_type = password
43
+
44
+[oslo_messaging_notifications]
45
+transport_url = {{ notify_transport_url }}

+ 12
- 0
ansible/roles/haproxy/tasks/precheck.yml View File

@@ -256,6 +256,18 @@
256 256
     - haproxy_stat.find('congress_api') == -1
257 257
     - "host_running_haproxy == 'None'"
258 258
 
259
+- name: Checking free port for Cyborg API HAProxy
260
+  wait_for:
261
+    host: "{{ kolla_internal_vip_address }}"
262
+    port: "{{ cyborg_api_port }}"
263
+    connect_timeout: 1
264
+    timeout: 1
265
+    state: stopped
266
+  when:
267
+    - enable_cyborg | bool
268
+    - inventory_hostname in groups['haproxy']
269
+    - haproxy_stat.find('cyborg_api') == -1
270
+
259 271
 - name: Checking free port for Designate API HAProxy
260 272
   wait_for:
261 273
     host: "{{ kolla_internal_vip_address }}"

+ 17
- 0
ansible/site.yml View File

@@ -30,6 +30,7 @@
30 30
         - enable_cloudkitty_{{ enable_cloudkitty | bool }}
31 31
         - enable_collectd_{{ enable_collectd | bool }}
32 32
         - enable_congress_{{ enable_congress | bool }}
33
+        - enable_cyborg_{{ enable_cyborg | bool }}
33 34
         - enable_designate_{{ enable_designate | bool }}
34 35
         - enable_elasticsearch_{{ enable_elasticsearch | bool }}
35 36
         - enable_etcd_{{ enable_etcd | bool }}
@@ -157,6 +158,11 @@
157 158
             tasks_from: loadbalancer
158 159
           tags: congress
159 160
           when: enable_congress | bool
161
+        - include_role:
162
+            role: cyborg
163
+            tasks_from: loadbalancer
164
+          tags: cyborg
165
+          when: enable_cyborg | bool
160 166
         - include_role:
161 167
             role: designate
162 168
             tasks_from: loadbalancer
@@ -998,6 +1004,17 @@
998 1004
         tags: congress,
999 1005
         when: enable_congress | bool }
1000 1006
 
1007
+- name: Apply role cyborg
1008
+  gather_facts: false
1009
+  hosts:
1010
+    - cyborg
1011
+    - '&enable_cyborg_True'
1012
+  serial: '{{ serial|default("0") }}'
1013
+  roles:
1014
+    - { role: cyborg,
1015
+        tags: cyborg,
1016
+        when: enable_cyborg | bool }
1017
+
1001 1018
 - name: Apply role tempest
1002 1019
   gather_facts: false
1003 1020
   hosts:

+ 1
- 0
etc/kolla/globals.yml View File

@@ -210,6 +210,7 @@ kolla_internal_vip_address: "10.10.10.254"
210 210
 #enable_cloudkitty: "no"
211 211
 #enable_collectd: "no"
212 212
 #enable_congress: "no"
213
+#enable_cyborg: "no"
213 214
 #enable_designate: "no"
214 215
 #enable_destroy_images: "no"
215 216
 #enable_elasticsearch: "{{ 'yes' if enable_central_logging | bool or enable_freezer | bool or enable_osprofiler | bool or enable_skydive | bool or enable_monasca | bool else 'no' }}"

+ 3
- 0
etc/kolla/passwords.yml View File

@@ -102,6 +102,9 @@ cinder_keystone_password:
102 102
 cloudkitty_database_password:
103 103
 cloudkitty_keystone_password:
104 104
 
105
+cyborg_database_password:
106
+cyborg_keystone_password:
107
+
105 108
 panko_database_password:
106 109
 panko_keystone_password:
107 110
 

+ 3
- 0
releasenotes/notes/add-cyborg-c7ee957a2cbe8e99.yaml View File

@@ -0,0 +1,3 @@
1
+---
2
+features:
3
+  - Add cyborg ansible role

+ 15
- 0
tests/templates/inventory.j2 View File

@@ -183,6 +183,10 @@ control
183 183
 [aodh:children]
184 184
 control
185 185
 
186
+[cyborg:children]
187
+control
188
+compute
189
+
186 190
 [congress:children]
187 191
 control
188 192
 
@@ -492,6 +496,17 @@ aodh
492 496
 [aodh-notifier:children]
493 497
 aodh
494 498
 
499
+# Cyborg
500
+[cyborg-api:children]
501
+cyborg
502
+
503
+[cyborg-agent:children]
504
+cyborg
505
+
506
+[cyborg-conductor:children]
507
+cyborg
508
+
509
+
495 510
 # Panko
496 511
 [panko-api:children]
497 512
 panko

Loading…
Cancel
Save