1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_etebase.git synced 2024-08-16 10:19:52 +02:00

improve linting and cleanup

This commit is contained in:
L3D 2023-10-29 14:43:07 +01:00
parent e6428f49cb
commit 41973e187d
No known key found for this signature in database
GPG key ID: AD65B920933B4B20
14 changed files with 54 additions and 32 deletions

View file

@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'checkout git repo'
- name: Checkout git repo
uses: actions/checkout@v4
with:
submodules: true

View file

@ -8,7 +8,7 @@ on:
jobs:
build:
name: Jinja2 Linting
name: Galaxy Role Importer
runs-on: ubuntu-latest
steps:

View file

@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'checkout git repo'
- name: Checkout git repo
uses: actions/checkout@v4
with:
submodules: true

View file

@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'checkout git repo'
- name: Checkout git repo
uses: actions/checkout@v4
with:
submodules: true

View file

@ -91,6 +91,15 @@ By the way, this role requires that the Ansible user be allowed to execute comma
submodules_versioncheck: true
```
## Requirements
The ``community.general`` collection is required for some parts of this ansible role.
You can install it with this command:
```bash
ansible-galaxy collection install -r requirements.yml --upgrade
```
Contributing
--------------
Don't hesitate to open a issue or *(even better)* create a pull request.

4
requirements.yml Normal file
View file

@ -0,0 +1,4 @@
---
collections:
- name: 'community.general'
version: ">=7.5.0,<=8.0.0"

View file

@ -32,7 +32,7 @@
recurse: true
group: "{{ etebase__group }}"
owner: "{{ etebase__user }}"
with_items:
loop:
- "{{ etebase__backup_destionation }}"
- "{{ etebase__current_backup_destination }}"
@ -59,7 +59,7 @@
recurse: true
group: "{{ etebase__group }}"
owner: "{{ etebase__user }}"
with_items:
loop:
- "{{ etebase__current_backup_destination }}"
- name: Backup static root dir
@ -84,7 +84,7 @@
dest: "{{ etebase__current_backup_destination }}"
remote_src: true
- name: Create bz2 archive of backup
- name: Create bz2 archive of backup # noqa: H1901
become: true
community.general.archive:
mode: 0640

View file

@ -18,7 +18,7 @@
owner: "{{ etebase__user }}"
recurse: true
mode: 'u=rwX,g=rX,o=rX'
with_items:
loop:
- "{{ etebase__global_static_root }}"
- name: "Create media data directorys"
@ -30,7 +30,7 @@
owner: "{{ etebase__user }}"
recurse: true
mode: 'u=rwX,g=rX,o='
with_items:
loop:
- "{{ etebase__global_media_root }}"
- "{{ etebase__secrets_dir }}"

View file

@ -1,5 +1,5 @@
---
- name: Set git configuration for safe.directory
- name: Set git configuration for safe.directory # noqa: H1901
community.general.git_config:
scope: global
name: safe.directory

View file

@ -8,7 +8,7 @@
owner: "{{ etebase__user }}"
recurse: true
mode: 'u=rwX,g=rX,o=rX'
with_items:
loop:
- "{{ etebase__global_static_root }}"
notify:
- "Systemctl restart etebase.service"
@ -23,7 +23,7 @@
owner: "{{ etebase__user }}"
recurse: true
mode: 'u=rwX,g=rX,o='
with_items:
loop:
- "{{ etebase__global_media_root }}"
- "{{ etebase__secrets_dir }}"
- "{{ etebase__venv }}"

View file

@ -1,33 +1,43 @@
---
- name: Run optional versionscheck
ansible.builtin.include_tasks: versioncheck.yml
ansible.builtin.include_tasks:
file: 'versioncheck.yml'
when: submodules_versioncheck | bool
- name: Create Etebase User/Group
ansible.builtin.include_tasks: create_user.yml
ansible.builtin.include_tasks:
file: 'create_user.yml'
- name: Define Etebase Version
ansible.builtin.include_tasks: set_version.yml
ansible.builtin.include_tasks:
file: 'set_version.yml'
- name: Run optional etebase backup
ansible.builtin.include_tasks: backup.yml
ansible.builtin.include_tasks:
file: 'backup.yml'
when: etebase__create_backup | bool
- name: Download Etebase Repo
ansible.builtin.include_tasks: download.yml
ansible.builtin.include_tasks:
file: 'download.yml'
- name: Setup Virtualenv and install Requirements
ansible.builtin.include_tasks: python_venv.yml
ansible.builtin.include_tasks:
file: 'python_venv.yml'
- name: Create Etebase Config
ansible.builtin.include_tasks: configure.yml
ansible.builtin.include_tasks:
file: 'configure.yml'
- name: Run ./manage.py migrate
ansible.builtin.include_tasks: migrate.yml
ansible.builtin.include_tasks:
file: 'migrate.yml'
- name: Setup Systemd Service
ansible.builtin.include_tasks: systemd.yml
ansible.builtin.include_tasks:
file: 'systemd.yml'
when: etebase__systemd_setup | bool
- name: Cleanup file permissions
ansible.builtin.include_tasks: filepermissions.yml
ansible.builtin.include_tasks:
file: 'filepermissions.yml'

View file

@ -7,7 +7,7 @@
changed_when: _etebase_download.changed or _etebase_config.changed
register: _etebase_migrate
- name: Print output of python3 manage.py migrate
- name: Print output of python3 manage.py migrate # noqa: H500
ansible.builtin.debug:
verbosity: 1
msg: "{{ _etebase_migrate.stdout }}"
@ -23,7 +23,7 @@
- "Systemctl restart etebase.service"
- "Systemctl restart webserver"
- name: Print output of python3 manage.py collectstatic
- name: Print output of python3 manage.py collectstatic # noqa: H500
ansible.builtin.debug:
verbosity: 1
msg: "{{ _etebase_collectstatic.stdout }}"
@ -37,7 +37,7 @@
owner: "{{ etebase__user }}"
recurse: true
mode: 'u=rwX,g=rX,o='
with_items:
loop:
- "{{ etebase__secrets_dir }}"
- name: "Fix File Permissions for static data directory"
@ -49,10 +49,10 @@
owner: "{{ etebase__user }}"
recurse: true
mode: 'u=rwX,g=rX,o=rX'
with_items:
loop:
- "{{ etebase__global_static_root }}"
- name: Print hint how to create admin User
- name: Print hint how to create admin User # noqa: H500
ansible.builtin.debug:
# yamllint disable-line rule:line-length
msg: "To create a admin user, run 'cd {{ etebase__user_home }}/etebase_{{ etebase_version_target }}; source {{ etebase__venv }}/bin/activate; python3 ./manage.py createsuperuser' as priviledged user."

View file

@ -39,7 +39,7 @@
etebase_version_target: "{{ etebase__version }}"
when: etebase__version != "latest"
- name: Print Etebase Version
- name: Print Etebase Version # noqa: H500
ansible.builtin.debug:
verbosity: 1
msg: "etebase version is set to {{ etebase_version_target }}"

View file

@ -7,7 +7,7 @@
ansible.builtin.file:
path: '/etc/.ansible-version'
state: directory
mode: "0755"
mode: '0755'
when: submodules_versioncheck | bool
- name: Check playbook version
@ -16,15 +16,14 @@
src: "/etc/.ansible-version/{{ playbook_version_path }}"
register: playbook_version
when: submodules_versioncheck | bool
ignore_errors: true
failed_when: false
- name: Print remote role version
- name: Print remote role version # noqa: H500
ansible.builtin.debug:
msg: "Remote role version: {{ playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode | string }}"
when: submodules_versioncheck | bool
- name: Print locale role version
- name: Print locale role version # noqa: H500
ansible.builtin.debug:
msg: "Local role version: '{{ playbook_version_number | string }}'."
when: submodules_versioncheck | bool