Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
sdarwin committed Jan 17, 2025
1 parent 1a4be91 commit 836c415
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 31 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ jobs:

- name: Lint code.
run: |
set -e
set -xe
yamllint --version
yamllint .
ansible-lint --version
ansible-lint .
molecule:
Expand Down
9 changes: 9 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,12 @@ rules:
line-length:
max: 400
level: warning
# the following is apparently required by ansible-lint
comments:
min-spaces-from-content: 1
comments-indentation: false
braces:
max-spaces-inside: 1
octal-values:
forbid-implicit-octal: true
forbid-explicit-octal: true
6 changes: 4 additions & 2 deletions default.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
---
- hosts: all
- name: Install Clients
hosts: all
# remote_user: ansible
become: true
roles:
# this is the Ansible Galaxy name, you could change it to ansible-munin if directly downloading from github
- {role: 'sdarwin.munin', run_munin_client: true}

- hosts: monitoring-servers
- name: Install Munin Servers
hosts: monitoring-servers
# remote_user: ansible
become: true
roles:
Expand Down
23 changes: 14 additions & 9 deletions playbooks/munin-playbook.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
---
- hosts: all:!windows:!blackbox
- name: Collect Facts
hosts: all:!windows:!blackbox
remote_user: ubuntu
become: true
tasks:
- name: collect facts
setup:
- name: Collect facts
ansible.builtin.setup:

- hosts: windows
- name: Collect Facts (windows)
hosts: windows
tasks:
- name: collect facts
setup:
- name: Collect facts (windows)
ansible.builtin.setup:

- hosts: newservers:!windows
- name: Install Client (new servers)
hosts: newservers:!windows
become: true
roles:
- {role: 'sdarwin.munin', run_munin_client: true}

- hosts: newservers:&windows
- name: Install Client (new servers windows)
hosts: newservers:&windows
roles:
- {role: 'sdarwin.munin', run_munin_client: true}

- hosts: monitoring-servers
- name: Munin Servers
hosts: monitoring-servers
remote_user: ubuntu
become: true
roles:
Expand Down
17 changes: 10 additions & 7 deletions playbooks/munin-server.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
---
- hosts: all:!windows:!blackbox
- name: Collect Facts
hosts: all:!windows:!blackbox
remote_user: ubuntu
become: true
tasks:
- name: collect facts
setup:
- name: Collect facts
ansible.builtin.setup:

- hosts: windows
- name: Collect Facts (windows)
hosts: windows
tasks:
- name: collect facts
setup:
- name: Collect facts
ansible.builtin.setup:

- hosts: monitoring-servers
- name: Monitoring Servers
hosts: monitoring-servers
remote_user: ubuntu
become: true
roles:
Expand Down
6 changes: 3 additions & 3 deletions tasks/client_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
when: ansible_os_family == 'RedHat' and not epel_repofile_result.stat.exists

- name: Install EPEL repo.
ansible.builtin.yum:
ansible.builtin.dnf:
name: "{{ epel_repo_url }}"
state: present
# register: result
Expand All @@ -29,7 +29,7 @@

# To enable powertools, see next step
- name: Install dnf-plugins-core
ansible.builtin.yum:
ansible.builtin.dnf:
name: dnf-plugins-core
state: present
when:
Expand All @@ -56,7 +56,7 @@
failed_when: false

- name: Ensure munin-node is installed (RedHat).
ansible.builtin.yum:
ansible.builtin.dnf:
name: munin-node
state: present
enablerepo: epel
Expand Down
6 changes: 3 additions & 3 deletions tasks/server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
when: ansible_os_family == 'RedHat'

- name: Install EPEL repo.
ansible.builtin.yum:
ansible.builtin.dnf:
name: "{{ epel_repo_url }}"
state: present
register: result
Expand All @@ -26,7 +26,7 @@

# To enable powertools, see next step
- name: Install dnf-plugins-core
ansible.builtin.yum:
ansible.builtin.dnf:
name: dnf-plugins-core
state: present
when:
Expand All @@ -42,7 +42,7 @@
changed_when: false

- name: Install required packages for munin (RedHat).
ansible.builtin.yum:
ansible.builtin.dnf:
name: "{{ munin_packages }}"
state: present
when: ansible_os_family == 'RedHat'
Expand Down
2 changes: 1 addition & 1 deletion tests/test-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@
when: ansible_os_family == 'RedHat'

roles:
- role_under_test
- role_under_test # noqa syntax-check[specific]
2 changes: 1 addition & 1 deletion tests/test.server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
when: ansible_os_family == 'Debian'

roles:
- role_under_test
- role_under_test # noqa syntax-check[specific]
8 changes: 4 additions & 4 deletions tests/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
- user: muninadmin
pass: Password1change
become: true
roles:
- {role: 'role_under_test', run_munin_server: true}
roles: # noqa syntax-check[specific]
- {role: 'role_under_test', run_munin_server: true} # noqa syntax-check[specific]

- hosts: all
become: true
roles:
- {role: 'role_under_test', run_munin_client: true}
roles: # noqa syntax-check[specific]
- {role: 'role_under_test', run_munin_client: true} # noqa syntax-check[specific]

0 comments on commit 836c415

Please sign in to comment.