Skip to content

fix ansible-lint errors #146

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ galaxy_info:
description: Java for Linux
company: "Midwestern Mac, LLC"
license: "license (BSD, MIT)"
min_ansible_version: 2.10
min_ansible_version: "2.10"
platforms:
- name: Fedora
versions:
Expand All @@ -30,7 +30,7 @@ galaxy_info:
- jammy
- name: FreeBSD
versions:
- 10.2
- "10.2"
galaxy_tags:
- development
- system
Expand Down
26 changes: 15 additions & 11 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
- name: Include OS-specific variables for Fedora or FreeBSD.
include_vars: "{{ ansible_distribution }}.yml"
ansible.builtin.include_vars: "{{ ansible_distribution }}.yml"
when: ansible_distribution == 'FreeBSD' or ansible_distribution == 'Fedora'

- name: Include OS-specific variables for Amazon.
include_vars: "{{ ansible_distribution }}-{{ ansible_distribution_version}}.yml"
ansible.builtin.include_vars: "{{ ansible_distribution }}-{{ ansible_distribution_version }}.yml"
when: ansible_distribution == 'Amazon'

- name: Include version-specific variables for CentOS/RHEL.
include_vars: "RedHat-{{ ansible_distribution_version.split('.')[0] }}.yml"
ansible.builtin.include_vars: "RedHat-{{ ansible_distribution_version.split('.')[0] }}.yml"
when: >-
ansible_distribution in [
'CentOS',
Expand All @@ -20,34 +20,38 @@
]

- name: Include version-specific variables for Ubuntu.
include_vars: "{{ ansible_distribution }}-{{ ansible_distribution_version.split('.')[0] }}.yml"
ansible.builtin.include_vars: "{{ ansible_distribution }}-{{ ansible_distribution_version.split('.')[0] }}.yml"
when: ansible_distribution == 'Ubuntu'

- name: Include version-specific variables for Debian.
include_vars: "{{ ansible_distribution | title }}-{{ ansible_distribution_version.split('.')[0] }}.yml"
ansible.builtin.include_vars: "{{ ansible_distribution | title }}-{{ ansible_distribution_version.split('.')[0] }}.yml"
when: ansible_os_family == 'Debian'

- name: Define java_packages.
set_fact:
ansible.builtin.set_fact:
java_packages: "{{ __java_packages | list }}"
when: java_packages is not defined

# Setup/install tasks.
- include_tasks: setup-RedHat.yml
- name: Include task setup-RedHat.yml
ansible.builtin.include_tasks: setup-RedHat.yml
when: ansible_os_family == 'RedHat' and ansible_distribution_file_variety == 'RedHat'

- include_tasks: setup-Amazon.yml
- name: Include task setup-Amazon.yml
ansible.builtin.include_tasks: setup-Amazon.yml
when: ansible_distribution == 'Amazon'

- include_tasks: setup-Debian.yml
- name: Include task setup-Debian.yml
ansible.builtin.include_tasks: setup-Debian.yml
when: ansible_os_family == 'Debian'

- include_tasks: setup-FreeBSD.yml
- name: Include task setup-FreeBSD.yml
ansible.builtin.include_tasks: setup-FreeBSD.yml
when: ansible_os_family == 'FreeBSD'

# Environment setup.
- name: Set JAVA_HOME if configured.
template:
ansible.builtin.template:
src: java_home.sh.j2
dest: /etc/profile.d/java_home.sh
mode: 0644
Expand Down
2 changes: 1 addition & 1 deletion tasks/setup-Amazon.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: Ensure Java is installed.
package:
ansible.builtin.package:
name: "{{ java_packages }}"
state: present
4 changes: 2 additions & 2 deletions tasks/setup-Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=863199 and
# https://github.com/geerlingguy/ansible-role-java/issues/64
- name: Ensure 'man' directory exists.
file: # noqa 208
ansible.builtin.file:
path: /usr/share/man/man1
state: directory
mode: 0755
Expand All @@ -11,6 +11,6 @@
- ansible_distribution_major_version | int >= 18

- name: Ensure Java is installed.
apt:
ansible.builtin.apt:
name: "{{ java_packages }}"
state: present
6 changes: 3 additions & 3 deletions tasks/setup-FreeBSD.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
---
- name: Ensure Java is installed.
pkgng:
community.general.pkgng:
name: "{{ java_packages }}"
state: present

- name: Ensure proc is mounted
mount:
ansible.posix.mount:
name: /proc
fstype: procfs
src: proc
opts: rw
state: mounted

- name: Ensure fdesc is mounted
mount:
ansible.posix.mount:
name: /dev/fd
fstype: fdescfs
src: fdesc
Expand Down
2 changes: 1 addition & 1 deletion tasks/setup-RedHat.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: Ensure Java is installed.
package:
ansible.builtin.package:
name: "{{ java_packages }}"
state: present