Created
November 24, 2023 03:22
-
-
Save laurobmb/013dcfc030297c181f4109ea4f3b7df2 to your computer and use it in GitHub Desktop.
Playbook for install jboss eap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - name: JBoss EAP installation | |
| hosts: jboss-host | |
| become: true | |
| tasks: | |
| - name: Install packages | |
| ansible.builtin.dnf: | |
| name: "{{ item }}" | |
| state: present | |
| loop: | |
| - java-1.8.0-openjdk.x86_64 | |
| - unzip | |
| - name: Unzip the downloaded ZIP file | |
| ansible.builtin.unarchive: | |
| src: /tmp/jboss-eap-7.4.0.zip | |
| dest: /opt | |
| remote_src: true | |
| - name: Create JBoss EAP Group | |
| ansible.builtin.group: | |
| name: jboss-group | |
| system: true | |
| state: present | |
| - name: Create JBoss EAP user | |
| ansible.builtin.user: | |
| name: jboss-user | |
| group: jboss-group | |
| password: pa$$w0rd | |
| home: /opt/jboss-eap-7.4 | |
| shell: "/bin/bash" | |
| - name: Change owner & group of JBoss EAP directory | |
| ansible.builtin.file: | |
| path: /opt/jboss-eap-7.4 | |
| owner: jboss-user | |
| group: jboss-group | |
| recurse: true | |
| - name: Edit JBoss EAP configuration file | |
| ansible.builtin.lineinfile: | |
| state: present | |
| path: /opt/jboss-eap-7.4/bin/init.d/jboss-eap.conf | |
| regexp: "{{ item.regexp }}" | |
| line: "{{ item.line }}" | |
| with_items: | |
| #- {regexp: "^# JAVA_HOME=", line: 'JAVA_HOME="/opt/jdk-18.0.2.1"'} | |
| - {regexp: "^# JBOSS_HOME=", line: 'JBOSS_HOME="/opt/jboss-eap-7.4"'} | |
| - {regexp: "^# JBOSS_USER=", line: 'JBOSS_USER=jboss-user'} | |
| - {regexp: "^# JBOSS_MODE=", line: 'JBOSS_MODE=standalone'} | |
| - {regexp: "^# JBOSS_CONFIG=", line: 'JBOSS_CONFIG=standalone.xml'} | |
| - {regexp: "^# JBOSS_OPTS=", line: 'JBOSS_OPTS="-b {{ ansible_default_ipv4.address }} -bmanagment {{ ansible_default_ipv4.address }}"'} | |
| - name: Update /etc/profile with JBOSS_HOME variable | |
| ansible.builtin.lineinfile: | |
| path: /etc/profile | |
| state: present | |
| line: "{{ item }}" | |
| with_items: | |
| - 'export JBOSS_HOME="/opt/jboss-eap-7.4"' | |
| - 'export PATH=$PATH:$JBOSS_HOME/bin' | |
| - name: Configure JBoss EAP as a service | |
| ansible.builtin.command: | |
| chdir: /opt/jboss-eap-7.4 | |
| cmd: "{{ item }}" | |
| with_items: | |
| - cp /opt/jboss-eap-7.4/bin/init.d/jboss-eap.conf /etc/default/ | |
| - cp /opt/jboss-eap-7.4/bin/init.d/jboss-eap-rhel.sh /etc/init.d/ | |
| - restorecon /etc/init.d/jboss-eap-rhel.sh | |
| - chkconfig --add jboss-eap-rhel.sh | |
| changed_when: false | |
| - name: Start JBoss EAP Service | |
| ansible.builtin.service: | |
| name: jboss-eap-rhel | |
| state: started | |
| enabled: true | |
| - name: Liberacao de firewall | |
| ansible.posix.firewalld: | |
| port: "{{ item }}" | |
| permanent: true | |
| state: enabled | |
| immediate: true | |
| loop: | |
| - 8080/tcp | |
| - 8443/tcp | |
| - 9990/tcp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment