Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistency changes #55

Merged
merged 3 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .ansible-lint
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
warn_list:
- role-name
- name[play]
- name[casing]
- '503'
- no-handler
9 changes: 4 additions & 5 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 @@ -43,11 +45,8 @@ jobs:
matrix:
include:
- distro: debian8
ansible-version: '<2.10'
- distro: debian9
- distro: debian10
- distro: ubuntu1604
ansible-version: '>=2.9, <2.10'
- distro: ubuntu1604
ansible-version: '>=2.10, <2.11'
- distro: ubuntu1604
Expand All @@ -66,7 +65,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 handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# handlers file
---
- name: restart supervisor

Check warning on line 3 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
service:
ansible.builtin.service:
name: supervisor
state: restarted
when: service_default_state | default('started') == 'started'
4 changes: 2 additions & 2 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
- name: Converge

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

View workflow job for this annotation

GitHub Actions / Lint

role-name[path]

Avoid using paths when importing roles. (../../../)
hosts: all
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.
include_vars: "{{ item }}"
ansible.builtin.include_vars: "{{ item }}"
with_first_found:
- "{{ playbook_dir }}/../../tests/vars/_{{ ansible_distribution_release }}.yml"
- "{{ playbook_dir }}/../../tests/vars/_{{ ansible_distribution | lower }}.yml"
- "{{ playbook_dir }}/../../tests/vars/_default.yml"
- name: include vars

Check warning on line 12 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 }}/../../vars/main.yml"
ansible.builtin.include_vars: "{{ playbook_dir }}/../../vars/main.yml"
roles:
- ../../../
6 changes: 3 additions & 3 deletions molecule/default/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
hosts: all
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.
include_vars: "{{ item }}"
ansible.builtin.include_vars: "{{ item }}"
with_first_found:
- "{{ playbook_dir }}/../../tests/vars/_{{ ansible_distribution_release }}.yml"
- "{{ playbook_dir }}/../../tests/vars/_{{ ansible_distribution | lower }}.yml"
- "{{ playbook_dir }}/../../tests/vars/_default.yml"
- name: include vars

Check warning on line 12 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 }}/../../vars/main.yml"
ansible.builtin.include_vars: "{{ playbook_dir }}/../../vars/main.yml"
- name: include tasks

Check warning on line 14 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"
8 changes: 4 additions & 4 deletions tasks/configure.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tasks file
---
- name: configure | stat 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.
stat:
ansible.builtin.stat:
path: "{{ item }}/"
register: stat_directories
with_items:
Expand All @@ -16,8 +16,8 @@
- supervisor-configure-directories
- supervisor-configure-directories-stat

- name: configure | create directories

Check warning on line 19 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.item }}"
state: directory
owner: "{{ supervisor_system_user }}"
Expand All @@ -29,8 +29,8 @@
- supervisor-configure-directories
- supervisor-configure-directories-create

- name: configure | update configuration file - /etc/default/supervisor

Check warning on line 32 in tasks/configure.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
template:
ansible.builtin.template:
src: "{{ supervisor_default_file.lstrip('/') }}.j2"
dest: "{{ supervisor_default_file }}"
owner: "{{ supervisor_system_user }}"
Expand All @@ -42,7 +42,7 @@
- supervisor-configure-configuration-default-supervisor

- name: configure | update configuration file - /etc/supervisor/supervisord.conf
template:
ansible.builtin.template:
src: "{{ supervisor_configuration_file.lstrip('/') }}.j2"
dest: "{{ supervisor_configuration_file }}"
owner: "{{ supervisor_system_user }}"
Expand Down
4 changes: 2 additions & 2 deletions tasks/groups.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tasks file
---
- name: groups | update group configuration files (present)
template:
ansible.builtin.template:
src: etc/supervisor/conf.d/group.conf.j2
dest: "/etc/supervisor/conf.d/{{ item.key }}.conf"
owner: "{{ supervisor_system_user }}"
Expand All @@ -13,7 +13,7 @@
- supervisor-groups-present

- name: groups | update group configuration files (absent)
file:
ansible.builtin.file:
path: "/etc/supervisor/conf.d/{{ item.key }}.conf"
state: absent
with_dict: "{{ supervisor_groups_absent }}"
Expand Down
6 changes: 3 additions & 3 deletions tasks/install.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tasks file
---
- name: install | dependencies
apt:
ansible.builtin.apt:
name: "{{ supervisor_dependencies }}"
state: "{{ apt_install_state | default('latest') }}"
update_cache: true
Expand All @@ -10,7 +10,7 @@
- supervisor-install-dependencies

- name: install | supervisor (specific version)
pip:
ansible.builtin.pip:
name: supervisor
version: "{{ supervisor_version }}"
executable: "{{ supervisor_pip_executable | string }}"
Expand All @@ -19,7 +19,7 @@
- supervisor-install-specific

- name: install | supervisor (latest version)
pip:
ansible.builtin.pip:
name: supervisor
state: "{{ supervisor_version }}"
executable: "{{ supervisor_pip_executable | string }}"
Expand Down
20 changes: 13 additions & 7 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,53 @@
# tasks file
---
- include: install.yml
- name: install
ansible.builtin.import_tasks: install.yml
tags:
- configuration
- supervisor
- supervisor-install

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

- include: service-initd.yml
- name: service initd
ansible.builtin.import_tasks: service-initd.yml
when: ansible_service_mgr != 'systemd'
tags:
- configuration
- supervisor
- supervisor-configure
- supervisor-configure-initd

- include: service-systemd.yml
- name: service systemd
ansible.builtin.import_tasks: service-systemd.yml
when: ansible_service_mgr == 'systemd'
tags:
- configuration
- supervisor
- supervisor-configure
- supervisor-configure-systemd

- include: programs.yml
- name: programs
ansible.builtin.import_tasks: programs.yml
tags:
- configuration
- supervisor
- supervisor-programs

- include: groups.yml
- name: groups
ansible.builtin.import_tasks: groups.yml
tags:
- configuration
- supervisor
- supervisor-groups

- name: start and enable service
service:
ansible.builtin.service:
name: supervisor
state: "{{ service_default_state | default('started') }}"
enabled: "{{ service_default_enabled | default(true) | bool }}"
Expand Down
4 changes: 2 additions & 2 deletions tasks/programs.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tasks file
---
- name: programs | update program configuration files (present)
template:
ansible.builtin.template:
src: etc/supervisor/conf.d/program.conf.j2
dest: "/etc/supervisor/conf.d/{{ item.key }}.conf"
owner: "{{ supervisor_system_user }}"
Expand All @@ -13,7 +13,7 @@
- supervisor-programs-present

- name: programs | update program configuration files (absent)
file:
ansible.builtin.file:
path: "/etc/supervisor/conf.d/{{ item.key }}.conf"
state: absent
with_dict: "{{ supervisor_programs_absent }}"
Expand Down
2 changes: 1 addition & 1 deletion tasks/service-initd.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tasks file
---
- name: configure | initd | update script
template:
ansible.builtin.template:
src: "{{ supervisor_etc_init_d_file.lstrip('/') }}.j2"
dest: "{{ supervisor_etc_init_d_file }}"
owner: "{{ supervisor_system_user }}"
Expand Down
4 changes: 2 additions & 2 deletions tasks/service-systemd.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tasks file
---
- name: configure | systemd | update script
template:
ansible.builtin.template:
src: "{{ supervisor_etc_systemd_file.lstrip('/') }}.j2"
dest: "{{ supervisor_etc_systemd_file }}"
owner: "{{ supervisor_system_user }}"
Expand All @@ -13,7 +13,7 @@
- supervisor-service-systemd-update

- name: service | systemd | reload
systemd:
ansible.builtin.systemd:
daemon_reload: true
when: _update_systemd_script is changed
tags:
Expand Down
4 changes: 2 additions & 2 deletions tests/tasks/pre.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# pre test file
---
- name: install dependencies
apt:
ansible.builtin.apt:
name:
- "python{{ supervisor_python_version_major is version('3', '>=') | ternary('3', '') }}"
- curl
Expand All @@ -10,7 +10,7 @@
cache_valid_time: "{{ apt_update_cache_valid_time | default(3600) }}"

- name: install pip # noqa command-instead-of-module
shell: >
ansible.builtin.shell: >
curl -sL {{ supervisor_get_pip_url }} | python{{ supervisor_python_version_major | string }} -
changed_when: false
tags:
Expand Down
4 changes: 2 additions & 2 deletions tests/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
become: true
pre_tasks:
- name: include variables
include_vars: "{{ item }}"
ansible.builtin.include_vars: "{{ item }}"
with_first_found:
- "{{ playbook_dir }}/vars/_{{ ansible_distribution_release }}.yml"
- "{{ playbook_dir }}/vars/_{{ ansible_distribution | lower }}.yml"
- "{{ playbook_dir }}/vars/_default.yml"
- name: include tasks
include: "{{ playbook_dir }}/tasks/pre.yml"
ansible.builtin.import_tasks: "{{ playbook_dir }}/tasks/pre.yml"
roles:
- ../../
4 changes: 2 additions & 2 deletions tests/vagrant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
become: true
pre_tasks:
- name: include variables
include_vars: "{{ item }}"
ansible.builtin.include_vars: "{{ item }}"
with_first_found:
- "{{ playbook_dir }}/vars/_{{ ansible_distribution_release }}.yml"
- "{{ playbook_dir }}/vars/_{{ ansible_distribution | lower }}.yml"
- "{{ playbook_dir }}/vars/_default.yml"
- name: include tasks
include: "{{ playbook_dir }}/tasks/pre.yml"
ansible.builtin.import_tasks: "{{ playbook_dir }}/tasks/pre.yml"
roles:
- ../../
Loading