Skip to content

Commit

Permalink
Change yes/no to true/false, adhere to yamlspec 1.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-de-bock committed Mar 18, 2024
1 parent 045f2d6 commit 8c0361a
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/requirements2png.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ jobs:
uses: ad-m/github-push-action@master
with:
directory: ${{ github.repository }}
force: yes
force: true
branch: png
3 changes: 0 additions & 3 deletions .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ rules:
line-length: disable
truthy:
check-keys: no
allowed-values:
- "yes"
- "no"

ignore: |
.tox/
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ This example is taken from [`molecule/default/converge.yml`](https://github.com/
---
- name: Converge
hosts: all
become: yes
gather_facts: yes
become: true
gather_facts: true

roles:
- role: robertdebock.haproxy
Expand All @@ -28,7 +28,7 @@ This example is taken from [`molecule/default/converge.yml`](https://github.com/
address: "*"
port: 443
default_backend: backend
ssl: yes
ssl: true
crts:
- /tmp/haproxy.keycrt
- name: smtp
Expand All @@ -39,7 +39,7 @@ This example is taken from [`molecule/default/converge.yml`](https://github.com/
haproxy_backend_default_balance: roundrobin
haproxy_backends:
- name: backend
httpcheck: yes
httpcheck: true
# You can tell how the health check must be done.
# This requires haproxy version 2
# http_check:
Expand Down Expand Up @@ -81,7 +81,7 @@ This example is taken from [`molecule/default/converge.yml`](https://github.com/
haproxy_listens:
- name: listen
address: "*"
httpcheck: yes
httpcheck: true
listen_port: 8081
balance: roundrobin
# You can refer to hosts in an Ansible group.
Expand All @@ -98,8 +98,8 @@ The machine needs to be prepared. In CI this is done using [`molecule/default/pr
---
- name: Prepare
hosts: all
become: yes
gather_facts: no
become: true
gather_facts: false
roles:
- role: robertdebock.bootstrap
Expand Down Expand Up @@ -146,7 +146,7 @@ The default values for the variables are set in [`defaults/main.yml`](https://gi
# defaults file for haproxy
# Configure stats in HAProxy?
haproxy_stats: yes
haproxy_stats: true
haproxy_stats_port: 1936
haproxy_stats_bind_addr: "0.0.0.0"
Expand Down
2 changes: 1 addition & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# defaults file for haproxy

# Configure stats in HAProxy?
haproxy_stats: yes
haproxy_stats: true
haproxy_stats_port: 1936
haproxy_stats_bind_addr: "0.0.0.0"

Expand Down
2 changes: 1 addition & 1 deletion meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ argument_specs:
options:
haproxy_stats:
type: "bool"
default: yes
default: true
description: "Configure stats in HAProxy?"
haproxy_stats_port:
type: "int"
Expand Down
10 changes: 5 additions & 5 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
- name: Converge
hosts: all
become: yes
gather_facts: yes
become: true
gather_facts: true

roles:
- role: ansible-role-haproxy
Expand All @@ -15,7 +15,7 @@
address: "*"
port: 443
default_backend: backend
ssl: yes
ssl: true
crts:
- /tmp/haproxy.keycrt
- name: smtp
Expand All @@ -26,7 +26,7 @@
haproxy_backend_default_balance: roundrobin
haproxy_backends:
- name: backend
httpcheck: yes
httpcheck: true
# You can tell how the health check must be done.
# This requires haproxy version 2
# http_check:
Expand Down Expand Up @@ -68,7 +68,7 @@
haproxy_listens:
- name: listen
address: "*"
httpcheck: yes
httpcheck: true
listen_port: 8081
balance: roundrobin
# You can refer to hosts in an Ansible group.
Expand Down
4 changes: 2 additions & 2 deletions molecule/default/prepare.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
- name: Prepare
hosts: all
become: yes
gather_facts: no
become: true
gather_facts: false

roles:
- role: robertdebock.bootstrap
Expand Down
8 changes: 4 additions & 4 deletions molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
- name: Verify
hosts: all
become: yes
gather_facts: no
become: true
gather_facts: false

tasks:
- name: Install testing requirements
Expand All @@ -22,7 +22,7 @@
- name: Check of content can be retrieved
ansible.builtin.uri:
url: "{{ item }}"
validate_certs: no
validate_certs: false
status_code:
- 200
loop:
Expand All @@ -32,7 +32,7 @@
- name: Check if stats are available
ansible.builtin.shell:
cmd: "echo 'show stat' | socat unix-connect:/var/lib/haproxy/stats stdio"
changed_when: no
changed_when: false

handlers:
- name: Uninstall testing requirements
Expand Down
50 changes: 25 additions & 25 deletions tasks/assert.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
that:
- haproxy_stats is defined
- haproxy_stats is boolean
quiet: yes
quiet: true

- name: assert | Test haproxy_stats_port
ansible.builtin.assert:
Expand All @@ -14,31 +14,31 @@
- haproxy_stats_port is number
- haproxy_stats_port > 0
- haproxy_stats_port < 65536
quiet: yes
quiet: true

- name: assert | Test haproxy_stats_bind_addr
ansible.builtin.assert:
that:
- haproxy_stats_bind_addr is defined
- haproxy_stats_bind_addr is string
- haproxy_stats_bind_addr is not none
quiet: yes
quiet: true

- name: assert | Test haproxy_retries
ansible.builtin.assert:
that:
- haproxy_retries is defined
- haproxy_retries is number
- haproxy_retries >= 0
quiet: yes
quiet: true

- name: assert | Test timeouts are set correctly
ansible.builtin.assert:
that:
- item is defined
- item is string
- item is not none
quiet: yes
quiet: true
loop:
- "{{ haproxy_timeout_http_request }}"
- "{{ haproxy_timeout_connect }}"
Expand All @@ -53,14 +53,14 @@
- haproxy_maxconn is defined
- haproxy_maxconn is number
- haproxy_maxconn > 0
quiet: yes
quiet: true

- name: assert | Test haproxy_frontends
ansible.builtin.assert:
that:
- haproxy_frontends is defined
- haproxy_frontends is iterable
quiet: yes
quiet: true

- name: assert | Test item in haproxy_frontends
ansible.builtin.assert:
Expand All @@ -78,7 +78,7 @@
- item.default_backend is defined
- item.default_backend is string
- item.default_backend is not none
quiet: yes
quiet: true
loop: "{{ haproxy_frontends }}"
loop_control:
label: "{{ item.name }}"
Expand All @@ -89,7 +89,7 @@
- item.ssl is boolean
- item.crts is defined
- item.crts is iterable
quiet: yes
quiet: true
loop: "{{ haproxy_frontends }}"
loop_control:
label: "{{ item.name }}"
Expand All @@ -101,7 +101,7 @@
that:
- item.mode is string
- item.mode in [ "http", "tcp" ]
quiet: yes
quiet: true
loop: "{{ haproxy_frontends }}"
loop_control:
label: "{{ item.name }}"
Expand All @@ -113,15 +113,15 @@
that:
- haproxy_backends is defined
- haproxy_backends is iterable
quiet: yes
quiet: true

- name: assert | Test haproxy_backend_default_balance
ansible.builtin.assert:
that:
- haproxy_backend_default_balance is defined
- haproxy_backend_default_balance is string
- haproxy_backend_default_balance in [ "roundrobin", "static-rr", "leastconn", "first", "source", "uri", "url_param", "hdr", "rdp-cookie" ]
quiet: yes
quiet: true

- name: assert | Test item in haproxy_backends
ansible.builtin.assert:
Expand All @@ -140,7 +140,7 @@
- item.port > 0
- item.port < 65536
- (item.options is defined and item.options is iterable) or item.options is undefined
quiet: yes
quiet: true
loop: "{{ haproxy_backends }}"
loop_control:
label: "{{ item.name }}"
Expand All @@ -150,7 +150,7 @@
that:
- item.mode is string
- item.mode in [ "http", "tcp" ]
quiet: yes
quiet: true
loop: "{{ haproxy_backends }}"
loop_control:
label: "{{ item.name }}"
Expand All @@ -162,7 +162,7 @@
that:
- item.httpcheck is boolean
or item.httpcheck is string
quiet: yes
quiet: true
loop: "{{ haproxy_backends }}"
loop_control:
label: "{{ item.name }}"
Expand All @@ -175,7 +175,7 @@
- item.httpcheck_method is string
- item.httpcheck_method is not none
- item.httpcheck is defined
quiet: yes
quiet: true
loop: "{{ haproxy_backends }}"
loop_control:
label: "{{ item.name }}"
Expand All @@ -186,7 +186,7 @@
ansible.builtin.assert:
that:
- item.http_check is mapping
quiet: yes
quiet: true
loop: "{{ haproxy_backends }}"
loop_control:
label: "{{ item.name }}"
Expand All @@ -201,7 +201,7 @@
- item.http_check.send.method in [ "GET", "HEAD" ]
- item.http_check.send.uri is defined
- item.http_check.send.uri is not none
quiet: yes
quiet: true
loop: "{{ haproxy_backends }}"
loop_control:
label: "{{ item.name }}"
Expand All @@ -213,7 +213,7 @@
that:
- item.http_check.expect is string
- item.http_check.expect is not none
quiet: yes
quiet: true
loop: "{{ haproxy_backends }}"
loop_control:
label: "{{ item.name }}"
Expand All @@ -225,7 +225,7 @@
that:
- haproxy_listens is defined
- haproxy_listens is iterable
quiet: yes
quiet: true

- name: assert | Test item in haproxy_listens
ansible.builtin.assert:
Expand All @@ -250,7 +250,7 @@
- item.port < 65536
- item.servers is defined
- item.servers is iterable
quiet: yes
quiet: true
loop: "{{ haproxy_listens }}"
loop_control:
label: "{{ item.name }}"
Expand All @@ -261,7 +261,7 @@
- item.ssl is boolean
- item.crts is defined
- item.crts is iterable
quiet: yes
quiet: true
loop: "{{ haproxy_listens }}"
loop_control:
label: "{{ item.name }}"
Expand All @@ -273,7 +273,7 @@
that:
- item.mode is string
- item.mode in [ "http", "tcp" ]
quiet: yes
quiet: true
loop: "{{ haproxy_listens }}"
loop_control:
label: "{{ item.name }}"
Expand All @@ -286,13 +286,13 @@
- haproxy_listen_default_balance is defined
- haproxy_listen_default_balance is string
- haproxy_listen_default_balance in [ "roundrobin", "static-rr", "leastconn", "first", "source", "uri", "url_param", "hdr", "rdp-cookie" ]
quiet: yes
quiet: true

- name: assert | Test httpcheck item in haproxy_listens
ansible.builtin.assert:
that:
- item.httpcheck is boolean
quiet: yes
quiet: true
loop: "{{ haproxy_listens }}"
loop_control:
label: "{{ item.name }}"
Expand Down
Loading

0 comments on commit 8c0361a

Please sign in to comment.