Ian Wienand 7f2e6f3325
roles/openafs-client: small overhaul of rpm builds
The main failure case for the openafs packages is when the images are
running an old kernel and upstream has moved on, and we only have
headers available for new kernels.  This usually indicates image
building is stuck.  This adds an inline check to make sure the running
kernel has headers available; if not it bails out with a clear
message.

When this does fail to build, we'd like to get some output of why the
service fails.  This adds an error handler to systemctl dump the
status on failure.

We can cleanup the build a bit to remove the centos7 builds now.

Finally, the log copying was broken -- the paths are different on
centos 8 and 9.  The extant "cp" would fail on centos8 and then the
chown would never run, so we wouldn't collect the build logs.  Make
this a find/cp pair too.

Change-Id: Iaa38357a8a683a474c38900f5dc322e088849416
2024-01-18 19:32:30 +11:00

105 lines
2.4 KiB
YAML

- name: Setup OS specific variable include
include_vars: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- "{{ ansible_distribution }}.{{ ansible_distribution_major_version }}.yaml"
- "{{ ansible_distribution }}.yaml"
- "{{ ansible_os_family }}.yaml"
paths:
- vars
- name: Increase udp buffer sizes
copy:
src: 99-afs-udp.conf
dest: /etc/sysctl.d/99-afs-udp.conf
owner: root
group: root
mode: '0644'
become: yes
- name: Check config path defined
fail:
msg: "openafs_client_config_path not defined"
when: not openafs_client_config_path
- name: Create configuration directory
file:
path: '{{ openafs_client_config_path }}'
state: directory
become: yes
- name: Install client base config files
template:
dest: '{{ openafs_client_config_path }}/{{ item }}'
owner: root
group: root
mode: 0644
src: '{{ item }}'
loop:
- afs.conf.client
- CellServDB
become: yes
- name: Install client templated config files
template:
dest: '{{ openafs_client_config_path }}/{{ item }}'
owner: root
group: root
mode: 0644
src: '{{ item }}.j2'
loop:
- cacheinfo
- ThisCell
become: yes
- name: Ensure cache location directory
file:
path: '{{ openafs_client_cache_directory }}'
state: directory
owner: root
group: root
mode: 0700
become: yes
- name: Set timeout override
become: yes
block:
- name: Create service override directory
file:
path: '/etc/systemd/system/openafs-client.service.d'
state: directory
owner: root
group: root
mode: 0755
- name: Save override
template:
dest: '/etc/systemd/system/openafs-client.service.d/timeout.conf'
src: 'timeout.conf.j2'
group: root
mode: 0644
- name: Setup OS specific openafs-client environment
include_tasks: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- "{{ ansible_distribution }}.yaml"
- "{{ ansible_os_family }}.yaml"
- "default.yaml"
paths:
- openafs-client
- name: Ensure openafs-client service running
block:
- name: Start service
service:
name: openafs-client
state: started
enabled: yes
become: yes
rescue:
- name: Dump service status
command: systemctl status openafs-client.service
become: yes