Skip to content

Commit

Permalink
Merge pull request #409 from stackhpc/magnum-config-templating
Browse files Browse the repository at this point in the history
rearrange magnum config.yml
  • Loading branch information
scrungus authored Aug 10, 2023
2 parents c934fe5 + 9db19c6 commit 0a56762
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 26 deletions.
52 changes: 26 additions & 26 deletions ansible/roles/magnum/tasks/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,32 @@
when:
- kolla_copy_ca_into_containers | bool

- name: Check if management cluster kubeconfig is provided
stat:
path: "{{ node_custom_config }}/magnum/kubeconfig"
register: kubeconfig
delegate_to: localhost

- name: Optionally configure magnum for cluster-api driver
set_fact:
magnum_cluster_api_driver_enabled: true
when: kubeconfig.stat.exists

- name: Copying over kubeconfig for management cluster
vars:
service: "{{ magnum_services['magnum-conductor'] }}"
copy:
src: "{{ node_custom_config }}/magnum/kubeconfig"
dest: "{{ node_config_directory }}/magnum-conductor/kubeconfig"
mode: "0660"
become: true
when:
- inventory_hostname in groups[service.group]
- service.enabled | bool
- magnum_cluster_api_driver_enabled is defined
notify:
- Restart magnum-conductor container

- name: Copying over config.json files for services
template:
src: "{{ item.key }}.json.j2"
Expand Down Expand Up @@ -67,32 +93,6 @@
with_dict: "{{ magnum_services }}"
notify:
- Restart {{ item.key }} container

- name: Check if management cluster kubeconfig is provided
stat:
path: "{{ node_custom_config }}/magnum/kubeconfig"
register: kubeconfig
delegate_to: localhost

- name: Optionally configure magnum for cluster-api driver
set_fact:
magnum_cluster_api_driver_enabled: true
when: kubeconfig.stat.exists

- name: Copying over kubeconfig for management cluster
vars:
service: "{{ magnum_services['magnum-conductor'] }}"
copy:
src: "{{ node_custom_config }}/magnum/kubeconfig"
dest: "{{ node_config_directory }}/magnum-conductor/kubeconfig"
mode: "0660"
become: true
when:
- inventory_hostname in groups[service.group]
- service.enabled | bool
- magnum_cluster_api_driver_enabled is defined
notify:
- Restart magnum-conductor container

- name: Copying over existing policy file
template:
Expand Down
4 changes: 4 additions & 0 deletions ansible/roles/magnum/templates/magnum.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ ca_file = {{ openstack_cacert }}

[nova_client]
region_name = {{ openstack_region_name }}
{% if magnum_cluster_api_driver_enabled is defined %}
endpoint_type = publicURL
{% else %}
endpoint_type = internalURL
{% endif %}
ca_file = {{ openstack_cacert }}

[keystone_auth]
Expand Down

0 comments on commit 0a56762

Please sign in to comment.