Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
lukapetrovic-git committed Oct 18, 2024
1 parent ab0557f commit f49056d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 30 deletions.
3 changes: 2 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
haproxy_version: 2.8

# Global config section
Expand All @@ -14,8 +15,8 @@ haproxy_global_vars:
haproxy_default_vars:
- log global
- mode tcp
- option dontlognull
- option tcplog
- option dontlognull

# Frontends
haproxy_frontends:
Expand Down
2 changes: 1 addition & 1 deletion handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: Reload HAProxy
service:
ansible.builtin.service:
name: haproxy
state: reloaded
57 changes: 29 additions & 28 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,41 @@
ansible.builtin.apt:
name: software-properties-common
state: present
update_cache: yes
update_cache: true
cache_valid_time: 3600

- name: Check if PPA vbernat/haproxy-{{ haproxy_version }} is present
ansible.builtin.shell: add-apt-repository --list | grep vbernat/haproxy-{{ haproxy_version }}
- name: Check if PPA present - vbernat/haproxy-{{ haproxy_version }}
ansible.builtin.shell: |
set -o pipefail
add-apt-repository --list | grep vbernat/haproxy-{{ haproxy_version }}
args:
executable: /bin/bash
failed_when: haproxy_repo_present.rc not in [0,1]
changed_when: false
register: haproxy_repo_present

- name: Print return information from the previous task
ansible.builtin.debug:
var: haproxy_repo_present
# - name: Add HAProxy {{ haproxy_version }} repository into sources list
# ansible.builtin.apt_repository:
# repo: "ppa:vbernat/haproxy-{{ haproxy_version }}"
# state: present
# update_cache: true
- name: Add PPA vbernat/haproxy-{{ haproxy_version }}
ansible.builtin.command: add-apt-repository ppa:vbernat/haproxy-{{ haproxy_version }} -y
changed_when: true
when: haproxy_repo_present.stdout == ''

# - name: Install HAProxy
# ansible.builtin.apt:
# name: "haproxy={{ haproxy_version }}.*"
# state: present
- name: Install HAProxy
ansible.builtin.apt:
name: "haproxy={{ haproxy_version }}.*"
state: present
update_cache: true

# - name: Copy HAProxy configuration
# ansible.builtin.template:
# src: haproxy.cfg.j2
# dest: /etc/haproxy/haproxy.cfg
# mode: 0644
# validate: haproxy -f %s -c -q
# force: true
# notify: Reload HAProxy
- name: Copy HAProxy configuration
ansible.builtin.template:
src: haproxy.cfg.j2
dest: /etc/haproxy/haproxy.cfg
mode: "0644"
validate: haproxy -f %s -c -q
force: true
notify: Reload HAProxy

# - name: Ensure HAProxy is started and enabled at boot
# ansible.builtin.service:
# name: haproxy
# state: started
# enabled: true
- name: Ensure HAProxy is started and enabled at boot
ansible.builtin.service:
name: haproxy
state: started
enabled: true

0 comments on commit f49056d

Please sign in to comment.