Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support bootc #830

Draft
wants to merge 11 commits into
base: bootc
Choose a base branch
from
3 changes: 3 additions & 0 deletions playbooks/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
name: osp.edpm.edpm_kernel
tags:
- edpm_kernel
when: not ansible_local.bootc
- name: Import edpm_tuned
ansible.builtin.import_role:
name: osp.edpm.edpm_tuned
Expand All @@ -53,9 +54,11 @@
tasks_from: kernelargs.yml
tags:
- edpm_kernel
when: not ansible_local.bootc
- name: Configure KSM for kernel
ansible.builtin.import_role:
name: osp.edpm.edpm_kernel
tasks_from: ksm.yml
tags:
- edpm_kernel
when: not ansible_local.bootc
4 changes: 2 additions & 2 deletions roles/edpm_bootstrap/tasks/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@

- name: Include packages tasks
ansible.builtin.include_tasks: packages.yml
when: not bootc
when: not ansible_local.bootc

- name: Import common post packages tasks
ansible.builtin.import_tasks: bootstrap-common-post-packages.yml

- name: Include swap tasks
ansible.builtin.include_tasks: swap.yml
when: not bootc
when: not ansible_local.bootc

- name: Import FIPS tasks
ansible.builtin.import_tasks: fips.yml
Expand Down
2 changes: 1 addition & 1 deletion roles/edpm_bootstrap/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

- name: Include download_cache tasks
ansible.builtin.include_tasks: download_cache.yml
when: not bootc
when: not ansible_local.bootc

- name: Import bootstrap tasks
ansible.builtin.import_tasks: bootstrap.yml
24 changes: 16 additions & 8 deletions roles/edpm_container_manage/tasks/shutdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,25 @@
loop:
- 'edpm-container-shutdown'
- 'edpm-start-podman-container'
- name: "Create /usr/lib/systemd/system/edpm-container-shutdown.service"
when: not edpm_use_bootc

- name: "Create systemd preset dir"
ansible.builtin.file:
state: "directory"
path: "/etc/systemd/system-preset"
mode: 0644

- name: "Create /etc/systemd/system/edpm-container-shutdown.service"
ansible.builtin.copy:
src: "{{ role_path }}/files/edpm-container-shutdown-service"
dest: "/usr/lib/systemd/system/edpm-container-shutdown.service"
dest: "/etc/systemd/system/edpm-container-shutdown.service"
mode: '0644'
owner: root
group: root
- name: "Create /usr/lib/systemd/system-preset/91-edpm-container-shutdown.preset"
- name: "Create /etc/systemd/system-preset/91-edpm-container-shutdown.preset"
ansible.builtin.copy:
src: "{{ role_path }}/files/91-edpm-container-shutdown-preset"
dest: "/usr/lib/systemd/system-preset/91-edpm-container-shutdown.preset"
dest: "/etc/systemd/system-preset/91-edpm-container-shutdown.preset"
mode: '0644'
owner: root
group: root
Expand All @@ -47,17 +55,17 @@
state: started
enabled: true
daemon_reload: true
- name: "Create /usr/lib/systemd/system/netns-placeholder.service"
- name: "Create /etc/systemd/system/netns-placeholder.service"
ansible.builtin.copy:
src: "{{ role_path }}/files/netns-placeholder-service"
dest: "/usr/lib/systemd/system/netns-placeholder.service"
dest: "/etc/systemd/system/netns-placeholder.service"
mode: '0644'
owner: root
group: root
- name: "Create /usr/lib/systemd/system-preset/91-netns-placeholder.preset"
- name: "Create /etc/systemd/system-preset/91-netns-placeholder.preset"
ansible.builtin.copy:
src: "{{ role_path }}/files/91-netns-placeholder-preset"
dest: "/usr/lib/systemd/system-preset/91-netns-placeholder.preset"
dest: "/etc/systemd/system-preset/91-netns-placeholder.preset"
mode: '0644'
owner: root
group: root
Expand Down
15 changes: 6 additions & 9 deletions roles/edpm_iscsid/tasks/run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,12 @@
file: healthchecks.yml

- name: Manage iscsid containers
ansible.builtin.include_role:
name: edpm_container_standalone
vars:
edpm_container_standalone_service: iscsid
edpm_container_standalone_container_defs:
iscsid: "{{ lookup('template', 'iscsid.yaml.j2') | from_yaml }}"
edpm_container_standalone_kolla_config_files:
iscsid: "{{ lookup('file', 'files/iscsid.yaml') | from_yaml }}"
ansible.builtin.systemd_service:
name: edpm-compute@iscsid
enabled: true
state: started
register: manage_iscsid_stat
become: true

- name: Check if the iscsid container restart is required
ansible.builtin.stat:
Expand All @@ -52,7 +49,7 @@
- not manage_iscsid_stat.changed|bool
- iscsi_restart_stat.stat.exists|bool
ansible.builtin.systemd:
name: edpm_iscsid
name: edpm-compute@iscsid
state: restarted

- name: Remove iscsid container restart sentinel file
Expand Down
4 changes: 3 additions & 1 deletion roles/edpm_kernel/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
name: "{{ edpm_kernel_extra_packages }}"
state: present
register: _install_packages_result
when: edpm_kernel_extra_packages | length > 0
when:
- edpm_kernel_extra_packages | length > 0
- not ansible_local.bootc
until: _install_packages_result is succeeded
retries: "{{ edpm_kernel_download_retries }}"
delay: "{{ edpm_kernel_download_delay }}"
Expand Down
1 change: 1 addition & 0 deletions roles/edpm_libvirt/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
delay: "{{ edpm_libvirt_download_delay }}"
notify:
- Restart libvirt
when: not ansible_local.bootc

- name: Ensure monolithic libvirt and tcp socket activation is not enabled or running
tags:
Expand Down
8 changes: 7 additions & 1 deletion roles/edpm_logrotate_crond/tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@
- name: Configure tmpwatch on the host
become: true
block:
- name: Create /var/lib/openstack/cron
ansible.builtin.file:
path: "/var/lib/openstack/cron"
mode: 0644
state: directory

- name: Push script
ansible.builtin.copy:
dest: /usr/local/sbin/containers-tmpwatch
dest: /var/lib/openstack/cron/containers-tmpwatch
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/usr is immutable with bootc deployments. So I've proposed doing this in two different ways. 1, we bake the scripts into the container file:
https://github.com/openstack-k8s-operators/install_yamls/pull/950/files#diff-f8fb9af5355b45b9ca8936bf0d721c6f0e37e13b637f5598e2be19995dea23e7R45-R46

And 2. Which is this method of writing to /var/lib/openstack. I personally prefer doing it this way if we can agree on a common place for any scripts that we want to use. That saves us baking things into images and then trying to keep them in sync. Better imo to have them in edpm-ansible for now.

owner: root
group: root
mode: "0755"
Expand Down
2 changes: 2 additions & 0 deletions roles/edpm_logrotate_crond/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
until: edpm_logrotate_crond_cronie_package_download is succeeded
retries: "{{ edpm_logrotate_crond_download_retries }}"
delay: "{{ edpm_logrotate_crond_download_delay }}"
when:
- not ansible_local.bootc

- name: Gather SELinux fact if needed
when:
Expand Down
13 changes: 5 additions & 8 deletions roles/edpm_multipathd/tasks/run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,12 @@
file: healthchecks.yml

- name: Manage multipathd containers
ansible.builtin.include_role:
name: edpm_container_standalone
vars:
edpm_container_standalone_service: multipathd
edpm_container_standalone_container_defs:
multipathd: "{{ lookup('template', 'multipathd.yaml.j2') | from_yaml }}"
edpm_container_standalone_kolla_config_files:
multipathd: "{{ lookup('template', 'kolla_multipathd.yaml.j2') | from_yaml }}"
ansible.builtin.systemd_service:
name: edpm-compute@multipathd
enabled: true
state: started
register: manage_multipathd_stat
become: true

- name: Check if the multipathd container restart is required
ansible.builtin.stat:
Expand Down
4 changes: 3 additions & 1 deletion roles/edpm_network_config/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
# under the License.

- name: Configure network with network role from system roles [nmstate]
when: edpm_network_config_tool == 'nmstate'
when:
- edpm_network_config_tool == 'nmstate'
- not ansible_local.bootc
become: true
block:
- name: Install OVS NetworkManager plugin [nmstate]
Expand Down
1 change: 1 addition & 0 deletions roles/edpm_network_config/tasks/network_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
until: edpm_network_config_onc_download is succeeded
retries: "{{ edpm_network_config_download_retries }}"
delay: "{{ edpm_network_config_download_delay }}"
when: not ansible_local.bootc

- name: Ensure /var/lib/edpm-config directory exists
become: true
Expand Down
13 changes: 5 additions & 8 deletions roles/edpm_neutron_metadata/tasks/run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,8 @@
file: healthchecks.yml

- name: Run ovn_metadata_agent container
ansible.builtin.include_role:
name: osp.edpm.edpm_container_standalone
vars:
edpm_container_standalone_service: ovn_metadata_agent
edpm_container_standalone_container_defs:
ovn_metadata_agent: "{{ lookup('template', 'ovn_metadata_agent.yaml.j2') | from_yaml }}"
edpm_container_standalone_kolla_config_files:
ovn_metadata_agent: "{{ lookup('template', 'kolla_ovn_metadata_agent.yaml.j2') | from_yaml }}"
ansible.builtin.systemd_service:
name: edpm-compute@ovn_metadata_agent
enabled: true
state: started
become: true
1 change: 1 addition & 0 deletions roles/edpm_nvmeof/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@
ansible.builtin.package:
name: nvme-cli
state: present
when: not ansible_local.bootc
14 changes: 6 additions & 8 deletions roles/edpm_ovn/tasks/run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,9 @@
file: healthchecks.yml

- name: Run ovn_controller container
ansible.builtin.include_role:
name: osp.edpm.edpm_container_standalone
vars:
edpm_container_standalone_service: ovn_controller
edpm_container_standalone_container_defs:
ovn_controller: "{{ lookup('template', 'ovn_controller.yaml.j2') | from_yaml }}"
edpm_container_standalone_kolla_config_files:
ovn_controller: "{{ lookup('template', 'kolla_ovn_controller.yaml.j2') | from_yaml }}"
Comment on lines -40 to -47
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of this needs to stay in order to support both deployment methodologies. It can just be conditional like:
https://github.com/openstack-k8s-operators/edpm-ansible/pull/830/files#diff-34e3323585e197e806d463771e3b5132716048c41818b1318fecb2c0d8e36cd6R45

ansible.builtin.systemd_service:
name: edpm-compute@ovn_controller
enabled: true
state: started
become: true

1 change: 1 addition & 0 deletions roles/edpm_ovs/tasks/download_cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
until: _install_packages_result is succeeded
retries: "{{ edpm_ovs_download_retries }}"
delay: "{{ edpm_ovs_download_delay }}"
when: not ansible_local.bootc
1 change: 1 addition & 0 deletions roles/edpm_ovs/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
until: edpm_ovs_package_install is succeeded
retries: "{{ edpm_ovs_download_retries }}"
delay: "{{ edpm_ovs_download_delay }}"
when: not ansible_local.bootc

- name: Ensure ovs services are enabled and running
tags:
Expand Down
1 change: 1 addition & 0 deletions roles/edpm_podman/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
until: edpm_podman_package_download is succeeded
retries: "{{ edpm_podman_download_retries }}"
delay: "{{ edpm_podman_download_delay }}"
when: not ansible_local.bootc

- name: Ensure we get the ansible interfaces facts
when:
Expand Down
1 change: 1 addition & 0 deletions roles/edpm_reboot/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
become: true
ansible.builtin.dnf:
name: yum-utils
when: not ansible_local.bootc

- name: Check if reboot is required with needs-restarting
ansible.builtin.command: needs-restarting -r
Expand Down
2 changes: 2 additions & 0 deletions roles/edpm_sshd/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
until: _sshd_install_result is succeeded
retries: "{{ edpm_sshd_download_retries }}"
delay: "{{ edpm_sshd_download_delay }}"
when:
- not ansible_local.bootc

# NOTE(mwhahaha): we need this here because in order to validate our generated
# config, we need to ensure the host keys exist
Expand Down
7 changes: 7 additions & 0 deletions roles/edpm_telemetry/tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,10 @@
mode: "0644"
owner: ceilometer
group: ceilometer

- name: Start ceilometer_agent_compute container - bootc
ansible.builtin.systemd_service:
name: edpm-compute@ceilometer_agent_compute
state: started
enabled: true
when: bootc
9 changes: 9 additions & 0 deletions roles/edpm_telemetry/tasks/exporter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,18 @@
edpm_container_manage_healthcheck_disabled: true
edpm_container_manage_config_patterns: "{{ exporter }}.json"
edpm_container_manage_clean_orphans: false
when: not ansible_local.bootc

- name: Restart exporter container
become: true
ansible.builtin.systemd:
state: restarted
name: "edpm_{{ exporter }}.service"
when: not ansible_local.bootc

- name: Deploy exporter container - bootc
ansible.builtin.systemd_service:
name: edpm-compute@node_exporter
state: started
enabled: true

1 change: 1 addition & 0 deletions roles/edpm_tuned/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

- name: Install packages
ansible.builtin.include_tasks: install.yml
when: not ansible_local.bootc

- name: Configure tuned
ansible.builtin.include_tasks: configure.yml
Expand Down
Loading