Skip to content

Commit

Permalink
Merge pull request #2 from guidograzioli/fix_molecule_tests
Browse files Browse the repository at this point in the history
Add comprehensive molecule test
  • Loading branch information
guidograzioli authored Aug 29, 2023
2 parents a621a32 + 153eb0c commit 3f3b64d
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 7 deletions.
1 change: 1 addition & 0 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
vars:
jbcs_configure_firewalld: False
jbcs_offline_install: False
jbcs_bind_address: '*'
rhn_username: "{{ lookup('env', 'PROD_JBOSSNETWORK_API_CLIENTID') }}"
rhn_password: "{{ lookup('env', 'PROD_JBOSSNETWORK_API_SECRET') }}"
roles:
Expand Down
6 changes: 6 additions & 0 deletions molecule/default/prepare.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
---
- name: Prepare
hosts: all
gather_facts: True
tasks:
- name: "Ensure required packages are installed."
ansible.builtin.yum:
name:
- sudo
- procps-ng
- openssl
state: present

- name: Display Ansible version
Expand All @@ -30,3 +32,7 @@
when:
- assets_server is defined
- assets_server | length > 0

- name: "Create self signed cert"
ansible.builtin.shell: |
openssl req -x509 -newkey rsa:2048 -sha256 -days 1 -nodes -keyout /etc/pki/tls/private/instance.key -out /etc/pki/tls/certs/instance.crt -subj "/CN=instance" -addext 'subjectAltName=IP:127.0.0.1'
12 changes: 9 additions & 3 deletions molecule/default/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
- name: Verify
hosts: all
tasks:
- name: foo
ansible.builtin.debug:
msg: "bar"
- name: Test port 80 redirect to 443
ansible.builtin.uri:
url: http://localhost
method: GET
status_code: 200
validate_certs: False
return_content: true
register: this
failed_when: this is failed or 'Index of /' not in this.content or not this.redirected
2 changes: 1 addition & 1 deletion roles/jbcs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Role Defaults
|`jbcs_home`| Home directory | `/opt/jbcs/jbcs-httpd24-2.4/` |
|`jbcs_bind_address`| Bind address | `localhost` |
|`jbcs_listen_port`| HTTP listen port | `80` |
|`jbcs_mod_cluster_enable`| Enable modcluster module | `False` |
|`jbcs_mod_cluster_enable`| Enable modcluster module | `True` |
|`jbcs_mod_cluster_port`| Modcluster advertise port | `6666` |
|`jbcs_mod_cluster_require`| Require argument for modcluster location | `all granted` |
|`jbcs_mod_cluster_balancer`| Balancer name for modcluster cluster | `loadbalancer` |
Expand Down
4 changes: 2 additions & 2 deletions roles/jbcs/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jbcs_home: /opt/jbcs/jbcs-httpd24-2.4/
jbcs_bind_address: "localhost"
jbcs_listen_port: 80

jbcs_mod_cluster_enable: false
jbcs_mod_cluster_enable: True
jbcs_mod_cluster_port: 6666
jbcs_mod_cluster_require: "all granted"
jbcs_mod_cluster_balancer: loadbalancer
Expand All @@ -28,4 +28,4 @@ jbcs_external_domain_name: "{{ ansible_nodename }}"
jbcs_offline_install: True

jbcs_configure_firewalld: True
jbcs_port_check: False
jbcs_port_check: False
2 changes: 1 addition & 1 deletion roles/jbcs/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ argument_specs:
type: "int"
jbcs_mod_cluster_enable:
# line 13 of jbcs/defaults/main.yml
default: false
default: true
description: "Enable modcluster module"
type: "bool"
jbcs_mod_cluster_port:
Expand Down
1 change: 1 addition & 0 deletions roles/jbcs/tasks/prereqs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
packages_list:
- unzip
- procps-ng
- mailcap

0 comments on commit 3f3b64d

Please sign in to comment.