Ansible Molecule #309
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# | |
# Ansible managed | |
# | |
name: Ansible Molecule | |
on: | |
push: | |
branches: | |
- master | |
schedule: | |
- cron: '23 12 12 * *' | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: ansible-lint | |
uses: ansible/ansible-lint@main | |
molecule: | |
needs: | |
- lint | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
distro: | |
- image: "alpine" | |
tag: "latest" | |
- image: "amazonlinux" | |
tag: "latest" | |
- image: "enterpriselinux" | |
tag: "latest" | |
- image: "debian" | |
tag: "latest" | |
- image: "debian" | |
tag: "bullseye" | |
- image: "fedora" | |
tag: "latest" | |
- image: "ubuntu" | |
tag: "latest" | |
- image: "ubuntu" | |
tag: "jammy" | |
- image: "ubuntu" | |
tag: "focal" | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
with: | |
path: ansible-role-logrotate | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.*" | |
- name: Configure Docker for systemd | |
run: | | |
sudo mkdir -p /etc/docker | |
echo '{ | |
"features": { | |
"buildkit": true | |
}, | |
"exec-opts": ["native.cgroupdriver=systemd"] | |
}' | sudo tee /etc/docker/daemon.json | |
sudo systemctl restart docker || true | |
- name: Install Docker | |
uses: docker/setup-buildx-action@v3 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip3 install ansible molecule molecule-plugins[docker] docker | |
- name: Test with molecule | |
run: | | |
cd ansible-role-logrotate | |
molecule test | |
env: | |
PY_COLORS: 1 | |
ANSIBLE_FORCE_COLOR: 1 | |
ANSIBLE_ROLES_PATH: ~/.ansible/roles:${GITHUB_WORKSPACE}/ansible-role-logrotate | |
image: ${{ matrix.distro.image }} | |
tag: ${{ matrix.distro.tag }} |