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 220524f commit 339f021
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 48 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,16 +14,16 @@ 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

vars_files:
- ../../vars/main.yml
- ../../defaults/main.yml

roles:
- role: robertdebock.httpd
# https_ssl_enable: yes
# https_ssl_enable: true
httpd_port: 8080
httpd_ssl_port: 8443
httpd_locations:
Expand Down Expand Up @@ -62,7 +62,7 @@ This example is taken from [`molecule/default/converge.yml`](https://github.com/
# - name: no_doc_root
# servername: nodocroot.example.com
# documentroot: /var/www/html/nodocroot
# create_docroot: no
# create_docroot: false
httpd_directories:
- name: my_directory
path: "{{ httpd_data_directory }}/my_directory"
Expand All @@ -78,8 +78,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 @@ -109,7 +109,7 @@ httpd_servername: "{{ ansible_fqdn }}"
httpd_port: 80

# Enable (self-signed certificates) SSL?
https_ssl_enable: no
https_ssl_enable: false

# To configure https, set the hostname to listen to.
httpd_ssl_servername: "{{ ansible_fqdn }}"
Expand All @@ -124,7 +124,7 @@ httpd_openssl_crt: "{{ httpd_openssl_crt_directory }}/apache-httpd.crt"
httpd_openssl_key: "{{ httpd_openssl_key_directory }}/apache-httpd.key"

# If the "it works" page should be kept
httpd_remove_example: no
httpd_remove_example: false

# Additionnal httpd module to install

Expand Down
4 changes: 2 additions & 2 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ httpd_servername: "{{ ansible_fqdn }}"
httpd_port: 80

# Enable (self-signed certificates) SSL?
https_ssl_enable: no
https_ssl_enable: false

# To configure https, set the hostname to listen to.
httpd_ssl_servername: "{{ ansible_fqdn }}"
Expand All @@ -23,7 +23,7 @@ httpd_openssl_crt: "{{ httpd_openssl_crt_directory }}/apache-httpd.crt"
httpd_openssl_key: "{{ httpd_openssl_key_directory }}/apache-httpd.key"

# If the "it works" page should be kept
httpd_remove_example: no
httpd_remove_example: false

# Additionnal httpd module to install

Expand Down
2 changes: 1 addition & 1 deletion handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- name: Test httpd configuration validity
ansible.builtin.command:
cmd: "{{ httpd_binary }} -t"
changed_when: no
changed_when: false
when:
- ansible_os_family != "Suse"

Expand Down
8 changes: 4 additions & 4 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
---
- name: Converge
hosts: all
become: yes
gather_facts: yes
become: true
gather_facts: true

vars_files:
- ../../vars/main.yml
- ../../defaults/main.yml

roles:
- role: ansible-role-httpd
# https_ssl_enable: yes
# https_ssl_enable: true
httpd_port: 8080
httpd_ssl_port: 8443
httpd_locations:
Expand Down Expand Up @@ -49,7 +49,7 @@
# - name: no_doc_root
# servername: nodocroot.example.com
# documentroot: /var/www/html/nodocroot
# create_docroot: no
# create_docroot: false
httpd_directories:
- name: my_directory
path: "{{ httpd_data_directory }}/my_directory"
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
6 changes: 3 additions & 3 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: yes
become: true
gather_facts: true

vars_files:
- ../../vars/main.yml
Expand All @@ -25,7 +25,7 @@
- name: See if the sample index.html returns 200
ansible.builtin.uri:
url: "http://127.0.0.1:8080/"
return_content: yes
return_content: true
register: index_html
failed_when:
- "'Hello World' not in index_html.content"
Expand Down
38 changes: 19 additions & 19 deletions tasks/assert.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- httpd_servername is defined
- httpd_servername is string
- httpd_servername is not none
quiet: yes
quiet: true

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

- name: assert | Test https_ssl_enable
ansible.builtin.assert:
that:
- https_ssl_enable is defined
- https_ssl_enable is boolean
quiet: yes
quiet: true

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

- name: assert | Test httpd_ssl_port
ansible.builtin.assert:
Expand All @@ -39,13 +39,13 @@
- httpd_ssl_port > 0
- httpd_ssl_port < 65535
- httpd_ssl_port != httpd_port
quiet: yes
quiet: true

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

Expand All @@ -61,7 +61,7 @@
- item.backend_url is defined
- item.backend_url is string
- item.backend_url is not none
quiet: yes
quiet: true
loop: "{{ httpd_locations }}"
loop_control:
label: "{{ item.name }}"
Expand All @@ -72,7 +72,7 @@
ansible.builtin.assert:
that:
- httpd_vhosts is iterable
quiet: yes
quiet: true
when:
- httpd_vhosts is defined

Expand All @@ -84,7 +84,7 @@
- item.name is not none
- item.servername is defined
- item.servername is string
quiet: yes
quiet: true
loop: "{{ httpd_vhosts }}"
loop_control:
label: "{{ item.name }}"
Expand All @@ -95,7 +95,7 @@
ansible.builtin.assert:
that:
- item.create_docroot is boolean
quiet: yes
quiet: true
loop: "{{ httpd_vhosts }}"
loop_control:
label: "{{ item.name }}"
Expand All @@ -107,7 +107,7 @@
ansible.builtin.assert:
that:
- item.serveralias is iterable
quiet: yes
quiet: true
loop: "{{ httpd_vhosts }}"
loop_control:
label: "{{ item.name }}"
Expand All @@ -119,7 +119,7 @@
ansible.builtin.assert:
that:
- httpd_directories is iterable
quiet: yes
quiet: true
when:
- httpd_directories is defined

Expand All @@ -132,7 +132,7 @@
- item.path is string
- item.path is not none
- item.option is defined or item.allow_override is defined
quiet: yes
quiet: true
loop: "{{ httpd_directories }}"
loop_control:
label: "{{ item.name }}"
Expand All @@ -143,7 +143,7 @@
ansible.builtin.assert:
that:
- item.options is iterable
quiet: yes
quiet: true
loop: "{{ httpd_directories }}"
loop_control:
label: "{{ item.name }}"
Expand All @@ -156,7 +156,7 @@
that:
- item.allow_override is string
- item.allow_override is not none
quiet: yes
quiet: true
loop: "{{ httpd_directories }}"
loop_control:
label: "{{ item.name }}"
Expand All @@ -169,25 +169,25 @@
that:
- httpd_remove_example is defined
- httpd_remove_example is boolean
quiet: yes
quiet: true

- name: assert | Test httpd_additionnal_modules
ansible.builtin.assert:
that:
- httpd_additionnal_modules is defined
- httpd_additionnal_modules | type_debug == "list"
quiet: yes
quiet: true

- name: assert | Test if httpd_modules_to_activate_with_command is set correctly
ansible.builtin.assert:
that:
- httpd_modules_to_activate_with_command is defined
- httpd_modules_to_activate_with_command | type_debug == "list"
quiet: yes
quiet: true

- name: assert | Test if default_vhost_conf is set correctly
ansible.builtin.assert:
that:
- default_vhost_conf is defined
- default_vhost_conf is string
quiet: yes
quiet: true
10 changes: 5 additions & 5 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- name: Import assert.yml
ansible.builtin.import_tasks:
file: assert.yml
run_once: yes
run_once: true
delegate_to: localhost

- name: Install apache httpd
Expand All @@ -20,8 +20,8 @@
- name: Modify selinux settings
ansible.posix.seboolean:
name: "{{ item }}"
state: yes
persistent: yes
state: true
persistent: true
when:
- ansible_selinux.status is defined
- ansible_selinux.status == "enabled"
Expand Down Expand Up @@ -49,7 +49,7 @@
- name: Activate httpd module | Debian
ansible.builtin.command:
cmd: "a2enmod {{ item }}"
changed_when: no
changed_when: false
loop: "{{ httpd_modules_to_activate_with_command }}"
when:
- ansible_os_family == 'Debian'
Expand Down Expand Up @@ -105,4 +105,4 @@
ansible.builtin.service:
name: "{{ httpd_service }}"
state: started
enabled: yes
enabled: true

0 comments on commit 339f021

Please sign in to comment.