-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add possibility to install keepalived from repo (#49)
* Add possibility to install keepalived from repo default install mode is from git * Fix https://github.com/Oefenweb/ansible-keepalived/pull/46/files#r753059604 * Fix https://github.com/Oefenweb/ansible-keepalived/pull/46/files#r753058074 * Add git specific tasks files * Improve Install from repo - Install before allow binding non-local IP (as need sysctl install by procps) - Install procps if need when keepalived_install_method == 'native' - notify restart keepalived when upgrade keepalive and keepalived_install_method == 'native' - moved 'install dependencies' to git.yml - add tags, apt_state (default is lastest), update_cache and cache_valid_time on Install from repo * Add possibility to install keepalived from repo * Improved documentation * Remove typo Co-authored-by: Christian Iuga <[email protected]>
- Loading branch information
1 parent
3bc10c2
commit 2438623
Showing
8 changed files
with
149 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
# tasks file | ||
--- | ||
- name: install | git | dependencies | ||
apt: | ||
name: "{{ keepalived_dependencies_git }}" | ||
state: "{{ apt_install_state | default('latest') }}" | ||
tags: | ||
- keepalived-install-git-dependencies | ||
|
||
- name: install | git | create (checkout) directory | ||
file: | ||
path: "{{ keepalived_checkout_path }}" | ||
state: directory | ||
owner: root | ||
group: root | ||
mode: 0755 | ||
tags: | ||
- keepalived-install-git-checkout | ||
- keepalived-install-git-checkout-directory | ||
|
||
- name: install | git | checkout repository | ||
git: | ||
repo: "{{ keepalived_git_repo }}" | ||
dest: "{{ keepalived_checkout_path }}" | ||
version: "{{ keepalived_version }}" | ||
force: true | ||
register: _git_checkout | ||
tags: | ||
- keepalived-install-git-checkout-repository | ||
|
||
- name: install | git | regenerate the build files | ||
shell: > | ||
aclocal && autoheader && automake --add-missing && autoreconf | ||
args: | ||
chdir: "{{ keepalived_checkout_path }}" | ||
when: | ||
- _git_checkout is changed | ||
- keepalived_version is version('v1.2.24', '>=') | ||
- keepalived_version is version('v2.1.0', '<') | ||
tags: | ||
- keepalived-install-git-build | ||
- keepalived-install-git-build-regenerate-build-files | ||
|
||
- name: install | git | regenerate the build files | ||
shell: > | ||
./build_setup | ||
args: | ||
chdir: "{{ keepalived_checkout_path }}" | ||
when: | ||
- _git_checkout is changed | ||
- keepalived_version is version('v2.1.0', '>=') | ||
tags: | ||
- keepalived-install-git-build | ||
- keepalived-install-git-build-regenerate-build-files | ||
|
||
- name: install | git | build | ||
shell: > | ||
./configure {{ keepalived_configure_options | join(' ') }} && make -j{{ ansible_processor_cores + 1 }} | ||
args: | ||
chdir: "{{ keepalived_checkout_path }}" | ||
when: _git_checkout is changed | ||
tags: | ||
- keepalived-install-git-build | ||
- keepalived-install-git-build-configure-make | ||
|
||
- name: install | git | remove (distro version) | ||
apt: | ||
name: keepalived | ||
state: absent | ||
purge: true | ||
tags: | ||
- keepalived-install-git-remove | ||
- keepalived-install-git-remove-distro | ||
|
||
- name: install | git | install | ||
shell: > | ||
make install | ||
args: | ||
chdir: "{{ keepalived_checkout_path }}" | ||
when: _git_checkout is changed | ||
notify: restart keepalived | ||
tags: | ||
- keepalived-install-git-install | ||
|
||
- name: install | git | add script user | ||
user: | ||
name: keepalived_script | ||
comment: 'keepalived script' | ||
home: /nonexistent | ||
shell: /bin/false | ||
system: yes | ||
when: keepalived_create_keepalived_script_user | bool | ||
tags: | ||
- keepalived-install-git-script | ||
- keepalived-install-git-script-user | ||
|
||
- name: install | git | cleanup build | ||
shell: > | ||
git reset --hard && git clean -d -x -f | ||
args: | ||
chdir: "{{ keepalived_checkout_path }}" | ||
when: _git_checkout is changed | ||
tags: | ||
- keepalived-install-git-cleanup | ||
- keepalived-install-git-cleanup-build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# tasks file | ||
--- | ||
- name: install | native | dependencies | ||
apt: | ||
name: "{{ keepalived_dependencies_native }}" | ||
state: "{{ apt_install_state | default('latest') }}" | ||
notify: restart keepalived | ||
tags: | ||
- keepalived-install-native-dependencies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,26 @@ | ||
# vars file | ||
--- | ||
keepalived_dependencies: | ||
keepalived_dependencies_git: | ||
- git | ||
- build-essential | ||
- automake | ||
- libtool | ||
- pkg-config | ||
- libssl-dev | ||
- procps | ||
keepalived_dependencies_native: | ||
- keepalived | ||
- procps | ||
|
||
keepalived_checkout_path: /var/lib/ansible/keepalived/checkouts/keepalived | ||
|
||
keepalived_configuration_file: /etc/keepalived/keepalived.conf | ||
|
||
keepalived_etc_systemd_file: /etc/systemd/system/keepalived.service | ||
keepalived_etc_init_file: /etc/init/keepalived.conf | ||
keepalived_install_prefix: >- | ||
{%- if keepalived_install_method == 'git' -%} | ||
/usr/local/sbin | ||
{%- else -%} | ||
/usr/sbin | ||
{%- endif -%} |