Skip to content

Commit

Permalink
add molecule tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rekup committed Sep 23, 2023
1 parent d81d715 commit 7c23b1c
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
20 changes: 20 additions & 0 deletions molecule/system_settings_general/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
- name: converge
hosts: all
become: true
tasks:
- name: Converge - Set hostname
puzzle.opnsense.system_settings_general:
hostname: opnsense01

- name: Converge - Set domain
puzzle.opnsense.system_settings_general:
domain: example.org

- name: get hostname
ansible.builtin.command: hostname
register: hostname_value
changed_when: false

- ansible.builtin.assert:
that: hostname_value.stdout == "opnsense01.example.org"
47 changes: 47 additions & 0 deletions molecule/system_settings_general/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
scenario:
name: system_settings_general
test_sequence:
# - dependency not relevant uless we have requirements
- destroy
- syntax
- create
- converge
- idempotence
- verify
- destroy

driver:
name: vagrant
parallel: true

platforms:
- name: "22.7"
hostname: false
box: puzzle/opnsense
box_version: "22.7"
memory: 1024
cpus: 2
instance_raw_config_args:
- 'vm.guest = :freebsd'
- 'ssh.sudo_command = "%c"'
- 'ssh.shell = "/bin/sh"'
- name: "23.1"
box: puzzle/opnsense
hostname: false
box_version: "23.1"
memory: 1024
cpus: 2
instance_raw_config_args:
- 'vm.guest = :freebsd'
- 'ssh.sudo_command = "%c"'
- 'ssh.shell = "/bin/sh"'

provisioner:
name: ansible
env:
ANSIBLE_VERBOSITY: 3
verifier:
name: ansible
options:
become: true
6 changes: 6 additions & 0 deletions molecule/system_settings_general/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- name: Verify connectivity to server
hosts: all
tasks:
- name: Ping the server
ansible.builtin.ping:

0 comments on commit 7c23b1c

Please sign in to comment.