Skip to content

Commit

Permalink
Merge pull request #62 from Oefenweb/consistency-changes
Browse files Browse the repository at this point in the history
Consistency changes
  • Loading branch information
tersmitten committed Oct 2, 2023
2 parents 5962831 + 6307bc0 commit 2674494
Show file tree
Hide file tree
Showing 20 changed files with 93 additions and 73 deletions.
2 changes: 1 addition & 1 deletion .ansible-lint
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
warn_list:
- role-name
- name[play]
- name[casing]
- no-handler
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ jobs:
python-version: '3.x'

- name: Install test dependencies
run: pip install ansible-lint[community,yamllint]
run: |
pip install ansible-lint
ansible-galaxy install -r requirements.yml
- name: Lint code
run: |
Expand All @@ -42,8 +44,6 @@ jobs:
fail-fast: false
matrix:
include:
- distro: ubuntu1604
ansible-version: '>=2.9, <2.10'
- distro: ubuntu1604
ansible-version: '>=2.10, <2.11'
- distro: ubuntu1604
Expand All @@ -62,7 +62,7 @@ jobs:
python-version: '3.x'

- name: Install test dependencies
run: pip install 'ansible${{ matrix.ansible-version }}' molecule[docker] docker
run: pip install 'ansible${{ matrix.ansible-version }}' molecule-plugins[docker] docker

- name: Run Molecule tests
run: |
Expand Down
2 changes: 1 addition & 1 deletion molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
become: true
pre_tasks:
- name: include vars

Check warning on line 6 in molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 6 in molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 6 in molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 6 in molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 6 in molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 6 in molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
include_vars: "{{ playbook_dir }}/../../tests/vars/main.yml"
ansible.builtin.include_vars: "{{ playbook_dir }}/../../tests/vars/main.yml"
roles:
- ../../../
9 changes: 5 additions & 4 deletions molecule/default/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
become: true
tasks:
- name: include vars

Check warning on line 6 in molecule/default/prepare.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 6 in molecule/default/prepare.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 6 in molecule/default/prepare.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 6 in molecule/default/prepare.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 6 in molecule/default/prepare.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 6 in molecule/default/prepare.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
include_vars: "{{ playbook_dir }}/../../defaults/main.yml"
ansible.builtin.include_vars: "{{ playbook_dir }}/../../defaults/main.yml"
- name: include vars

Check warning on line 8 in molecule/default/prepare.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 8 in molecule/default/prepare.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 8 in molecule/default/prepare.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 8 in molecule/default/prepare.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 8 in molecule/default/prepare.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 8 in molecule/default/prepare.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
include_vars: "{{ playbook_dir }}/../../tests/vars/main.yml"
ansible.builtin.include_vars: "{{ playbook_dir }}/../../tests/vars/main.yml"
- name: include tasks

Check warning on line 10 in molecule/default/prepare.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 10 in molecule/default/prepare.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 10 in molecule/default/prepare.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 10 in molecule/default/prepare.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 10 in molecule/default/prepare.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 10 in molecule/default/prepare.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
include: "{{ playbook_dir }}/../../tests/tasks/pre.yml"
ansible.builtin.import_tasks: "{{ playbook_dir }}/../../tests/tasks/pre.yml"
handlers:
- import_tasks: "{{ playbook_dir }}/../../tests/handlers/main.yml"
- name: include handlers

Check warning on line 13 in molecule/default/prepare.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 13 in molecule/default/prepare.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 13 in molecule/default/prepare.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 13 in molecule/default/prepare.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 13 in molecule/default/prepare.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 13 in molecule/default/prepare.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
ansible.builtin.import_tasks: "{{ playbook_dir }}/../../tests/handlers/main.yml"
3 changes: 2 additions & 1 deletion requirements.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# requirements file
---
collections: []
collections:
- name: community.mysql
2 changes: 1 addition & 1 deletion tasks/chown.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tasks file
---
- name: change owner (and group)

Check warning on line 3 in tasks/chown.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 3 in tasks/chown.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 3 in tasks/chown.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 3 in tasks/chown.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 3 in tasks/chown.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 3 in tasks/chown.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
file:
ansible.builtin.file:
path: "{{ item.path }}"
owner: "{{ item.owner | default('www-data') }}"
group: "{{ item.group | default(item.owner) | default('www-data') }}"
Expand Down
2 changes: 1 addition & 1 deletion tasks/configure.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tasks file
---
- name: configure | create (data) directories

Check warning on line 3 in tasks/configure.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 3 in tasks/configure.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 3 in tasks/configure.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 3 in tasks/configure.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 3 in tasks/configure.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 3 in tasks/configure.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
file:
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: root
Expand Down
14 changes: 8 additions & 6 deletions tasks/core.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tasks file
---
- name: core | check download

Check warning on line 3 in tasks/core.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 3 in tasks/core.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 3 in tasks/core.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 3 in tasks/core.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 3 in tasks/core.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 3 in tasks/core.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
command: >
ansible.builtin.command: >
test -f {{ item.path }}/wp-load.php
register: _check_download
failed_when: false
Expand All @@ -11,17 +11,18 @@
- wordpress-core-is-downloaded

- name: core | download

Check warning on line 13 in tasks/core.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 13 in tasks/core.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 13 in tasks/core.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 13 in tasks/core.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 13 in tasks/core.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check warning on line 13 in tasks/core.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
command: >
ansible.builtin.command: >
wp-cli core download
--allow-root --no-color --path='{{ item.item.path }}'
--locale='{{ item.item.locale | default('en_US') }}'
changed_when: true
with_items: "{{ _check_download.results | default([]) }}"
when: item.rc != 0
tags:
- wordpress-core-downloaded

- name: core | configure
command: >
ansible.builtin.command: >
wp-cli core config
--allow-root --no-color --path='{{ item.path }}'
--dbname='{{ item.dbname }}'
Expand All @@ -36,7 +37,7 @@
- wordpress-core-configure

- name: core | identify installation
command: >
ansible.builtin.command: >
wp-cli core is-installed
--allow-root --no-color --path='{{ item.path }}'
register: _check_installation
Expand All @@ -47,20 +48,21 @@
- wordpress-core-is-installed

- name: core | install
command: >
ansible.builtin.command: >
wp-cli core install
--allow-root --no-color --path='{{ item.item.path }}'
--url='{{ item.item.url }}' --title='{{ item.item.title }}'
--admin_name='{{ item.item.admin_name | default('admin') }}'
--admin_email='{{ item.item.admin_email }}'
--admin_password='{{ item.item.admin_password }}'
changed_when: true
with_items: "{{ _check_installation.results | default([]) }}"
when: item.rc != 0
tags:
- wordpress-core-install

- name: core | check install
command: >
ansible.builtin.command: >
wp-cli core is-installed
--allow-root --no-color --path='{{ item.path }}'
changed_when: false
Expand Down
30 changes: 20 additions & 10 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,70 @@
# tasks file
---
- include: wp-cli.yml
- name: wp-cli
ansible.builtin.import_tasks: wp-cli.yml
tags:
- configuration
- wordpress
- wordpress-wp-cli

- include: core.yml
- name: core
ansible.builtin.import_tasks: core.yml
tags:
- configuration
- wordpress
- wordpress-core

- include: configure.yml
- name: configure
ansible.builtin.import_tasks: configure.yml
tags:
- configuration
- wordpress
- wordpress-configure

- include: wp-cron.yml
- name: wp-cron
ansible.builtin.import_tasks: wp-cron.yml
tags:
- configuration
- wordpress
- wordpress-wp-cron

- include: themes.yml
- name: themes
ansible.builtin.import_tasks: themes.yml
tags:
- configuration
- wordpress
- wordpress-themes

- include: plugins.yml
- name: plugins
ansible.builtin.import_tasks: plugins.yml
tags:
- configuration
- wordpress
- wordpress-plugins

- include: users.yml
- name: users
ansible.builtin.import_tasks: users.yml
tags:
- configuration
- wordpress
- wordpress-users

- include: options.yml
- name: options
ansible.builtin.import_tasks: options.yml
tags:
- configuration
- wordpress
- wordpress-options

- include: queries.yml
- name: queries
ansible.builtin.import_tasks: queries.yml
tags:
- configuration
- wordpress
- wordpress-queries

- include: chown.yml
- name: chown
ansible.builtin.import_tasks: chown.yml
tags:
- configuration
- wordpress
Expand Down
6 changes: 3 additions & 3 deletions tasks/options.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tasks file
---
- name: add options
command: >
ansible.builtin.command: >
wp-cli option
--allow-root --no-color --path='{{ item.0.path }}'
{{ item.1.command }} '{{ item.1.name }}' '{{ item.1.value }}' --autoload={{ 'yes' if item.1.autoload | default(true) else 'no' }}
Expand All @@ -16,7 +16,7 @@
- wordpress-options-add

- name: update options
command: >
ansible.builtin.command: >
wp-cli option
--allow-root --no-color --path='{{ item.0.path }}'
{{ item.1.command }} '{{ item.1.name }}' '{{ item.1.value }}'
Expand All @@ -30,7 +30,7 @@
- wordpress-options-update

- name: delete options
command: >
ansible.builtin.command: >
wp-cli option
--allow-root --no-color --path='{{ item.0.path }}'
{{ item.1.command }} '{{ item.1.name }}'
Expand Down
19 changes: 11 additions & 8 deletions tasks/plugins.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tasks file
---
- name: plugins | identify installation
command: >
ansible.builtin.command: >
wp-cli --allow-root --no-color --path='{{ item.0.path }}' plugin is-installed {{ item.1.name }}
register: _check_installation_plugins
failed_when: false
Expand All @@ -14,9 +14,10 @@
- wordpress-plugins-is-installed-plugin

- name: plugins | install | wordpress.org
command: >
ansible.builtin.command: >
wp-cli --allow-root --no-color --path='{{ item.item.0.path }}'
{{ '--force' if item.item.1.force | default(false) else '' }} plugin install {{ item.item.1.name }}
changed_when: true
with_items: "{{ _check_installation_plugins.results | default([]) }}"
when:
- item.item.1.name
Expand All @@ -28,7 +29,7 @@
- wordpress-plugins-install-plugin-wordpress_org

- name: plugins | install | zip | copy
copy:
ansible.builtin.copy:
src: "{{ item.item.1.zip }}"
dest: "{{ wordpress_data_path }}/plugins/{{ item.item.1.name }}.zip"
owner: root
Expand All @@ -46,9 +47,10 @@
- wordpress-plugins-install-plugin-zip-copy

- name: plugins | install | zip | install
command: >
ansible.builtin.command: >
wp-cli --allow-root --no-color --path='{{ item.item.0.path }}'
{{ '--force' if item.item.1.force | default(false) else '' }} plugin install {{ wordpress_data_path }}/plugins/{{ item.item.1.name }}.zip
changed_when: true
with_items: "{{ _check_installation_plugins.results | default([]) }}"
when:
- item.item.1.name
Expand All @@ -61,9 +63,10 @@
- wordpress-plugins-install-plugin-zip-install

- name: plugins | install | url
command: >
ansible.builtin.command: >
wp-cli --allow-root --no-color --path='{{ item.item.0.path }}'
{{ '--force' if item.item.1.force | default(false) else '' }} plugin install {{ item.item.1.url }}
changed_when: true
with_items: "{{ _check_installation_plugins.results | default([]) }}"
when:
- item.item.1.name
Expand All @@ -75,7 +78,7 @@
- wordpress-plugins-install-plugin-url

- name: plugins | check install
command: >
ansible.builtin.command: >
wp-cli --allow-root --no-color --path='{{ item.0.path }}' plugin is-installed {{ item.1.name }}
changed_when: false
with_subelements:
Expand All @@ -86,7 +89,7 @@
- wordpress-plugins-check-install-plugin

- name: plugins | activate
command: >
ansible.builtin.command: >
wp-cli --allow-root --no-color --path='{{ item.0.path }}' plugin activate {{ item.1.name }}
register: _check_activate_plugin
changed_when: "'Success: Plugin' in _check_activate_plugin.stdout and not 'already' in _check_activate_plugin.stdout"
Expand All @@ -100,7 +103,7 @@
- wordpress-plugins-activate-plugin

- name: plugins | deactivate
command: >
ansible.builtin.command: >
wp-cli --allow-root --no-color --path='{{ item.0.path }}' plugin deactivate {{ item.1.name }}
register: _check_deactivate_plugin
changed_when: "'Success: Plugin' in _check_deactivate_plugin.stdout and not 'already' in _check_deactivate_plugin.stdout"
Expand Down
2 changes: 1 addition & 1 deletion tasks/queries.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tasks file
---
- name: queries | execute queries
command: >
ansible.builtin.command: >
wp-cli db query
--allow-root --no-color --path='{{ item.0.path }}'
"{{ item.1 }}; SELECT ROW_COUNT();"
Expand Down
9 changes: 5 additions & 4 deletions tasks/themes.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tasks file
---
- name: themes | identify installation
command: >
ansible.builtin.command: >
wp-cli --allow-root --no-color --path='{{ item.0.path }}' theme is-installed {{ item.1.name }}
register: _check_installation_themes
failed_when: false
Expand All @@ -14,8 +14,9 @@
- wordpress-themes-is-installed-theme

- name: themes | install
command: >
ansible.builtin.command: >
wp-cli --allow-root --no-color --path='{{ item.item.0.path }}' theme install {{ item.item.1.name }}
changed_when: true
with_items: "{{ _check_installation_themes.results | default([]) }}"
when:
- item.item.1.name
Expand All @@ -24,7 +25,7 @@
- wordpress-themes-install-theme

- name: themes | check install
command: >
ansible.builtin.command: >
wp-cli --allow-root --no-color --path='{{ item.0.path }}' theme is-installed {{ item.1.name }}
changed_when: false
with_subelements:
Expand All @@ -35,7 +36,7 @@
- wordpress-themes-install-theme-check

- name: themes | activate
command: >
ansible.builtin.command: >
wp-cli --allow-root --no-color --path='{{ item.0.path }}' theme activate {{ item.1.name }}
register: _check_activate_theme
changed_when: "'Success: Switched to' in _check_activate_theme.stdout"
Expand Down
Loading

0 comments on commit 2674494

Please sign in to comment.