Skip to content

Commit 709f5aa

Browse files
authored
Merge pull request #157 from evrardjp/cleanup
Modernize role
2 parents c6b8b21 + 1a26157 commit 709f5aa

30 files changed

+424
-426
lines changed

.ansible-lint

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Rule 106 was added long after this role has been created.
2+
# The ansible-lint removes the prefix "ansible-role-*" for this test, and not the "ansible-" prefix.
3+
# Any role in the form of "ansible-*" is broken with this in.
4+
# Instead of renaming my role and breaking the world, I will just ignore that lint test.
5+
skip_list:
6+
- '106' # Role name {} does not match ``^[a-z][a-z0-9_]+$`` pattern
7+

.github/workflows/molecule.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: Molecule Test
3+
on: [push, pull_request]
4+
jobs:
5+
build:
6+
runs-on: ubuntu-latest
7+
strategy:
8+
max-parallel: 2
9+
matrix:
10+
ansible: ["2.9", "latest"]
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: Install dependencies
14+
run: |
15+
sudo apt remove ansible
16+
sudo apt install tox
17+
- name: Test with molecule using tox
18+
run: |
19+
sudo -H -E tox -e ansible-${{ matrix.ansible }}

.yamllint

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
# Based on ansible-lint config
3+
extends: default
4+
5+
rules:
6+
braces:
7+
max-spaces-inside: 1
8+
level: error
9+
brackets:
10+
max-spaces-inside: 1
11+
level: error
12+
colons:
13+
max-spaces-after: -1
14+
level: error
15+
commas:
16+
max-spaces-after: -1
17+
level: error
18+
comments: disable
19+
comments-indentation: disable
20+
document-start: disable
21+
empty-lines:
22+
max: 3
23+
level: error
24+
hyphens:
25+
level: error
26+
indentation: disable
27+
key-duplicates: enable
28+
line-length: disable
29+
new-line-at-end-of-file: disable
30+
new-lines:
31+
type: unix
32+
trailing-spaces: disable
33+
truthy: disable
34+
ignore:
35+
.tox/

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ Requirements
88

99
No fancy requirements. Only package and file management in the role.
1010

11+
Starting with this role version 4.0.0, the following minimum OS versions are required:
12+
- Ubuntu: 15.04 or above
13+
- Debian: Jessie or above
14+
- CentOS: 7 or above
15+
16+
For older OSes, please use a previous version of this role.
17+
1118
Role Variables
1219
--------------
1320

@@ -23,6 +30,8 @@ The main variables are:
2330
* keepalived_bind_on_non_local: This variable (defaulted to "False") determines whether the system that host keepalived will allow its apps to bind on non-local addresses. If you set it to true, this allows apps to bind (and start) even if they don't currently have the VIP for example.
2431

2532
Please check the examples for more explanations on how these dicts must be configured.
33+
You can find an example playbook in this README, and other examples in `tests/`, including
34+
examples on the variables configuration.
2635

2736
Other editable variables are listed in the defaults/main.yml. Please read the explanation there if you want to override them.
2837
An example of a notification script is also given, in the files folder.

Vagrantfile

Lines changed: 0 additions & 81 deletions
This file was deleted.

defaults/main.yml

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,12 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
# keepalived_ubuntu_src should be either "uca", "ppa" or "native":
17-
# "ppa" will ensure that keepalived ppa source is installed (recommended)
18-
# "uca" will ensure that the Ubuntu Cloud Archive is installed (good enough)
19-
# "native" will not ensure any external repository is set
20-
# and use what's available (not recommended, unless you defined one of the
21-
# above on your hosts)
22-
# Please see vars/ for information about these repositories
23-
# TODO(evrardjp), 2017-11:to remove the conditional
24-
# Remove the deprecation conditional and provide a good unconditional
25-
# default:
26-
#keepalived_ubuntu_src: "uca"
27-
keepalived_ubuntu_src: "{{ (keepalived_uca_enable is defined and (keepalived_uca_enable | bool)) | ternary('uca','ppa') }}"
28-
29-
# If using UCA, you may want to point with your local mirror of UCA.
30-
keepalived_uca_apt_repo_url: "http://ubuntu-cloud.archive.canonical.com/ubuntu"
31-
3216
# If running keepalived with SELinux, you could need to compile your
3317
# rules. Please override this list with path to files to compile.
3418
keepalived_selinux_compile_rules:
3519
- keepalived_ping
3620
- keepalived_setpgid
3721

38-
# TODO(evrardjp), 2017-11:
39-
# Remove the deprecation conditional and provide a good unconditional
40-
# default:
4122
#keepalived_package_state: "latest"
4223
keepalived_package_state: "{{ ( (keepalived_use_latest_stable | default(true)) | bool) | ternary('latest','present') }}"
4324

@@ -61,7 +42,7 @@ keepalived_bind_on_non_local: False
6142
# After=network-online.target
6243
keepalived_systemd_overrides: True
6344

64-
# Whether to add systemd option Restart=allways
45+
# Whether to add systemd option Restart=always
6546
# It depends on bool keepalived_systemd_overrides, so to add both must be True
6647
keepalived_systemd_override_service_restart: False
6748

handlers/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# backported to previous branches, we should rely on command to do service reload
1818
# else, testing is broken.
1919
- name: restart keepalived
20-
shell: "systemctl restart {{ keepalived_service_name }} || service {{ keepalived_service_name }} restart"
20+
command: "systemctl restart {{ keepalived_service_name }}"
2121
tags:
2222
- skip_ansible_lint
2323
#- name: restart keepalived

meta/main.yml

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,39 @@
1-
---
2-
# Copyright 2015, Jean-Philippe Evrard <[email protected]>
3-
#
4-
# Licensed under the Apache License, Version 2.0 (the "License");
5-
# you may not use this file except in compliance with the License.
6-
# You may obtain a copy of the License at
7-
#
8-
# http://www.apache.org/licenses/LICENSE-2.0
9-
#
10-
# Unless required by applicable law or agreed to in writing, software
11-
# distributed under the License is distributed on an "AS IS" BASIS,
12-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
# See the License for the specific language governing permissions and
14-
# limitations under the License.
15-
16-
galaxy_info:
17-
author: Jean-Philippe Evrard
18-
description: This role installs and configure keepalived based on a variable file
19-
license: Apache
20-
min_ansible_version: 2.4
21-
platforms:
22-
- name: EL
23-
versions:
24-
- 7
25-
- 8
26-
- name: Ubuntu
27-
versions:
28-
- trusty
29-
- xenial
30-
- name: opensuse
31-
versions:
32-
- all
33-
- name: Debian
34-
versions:
35-
- stretch
36-
galaxy_tags:
37-
- clustering
38-
dependencies: []
1+
---
2+
# Copyright 2015, Jean-Philippe Evrard <[email protected]>
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
galaxy_info:
17+
author: Jean-Philippe Evrard
18+
description: This role installs and configure keepalived based on a variable file
19+
license: Apache
20+
min_ansible_version: 2.4
21+
platforms:
22+
- name: EL
23+
versions:
24+
- 7
25+
- 8
26+
- name: Ubuntu
27+
versions:
28+
- xenial
29+
- bionic
30+
- focal
31+
- name: opensuse
32+
versions:
33+
- all
34+
- name: Debian
35+
versions:
36+
- stretch
37+
galaxy_tags:
38+
- clustering
39+
dependencies: []

molecule/default/Dockerfile.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{ lookup('url', 'https://raw.githubusercontent.com/ericsysmin/docker-ansible-testing/master/' ~ item.image ~ '/Dockerfile', split_lines=False) }}

molecule/default/cleanup.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
- name: Prepare molecule instance
3+
hosts: all[0]
4+
gather_facts: no
5+
tasks:
6+
- name: Create a network with custom IPAM config
7+
delegate_to: localhost
8+
community.general.docker_network:
9+
name: keepalived-network
10+
state: absent

0 commit comments

Comments
 (0)