Skip to content

Commit 54f7101

Browse files
committed
Update pod spec during deployment
Signed-off-by: Brendan Shephard <[email protected]>
1 parent cde9667 commit 54f7101

File tree

1 file changed

+47
-4
lines changed

1 file changed

+47
-4
lines changed

roles/edpm_ovn/tasks/run.yml

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,52 @@
4343
ovn_controller: "{{ lookup('template', 'kolla_ovn_controller.yaml.j2') | from_yaml }}"
4444
when: not edpm_use_bootc
4545

46-
- name: Run ovn_controller container
47-
ansible.builtin.systemd_service:
48-
name: edpm-compute@ovn_controller
49-
state: started
46+
- name: Configure ovn_controller for bootc deployments
47+
block:
48+
- name: Collect default pod spec
49+
ansible.builtin.slurp:
50+
src: /usr/share/containers/systemd/ovn_controller.yaml
51+
register: ovn_controller_pod_spec
52+
53+
- name: Decode and parse the YAML content
54+
ansible.builtin.set_fact:
55+
ovn_controller_pod_spec: "{{ ovn_controller_pod_spec.content | b64decode | from_yaml }}"
56+
57+
- name: Update fields in the YAML data
58+
ansible.builtin.set_fact:
59+
updated_pod_spec: >-
60+
{{
61+
ovn_controller_pod_spec | combine({
62+
'spec': {
63+
'containers': ovn_controller_pod_spec.spec.containers | zip_longest([], [{'image': edpm_ovn_controller_agent_image}]) | map('combine') | list,
64+
},
65+
}, recursive=true)
66+
}}
67+
68+
- name: Write the updated pod spec to /etc
69+
ansible.builtin.copy:
70+
content: "{{ updated_pod_spec | to_yaml }}"
71+
dest: /etc/containers/systemd/ovn_controller.yaml
72+
mode: '0644'
73+
74+
- name: Copy systemd service template
75+
ansible.builtin.copy:
76+
remote_src: true
77+
src: /usr/share/containers/systemd/[email protected]
78+
dest: /etc/containers/systemd/[email protected]
79+
80+
- name: Update service template Yaml path
81+
ansible.builtin.ini_file:
82+
path: /etc/containers/systemd/[email protected]
83+
section: Kube
84+
option: "Yaml"
85+
value: "/etc/containers/systemd/%i.yaml"
86+
mode: "0644"
87+
88+
- name: Run ovn_controller container
89+
ansible.builtin.systemd_service:
90+
daemon_reload: true
91+
name: edpm-compute@ovn_controller
92+
state: started
5093
become: true
5194
when: edpm_use_bootc

0 commit comments

Comments
 (0)