diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 0000000..4dc6823 --- /dev/null +++ b/.ansible-lint @@ -0,0 +1,8 @@ +--- + +skip_list: + - meta-runtime[unsupported-version] + - galaxy[no-changelog] + - galaxy[version-incorrect] + - name[casing] + - var-naming[no-role-prefix] diff --git a/.forgejo/workflows/ansible-galaxy.yml b/.forgejo/workflows/ansible-galaxy.yml index 83cc0af..ffcfb22 100644 --- a/.forgejo/workflows/ansible-galaxy.yml +++ b/.forgejo/workflows/ansible-galaxy.yml @@ -2,7 +2,7 @@ name: Ansible Galaxy -on: +on: # noqa yaml[truthy] push: tags: - 'v*' diff --git a/.forgejo/workflows/ansible-lint.yml b/.forgejo/workflows/ansible-lint.yml index a51dce6..b42b17b 100644 --- a/.forgejo/workflows/ansible-lint.yml +++ b/.forgejo/workflows/ansible-lint.yml @@ -1,7 +1,7 @@ --- name: Ansible Lint -on: [push, pull_request] +on: [push, pull_request] # noqa yaml[truthy] jobs: build: @@ -15,4 +15,3 @@ jobs: apt update; apt install --yes python3-pip pip3 install --break-system-packages ansible-lint ansible-lint - diff --git a/galaxy.yml b/galaxy.yml index d8d9e1c..b213857 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -16,7 +16,7 @@ readme: README.md # A list of the collection's content authors. Can be just the name or in the format 'Full Name (url) # @nicks:irc/im.site#channel' authors: -- s3lph + - s3lph ### OPTIONAL but strongly recommended @@ -26,11 +26,12 @@ description: Install and configure Nextcloud and PHP-FPM. # Either a single license or a list of licenses for content inside of a collection. Ansible Galaxy currently only # accepts L(SPDX,https://spdx.org/licenses/) licenses. This key is mutually exclusive with 'license_file' license: -- MIT + - MIT # A list of tags you want to associate with the collection for indexing/searching. A tag name has the same character # requirements as 'namespace' and 'name' tags: + - application - nextcloud - php - keydb @@ -67,4 +68,3 @@ build_ignore: [] # 'omit_default_directives' is a boolean that controls whether the default directives are used. Mutually exclusive # with 'build_ignore' # manifest: null - diff --git a/meta/runtime.yml b/meta/runtime.yml index 2fe301c..c8a010b 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -1,7 +1,7 @@ --- # Collections must specify a minimum required ansible version to upload # to galaxy -requires_ansible: '>=2.9.10' +requires_ansible: '>=2.10' # Content that Ansible needs to load from another location or that has # been deprecated/removed diff --git a/playbooks/nextcloud_stack.yml b/playbooks/nextcloud_stack.yml index bbad324..07adc2f 100644 --- a/playbooks/nextcloud_stack.yml +++ b/playbooks/nextcloud_stack.yml @@ -1,6 +1,7 @@ --- -- hosts: all +- name: Deploy the Nextcloud stack + hosts: all roles: - s3lph.nextcloud.php - s3lph.nextcloud.keydb diff --git a/plugins/modules/install.py b/plugins/modules/install.py index 7246d38..10ddf46 100644 --- a/plugins/modules/install.py +++ b/plugins/modules/install.py @@ -102,7 +102,6 @@ EXAMPLES = r''' admin_user: admin admin_pass: changeme admin_email: admin@example.org - ''' diff --git a/roles/keydb/tasks/config.yml b/roles/keydb/tasks/config.yml index 2745412..c0bbd38 100644 --- a/roles/keydb/tasks/config.yml +++ b/roles/keydb/tasks/config.yml @@ -6,7 +6,7 @@ dest: /etc/keydb/keydb.conf owner: keydb group: keydb - mode: 0640 + mode: "0640" notify: - restart keydb diff --git a/roles/keydb/tasks/main.yml b/roles/keydb/tasks/main.yml index 08ea6a6..f09d731 100644 --- a/roles/keydb/tasks/main.yml +++ b/roles/keydb/tasks/main.yml @@ -1,11 +1,13 @@ --- -- ansible.builtin.import_tasks: install.yml +- name: Install KeyDB + ansible.builtin.import_tasks: install.yml tags: - "role::keydb" - "role::keydb:install" -- ansible.builtin.import_tasks: config.yml +- name: Configure KeyDB + ansible.builtin.import_tasks: config.yml tags: - "role::keydb" - "role::keydb:config" diff --git a/roles/nextcloud/handlers/main.yml b/roles/nextcloud/handlers/main.yml index 1d9f4e9..f7f9ac3 100644 --- a/roles/nextcloud/handlers/main.yml +++ b/roles/nextcloud/handlers/main.yml @@ -2,7 +2,7 @@ - name: restart php-fpm ansible.builtin.service: - name: "php{{ php_version}}-fpm.service" + name: "php{{ php_version }}-fpm.service" state: restarted - name: restart apache2 diff --git a/roles/nextcloud/meta/argument_specs.yml b/roles/nextcloud/meta/argument_specs.yml index 184d290..1a8cb69 100644 --- a/roles/nextcloud/meta/argument_specs.yml +++ b/roles/nextcloud/meta/argument_specs.yml @@ -36,7 +36,7 @@ argument_specs: description: Port of the Redis server, or 0 if a UNIX socket is used. type: int default: 0 - nextcloud_redis_dbindex: + nextcloud_redis_dbindex: description: Redis database index. type: int default: 0 diff --git a/roles/nextcloud/tasks/install.yml b/roles/nextcloud/tasks/install.yml index 8e5d3a5..bcb24e9 100644 --- a/roles/nextcloud/tasks/install.yml +++ b/roles/nextcloud/tasks/install.yml @@ -25,11 +25,11 @@ - nextcloud_db_engine == 'mysql' - nextcloud_db_host == 'localhost' block: - + - name: Install MariaDB server ansible.builtin.apt: name: mariadb-server - + - name: Create MariaDB Database community.mysql.mysql_db: name: '{{ nextcloud_db_name }}' @@ -68,7 +68,7 @@ become_user: www-data s3lph.nextcloud.nextcloud_facts: webroot: /var/lib/nextcloud/webroot - when: nextcloud_register_installation.changed + when: nextcloud_register_installation.changed # noqa no-handler - name: Set common Nextcloud options become: true diff --git a/roles/nextcloud/tasks/main.yml b/roles/nextcloud/tasks/main.yml index 492b58f..57a26e1 100644 --- a/roles/nextcloud/tasks/main.yml +++ b/roles/nextcloud/tasks/main.yml @@ -1,11 +1,13 @@ --- -- ansible.builtin.import_tasks: install.yml +- name: Install Nextcloud + ansible.builtin.import_tasks: install.yml tags: - "role::nextcloud" - "role::nextcloud:install" -- ansible.builtin.import_tasks: config.yml +- name: Configure Nextcloud + ansible.builtin.import_tasks: config.yml tags: - "role::nextcloud" - "role::nextcloud:config" diff --git a/roles/php/defaults/main.yml b/roles/php/defaults/main.yml index 1521dc9..6f84cd1 100644 --- a/roles/php/defaults/main.yml +++ b/roles/php/defaults/main.yml @@ -14,4 +14,3 @@ php_ini: opcache.max_accelerated_files: "10000" opcache.revalidate_freq: "60" opcache.save_comments: "1" - diff --git a/roles/php/tasks/config.yml b/roles/php/tasks/config.yml index 236e54e..9104761 100644 --- a/roles/php/tasks/config.yml +++ b/roles/php/tasks/config.yml @@ -6,7 +6,7 @@ dest: "/etc/php/{{ php_version }}/{{ item }}/conf.d/99-nextcloud.ini" owner: root group: root - mode: 0644 + mode: "0644" loop: - fpm - cli @@ -22,7 +22,7 @@ - name: Enable wanted and disable unwanted php-fpm apache2 config ansible.builtin.file: path: "{{ item.path }}" - state: >- + state: | {%- if item.path.endswith(wanted) -%} link {%- else -%} @@ -31,7 +31,7 @@ src: "/etc/apache2/conf-available{{ wanted }}" owner: root group: root - mode: 0644 + mode: "0644" vars: wanted: "/php{{ php_version }}-fpm.conf" loop: "{{ php_register_conf_enabled.files }}" @@ -51,4 +51,4 @@ ansible.builtin.service: name: "php{{ php_version }}-fpm.service" state: started - enabled: yes + enabled: true diff --git a/roles/php/tasks/main.yml b/roles/php/tasks/main.yml index d802466..e30be31 100644 --- a/roles/php/tasks/main.yml +++ b/roles/php/tasks/main.yml @@ -1,11 +1,13 @@ --- -- ansible.builtin.import_tasks: install.yml +- name: Install PHP + ansible.builtin.import_tasks: install.yml tags: - "role::php" - "role::php:install" -- ansible.builtin.import_tasks: config.yml +- name: Configure PHP + ansible.builtin.import_tasks: config.yml tags: - "role::php" - "role::php:config"