Skip to content

Commit

Permalink
Fix ansible-lint rule violations
Browse files Browse the repository at this point in the history
  • Loading branch information
ansible-code-bot-stage[bot] committed Dec 13, 2024
1 parent 8a2faf3 commit 86fc270
Show file tree
Hide file tree
Showing 17 changed files with 30 additions and 50 deletions.
1 change: 0 additions & 1 deletion .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ exclude_paths:
- changelogs
skip_list:
- var-naming[no-role-prefix]
...
5 changes: 2 additions & 3 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ default: true
# MD003/heading-style/header-style - Heading style
# This will ensure that the heading format is consistent across all markdown files
MD003:
style: "atx"
style: atx

# MD013/line-length - Line length
# Setting to false to match the yamllint setting
Expand All @@ -17,5 +17,4 @@ MD0046:

MD033:
allowed_elements:
- "br"
...
- br
7 changes: 3 additions & 4 deletions .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ rules:
truthy:
level: error
allowed-values:
- 'true'
- 'false'
- 'on'
...
- "true"
- "false"
- on
3 changes: 1 addition & 2 deletions minecraft/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ force_gamemode: false
gamemode: survival
hardcore_mode: false
max_players: 20
motd: "Minecraft Server"
...
motd: Minecraft Server
1 change: 0 additions & 1 deletion minecraft/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@
state: started
enabled: true
daemon_reload: true
...
5 changes: 2 additions & 3 deletions minecraft/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ galaxy_info:

license: GPL-3.0-only

min_ansible_version: '2.9.10'
min_ansible_version: 2.9.10

platforms:
- name: 'EL'
- name: EL
versions:
- all

galaxy_tags:
- minecraft

dependencies: []
...
5 changes: 2 additions & 3 deletions minecraft/molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
hosts: server
become: true
tasks:
- name: "Include minecraft"
- name: Include minecraft
ansible.builtin.include_role:
name: "minecraft"
...
name: minecraft
3 changes: 1 addition & 2 deletions minecraft/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ provisioner:
inventory:
group_vars:
server:
motd: 'Minecraft server deployed by Molecule'
motd: Minecraft server deployed by Molecule
host_vars:
minecraft-client:
wait_seconds: ${WAIT_SECONDS:-120}
verifier:
name: ansible
...
2 changes: 0 additions & 2 deletions minecraft/molecule/default/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
hosts: client
become: true
tasks:

- name: Install pip
ansible.builtin.dnf:
name: python3-pip
Expand All @@ -12,4 +11,3 @@
- name: Install mcstatus
ansible.builtin.pip:
name: mcstatus
...
12 changes: 5 additions & 7 deletions minecraft/molecule/default/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,30 @@
vars:
address: '{{ hostvars["minecraft-server"].ansible_default_ipv4.address }}'
tasks:

- name: Wait to confirm server is reachable after {{ wait_seconds }}
ansible.builtin.command: 'mcstatus {{ address }} status'
ansible.builtin.command: mcstatus {{ address }} status
changed_when: false
retries: '{{ wait_seconds // 5 }}'
retries: "{{ wait_seconds // 5 }}"
delay: 5
register: mcstatus_status_raw
until: not (mcstatus_status_raw is failed)

- name: Load the mcstatus status json
ansible.builtin.set_fact:
mcstatus_status: '{{ mcstatus_status_raw.stdout | from_yaml }}'
mcstatus_status: "{{ mcstatus_status_raw.stdout | from_yaml }}"

- name: The mcstatus status output
ansible.builtin.debug:
var: mcstatus_status

- name: Query server
ansible.builtin.command: 'mcstatus {{ address }} query'
ansible.builtin.command: mcstatus {{ address }} query
changed_when: false
register: mcstatus_query_raw

- name: Load the mcstatus query json
ansible.builtin.set_fact:
mcstatus_query: '{{ mcstatus_query_raw.stdout | from_yaml }}'
mcstatus_query: "{{ mcstatus_query_raw.stdout | from_yaml }}"

- name: Assert motd is properly set and reported
ansible.builtin.assert:
Expand All @@ -41,4 +40,3 @@
- motd in mcstatus_status.description
vars:
motd: '{{ hostvars["minecraft-server"].motd }}'
...
19 changes: 9 additions & 10 deletions minecraft/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@

- name: Create minecraft directories
ansible.builtin.file:
path: "/opt/{{ item }}"
path: /opt/{{ item }}
state: directory
owner: minecraft
group: minecraft
mode: '0755'
mode: "0755"
with_items:
- minecraft
- minecraft/backup
Expand Down Expand Up @@ -44,7 +44,7 @@

- name: Get most recent release to download
ansible.builtin.uri:
url: '{{ recent_release.url }}'
url: "{{ recent_release.url }}"
method: GET
vars:
recent_release: '{{ (version_manifest.json.versions | selectattr("id", "equalto", version_manifest.json.latest.release) | list).0 }}'
Expand All @@ -57,9 +57,9 @@

- name: Download latest Minecraft release
ansible.builtin.get_url:
url: '{{ latest_version_manifest.json.downloads.server.url }}'
url: "{{ latest_version_manifest.json.downloads.server.url }}"
dest: /opt/minecraft/server/server.jar
mode: '0644'
mode: "0644"

- name: Clone mcrcon repo
ansible.builtin.git:
Expand All @@ -78,27 +78,26 @@
remote_src: true
src: /opt/minecraft/build/mcrcon-code/mcrcon
dest: /opt/minecraft/mcrcon
mode: '0755'
mode: "0755"
owner: minecraft
group: minecraft

- name: Create minecraft systemd file
ansible.builtin.template:
src: minecraft.service.j2
dest: /etc/systemd/system/minecraft.service
mode: '0644'
mode: "0644"
notify: Systemd_reload

- name: Populate minecraft server.properties
ansible.builtin.template:
src: server.properties.j2
mode: '0644'
mode: "0644"
dest: /opt/minecraft/server/server.properties

- name: Agree to the EULA
ansible.builtin.copy:
content: |
eula=true
mode: '0644'
mode: "0644"
dest: /opt/minecraft/server/eula.txt
...
1 change: 0 additions & 1 deletion minecraft/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ package_deps:
- rsync
- git
- gcc
...
3 changes: 1 addition & 2 deletions web/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ galaxy_info:

license: GPL-3.0-only

min_ansible_version: '2.9.10'
min_ansible_version: 2.9.10

platforms:
- name: Fedora
Expand All @@ -20,4 +20,3 @@ galaxy_info:
- test

dependencies: []
...
5 changes: 2 additions & 3 deletions web/molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
- name: Converge
hosts: all
tasks:
- name: "Include web"
- name: Include web
ansible.builtin.include_role:
name: "web"
...
name: web
3 changes: 1 addition & 2 deletions web/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ platforms:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
pre_build_image: true
published_ports:
- 0.0.0.0:8080:80
- "0.0.0.0:8080:80"
provisioner:
name: ansible
config_options:
ssh_connection:
pipelining: false
verifier:
name: ansible
...
2 changes: 0 additions & 2 deletions web/molecule/default/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
hosts: all
gather_facts: false
tasks:

- name: Test that the website is up
ansible.builtin.uri:
url: http://localhost
...
3 changes: 1 addition & 2 deletions web/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@
dest: /var/www/html/index.html
owner: apache
group: apache
mode: '0644'
mode: "0644"

- name: Start httpd service
ansible.builtin.systemd:
name: httpd
enabled: true
state: started
daemon_reload: true
...

0 comments on commit 86fc270

Please sign in to comment.