diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e8dcd26..7271b82 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,10 +12,10 @@ jobs: with: python-version: 3.7 - name: Install Molecule - run: pip install molecule[lint,docker] - - name: Lint run: | - yamllint . - ansible-lint + pip install -U pip setuptools wheel + pip install -r requirements-dev.txt + # - name: Debugging with tmate + # uses: mxschmitt/action-tmate@v3.5 - name: Test using Molecule run: molecule test \ No newline at end of file diff --git a/.yamllint b/.yamllint index 8827676..09db584 100644 --- a/.yamllint +++ b/.yamllint @@ -1,5 +1,8 @@ --- # Based on ansible-lint config +ignore: | + .direnv + extends: default rules: diff --git a/README.md b/README.md index 65af0c6..4aa9cc5 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Main features: ``` - hosts: webservers roles: - - role: borgbackup + - role: m3nu.ansible_role_borgbackup borg_encryption_passphrase: CHANGEME borg_repository: m5vz9gp4@m5vz9gp4.repo.borgbase.com:repo borg_source_directories: @@ -44,7 +44,7 @@ $ ansible-galaxy install m3nu.ansible_role_borgbackup Clone to local folder ``` -$ git clone https://github.com/borgbase/ansible-role-borgbackup.git roles/borgbackup +$ git clone https://github.com/borgbase/ansible-role-borgbackup.git roles/ansible_role_borgbackup ``` diff --git a/meta/main.yml b/meta/main.yml index 69c0acd..27b7a86 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -3,6 +3,8 @@ dependencies: [] galaxy_info: author: Manuel Riel + role_name: ansible_role_borgbackup + namespace: m3nu description: Set up backup to remote machine using Borg and Borgmatic. company: "BorgBase.com" license: license (BSD, MIT) diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index 525a2e2..4b0e975 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -7,7 +7,7 @@ name: openssh-server state: present roles: - - role: ansible-role-borgbackup + - role: m3nu.ansible_role_borgbackup borg_encryption_passphrase: CHANGEME borg_repository: m5vz9gp4@m5vz9gp4.repo.borgbase.com:repo borg_source_directories: diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index a4079f9..bdf618e 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -10,10 +10,6 @@ platforms: image: centos:latest - name: fedora-latest image: fedora:latest - - name: fedora-31 - image: fedora:31 - - name: debian-oldstable - image: debian:oldstable - name: debian-stable image: debian:stable - name: ubuntu-bionic @@ -24,3 +20,7 @@ provisioner: name: ansible verifier: name: ansible +lint: | + set -e + yamllint . + ansible-lint . \ No newline at end of file diff --git a/requirements-dev.txt b/requirements-dev.txt index 74ecc22..2678b98 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,3 +1,3 @@ -molecule[lint,docker] +ansible ansible-lint -testinfra \ No newline at end of file +molecule[lint,docker] \ No newline at end of file diff --git a/tasks/RedHat.yml b/tasks/RedHat.yml index 59e51b5..ed97d53 100644 --- a/tasks/RedHat.yml +++ b/tasks/RedHat.yml @@ -1,7 +1 @@ --- -- name: Install EPEL repo - yum: - pkg: epel-release - state: installed - update_cache: yes - when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux' diff --git a/tasks/main.yml b/tasks/main.yml index 293279a..92f0b3a 100755 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -6,8 +6,9 @@ - "{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml" - "{{ ansible_distribution }}.yml" - "{{ ansible_os_family }}.yml" + - "{{ ansible_lsb.id }}.yml" -- name: Run OS-specific setup +- name: Run OS-specific tasks include: "{{ item }}" with_first_found: - "{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml" @@ -39,7 +40,8 @@ ssh_key_type: ed25519 register: root_user -- debug: +- name: Print key created for root user (use for remote repo) + debug: var: root_user['ssh_public_key'] - name: Create new repository for server diff --git a/vars/ManjaroLinux.yml b/vars/ManjaroLinux.yml new file mode 100644 index 0000000..a4dfa5d --- /dev/null +++ b/vars/ManjaroLinux.yml @@ -0,0 +1,8 @@ +--- +borg_packages: + - borgmatic + - openssh + - cronie + +python_bin: python3 +pip_bin: pip3