Skip to content

Commit

Permalink
Merge pull request #65 from noonedeadpunk/master
Browse files Browse the repository at this point in the history
Added ability to specify daemon launch arguments.
  • Loading branch information
evrardjp authored Oct 16, 2018
2 parents 64764d2 + 50b4e9e commit b15d360
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 1 deletion.
12 changes: 12 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,15 @@ keepalived_bind_on_non_local: False
# Example:
#keepalived_global_defs:
# - enable_script_security

# Set location of keepalived daemon options file path
# For Debian based systems it's usually /etc/default/keepalived
# For RedHat based systems it's usually /etc/sysconfig/keepalived
keepalived_daemon_options_file_path: "{{ _keepalived_daemon_options_file_path }}"

# Overriding keepalived daemon extra arguments, which will be applied inside of
# the keepalived_daemon_options_file_path variable.
# Example:
#keepalived_daemon_default_options_overrides:
# - "DAEMON_ARGS='--snmp'"
keepalived_daemon_default_options_overrides: []
22 changes: 21 additions & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
tags:
- keepalived-install

- name: configure keepalived
- name: Configure keepalived
template:
src: keepalived.conf.j2
dest: "{{ keepalived_config_file_path }}"
Expand All @@ -54,6 +54,26 @@
notify:
- restart keepalived

- name: Check that daemon options file exists
stat:
path: "{{ keepalived_daemon_options_file_path }}"
register: keepalived_daemon_options_file
tags:
- keepalived-config

- name: Configure keepalived extra params
lineinfile:
line: "{{ item }}"
regexp: "^{{ item.split('=')[0] }}"
dest: "{{ keepalived_daemon_options_file_path }}"
state: present
with_items: "{{ keepalived_daemon_default_options_overrides }}"
when: keepalived_daemon_options_file.stat.exists
tags:
- keepalived-config
notify:
- restart keepalived

- name: Dropping the tracking scripts
copy:
src: "{{ item.value.src_check_script }}"
Expand Down
1 change: 1 addition & 0 deletions vars/debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
keepalived_package_name: "keepalived"
keepalived_service_name: "keepalived"
keepalived_config_file_path: "/etc/keepalived/keepalived.conf"
_keepalived_daemon_options_file_path: "/etc/default/keepalived"
# Debian is WIP, and only native packages from the distribution are supported for now.
keepalived_ubuntu_src: "native" #no support of ppas under debian -> forced source to be native

Expand Down
1 change: 1 addition & 0 deletions vars/redhat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@
keepalived_package_name: "keepalived"
keepalived_service_name: "keepalived"
keepalived_config_file_path: "/etc/keepalived/keepalived.conf"
_keepalived_daemon_options_file_path: "/etc/sysconfig/keepalived"
1 change: 1 addition & 0 deletions vars/suse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@
keepalived_package_name: "keepalived"
keepalived_service_name: "keepalived"
keepalived_config_file_path: "/etc/keepalived/keepalived.conf"
_keepalived_daemon_options_file_path: "/etc/sysconfig/keepalived"
5 changes: 5 additions & 0 deletions vars/ubuntu-14.04.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ keepalived_package_name: "keepalived"
keepalived_service_name: "keepalived"
keepalived_config_file_path: "/etc/keepalived/keepalived.conf"

# As ppa has more fresh version of keepalived package,
# daemon file path and structure as for redhat systems.
# Ubuntu native package uses different location.
_keepalived_daemon_options_file_path: "/etc/sysconfig/keepalived"

## Repo details for keepalived ppa
keepalived_ppa_repo: "ppa:keepalived/stable"
keepalived_ppa_keyid: "7C33BDC6"
Expand Down
6 changes: 6 additions & 0 deletions vars/ubuntu-16.04.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ keepalived_package_name: "keepalived"
keepalived_service_name: "keepalived.service"
keepalived_config_file_path: "/etc/keepalived/keepalived.conf"

# As native repo has more fresh version of keepalived package,
# daemon file path is the default one.
# PPA package uses different location and file structure,
# like redhat.
_keepalived_daemon_options_file_path: "/etc/default/keepalived"

## Repo details for keepalived ppa
keepalived_ppa_repo: "ppa:keepalived/stable"
keepalived_ppa_keyid: "7C33BDC6"
Expand Down

0 comments on commit b15d360

Please sign in to comment.