Skip to content

Commit

Permalink
update molecule docker driver
Browse files Browse the repository at this point in the history
we use `molecule-plugin[docker]` to install the docker driver used by
molecule 5.0
and an example directory with the meta and files needed by molecule to
run

related to #45

Co-authored-by: Beck Davis <[email protected]>
Co-authored-by: Vickie Karasic <[email protected]>
  • Loading branch information
3 people committed Nov 12, 2024
1 parent b05be36 commit dd7b6d9
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 1 deletion.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ansible>=6.7
molecule[docker]
molecule-plugins[docker]
ansible-lint
passlib
wheel
Expand Down
14 changes: 14 additions & 0 deletions roles/example/.ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
skip_list:
- ANSIBLE0002
- ANSIBLE0006
- ANSIBLE0010
- ANSIBLE0016
- '303'
- '305'
- '306'
- '403'
- '503'
- '204'
use_default_rules: true
verbosity: 1
14 changes: 14 additions & 0 deletions roles/example/.yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
extends: default

rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
line-length: disable
# NOTE(retr0h): Templates no longer fail this lint rule.
# Uncomment if running old Molecule templates.
# truthy: disable
17 changes: 17 additions & 0 deletions roles/example/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
galaxy_info:
role_name: <role_name>
company: Princeton University Library
description: <Role Description>
author: pulibrary

license: MIT

min_ansible_version: 2.2

platforms:
- name: Ubuntu
versions:
- jammy
dependencies:
- role: "<role I depend on>"
15 changes: 15 additions & 0 deletions roles/example/molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
- name: Converge
hosts: all
vars:
- running_on_server: false
become: true
pre_tasks:
- name: Update cache
ansible.builtin.apt:
update_cache: true
cache_valid_time: 600
tasks:
- name: "Include example"
ansible.builtin.include_role:
name: example
22 changes: 22 additions & 0 deletions roles/example/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
scenario:
name: default
driver:
name: docker
lint: |
set -e
yamllint .
ansible-lint
platforms:
- name: instance
image: "ghcr.io/pulibrary/pul_containers:jammy_multi"
command: "sleep infinity"
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
privileged: true
pre_build_image: true
provisioner:
name: ansible
log: true
verifier:
name: ansible
20 changes: 20 additions & 0 deletions roles/example/molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
- name: Verify
hosts: all
gather_facts: false
tasks:
- name: Check ruby package status
ansible.builtin.package:
name: "{{ item }}"
state: present
check_mode: true
register: pkg_status
loop:
- ruby-switch
- ruby2.6-dev
- ruby2.6

- name: Test for ruby packages
ansible.builtin.assert:
that:
- not pkg_status.changed

0 comments on commit dd7b6d9

Please sign in to comment.