mirror of
https://github.com/borgbase/ansible-role-borgbackup.git
synced 2025-08-30 13:46:48 +02:00
rocky8 specifics added
This commit is contained in:
parent
b206824a38
commit
2daac5a816
16
.github/workflows/main.yml
vendored
16
.github/workflows/main.yml
vendored
@ -19,3 +19,19 @@ jobs:
|
||||
# uses: mxschmitt/action-tmate@v3.5
|
||||
- name: Test using Molecule
|
||||
run: molecule test
|
||||
test-rocky8:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.10"
|
||||
- name: Install Molecule
|
||||
run: |
|
||||
pip install -U pip setuptools wheel
|
||||
pip install -r requirements-dev-rocky8.txt
|
||||
# - name: Debugging with tmate
|
||||
# uses: mxschmitt/action-tmate@v3.5
|
||||
- name: Test using Molecule
|
||||
run: molecule test -s rocky8
|
||||
|
23
molecule/rocky8/Dockerfile.j2
Normal file
23
molecule/rocky8/Dockerfile.j2
Normal file
@ -0,0 +1,23 @@
|
||||
# Molecule managed
|
||||
|
||||
{% if item.registry is defined %}
|
||||
FROM {{ item.registry.url }}/{{ item.image }}
|
||||
{% else %}
|
||||
FROM {{ item.image }}
|
||||
{% endif %}
|
||||
|
||||
{% if item.env is defined %}
|
||||
{% for var, value in item.env.items() %}
|
||||
{% if value %}
|
||||
ENV {{ var }} {{ value }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python3 python3-pip sudo bash ca-certificates iproute2 python3-apt aptitude && apt-get clean; \
|
||||
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install /usr/bin/python3 /usr/bin/python3-config /usr/bin/dnf-3 sudo bash iproute && dnf clean all; \
|
||||
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y /usr/bin/python /usr/bin/python2-config sudo yum-plugin-ovl bash iproute && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
|
||||
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml iproute2 && zypper clean -a; \
|
||||
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
|
||||
elif [ $(command -v pacman) ]; then pacman --noconfirm -Suy python python-pip sudo openssh; \
|
||||
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates iproute2 && xbps-remove -O; fi
|
22
molecule/rocky8/INSTALL.rst
Normal file
22
molecule/rocky8/INSTALL.rst
Normal file
@ -0,0 +1,22 @@
|
||||
*******
|
||||
Docker driver installation guide
|
||||
*******
|
||||
|
||||
Requirements
|
||||
============
|
||||
|
||||
* Docker Engine
|
||||
|
||||
Install
|
||||
=======
|
||||
|
||||
Please refer to the `Virtual environment`_ documentation for installation best
|
||||
practices. If not using a virtual environment, please consider passing the
|
||||
widely recommended `'--user' flag`_ when invoking ``pip``.
|
||||
|
||||
.. _Virtual environment: https://virtualenv.pypa.io/en/latest/
|
||||
.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ pip install 'molecule[docker]'
|
55
molecule/rocky8/converge.yml
Normal file
55
molecule/rocky8/converge.yml
Normal file
@ -0,0 +1,55 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
pre_tasks:
|
||||
- name: Set ssh server package name for non-Archlinux ansible_os_family
|
||||
set_fact:
|
||||
openssh_package: "openssh-server"
|
||||
pip3_extra_args: ""
|
||||
when: ansible_os_family != "Archlinux"
|
||||
|
||||
- name: Set ssh server package name and pip3 argument for Archlinux ansible_os_family
|
||||
set_fact:
|
||||
openssh_package: "openssh"
|
||||
pip3_extra_args: "--break-system-packages"
|
||||
when: ansible_os_family == "Archlinux"
|
||||
|
||||
- name: Install openssh
|
||||
package:
|
||||
name: "{{ openssh_package }}"
|
||||
state: present
|
||||
|
||||
- name: Enable EPEL for yamllint
|
||||
package:
|
||||
name: epel-release
|
||||
state: present
|
||||
when: ansible_os_family == 'RedHat' and ansible_distribution != 'Fedora'
|
||||
|
||||
- name: Install yamllint
|
||||
package:
|
||||
name: yamllint
|
||||
state: present
|
||||
|
||||
roles:
|
||||
- role: borgbase.ansible_role_borgbackup
|
||||
borg_install_method: pip
|
||||
borgmatic_timer: cron
|
||||
borg_repository: m5vz9gp4@m5vz9gp4.repo.borgbase.com:repo
|
||||
borg_encryption_passphrase: CHANGEME
|
||||
borg_source_directories:
|
||||
- /srv/www
|
||||
- /var/lib/automysqlbackup
|
||||
borg_exclude_patterns:
|
||||
- /srv/www/old-sites
|
||||
borg_retention_policy:
|
||||
keep_hourly: 3
|
||||
keep_daily: 7
|
||||
keep_weekly: 4
|
||||
keep_monthly: 6
|
||||
borgmatic_hooks:
|
||||
before_backup:
|
||||
- echo "`date` - Starting backup."
|
||||
postgresql_databases:
|
||||
- name: users
|
||||
hostname: database1.example.org
|
||||
port: 5433
|
16
molecule/rocky8/molecule.yml
Normal file
16
molecule/rocky8/molecule.yml
Normal file
@ -0,0 +1,16 @@
|
||||
---
|
||||
dependency:
|
||||
name: galaxy
|
||||
driver:
|
||||
name: docker
|
||||
platforms:
|
||||
- name: rockylinux-8
|
||||
image: rockylinux/rockylinux:8
|
||||
provisioner:
|
||||
name: ansible
|
||||
verifier:
|
||||
name: ansible
|
||||
lint: |
|
||||
set -e
|
||||
yamllint .
|
||||
ansible-lint .
|
13
molecule/rocky8/verify.yml
Normal file
13
molecule/rocky8/verify.yml
Normal file
@ -0,0 +1,13 @@
|
||||
---
|
||||
- name: Verify
|
||||
hosts: all
|
||||
tasks:
|
||||
- name: Ensure Borgmatic is installed correctly
|
||||
command: borgmatic --version
|
||||
|
||||
- name: Ensure Borg is installed correctly
|
||||
command: borgmatic borg --version
|
||||
|
||||
- name: Ensure produced YAML is valid
|
||||
command: |
|
||||
yamllint -d "{extends: relaxed, rules: {line-length: {max: 120}}}" /etc/borgmatic/config.yaml
|
4
requirements-dev-rocky8.txt
Normal file
4
requirements-dev-rocky8.txt
Normal file
@ -0,0 +1,4 @@
|
||||
ansible<10
|
||||
ansible-lint
|
||||
molecule
|
||||
molecule-plugins[docker]
|
Loading…
Reference in New Issue
Block a user