diff --git a/Ansible/activemq-artemis/cluster/inventory.ini b/Ansible/activemq-artemis/cluster/inventory.ini index 7dd5dbdc..040074ae 100644 --- a/Ansible/activemq-artemis/cluster/inventory.ini +++ b/Ansible/activemq-artemis/cluster/inventory.ini @@ -1,9 +1,9 @@ [master] -master ansible_host=147.182.174.211 ansible_user=root +master ansible_host=137.184.107.91 ansible_user=root [nodes] -node1 ansible_host=67.207.87.177 ansible_user=root -node2 ansible_host=24.144.106.189 ansible_user=root +node1 ansible_host=192.241.130.39 ansible_user=root +node2 ansible_host=165.22.186.108 ansible_user=root [nfs_server] -node2 ansible_host=24.144.106.189 ansible_user=root \ No newline at end of file +node2 ansible_host=165.22.186.108 ansible_user=root \ No newline at end of file diff --git a/Ansible/activemq-artemis/cluster/vars.yml b/Ansible/activemq-artemis/cluster/vars.yml index 7f02facc..c2cf6c13 100644 --- a/Ansible/activemq-artemis/cluster/vars.yml +++ b/Ansible/activemq-artemis/cluster/vars.yml @@ -5,7 +5,7 @@ java_packages: "Rocky": "java-11-openjdk" "CentOS": "java-11-openjdk" -artemis_version: "2.37.0" +artemis_version: "2.38.0" artemis_url: "https://downloads.apache.org/activemq/activemq-artemis/{{ artemis_version }}/apache-artemis-{{ artemis_version }}-bin.tar.gz" artemis_install_dir: "/opt/artemis" artemis_instance_dir: "/opt/artemis-instance" diff --git a/Ansible/activemq-artemis/install.yml b/Ansible/activemq-artemis/install.yml index e2444e5e..4b720c83 100644 --- a/Ansible/activemq-artemis/install.yml +++ b/Ansible/activemq-artemis/install.yml @@ -16,118 +16,118 @@ - "{{ java_packages[ansible_distribution] }}" state: present - - name: Find Java 11 installation path + - name: Find Java 17 installation path command: "update-alternatives --list java" register: java_alternatives_output - - name: Set default Java version to Java 11 + - name: Set default Java version to Java 17 alternatives: name: java - path: "{{ java_alternatives_output.stdout_lines | select('search', 'java-11') | list | first }}" - - - name: Download ActiveMQ Artemis - get_url: - url: "{{ artemis_url }}" - dest: /tmp/apache-artemis-{{ artemis_version }}-bin.tar.gz - - - name: Extract ActiveMQ Artemis - unarchive: - src: /tmp/apache-artemis-{{ artemis_version }}-bin.tar.gz - dest: /opt - remote_src: yes - - - name: Check if Artemis installation directory exists - stat: - path: "{{ artemis_install_dir }}" - register: artemis_install_dir_stat - - - name: Move extracted Artemis to installation directory - command: mv /opt/apache-artemis-{{ artemis_version }} {{ artemis_install_dir }} - when: not artemis_install_dir_stat.stat.exists - - - name: Create artemis group - group: - name: "{{ artemis_group }}" - state: present - - - name: Create artemis user and assign to group - user: - name: "{{ artemis_user }}" - group: "{{ artemis_group }}" - createhome: yes - shell: /bin/bash - state: present - - - name: Change ownership of Artemis directories - file: - path: "{{ item }}" - state: directory - owner: "{{ artemis_user }}" - group: "{{ artemis_group }}" - recurse: yes - loop: - - "{{ artemis_install_dir }}" - - "{{ artemis_instance_dir }}" - - - name: Ensure log directory exists and permissions are set - file: - path: "{{ artemis_instance_dir }}/log" - state: directory - owner: "{{ artemis_user }}" - group: "{{ artemis_group }}" - mode: '0755' - - - name: Ensure tmp/webapps directory exists and permissions are set - file: - path: "{{ artemis_instance_dir }}/tmp/webapps" - state: directory - owner: "{{ artemis_user }}" - group: "{{ artemis_group }}" - mode: '0755' - recurse: yes - - - name: Set permissions Artemis instance data directory - file: - path: /opt/artemis-instance/data - owner: "{{ artemis_user }}" - group: "{{ artemis_group }}" - state: directory - recurse: yes - - - name: Create Artemis instance - command: "{{ artemis_install_dir }}/bin/artemis create {{ artemis_instance_dir }} --user admin --password {{ artemis_password }} --allow-anonymous --force" - - - name: Deploy Artemis systemd service file - template: - src: artemis.service.j2 - dest: /etc/systemd/system/artemis.service - owner: root - group: root - mode: '0644' - - - name: Reload systemd daemon - command: systemctl daemon-reload - - - name: Enable and start the Artemis service - systemd: - name: artemis - enabled: yes - state: started - - - name: Update bootstrap.xml to bind to 0.0.0.0 - replace: - path: "{{ artemis_instance_dir }}/etc/bootstrap.xml" - regexp: '()' - replace: '\1http://0.0.0.0\3' - - - name: Update Jolokia access to allow all origins - replace: - path: "{{ artemis_instance_dir }}/etc/jolokia-access.xml" - regexp: '.*' - replace: '*://*' - - - name: Restart Artemis service after config changes - systemd: - name: artemis - state: restarted - enabled: yes \ No newline at end of file + path: "{{ java_alternatives_output.stdout_lines | select('search', 'java-17') | list | first }}" + + # - name: Download ActiveMQ Artemis + # get_url: + # url: "{{ artemis_url }}" + # dest: /tmp/apache-artemis-{{ artemis_version }}-bin.tar.gz + + # - name: Extract ActiveMQ Artemis + # unarchive: + # src: /tmp/apache-artemis-{{ artemis_version }}-bin.tar.gz + # dest: /opt + # remote_src: yes + + # - name: Check if Artemis installation directory exists + # stat: + # path: "{{ artemis_install_dir }}" + # register: artemis_install_dir_stat + + # - name: Move extracted Artemis to installation directory + # command: mv /opt/apache-artemis-{{ artemis_version }} {{ artemis_install_dir }} + # when: not artemis_install_dir_stat.stat.exists + + # - name: Create artemis group + # group: + # name: "{{ artemis_group }}" + # state: present + + # - name: Create artemis user and assign to group + # user: + # name: "{{ artemis_user }}" + # group: "{{ artemis_group }}" + # createhome: yes + # shell: /bin/bash + # state: present + + # - name: Change ownership of Artemis directories + # file: + # path: "{{ item }}" + # state: directory + # owner: "{{ artemis_user }}" + # group: "{{ artemis_group }}" + # recurse: yes + # loop: + # - "{{ artemis_install_dir }}" + # - "{{ artemis_instance_dir }}" + + # - name: Ensure log directory exists and permissions are set + # file: + # path: "{{ artemis_instance_dir }}/log" + # state: directory + # owner: "{{ artemis_user }}" + # group: "{{ artemis_group }}" + # mode: '0755' + + # - name: Ensure tmp/webapps directory exists and permissions are set + # file: + # path: "{{ artemis_instance_dir }}/tmp/webapps" + # state: directory + # owner: "{{ artemis_user }}" + # group: "{{ artemis_group }}" + # mode: '0755' + # recurse: yes + + # - name: Set permissions Artemis instance data directory + # file: + # path: /opt/artemis-instance/data + # owner: "{{ artemis_user }}" + # group: "{{ artemis_group }}" + # state: directory + # recurse: yes + + # - name: Create Artemis instance + # command: "{{ artemis_install_dir }}/bin/artemis create {{ artemis_instance_dir }} --user admin --password {{ artemis_password }} --allow-anonymous --force" + + # - name: Deploy Artemis systemd service file + # template: + # src: artemis.service.j2 + # dest: /etc/systemd/system/artemis.service + # owner: root + # group: root + # mode: '0644' + + # - name: Reload systemd daemon + # command: systemctl daemon-reload + + # - name: Enable and start the Artemis service + # systemd: + # name: artemis + # enabled: yes + # state: started + + # - name: Update bootstrap.xml to bind to 0.0.0.0 + # replace: + # path: "{{ artemis_instance_dir }}/etc/bootstrap.xml" + # regexp: '()' + # replace: '\1http://0.0.0.0\3' + + # - name: Update Jolokia access to allow all origins + # replace: + # path: "{{ artemis_instance_dir }}/etc/jolokia-access.xml" + # regexp: '.*' + # replace: '*://*' + + # - name: Restart Artemis service after config changes + # systemd: + # name: artemis + # state: restarted + # enabled: yes \ No newline at end of file diff --git a/Ansible/activemq-artemis/inventory.ini b/Ansible/activemq-artemis/inventory.ini index 6de24606..879afdee 100644 --- a/Ansible/activemq-artemis/inventory.ini +++ b/Ansible/activemq-artemis/inventory.ini @@ -1,4 +1,4 @@ [artemis_servers] -rockylinux ansible_host=137.184.107.91 ansible_user=root -debian ansible_host=192.241.130.39 ansible_user=root -ubuntu ansible_host=165.22.186.108 ansible_user=root \ No newline at end of file +debian ansible_host=157.245.130.56 ansible_user=root +ubuntu ansible_host=134.209.77.220 ansible_user=root +rockylinux ansible_host=142.93.56.4 ansible_user=root \ No newline at end of file diff --git a/Ansible/activemq-artemis/vars.yml b/Ansible/activemq-artemis/vars.yml index 55e1402b..a88b8a4e 100644 --- a/Ansible/activemq-artemis/vars.yml +++ b/Ansible/activemq-artemis/vars.yml @@ -1,10 +1,10 @@ --- java_packages: - "Ubuntu": "openjdk-11-jdk" - "Debian": "openjdk-11-jdk" - "Rocky": "java-11-openjdk" - "CentOS": "java-11-openjdk" -artemis_version: "2.37.0" + "Ubuntu": "openjdk-17-jdk" + "Debian": "openjdk-17-jdk" + "Rocky": "java-17-openjdk" + "CentOS": "java-17-openjdk" +artemis_version: "2.38.0" artemis_url: "https://downloads.apache.org/activemq/activemq-artemis/{{ artemis_version }}/apache-artemis-{{ artemis_version }}-bin.tar.gz" artemis_install_dir: "/opt/artemis" artemis_instance_dir: "/opt/artemis-instance" diff --git a/Ansible/java/install_java.yml b/Ansible/java/install_java.yml index 8598d00c..3e487def 100644 --- a/Ansible/java/install_java.yml +++ b/Ansible/java/install_java.yml @@ -1,30 +1,50 @@ ---- -- hosts: java_servers - become: yes +- name: Install and configure Java 17 on multiple OS families + hosts: all + become: true + vars_files: + - vars.yml + tasks: - - name: Install Java on RHEL-based systems - include_role: - name: geerlingguy.java - vars: - java_packages: - - java-11-openjdk - - java-11-openjdk-devel - when: ansible_os_family == 'RedHat' - - - name: Install Java on Debian-based systems - include_role: - name: geerlingguy.java - vars: - java_packages: - - openjdk-17-jdk - - default-jdk - - default-jre - when: ansible_os_family == 'Debian' - - - name: Install Java on Ubuntu systems - include_role: - name: geerlingguy.java - vars: - java_packages: - - openjdk-11-jdk - when: ansible_distribution == 'Ubuntu' \ No newline at end of file + - name: Install Java 17 on Debian-based systems + ansible.builtin.apt: + name: openjdk-17-jdk + state: present + when: ansible_os_family == "Debian" + + - name: Install Java 17 on RedHat-based systems + ansible.builtin.yum: + name: java-17-openjdk + state: present + when: ansible_os_family == "RedHat" + + - name: Identify Java 17 path on Debian-based systems + ansible.builtin.shell: "update-alternatives --list java | grep 'java-17'" + register: debian_java_path + when: ansible_os_family == "Debian" + + - name: Identify Java 17 path on RedHat-based systems + ansible.builtin.shell: "update-alternatives --list | grep 'java-17'" + register: redhat_java_path + when: ansible_os_family == "RedHat" + + - name: Set Java 17 as the default alternative on Debian-based systems + community.general.alternatives: + name: java + path: "{{ debian_java_path.stdout }}" + priority: 100 + when: ansible_os_family == "Debian" + + - name: Set Java 17 as the default alternative on RedHat-based systems + community.general.alternatives: + name: java + path: "{{ redhat_java_path.stdout }}" + priority: 100 + when: ansible_os_family == "RedHat" + + - name: Verify Java 17 installation + ansible.builtin.command: java -version + register: java_version + + - name: Display Java version + ansible.builtin.debug: + msg: "Java installed successfully. Version: {{ java_version.stdout_lines }}" \ No newline at end of file diff --git a/Ansible/java/inventory.ini b/Ansible/java/inventory.ini index 613f7ecf..6b9ef927 100644 --- a/Ansible/java/inventory.ini +++ b/Ansible/java/inventory.ini @@ -1,4 +1,4 @@ [java_servers] -rockylinux ansible_host=137.184.143.123 ansible_user=root -debian ansible_host=165.22.3.122 ansible_user=root -ubuntu ansible_host=159.223.131.6 ansible_user=root \ No newline at end of file +debian ansible_host=157.245.130.56 ansible_user=root +ubuntu ansible_host=134.209.77.220 ansible_user=root +rockylinux ansible_host=142.93.56.4 ansible_user=root \ No newline at end of file diff --git a/Ansible/java/java_17.yml b/Ansible/java/java_17.yml new file mode 100644 index 00000000..3e487def --- /dev/null +++ b/Ansible/java/java_17.yml @@ -0,0 +1,50 @@ +- name: Install and configure Java 17 on multiple OS families + hosts: all + become: true + vars_files: + - vars.yml + + tasks: + - name: Install Java 17 on Debian-based systems + ansible.builtin.apt: + name: openjdk-17-jdk + state: present + when: ansible_os_family == "Debian" + + - name: Install Java 17 on RedHat-based systems + ansible.builtin.yum: + name: java-17-openjdk + state: present + when: ansible_os_family == "RedHat" + + - name: Identify Java 17 path on Debian-based systems + ansible.builtin.shell: "update-alternatives --list java | grep 'java-17'" + register: debian_java_path + when: ansible_os_family == "Debian" + + - name: Identify Java 17 path on RedHat-based systems + ansible.builtin.shell: "update-alternatives --list | grep 'java-17'" + register: redhat_java_path + when: ansible_os_family == "RedHat" + + - name: Set Java 17 as the default alternative on Debian-based systems + community.general.alternatives: + name: java + path: "{{ debian_java_path.stdout }}" + priority: 100 + when: ansible_os_family == "Debian" + + - name: Set Java 17 as the default alternative on RedHat-based systems + community.general.alternatives: + name: java + path: "{{ redhat_java_path.stdout }}" + priority: 100 + when: ansible_os_family == "RedHat" + + - name: Verify Java 17 installation + ansible.builtin.command: java -version + register: java_version + + - name: Display Java version + ansible.builtin.debug: + msg: "Java installed successfully. Version: {{ java_version.stdout_lines }}" \ No newline at end of file