Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update molecule docker driver #246

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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