Skip to content

"tomcat_directory" variable not working properly on Amazon Linux 2023 #56

Open
@frang4

Description

@frang4

"tomcat_directory" variable not working properly on Amazon Linux 2023

I've set tomcat_directory variable with a custom value and it's still installing it on the default folder (/opt/service-name).

Here is my Vagrantfile

Vagrant.configure("2") do |config|
  config.vm.define "server" do |v|
    v.vm.box = "bento/amazonlinux-2023"
    v.vm.box_version = "202404.23.0"
    v.vm.network "forwarded_port", guest: 9090, host: 9090
  end
  config.vm.provision "ansible" do |ansible|
    ansible.galaxy_role_file = "requirements.yml"
    ansible.playbook = "playbooks/java-server.yml"
    # ansible.verbose = "-vvv"
    ansible.limit = 'all'
    ansible.compatibility_mode = "2.0"
    ansible.groups = {
        "java_server" => ["server"]
    }
  end
end

It's not a very complex playbook, it only installs tomcat and an a few java apps. As a requirement these apps must be on a specific folder.

Playbook

---
- name: Set tomcat values
  set_fact:
    my_tomcat_instance: |
      {{ my_java_app_tomcat_options | default({}) | combine({
          "name": my_ava_app_service_name,
          "user": my_java_app_user,
          "group": my_java_app_group,
          "tomcat_directory": my_java_app_home
        })
      }}
  when: my_java_app_tomcat_enabled

- name: Install and configure tomcat
  include_role:
    name: robertdebock.tomcat
  vars:
    tomcat_jre_home: "{{ my_java_app_java_home }}"
    tomcat_instances:
      - "{{ my_tomcat_instance }}"
  when: my_java_app_tomcat_enabled

All variables are being set properly and with the correct values as I've checked them multiple times using stdout. The problem is with the role.

Environment

  • Control node OS: Ubuntu 24.04
  • Control node Ansible version: 2.16.3
  • Managed node OS: Amazon Linux 2023

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions