--- /dev/null
+---
+
+- ansible.builtin.include_tasks:
+ file: install.yml
+
+# The core pattern is used by the CI containers
+- when: ansible_virtualization_role == "host" or (ansible_virtualization_role == "guest" and ansible_virtualization_type == "kvm")
+ block:
+ - name: 'Set core pattern for reboot'
+ ansible.builtin.copy:
+ dest: '/etc/sysctl.d/10-core_pattern.conf'
+ owner: 'root'
+ group: 'root'
+ mode: '0644'
+ content: "kernel.core_pattern /tmp/core.%p\n"
+ - name: 'Check current core pattern'
+ ansible.builtin.command:
+ argv: ['cat', '/proc/sys/kernel/core_pattern']
+ register: current_core_pattern
+ - name: 'Update current core pattern'
+ when: current_core_pattern.stdout|trim != "'{{incus_core_pattern}}'"
+ ansible.builtin.command:
+ argv: ['sysctl', '-w', "kernel.core_pattern='{{incus_core_pattern}}'"]
+
+- name: Check for images volume configuration
+ ansible.builtin.command:
+ argv: ['incus', 'config', "--target={{lxd_cluster['server_name']|default(ansible_hostname)}}", 'get', 'storage.images_volume']
+ register: images_volume_conf
+- name: Configure images volume
+ when: images_volume_conf.stdout|trim != "default/storage-images"
+ block:
+ - name: Create volume
+ ansible.builtin.command:
+ argv: ['incus', 'storage', 'volume', 'create', '--target', "{{lxd_cluster['server_name']|default(ansible_hostname)}}", 'default', 'storage-images']
+ - ansible.builtin.command:
+ argv: ['incus', 'config', 'set', '--target', "{{lxd_cluster['server_name']|default(ansible_hostname)}}", 'storage.images_volume', 'default/storage-images']
+
+- name: Check for backups volume configuration
+ ansible.builtin.command:
+ argv: ['incus', 'config', "--target={{lxd_cluster['server_name']|default(ansible_hostname)}}", 'get', 'storage.backups_volume']
+ register: backups_volume_conf
+- name: Configure backups volume
+ when: backups_volume_conf.stdout|trim != "default/storage-backups"
+ block:
+ - name: Create volume
+ ansible.builtin.command:
+ argv: ['incus', 'storage', 'volume', 'create', '--target', "{{lxd_cluster['server_name']|default(ansible_hostname)}}", 'default', 'storage-backups']
+ - ansible.builtin.command:
+ argv: ['incus', 'config', 'set', '--target', "{{lxd_cluster['server_name']|default(ansible_hostname)}}", 'storage.backups_volume', 'default/storage-backups']