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:
parent
e6428f49cb
commit
41973e187d
14 changed files with 54 additions and 32 deletions
2
.github/workflows/ansible-linting-check.yml
vendored
2
.github/workflows/ansible-linting-check.yml
vendored
|
@ -10,7 +10,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 'checkout git repo'
|
- name: Checkout git repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
|
|
2
.github/workflows/galaxy.yml
vendored
2
.github/workflows/galaxy.yml
vendored
|
@ -8,7 +8,7 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Jinja2 Linting
|
name: Galaxy Role Importer
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
2
.github/workflows/j2lint-check.yml
vendored
2
.github/workflows/j2lint-check.yml
vendored
|
@ -10,7 +10,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 'checkout git repo'
|
- name: Checkout git repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
|
|
2
.github/workflows/yamllint-check.yml
vendored
2
.github/workflows/yamllint-check.yml
vendored
|
@ -10,7 +10,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 'checkout git repo'
|
- name: Checkout git repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
|
|
|
@ -91,6 +91,15 @@ By the way, this role requires that the Ansible user be allowed to execute comma
|
||||||
submodules_versioncheck: true
|
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
|
Contributing
|
||||||
--------------
|
--------------
|
||||||
Don't hesitate to open a issue or *(even better)* create a pull request.
|
Don't hesitate to open a issue or *(even better)* create a pull request.
|
||||||
|
|
4
requirements.yml
Normal file
4
requirements.yml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
collections:
|
||||||
|
- name: 'community.general'
|
||||||
|
version: ">=7.5.0,<=8.0.0"
|
|
@ -32,7 +32,7 @@
|
||||||
recurse: true
|
recurse: true
|
||||||
group: "{{ etebase__group }}"
|
group: "{{ etebase__group }}"
|
||||||
owner: "{{ etebase__user }}"
|
owner: "{{ etebase__user }}"
|
||||||
with_items:
|
loop:
|
||||||
- "{{ etebase__backup_destionation }}"
|
- "{{ etebase__backup_destionation }}"
|
||||||
- "{{ etebase__current_backup_destination }}"
|
- "{{ etebase__current_backup_destination }}"
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@
|
||||||
recurse: true
|
recurse: true
|
||||||
group: "{{ etebase__group }}"
|
group: "{{ etebase__group }}"
|
||||||
owner: "{{ etebase__user }}"
|
owner: "{{ etebase__user }}"
|
||||||
with_items:
|
loop:
|
||||||
- "{{ etebase__current_backup_destination }}"
|
- "{{ etebase__current_backup_destination }}"
|
||||||
|
|
||||||
- name: Backup static root dir
|
- name: Backup static root dir
|
||||||
|
@ -84,7 +84,7 @@
|
||||||
dest: "{{ etebase__current_backup_destination }}"
|
dest: "{{ etebase__current_backup_destination }}"
|
||||||
remote_src: true
|
remote_src: true
|
||||||
|
|
||||||
- name: Create bz2 archive of backup
|
- name: Create bz2 archive of backup # noqa: H1901
|
||||||
become: true
|
become: true
|
||||||
community.general.archive:
|
community.general.archive:
|
||||||
mode: 0640
|
mode: 0640
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
owner: "{{ etebase__user }}"
|
owner: "{{ etebase__user }}"
|
||||||
recurse: true
|
recurse: true
|
||||||
mode: 'u=rwX,g=rX,o=rX'
|
mode: 'u=rwX,g=rX,o=rX'
|
||||||
with_items:
|
loop:
|
||||||
- "{{ etebase__global_static_root }}"
|
- "{{ etebase__global_static_root }}"
|
||||||
|
|
||||||
- name: "Create media data directorys"
|
- name: "Create media data directorys"
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
owner: "{{ etebase__user }}"
|
owner: "{{ etebase__user }}"
|
||||||
recurse: true
|
recurse: true
|
||||||
mode: 'u=rwX,g=rX,o='
|
mode: 'u=rwX,g=rX,o='
|
||||||
with_items:
|
loop:
|
||||||
- "{{ etebase__global_media_root }}"
|
- "{{ etebase__global_media_root }}"
|
||||||
- "{{ etebase__secrets_dir }}"
|
- "{{ etebase__secrets_dir }}"
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
- name: Set git configuration for safe.directory
|
- name: Set git configuration for safe.directory # noqa: H1901
|
||||||
community.general.git_config:
|
community.general.git_config:
|
||||||
scope: global
|
scope: global
|
||||||
name: safe.directory
|
name: safe.directory
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
owner: "{{ etebase__user }}"
|
owner: "{{ etebase__user }}"
|
||||||
recurse: true
|
recurse: true
|
||||||
mode: 'u=rwX,g=rX,o=rX'
|
mode: 'u=rwX,g=rX,o=rX'
|
||||||
with_items:
|
loop:
|
||||||
- "{{ etebase__global_static_root }}"
|
- "{{ etebase__global_static_root }}"
|
||||||
notify:
|
notify:
|
||||||
- "Systemctl restart etebase.service"
|
- "Systemctl restart etebase.service"
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
owner: "{{ etebase__user }}"
|
owner: "{{ etebase__user }}"
|
||||||
recurse: true
|
recurse: true
|
||||||
mode: 'u=rwX,g=rX,o='
|
mode: 'u=rwX,g=rX,o='
|
||||||
with_items:
|
loop:
|
||||||
- "{{ etebase__global_media_root }}"
|
- "{{ etebase__global_media_root }}"
|
||||||
- "{{ etebase__secrets_dir }}"
|
- "{{ etebase__secrets_dir }}"
|
||||||
- "{{ etebase__venv }}"
|
- "{{ etebase__venv }}"
|
||||||
|
|
|
@ -1,33 +1,43 @@
|
||||||
---
|
---
|
||||||
- name: Run optional versionscheck
|
- name: Run optional versionscheck
|
||||||
ansible.builtin.include_tasks: versioncheck.yml
|
ansible.builtin.include_tasks:
|
||||||
|
file: 'versioncheck.yml'
|
||||||
when: submodules_versioncheck | bool
|
when: submodules_versioncheck | bool
|
||||||
|
|
||||||
- name: Create Etebase User/Group
|
- name: Create Etebase User/Group
|
||||||
ansible.builtin.include_tasks: create_user.yml
|
ansible.builtin.include_tasks:
|
||||||
|
file: 'create_user.yml'
|
||||||
|
|
||||||
- name: Define Etebase Version
|
- name: Define Etebase Version
|
||||||
ansible.builtin.include_tasks: set_version.yml
|
ansible.builtin.include_tasks:
|
||||||
|
file: 'set_version.yml'
|
||||||
|
|
||||||
- name: Run optional etebase backup
|
- name: Run optional etebase backup
|
||||||
ansible.builtin.include_tasks: backup.yml
|
ansible.builtin.include_tasks:
|
||||||
|
file: 'backup.yml'
|
||||||
when: etebase__create_backup | bool
|
when: etebase__create_backup | bool
|
||||||
|
|
||||||
- name: Download Etebase Repo
|
- name: Download Etebase Repo
|
||||||
ansible.builtin.include_tasks: download.yml
|
ansible.builtin.include_tasks:
|
||||||
|
file: 'download.yml'
|
||||||
|
|
||||||
- name: Setup Virtualenv and install Requirements
|
- 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
|
- name: Create Etebase Config
|
||||||
ansible.builtin.include_tasks: configure.yml
|
ansible.builtin.include_tasks:
|
||||||
|
file: 'configure.yml'
|
||||||
|
|
||||||
- name: Run ./manage.py migrate
|
- name: Run ./manage.py migrate
|
||||||
ansible.builtin.include_tasks: migrate.yml
|
ansible.builtin.include_tasks:
|
||||||
|
file: 'migrate.yml'
|
||||||
|
|
||||||
- name: Setup Systemd Service
|
- name: Setup Systemd Service
|
||||||
ansible.builtin.include_tasks: systemd.yml
|
ansible.builtin.include_tasks:
|
||||||
|
file: 'systemd.yml'
|
||||||
when: etebase__systemd_setup | bool
|
when: etebase__systemd_setup | bool
|
||||||
|
|
||||||
- name: Cleanup file permissions
|
- name: Cleanup file permissions
|
||||||
ansible.builtin.include_tasks: filepermissions.yml
|
ansible.builtin.include_tasks:
|
||||||
|
file: 'filepermissions.yml'
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
changed_when: _etebase_download.changed or _etebase_config.changed
|
changed_when: _etebase_download.changed or _etebase_config.changed
|
||||||
register: _etebase_migrate
|
register: _etebase_migrate
|
||||||
|
|
||||||
- name: Print output of python3 manage.py migrate
|
- name: Print output of python3 manage.py migrate # noqa: H500
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
verbosity: 1
|
verbosity: 1
|
||||||
msg: "{{ _etebase_migrate.stdout }}"
|
msg: "{{ _etebase_migrate.stdout }}"
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
- "Systemctl restart etebase.service"
|
- "Systemctl restart etebase.service"
|
||||||
- "Systemctl restart webserver"
|
- "Systemctl restart webserver"
|
||||||
|
|
||||||
- name: Print output of python3 manage.py collectstatic
|
- name: Print output of python3 manage.py collectstatic # noqa: H500
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
verbosity: 1
|
verbosity: 1
|
||||||
msg: "{{ _etebase_collectstatic.stdout }}"
|
msg: "{{ _etebase_collectstatic.stdout }}"
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
owner: "{{ etebase__user }}"
|
owner: "{{ etebase__user }}"
|
||||||
recurse: true
|
recurse: true
|
||||||
mode: 'u=rwX,g=rX,o='
|
mode: 'u=rwX,g=rX,o='
|
||||||
with_items:
|
loop:
|
||||||
- "{{ etebase__secrets_dir }}"
|
- "{{ etebase__secrets_dir }}"
|
||||||
|
|
||||||
- name: "Fix File Permissions for static data directory"
|
- name: "Fix File Permissions for static data directory"
|
||||||
|
@ -49,10 +49,10 @@
|
||||||
owner: "{{ etebase__user }}"
|
owner: "{{ etebase__user }}"
|
||||||
recurse: true
|
recurse: true
|
||||||
mode: 'u=rwX,g=rX,o=rX'
|
mode: 'u=rwX,g=rX,o=rX'
|
||||||
with_items:
|
loop:
|
||||||
- "{{ etebase__global_static_root }}"
|
- "{{ 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:
|
ansible.builtin.debug:
|
||||||
# yamllint disable-line rule:line-length
|
# 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."
|
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."
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
etebase_version_target: "{{ etebase__version }}"
|
etebase_version_target: "{{ etebase__version }}"
|
||||||
when: etebase__version != "latest"
|
when: etebase__version != "latest"
|
||||||
|
|
||||||
- name: Print Etebase Version
|
- name: Print Etebase Version # noqa: H500
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
verbosity: 1
|
verbosity: 1
|
||||||
msg: "etebase version is set to {{ etebase_version_target }}"
|
msg: "etebase version is set to {{ etebase_version_target }}"
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: '/etc/.ansible-version'
|
path: '/etc/.ansible-version'
|
||||||
state: directory
|
state: directory
|
||||||
mode: "0755"
|
mode: '0755'
|
||||||
when: submodules_versioncheck | bool
|
when: submodules_versioncheck | bool
|
||||||
|
|
||||||
- name: Check playbook version
|
- name: Check playbook version
|
||||||
|
@ -16,15 +16,14 @@
|
||||||
src: "/etc/.ansible-version/{{ playbook_version_path }}"
|
src: "/etc/.ansible-version/{{ playbook_version_path }}"
|
||||||
register: playbook_version
|
register: playbook_version
|
||||||
when: submodules_versioncheck | bool
|
when: submodules_versioncheck | bool
|
||||||
ignore_errors: true
|
|
||||||
failed_when: false
|
failed_when: false
|
||||||
|
|
||||||
- name: Print remote role version
|
- name: Print remote role version # noqa: H500
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: "Remote role version: {{ playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode | string }}"
|
msg: "Remote role version: {{ playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode | string }}"
|
||||||
when: submodules_versioncheck | bool
|
when: submodules_versioncheck | bool
|
||||||
|
|
||||||
- name: Print locale role version
|
- name: Print locale role version # noqa: H500
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: "Local role version: '{{ playbook_version_number | string }}'."
|
msg: "Local role version: '{{ playbook_version_number | string }}'."
|
||||||
when: submodules_versioncheck | bool
|
when: submodules_versioncheck | bool
|
||||||
|
|
Loading…
Reference in a new issue