diff --git a/.git_hooks/pre-commit b/.git_hooks/pre-commit index 8298e73..e6424b7 100755 --- a/.git_hooks/pre-commit +++ b/.git_hooks/pre-commit @@ -8,7 +8,7 @@ set -x # Pre-commit hooks to copy steps from default CI/CD pipeline. See `bitbucket-pipelines.yml` for details. [ $(command -v shellcheck) ] && find . -path ./tmp -prune -false -o -name "*.sh" -print -exec shellcheck -x {} \; -[ $(command -v ansible-lint) ] && ansible-lint --nocolor -p --parseable-severity +[ $(command -v ansible-lint) ] && ansible-lint --nocolor -p [ $(command -v yamllint) ] && yamllint -s . [ $(command -v flake8) ] && flake8 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ed8ebf5 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +__pycache__ \ No newline at end of file diff --git a/handlers/main.yml b/handlers/main.yml index bb15095..707caf9 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,13 +1,13 @@ --- # file: roles/haproxy/handlers/main.yml - name: restart haproxy - service: + ansible.builtin.service: name: "{{ haproxy_service }}" state: restarted when: haproxy_mode == "system" - name: reload haproxy - service: + ansible.builtin.service: name: "{{ haproxy_service }}" state: reloaded when: haproxy_mode == "system" diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 5480c39..14f9952 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -7,7 +7,7 @@ driver: lint: | set -ex yamllint -s . - ansible-lint --nocolor -p --parseable-severity --exclude=molecule/ --exclude=tests/ + ansible-lint --nocolor -p --exclude=molecule/ --exclude=tests/ flake8 platforms: # https://wiki.debian.org/DebianReleases @@ -21,12 +21,18 @@ platforms: command: sleep infinity groups: [ Debian ] privileged: true - # https://www.centos.org/centos-linux/ - - name: centos8 - image: centos:8 + # https://rockylinux.org/ + - name: rockylinux8 + image: rockylinux:8 command: /sbin/init groups: [ RedHat ] privileged: true + # https://www.centos.org/centos-linux/ + # - name: centos8 + # image: centos:8 + # command: /sbin/init + # groups: [ RedHat ] + # privileged: true - name: centos7 image: centos:7 command: /sbin/init diff --git a/tasks/config.yml b/tasks/config.yml index fd47227..69f13e1 100644 --- a/tasks/config.yml +++ b/tasks/config.yml @@ -1,7 +1,7 @@ --- # file: roles/haproxy/tasks/config.yml - name: Configuring HAproxy - template: + ansible.builtin.template: src: etc/haproxy/haproxy.cfg.j2 dest: "{{ haproxy_config }}" mode: "0640" diff --git a/tasks/install-Debian.yml b/tasks/install-Debian.yml index 69ced0b..39d41d6 100644 --- a/tasks/install-Debian.yml +++ b/tasks/install-Debian.yml @@ -1,12 +1,12 @@ --- # file: roles/haproxy/tasks/install-Debian.yml - name: Set haproxy release - set_fact: + ansible.builtin.set_fact: haproxy_release: "{{ ansible_distribution_release }}-backports" when: haproxy_apt_backports | bool - name: "Installing HAproxy from {{ haproxy_release | default(ansible_distribution_release) }}" - apt: + ansible.builtin.apt: name: "{{ haproxy_package }}" state: present update_cache: true @@ -14,7 +14,7 @@ default_release: "{{ haproxy_release | default(ansible_distribution_release) }}" - name: "Installing selinux python bindings" - apt: + ansible.builtin.apt: name: "{{ haproxy_selinux_packages }}" state: present when: haproxy_selinux | bool diff --git a/tasks/install-Generic.yml b/tasks/install-Generic.yml index da37826..c7e56e5 100644 --- a/tasks/install-Generic.yml +++ b/tasks/install-Generic.yml @@ -1,7 +1,7 @@ --- # file: roles/haproxy/tasks/install-Generic.yml - name: "RedHat | Install basic repo file" - yum_repository: + ansible.builtin.yum_repository: name: "{{ item.name }}" description: "{{ item.description | default(omit) }}" baseurl: "{{ item.baseurl }}" @@ -18,11 +18,11 @@ when: haproxy_repo_yum is defined - name: Installing HAproxy package - package: + ansible.builtin.package: name: "{{ haproxy_package }}" - name: "Installing selinux python bindings" - package: + ansible.builtin.package: name: "{{ haproxy_selinux_packages }}" state: present when: haproxy_selinux | bool diff --git a/tasks/install.yml b/tasks/install.yml index 34a17db..951bd5e 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -6,7 +6,7 @@ when: ansible_os_family != 'Debian' - name: Enabling and starting HAproxy service - service: + ansible.builtin.service: name: "{{ haproxy_service }}" state: started enabled: true diff --git a/tasks/main.yml b/tasks/main.yml index 46599e4..ff84464 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,7 +1,7 @@ --- # file: roles/haproxy/tasks/main.yml - name: Include OS variables - include_vars: "{{ ansible_os_family }}.yml" + ansible.builtin.include_vars: "{{ ansible_os_family }}.yml" tags: - haproxy - haproxy-install