--- - name: Set OS dependent variables include_vars: "{{ lookup('first_found', params) }}" vars: params: files: - "{{ ansible_distribution | lower }}_{{ ansible_distribution_version | lower }}.yml" - "{{ ansible_distribution | lower }}_{{ ansible_distribution_major_version | lower }}.yml" - "{{ ansible_distribution | lower }}.yml" - "{{ ansible_os_family | lower }}.yml" - "{{ ansible_system | lower }}.yml" paths: - "{{ role_path }}/vars" ignore_errors: True tags: - always - name: OS is supported assert: that: __os_supported quiet: True vars: __os_supported: "{{ lookup('vars', '{}_os_supported'.format(role_name)) | bool }}" tags: - always - name: Install required packages package: name: "{{ item }}" state: present with_items: "{{ lookup('vars', '{}_packages'.format(role_name)) | list }}" tags: - install - name: Install keepalived configuration template: src: keepalived.conf.j2 dest: "/etc/keepalived/keepalived.conf" owner: root group: root mode: 0644 tags: - configure no_log: false notify: Restart keepalived - name: Enable keepalived service ansible.builtin.systemd_service: name: keepalived.service state: "{{ 'started' if keepalived_enabled else 'stopped' }}" enabled: "{{ keepalived_enabled }}" when: not ansible_check_mode