deploy_keepalived/tasks/configure.yml

45 lines
1.6 KiB
YAML
Raw Normal View History

---
# 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.j2
dest: "/etc/default/keepalived"
owner: "{{ deploy_keepalived_user }}"
group: "{{ deploy_keepalived_group }}"
mode: "0644"
- name: "Copy keepalived.conf template"
ansible.builtin.template:
src: 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 if deploy_keepalived_deploy_method == 'host' else 'root' }}"
group: "{{ deploy_keepalived_script_user if deploy_keepalived_deploy_method == 'host' else 'root' }}"
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 if deploy_keepalived_deploy_method == 'host' else 'root' }}"
group: "{{ deploy_keepalived_script_user if deploy_keepalived_deploy_method == 'host' else 'root' }}"
mode: "0700"
with_fileglob:
- "{{ deploy_keepalived_custom_scripts_src }}/*"
when: deploy_keepalived_custom_scripts_src