From 0a975ae4af4eb8c5299bc7239d9be9010bdaeef9 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Tue, 7 Aug 2018 19:51:09 -0500 Subject: [PATCH] roles/postfix: Vary shlib directory by arch The value of the `shlib_directory` is dependent the system architecture. Specifically, x86_64 machines use `/usr/lib64/postfix`, while everything else uses `/usr/lib/postfix`. This role was originally deployed on a Raspberry Pi, so the original path was correct. Attempting to deploy it on an x86_64 machine revealed the error. This commit adds a new task that loads a variables file based on the architecture. Each option defines an `arch_libdir` variable, which can be expanded in the `postfix_shlib_directory` variable as needed. --- roles/postfix/tasks/main.yml | 5 +++++ roles/postfix/vars/default-architecture.yml | 1 + roles/postfix/vars/defaults.yml | 2 +- roles/postfix/vars/x86_64.yml | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 roles/postfix/vars/default-architecture.yml create mode 100644 roles/postfix/vars/x86_64.yml diff --git a/roles/postfix/tasks/main.yml b/roles/postfix/tasks/main.yml index b00f916..096beb9 100644 --- a/roles/postfix/tasks/main.yml +++ b/roles/postfix/tasks/main.yml @@ -1,3 +1,8 @@ +- name: load architecture-specific values + include_vars: '{{ item }}' + with_first_found: + - '{{ ansible_architecture }}.yml' + - default-architecture.yml - name: load distribution-specifc values include_vars: '{{ item }}' with_first_found: diff --git a/roles/postfix/vars/default-architecture.yml b/roles/postfix/vars/default-architecture.yml new file mode 100644 index 0000000..d2596cd --- /dev/null +++ b/roles/postfix/vars/default-architecture.yml @@ -0,0 +1 @@ +arch_libdir: lib diff --git a/roles/postfix/vars/defaults.yml b/roles/postfix/vars/defaults.yml index d4b08ee..7a18cdd 100644 --- a/roles/postfix/vars/defaults.yml +++ b/roles/postfix/vars/defaults.yml @@ -5,4 +5,4 @@ postfix_compatibility_level: 2 postfix_sample_directory: /usr/share/doc/postfix/samples postfix_readme_directory: /usr/share/doc/postfix/README_FILES postfix_meta_directory: /etc/postfix -postfix_shlib_directory: /usr/lib/postfix +postfix_shlib_directory: /usr/{{ arch_libdir }}/postfix diff --git a/roles/postfix/vars/x86_64.yml b/roles/postfix/vars/x86_64.yml new file mode 100644 index 0000000..0488991 --- /dev/null +++ b/roles/postfix/vars/x86_64.yml @@ -0,0 +1 @@ +arch_libdir: lib64