diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..ad45155 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: +- package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: monthly diff --git a/.github/workflows/molecule.yml b/.github/workflows/molecule.yml index 855b56a..988ff7c 100644 --- a/.github/workflows/molecule.yml +++ b/.github/workflows/molecule.yml @@ -19,17 +19,17 @@ jobs: strategy: max-parallel: 4 matrix: - distro: [centos7, rockylinux8, ubuntu2004, ubuntu1804] + distro: [rockylinux8, rockylinux9, ubuntu2004, ubuntu2204] scenario: [default] steps: - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: - python-version: 3.8 + python-version: 3.10.11 - name: Install dependencies run: | diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c015732 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.sw? +*~ +*log.txt diff --git a/.mailmap b/.mailmap new file mode 100644 index 0000000..f2eef01 --- /dev/null +++ b/.mailmap @@ -0,0 +1,3 @@ +Thomas Widhalm +Afeef Ghannam <39904920+afeefghannam89@users.noreply.github.com> +Tobias Bauriedel diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..45ab57a --- /dev/null +++ b/AUTHORS @@ -0,0 +1,4 @@ +Afeef Ghannam +Marc Rupprecht +Thomas Widhalm +Tobias Bauriedel diff --git a/docs/rsnapshot.yml b/docs/rsnapshot.md similarity index 100% rename from docs/rsnapshot.yml rename to docs/rsnapshot.md diff --git a/galaxy.yml b/galaxy.yml new file mode 100644 index 0000000..0c7ebc7 --- /dev/null +++ b/galaxy.yml @@ -0,0 +1,33 @@ +namespace: netways +name: backup +version: 0.1.0-beta +readme: README.md +authors: + - Thomas Widhalm +description: > + This collection provides easy backup solutions as a + better than nothing approach. +license: + - GPL-3.0-or-later +tags: + - backup + - rsnapshot + - tools + - storage +dependencies: {} +repository: https://github.com/NETWAYS/ansible-collection-backup +documentation: https://github.com/NETWAYS/ansible-collection-backup/tree/main/docs +homepage: http://netways.de +issues: https://github.com/NETWAYS/ansible-collection-backup/issues +build_ignore: + - yamllint.yaml + - .cache + - molecule + - tests + - .gitignore + - .github + - .gitlab-ci.yml + - __pycache__ + - 'venv*' + - .idea + - '*.tar.gz' diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index e7eb8be..8e2a2de 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -10,6 +10,6 @@ include_role: name: rsnapshot - - name: "Include Bachup" + - name: "Include Backup" include_role: name: backup diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 50cb4dc..7149a20 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -1,14 +1,17 @@ --- dependency: name: galaxy + options: + requirements-file: requirements.yml driver: name: docker platforms: - - name: backup-default + - name: "backup-default-${MOLECULE_DISTRO}" image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: - /sys/fs/cgroup:/sys/fs/cgroup:rw + cgroupns_mode: host privileged: true pre_build_image: true provisioner: diff --git a/molecule/default/requirements.yml b/molecule/default/requirements.yml new file mode 100644 index 0000000..68100ec --- /dev/null +++ b/molecule/default/requirements.yml @@ -0,0 +1,3 @@ +--- +roles: + - geerlingguy.mysql diff --git a/molecule/default/verify.yml b/molecule/default/verify.yml index 3b7122c..691000f 100644 --- a/molecule/default/verify.yml +++ b/molecule/default/verify.yml @@ -1,5 +1,6 @@ --- -- hosts: all +- name: Tests + hosts: all vars: system_time: "{{ lookup('pipe','date +%Y%m%d') }}" tasks: @@ -15,7 +16,7 @@ stat: path: /opt/backup/rsnapshot/hourly.0/backup-defaul/root/rsnapshot/timestamp.hourly - - name: .my.cnf exists + - name: .my.cnf exists command: cat /root/.my.cnf - name: Create test table in database and insert test value @@ -44,14 +45,14 @@ community.mysql.mysql_db: name: testDatabase state: import - target: /opt/mysqlbackup/mysqldump_{{system_time}}.sql.bz2 + target: /opt/mysqlbackup/mysqldump_{{ system_time }}.sql.bz2 when: ansible_os_family == 'Debian' - name: Restore database community.mysql.mysql_db: name: testDatabase state: import - target: /opt/mysqlbackup/mysqldump_{{system_time}}.sql + target: /opt/mysqlbackup/mysqldump_{{ system_time }}.sql when: ansible_os_family == 'RedHat' - name: Simple select query to acme db @@ -59,7 +60,7 @@ login_db: testDatabase query: SELECT message FROM test register: mysql_query_output - + - name: Print the mysql query debug: var: mysql_query_output