deploy_keepalived/tasks/configure.yml
Bertrand Lanson 9bd6da5a67
All checks were successful
test / Linting (push) Successful in 12s
test / Molecule tests (default, debian11) (push) Successful in 3m8s
test / Molecule tests (default, debian12) (push) Successful in 3m23s
test / Molecule tests (default, ubuntu2204) (push) Successful in 3m36s
test / Molecule tests (with_custom_conf, debian12) (push) Successful in 3m41s
test / Molecule tests (default, ubuntu2004) (push) Successful in 3m45s
test / Molecule tests (with_custom_conf, debian11) (push) Successful in 3m46s
test / Molecule tests (with_custom_conf, ubuntu2004) (push) Successful in 4m2s
test / Molecule tests (with_custom_conf, ubuntu2204) (push) Successful in 2m47s
feat(config): add custom template option
2024-03-11 19:29:02 +01:00

45 lines
1.5 KiB
YAML

---
# task/configure file for deploy_keepalived
- name: "Configure for host installation"
when: deploy_keepalived_deploy_method == 'host'
block:
- name: "Create keepalived environment file"
ansible.builtin.template:
src: keepalived.env.j2
dest: "{{ deploy_keepalived_config_dir }}/keepalived.env"
owner: "{{ deploy_keepalived_user }}"
group: "{{ deploy_keepalived_group }}"
mode: "0600"
- name: "Copy keepalived.conf template"
ansible.builtin.template:
src: "{{ deploy_keepalived_custom_config_src if deploy_keepalived_use_custom_config else 'keepalived.conf.j2' }}"
dest: "{{ deploy_keepalived_config_dir }}/keepalived.conf"
owner: "{{ deploy_keepalived_user }}"
group: "{{ deploy_keepalived_group }}"
mode: "0600"
notify:
- "systemctl-enable-keepalived"
- "systemctl-restart-keepalived"
- name: "Copy default notify script"
ansible.builtin.template:
src: "{{ item }}"
dest: "{{ deploy_keepalived_scripts_dir }}/{{ (item | basename) }}"
owner: "{{ deploy_keepalived_script_user }}"
group: "{{ deploy_keepalived_script_user }}"
mode: "0700"
with_fileglob:
- "files/*"
- name: "Copy custom scripts"
ansible.builtin.template:
src: "{{ item }}"
dest: "{{ deploy_keepalived_scripts_dir }}/{{ (item | basename) }}"
owner: "{{ deploy_keepalived_script_user }}"
group: "{{ deploy_keepalived_script_user }}"
mode: "0700"
with_fileglob:
- "{{ deploy_keepalived_custom_scripts_src }}/*"
when: deploy_keepalived_custom_scripts_src