├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── ansible.cfg ├── files └── cli │ ├── add_datasource.cli │ ├── add_mod_cluster_6.cli │ └── add_mod_cluster_7.cli ├── group_vars ├── all.yml └── dev-eap-group.yml ├── init.sh ├── inventory ├── hosts-dev └── hosts-dev-tower ├── local.yml ├── roles ├── download-binaries │ ├── LICENSE │ ├── README.md │ ├── default │ │ └── main.yml │ ├── meta │ │ └── main.yml │ └── tasks │ │ └── main.yml ├── golden-image │ ├── LICENSE │ ├── README.md │ ├── default │ │ └── main.yml │ ├── files │ │ ├── build_6_4_x.sh │ │ ├── build_7_0_x.sh │ │ ├── cli │ │ │ ├── create_async_logger.cli │ │ │ ├── delete_ExampleDS_6.cli │ │ │ ├── delete_ExampleDS_7.cli │ │ │ ├── delete_console_logger.cli │ │ │ ├── delete_http_interface.cli │ │ │ ├── delete_jmx.cli │ │ │ ├── delete_mail_outbound.cli │ │ │ ├── delete_unsecure_interface_6.cli │ │ │ ├── disable_deployment_scanner.cli │ │ │ ├── disable_jsp_regeneration.cli │ │ │ ├── disable_silent_authentication.cli │ │ │ ├── enable_audit_log.cli │ │ │ ├── enable_native_lib_6.cli │ │ │ ├── enable_rbac.cli │ │ │ ├── enable_web_access_log.cli │ │ │ ├── remove_http_headers.cli │ │ │ ├── remove_patching_history.cli │ │ │ └── update_web_subsystem_6.cli │ │ └── eap_custom_modules │ │ │ └── ojdbc_modules │ │ │ └── system │ │ │ └── layers │ │ │ └── base │ │ │ └── com │ │ │ └── oracle │ │ │ └── main │ │ │ ├── module.xml │ │ │ └── ojdbc6.jar │ └── tasks │ │ └── main.yml ├── java-demo-app │ ├── LICENSE │ ├── README.md │ ├── default │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── vars │ │ └── main.yml └── requirements.yml ├── site.yml └── vagrant ├── README.md ├── Vagrantfile ├── nexus ├── nexus.service ├── nexus_2.13.yml └── nexus_3.yml └── tower └── tower.yml /.gitignore: -------------------------------------------------------------------------------- 1 | roles/golden-image-build/files/eap_custom_modules/ojdbc_modules/system/layers/base/com/oracle/main/ojdbc6.jar 2 | roles/Maarc.* 3 | roles/sabre1041.* 4 | vagrant/.vagrant 5 | vagrant/tower/license 6 | gi-build.log 7 | *.retry 8 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | language: python 3 | python: "2.7" 4 | 5 | env: 6 | matrix: 7 | - ANSIBLE_VERSION=2.0.2.0 8 | - ANSIBLE_VERSION=2.1.1.0 9 | 10 | install: 11 | - pip install ansible==$ANSIBLE_VERSION 12 | - ansible-galaxy install -r roles/requirements.yml -p ./roles 13 | - echo 'localhost' > inv 14 | 15 | script: 16 | 17 | # Syntax check 18 | - ansible-playbook -i inv local.yml --syntax-check 19 | - ansible-playbook -i inv site.yml --syntax-check 20 | 21 | # List tasks 22 | - ansible-playbook -i inv local.yml --list-tasks 23 | - ansible-playbook -i inv site.yml --list-tasks 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Marc Zottner & Roeland van de Pol 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | JBoss middleware orchestration with Ansible [![Build Status](https://travis-ci.org/Maarc/ansible_middleware_soe.svg?branch=master)](https://travis-ci.org/Maarc/ansible_middleware_soe) 2 | =========================================== 3 | 4 | This project is an example showing how to implement a Red Hat middleware Standard Operating Environment (SOE) using Ansible and Ansible Tower. 5 | 6 | Prerequisites 7 | ------------- 8 | 9 | To get started quickly with your SOE, you will need to install Ansible, Vagrant and VirtualBox locally. In addition to this, you will have to download and copy the Red Hat JBoss binaries from the [Red Hat Customer Support Portal](https://www.redhat.com/wapps/sso/login.html?redirect=https%3A%2F%2Faccess.redhat.com%2Fjbossnetwork%2Frestricted%2FlistSoftware.html) 10 | 11 | *1) Install [Vagrant](https://www.vagrantup.com/)* 12 | 13 | Please follow [those instructions](https://www.vagrantup.com/docs/installation/) to setup [Vagrant](https://www.vagrantup.com/). 14 | 15 | *2) Install [Ansible](https://www.ansible.com/)* 16 | 17 | * *Centos / RHEL / Other* - Please follow [the official](https://docs.ansible.com/ansible/intro_installation.html) instructions. 18 | * *MacOS* - Please follow [those instructions](https://valdhaus.co/writings/ansible-mac-osx/). 19 | 20 | *3) Install [Maven](https://maven.apache.org/)* 21 | 22 | * *Centos / RHEL / Other* - Please install the `maven` package probably available for your platform. 23 | * *MacOS* - Please follow [those instructions](https://maven.apache.org/install.html). 24 | 25 | *4) Retrieve the required Red Hat JBoss binaries* 26 | 27 | You have to choose one out of the two following options to download the Red Hat JBoss binaries: 28 | 29 | 4.1) Re-using locally downloaded binaries 30 | 31 | Please download the following Red Hat JBoss binaries from the [Red Hat Customer Support Portal](https://www.redhat.com/wapps/sso/login.html?redirect=https%3A%2F%2Faccess.redhat.com%2Fjbossnetwork%2Frestricted%2FlistSoftware.html) in a local directory of your choice (for example `/opt/tools/jboss/bin`). 32 | 33 | * jboss-eap-6.4.0.zip 34 | * jboss-eap-6.4.9-patch.zip 35 | * jboss-eap-6.4.11-patch.zip 36 | * jboss-eap-native-6.4.0-RHEL7-x86_64.zip 37 | * jboss-eap-7.0.0.zip 38 | * jboss-eap-7.0.3-patch.zip 39 | * jws-application-servers-3.0.3-RHEL7-x86_64.zip 40 | * jws-httpd-3.0.3-RHEL.zip 41 | 42 | ... and edit the `group_vars/all-yml` file to set the `local_rh_bin_dir` to the folder containing your zip files. For example: 43 | 44 | local_rh_bin_dir: /opt/tools/jboss/bin 45 | 46 | 47 | 4.2) Use your your Red Hat Customer Support Portal account to automatically download the binaries 48 | 49 | Edit the `group_vars/all-yml` file to set your `rhn_username` and `rhn_password` and comment out the `local_rh_bin_dir` variable. For example: 50 | 51 | #local_rh_bin_dir: /opt/tools/jboss/bin 52 | rhn_username: MY_ACCESS_REDHAT_COM_USERNAME 53 | rhn_password: MY_ACCESS_REDHAT_COM_PASSWORD 54 | 55 | 56 | *5) (optional) Ansible Tower license* 57 | 58 | If you wish to use Ansible Tower, you will need ... 59 | 60 | * to obtain a valid [Ansible Tower license file](https://www.ansible.com/license) 61 | * to save the license file as "./vagrant/tower/license" 62 | 63 | 64 | Setup 65 | ----- 66 | 67 | You have two options to provision your environment: 68 | 69 | a) Without using Ansible Tower 70 | 71 | $ ./init.sh 72 | 73 | b) Using Ansible Tower 74 | 75 | $ ./init.sh tower 76 | 77 | In both cases, it will take a while to create all virtual machines and provision them. 78 | 79 | 80 | Ansible Tower 81 | ------------- 82 | 83 | After having intialized the JBoss middleware Standard Operating Environment (using `./init.sh tower`), you should follow these steps to provision the virtual machines. 84 | 85 | Using the credentials displayed at the end of the installation, you will be able to log into Ansible Tower (https://192.168.0.200/) and there: 86 | 87 | 1. Import the current git repository as a project 88 | - name: ansible_middleware_soe 89 | - scm type: git 90 | - scm url: git@github.com:Maarc/ansible_middleware_soe.git 91 | - scm branch: master 92 | 93 | 2. Define a job template 94 | - name: Roll-out JBoss middleware 95 | - job-type: Run 96 | - inventory: Development virtual machines 97 | - project: ansible_middleware_soe 98 | - playbook: site.yml 99 | - machine credential: Vagrant virtual machines (ssh) 100 | 101 | 3. Run the defined job template 102 | 103 | 104 | Test 105 | ---- 106 | 107 | 108 | The deployed test applications can be accessed over the following URLs: 109 | 110 | * Ticket-monster 111 | - host-dev-01 (load-balancer): http://192.168.0.101/ticket-monster/ 112 | - host-dev-02 (JBoss EAP): http://192.168.0.102:8080/ticket-monster/ 113 | - host-dev-03 (JBoss EAP) http://192.168.0.103:8080/ticket-monster/ 114 | 115 | * Petclinic 116 | - host-dev-01 (load-balancer): http://192.168.0.101/petclinic/ 117 | - host-dev-02 (JBoss EAP): http://192.168.0.102:9080/petclinic/ 118 | - host-dev-03 (JBoss EAP) http://192.168.0.103:9080/petclinic/ 119 | 120 | * Jenkins 121 | - host-dev-01 (load-balancer): http://192.168.0.101/jenkins/ 122 | - host-dev-02 (JBoss EAP): http://192.168.0.102:10080/jenkins/ 123 | - host-dev-03 (JBoss EAP) http://192.168.0.103:10080/jenkins/ 124 | 125 | * tomcat-sample 126 | - host-dev-01 (JWS): http://192.168.0.101:8000/tomcat-sample/ 127 | 128 | 129 | Project structure 130 | ----------------- 131 | 132 | 133 | Here is a brief description of the structure of this projects: 134 | 135 | * **files/cli** contains the CLI files used for configuring JBoss EAP. 136 | * **group_vars** contains the ansible [group variables](https://docs.ansible.com/ansible/playbooks_variables.html). 137 | * **inventory** contains the [ansible inventory](https://docs.ansible.com/ansible/intro_inventory.html). "hosts-dev" lists the host for the development environment. At the same level, you can add a "host-int" or "host-prod" file listing your orchestrated hosts in the integration or production staging environments. 138 | * **roles** contains the main roles of this SOE implementations: 139 | - **roles/download-binaries** retrieves the Red Hat binaries. 140 | - **roles/golden-image** creates Red Hat JBoss golden images. 141 | - **roles/java-demo-app** downloads and builds the demo Java applications. 142 | - **roles/Maarc.rh-jboss-common** is the core role for all managed hosts. 143 | - **roles/Maarc.rh-jboss-eap** is the basis role for JBoss EAP instances. The role is quite parametrizable, registers the instance as a service and supports multiple instances on a same host. 144 | - **roles/Maarc.rh-jboss-web-server-httpd** is a role installing a JWS apache (HTTPD) server. 145 | - **roles/Maarc.rh-jboss-web-server-tomcat** is a role installing a JWS Tomcat server. 146 | - **roles/sabre1041.redhat-csp-download** is a role downloading Red Hat JBoss binaries from the customer portal. 147 | * **vagrant/Vagrantfile** contains a description of the virtual machines managed by vagrant. 148 | 149 | 150 | 151 | Troubleshooting 152 | --------------- 153 | 154 | If you encounter an error looking like ... 155 | 156 | fatal: [host-dev-eap-01]: UNREACHABLE! => {"changed": false, "msg": "SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to help diagnose the issue", "unreachable": true} 157 | 158 | ... either your virtual machine is down and you need to start it: 159 | 160 | cd vagrant; vagrant up host-dev-01; cd .. 161 | 162 | ... or restart it ... 163 | 164 | cd vagrant; vagrant reload host-dev-01; cd .. 165 | 166 | ... or you need to cleanup your .ssh/known_hosts file. For example like that: 167 | 168 | mv -n ~/.ssh/known_hosts{,_$(date +%s).orig} 169 | -------------------------------------------------------------------------------- /ansible.cfg: -------------------------------------------------------------------------------- 1 | [defaults] 2 | # pipelining = True 3 | hostfile = inventory/hosts-dev 4 | host_key_checking = False 5 | -------------------------------------------------------------------------------- /files/cli/add_datasource.cli: -------------------------------------------------------------------------------- 1 | /subsystem=datasources/data-source=ExampleDS/:add(jndi-name="java:jboss/datasources/ExampleDS",driver-name="h2",connection-url="jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE",password="sa",enabled="true",user-name="sa",use-java-context=true) 2 | -------------------------------------------------------------------------------- /files/cli/add_mod_cluster_6.cli: -------------------------------------------------------------------------------- 1 | # 2 | # mod_cluster registration - JBoss EAP 6 3 | # 4 | # Note: this can be improved to remove the IP (https://support.ansible.com/hc/en-us/articles/201957887-How-to-loop-over-a-list-of-hosts-in-a-group-inside-of-a-template-) 5 | /subsystem=modcluster/mod-cluster-config=configuration:write-attribute(name=advertise, value=false) 6 | /subsystem=modcluster/mod-cluster-config=configuration:write-attribute(name=proxy-list,value="192.168.0.101:6666") 7 | -------------------------------------------------------------------------------- /files/cli/add_mod_cluster_7.cli: -------------------------------------------------------------------------------- 1 | # 2 | # mod_cluster registration - JBoss EAP 7 3 | # 4 | # Note: this can be improved to remove the IP (https://support.ansible.com/hc/en-us/articles/201957887-How-to-loop-over-a-list-of-hosts-in-a-group-inside-of-a-template-) 5 | /socket-binding-group=standard-sockets/remote-destination-outbound-socket-binding=proxy_mod_cluster/:add(host=192.168.0.101,port=6666) 6 | /subsystem=modcluster/mod-cluster-config=configuration/:write-attribute(name=proxies,value=["proxy_mod_cluster"]) 7 | -------------------------------------------------------------------------------- /group_vars/all.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # =========== Red Hat JBoss binaries download =========== 4 | 5 | ## You have to choose one out of the two following options to download the Red Hat JBoss binaries: 6 | 7 | # 1) Point to a local directory containing all required Red Hat binaries 8 | local_rh_bin_dir: /opt/tools/jboss/bin 9 | 10 | # 2) Set your Red Hat Network (https://access.redhat.com) username and password for downloading the required binaries 11 | #rhn_username: MY_ACCESS_REDHAT_COM_USERNAME 12 | #rhn_password: MY_ACCESS_REDHAT_COM_PASSWORD 13 | 14 | # =========== Other =========== 15 | 16 | # User and group of the user used to connect to the remote host 17 | remote_user: "vagrant" 18 | 19 | # Local directory used for storing all binaries used by the SOE 20 | base_repo_dir: /tmp/mw_repo 21 | 22 | # Local directory containing all Java applications 23 | app_dir: "{{ base_repo_dir }}/java_apps/bin" 24 | # Local directory containing all installation binaries 25 | bin_dir: "{{ base_repo_dir }}/rh_jboss_binaries" 26 | # Local directory containing all golden images 27 | gi_dir: "{{ base_repo_dir }}/rh_jboss_golden_images" 28 | # Local directory containing the used CLI files 29 | cli_dir: "{{ playbook_dir }}/files/cli" 30 | 31 | 32 | # =========== Nexus connectivity =========== 33 | 34 | nexus_user: "admin" 35 | nexus_password: "admin123" 36 | nexus_host: 192.168.0.100:8081 37 | nexus_repository_id: "releases" 38 | 39 | 40 | # =========== Default variables =========== 41 | 42 | # This section contains a couple of variables that could be overridden with their default value. 43 | 44 | # Directory containing all downloaded artifacts on the remote host 45 | #download_dir: '/tmp' 46 | 47 | # Timezone for the hosts and the logs 48 | #timezone: Europe/Berlin 49 | 50 | # Used java version: Java 8 JDK. See recommendation https://access.redhat.com/solutions/18259 51 | #java_pkg_name: java-1.8.0-openjdk-devel 52 | -------------------------------------------------------------------------------- /group_vars/dev-eap-group.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # All instances use the specified JBoss EAP golden image 4 | jboss_eap_golden_image_name: 'jboss-eap-6.4.10_GI' 5 | 6 | # Setting IP binding for all JBoss EAP instances 7 | jboss_eap_bind_ip_address_public: "{{ ansible_eth1.ipv4.address }}" 8 | jboss_eap_bind_ip_address_management: "{{ ansible_eth1.ipv4.address }}" 9 | -------------------------------------------------------------------------------- /init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Initializes the Red Hat JBoss middleware SOE 3 | 4 | #set -x 5 | 6 | CURRENT=$(pwd) 7 | 8 | IS_NEXUS=false 9 | IS_TOWER=false 10 | 11 | for var in "$@" 12 | do 13 | case $var in 14 | "nexus") 15 | IS_NEXUS=true 16 | ;; 17 | "tower") 18 | IS_TOWER=true 19 | ;; 20 | esac 21 | done 22 | 23 | echo " >>> Retrieve required Ansible roles" 24 | ansible-galaxy install -r roles/requirements.yml -p roles --force 25 | 26 | echo " >>> Prepare locale file structure, build applications and golden images" 27 | ansible-playbook local.yml 28 | 29 | # Backup and removes the ssh known_hosts (prevents issues with ssh) 30 | mv -n ~/.ssh/known_hosts{,_$(date +%s).orig} 31 | 32 | echo " >>> Create and start the virtual machine(s)" 33 | cd ${CURRENT}/vagrant 34 | vagrant up host-dev-01 35 | vagrant up host-dev-02 36 | vagrant up host-dev-03 37 | 38 | if $IS_NEXUS; then 39 | vagrant up nexus 40 | fi 41 | 42 | if $IS_TOWER ; then 43 | vagrant up tower 44 | else 45 | echo " >>> Provision the virtual machine(s) with ansible" 46 | cd ${CURRENT} 47 | ansible-playbook site.yml 48 | fi 49 | 50 | if $IS_TOWER ; then 51 | echo "=================================================================================" 52 | echo " Congratulations, you just prepared your Red Hat JBoss middleware successfully!" 53 | echo " " 54 | echo " To provision your virtual machines, please log into Ansible Tower (https://192.168.0.200/)" 55 | echo " using the previously displayed user and password." 56 | echo " " 57 | echo "=================================================================================" 58 | else 59 | echo "=================================================================================" 60 | echo " Congratulations, you just setup your Red Hat JBoss middleware successfully!" 61 | echo " " 62 | echo " Check the running applications here:" 63 | echo " http://192.168.0.101/ticket-monster/" 64 | echo " http://192.168.0.101/petclinic/" 65 | echo " http://192.168.0.101/jenkins/" 66 | echo " " 67 | echo " Execute this command for running Ansible again:" 68 | echo " $ ansible-playbook site.yml" 69 | echo "=================================================================================" 70 | fi 71 | -------------------------------------------------------------------------------- /inventory/hosts-dev: -------------------------------------------------------------------------------- 1 | host-dev-01 ansible_ssh_host=192.168.0.101 ansible_ssh_user="vagrant" ansible_ssh_private_key_file="~/.vagrant.d/insecure_private_key" 2 | host-dev-02 ansible_ssh_host=192.168.0.102 ansible_ssh_user="vagrant" ansible_ssh_private_key_file="~/.vagrant.d/insecure_private_key" 3 | host-dev-03 ansible_ssh_host=192.168.0.103 ansible_ssh_user="vagrant" ansible_ssh_private_key_file="~/.vagrant.d/insecure_private_key" 4 | 5 | [dev:children] 6 | dev-eap-group 7 | dev-jws-group 8 | 9 | [dev-jws-group] 10 | host-dev-01 11 | 12 | [dev-eap-group] 13 | host-dev-02 14 | host-dev-03 15 | -------------------------------------------------------------------------------- /inventory/hosts-dev-tower: -------------------------------------------------------------------------------- 1 | host-dev-01 ansible_host=192.168.0.101 2 | host-dev-02 ansible_host=192.168.0.102 3 | host-dev-03 ansible_host=192.168.0.103 4 | 5 | [dev:children] 6 | dev-eap-group 7 | dev-jws-group 8 | 9 | [dev-jws-group] 10 | host-dev-01 11 | 12 | [dev-eap-group] 13 | host-dev-02 14 | host-dev-03 15 | -------------------------------------------------------------------------------- /local.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Setup the controller machine 4 | - hosts: localhost 5 | connection: local 6 | vars: 7 | required_software: 8 | 9 | # Red Hat JBoss EAP 10 | - { id: '37393', name: 'jboss-eap-6.4.0' } 11 | #- { id: '44441', name: 'jboss-eap-6.4.8-patch' } 12 | - { id: '45371', name: 'jboss-eap-6.4.9-patch' } 13 | # Note: jboss-eap-6.4.10-patch requires jboss-eap-6.4.9-patch 14 | #- { id: '46371', name: 'jboss-eap-6.4.10-patch' } 15 | # Note: jboss-eap-6.4.11-patch requires jboss-eap-6.4.9-patch 16 | - { id: '47611', name: 'jboss-eap-6.4.11-patch' } 17 | - { id: '37083', name: 'jboss-eap-native-6.4.0-RHEL7-x86_64' } 18 | - { id: '43891', name: 'jboss-eap-7.0.0' } 19 | #- { id: '45601', name: 'jboss-eap-7.0.1-patch' } 20 | #- { id: '46431', name: 'jboss-eap-7.0.2-patch' } 21 | - { id: '47721', name: 'jboss-eap-7.0.3-patch' } 22 | 23 | # Red Hat JBoss Web Server 24 | - { id: '44391', name: 'jws-application-servers-3.0.3-RHEL7-x86_64' } 25 | - { id: '44321', name: 'jws-httpd-3.0.3-RHEL7-x86_64' } 26 | 27 | golden_images_eap_6: 28 | - 6.4.11 29 | 30 | golden_images_eap_7: 31 | - 7.0.3 32 | 33 | roles: 34 | # Import necessary for the "download-binaries" role. 35 | - {role: "sabre1041.redhat-csp-download"} 36 | 37 | # Download the Red Hat software. 38 | - {role: "download-binaries"} 39 | 40 | # Create golden images. 41 | - {role: "golden-image"} 42 | 43 | # Build some sample applications. 44 | - {role: "java-demo-app"} 45 | -------------------------------------------------------------------------------- /roles/download-binaries/LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /roles/download-binaries/README.md: -------------------------------------------------------------------------------- 1 | Ansible role: "download-binaries" 2 | ================================= 3 | 4 | Description 5 | ----------- 6 | 7 | This role downloads all required libraries for the Red Hat middleware SOE and creates the local required file structure used for the software repository. 8 | 9 | 10 | Requirements 11 | ------------ 12 | 13 | This role has been tested on Ansible 2.0.2.0 and 2.1.1.0. It requires Red Hat Enterprise Linux 7. 14 | 15 | 16 | Dependencies 17 | ------------ 18 | 19 | `sabre1041.redhat-csp-download` 20 | 21 | 22 | License 23 | ------- 24 | 25 | [Apache 2.0](./LICENSE) 26 | 27 | 28 | Authors Information 29 | ------------------ 30 | 31 | * [Marc Zottner](https://github.com/Maarc) 32 | * [Roeland van de Pol](https://github.com/roelandpol) 33 | -------------------------------------------------------------------------------- /roles/download-binaries/default/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | required_software: 4 | # This is an example that should be overridden. 5 | # https://access.redhat.com/jbossnetwork/restricted/softwareDetail.html?softwareId=SOFTWARE_ID&downloadType=distributions 6 | - { id: 'SOFTWARE_ID', name: 'FILE_NAME_WITHOUT_EXTENSION' } 7 | -------------------------------------------------------------------------------- /roles/download-binaries/meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | galaxy_info: 3 | author: Marc Zottner 4 | license: license (Apache) 5 | min_ansible_version: 2.1.1.0 6 | platforms: 7 | - name: EL 8 | versions: 9 | - 7 10 | 11 | allow_duplicates: no 12 | 13 | # Empty as otherwise the Galaxy import does not work as expected. 14 | dependencies: 15 | - role: sabre1041.redhat-csp-download 16 | -------------------------------------------------------------------------------- /roles/download-binaries/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Check "base_repo_dir" variable 4 | fail: msg="This role requires 'base_repo_dir' to be set and non empty." 5 | when: base_repo_dir is not defined or base_repo_dir == '' 6 | 7 | - name: Register "local_rh_bin_dir" directory 8 | when: local_rh_bin_dir is defined 9 | stat: path={{ local_rh_bin_dir }} 10 | register: d 11 | 12 | - name: Check "local_rh_bin_dir" or "rhn_username" & "rhn_password" requirement 13 | fail: msg="Please set 'local_rh_bin_dir' to a valid location OR enter your 'rhn_username' and 'rhn_password'. Please refer to the README file for more information." 14 | when: (local_rh_bin_dir is not defined or d.stat.isdir is not defined or not d.stat.isdir) and ((rhn_username is not defined or rhn_username == '') or (rhn_username is not defined or rhn_username == '')) 15 | 16 | - name: Create "base_repo_dir" directory 17 | file: 18 | path: "{{ item }}" 19 | state: directory 20 | mode: "0750" 21 | with_items: 22 | - "{{ base_repo_dir }}" 23 | - "{{ bin_dir }}" 24 | 25 | - name: Copy Red Hat JBoss binaries to the binaries directory 26 | when: d.stat.isdir is defined and d.stat.isdir 27 | copy: 28 | src: "{{ local_rh_bin_dir }}/{{ item.name }}.zip" 29 | dest: "{{ bin_dir }}/{{ item.name }}.zip" 30 | with_items: "{{ required_software }}" 31 | 32 | - name: Download Red Hat JBoss binaries from the CSP portal (could take a while ...) 33 | when: rhn_username is defined and rhn_username != '' and rhn_username is defined and rhn_username != '' 34 | redhat_csp_download: 35 | username: "{{ rhn_username }}" 36 | password: "{{ rhn_password }}" 37 | url: "https://access.redhat.com/jbossnetwork/restricted/softwareDownload.html?softwareId={{ item.id }}" 38 | dest: "{{ bin_dir }}/{{ item.name }}.zip" 39 | with_items: "{{ required_software }}" 40 | -------------------------------------------------------------------------------- /roles/golden-image/LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /roles/golden-image/README.md: -------------------------------------------------------------------------------- 1 | Ansible role: "golden-image" 2 | ================================= 3 | 4 | Description 5 | ----------- 6 | 7 | This role builds company specific Red Hat JBoss EAP distributions (called "golden images") used by the [ansible middleware SOE](https://github.com/Maarc/ansible_middleware_soe). 8 | 9 | 10 | Requirements 11 | ------------ 12 | 13 | This role has been tested on Ansible 2.0.2.0 and 2.1.1.0. It requires Red Hat Enterprise Linux 7. 14 | 15 | 16 | Dependencies 17 | ------------ 18 | 19 | None. 20 | 21 | 22 | License 23 | ------- 24 | 25 | [Apache 2.0](./LICENSE) 26 | 27 | 28 | Authors Information 29 | ------------------ 30 | 31 | * [Marc Zottner](https://github.com/Maarc) 32 | * [Roeland van de Pol](https://github.com/roelandpol) 33 | -------------------------------------------------------------------------------- /roles/golden-image/default/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | golden_images_eap_6: 4 | - 6.4.11 5 | 6 | golden_images_eap_7: 7 | - 7.0.3 8 | -------------------------------------------------------------------------------- /roles/golden-image/files/build_6_4_x.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # This script builds the company specific Red Hat JBoss EAP gold-master distribution for EAP 6.4.x 4 | # 5 | 6 | if [ "$#" -ne 5 ] 7 | then 8 | echo "Usage: $0 " 9 | echo "Example: $0 build.log 6.4.11 /tmp/mw_repo/rh_jboss_binaries /tmp/mw_repo/conf /tmp/mw_repo/rh_jboss_golden_images" 10 | exit 1 11 | fi 12 | 13 | readonly VERSION="jboss-eap-${2}" 14 | readonly TARGET_EAP="${VERSION}_GI" 15 | readonly DIR_IN_ZIP="jboss-eap-6.4" 16 | readonly FILE_EAP_BASIS="jboss-eap-6.4.0.zip" 17 | readonly DIR_CONF="$5" 18 | readonly DIR_SOURCE="${3}" 19 | readonly DIR_MODULES="${DIR_CONF}/eap_custom_modules" 20 | readonly FILE_SOURCE_EAP="${DIR_SOURCE}/${FILE_EAP_BASIS}" 21 | readonly FILE_SOURCE_EAP_PATCH="${DIR_SOURCE}/${VERSION}-patch.zip" 22 | readonly FILE_SOURCE_EAP_NATIVE="${DIR_SOURCE}/jboss-eap-native-6.4.0-RHEL7-x86_64.zip" 23 | 24 | readonly DIR_TARGET="${4}/target" 25 | readonly FILE_LOG="${1}" 26 | readonly SEPARATOR="===============================================================================================" 27 | readonly DIR_TARGET_EAP="${DIR_TARGET}/${TARGET_EAP}" 28 | readonly FILE_TARGET_EAP="${TARGET_EAP}.zip" 29 | readonly FILE_CLI="${DIR_TARGET}/build.cli" 30 | readonly CMD_JBOSS_CLI="${DIR_TARGET_EAP}/bin/jboss-cli.sh" 31 | 32 | echo "$SEPARATOR\n Building ${VERSION} GI \n$SEPARATOR\n" 33 | 34 | echo "DIR_CONF: $DIR_CONF" >> ${FILE_LOG} 35 | echo "FILE_CLI: $FILE_CLI" >> ${FILE_LOG} 36 | echo "DIR_MODULES: $DIR_MODULES" >> ${FILE_LOG} 37 | 38 | declare COMMAND 39 | 40 | export JBOSS_HOME="${DIR_TARGET_EAP}" 41 | 42 | echo "\n[${VERSION}] Unpack JBoss EAP binaries (${FILE_EAP_BASIS}) \n${SEPARATOR}" >> "${FILE_LOG}" 43 | 44 | #set -x 45 | 46 | COMMAND="rm -Rf ${DIR_TARGET}; mkdir -p ${DIR_TARGET}" 47 | echo ${COMMAND} >> "${FILE_LOG}" 48 | eval ${COMMAND} 49 | 50 | COMMAND="unzip ${FILE_SOURCE_EAP} -d ${DIR_TARGET} 2>> ${FILE_LOG} 1>> /dev/null" 51 | echo ${COMMAND} >> "${FILE_LOG}" 52 | eval ${COMMAND} 53 | 54 | COMMAND="mv ${DIR_TARGET}/${DIR_IN_ZIP} ${DIR_TARGET_EAP} 2>&1 >> ${FILE_LOG}" 55 | echo ${COMMAND} >> "${FILE_LOG}" 56 | eval ${COMMAND} 57 | 58 | # 6.4.10 and 6.4.11 require 6.4.9 to be applied according to ... 59 | # https://access.redhat.com/jbossnetwork/restricted/softwareDetail.html?softwareId=46371&product=appplatform&version=6.4&downloadType=patches 60 | if [ "${2}" == "6.4.10" ] || [ "${2}" == "6.4.11" ] 61 | then 62 | echo "\n[${VERSION}] Patch to 6.4.9\n${SEPARATOR}" >> ${FILE_LOG} 63 | COMMAND="${CMD_JBOSS_CLI} --command=\"patch apply ${DIR_SOURCE}/jboss-eap-6.4.9-patch.zip\" 2>&1 >> ${FILE_LOG}" 64 | echo ${COMMAND} >> ${FILE_LOG} 65 | eval ${COMMAND} 66 | fi 67 | 68 | echo "\n[${VERSION}] Patch to ${VERSION}\n${SEPARATOR}" >> "${FILE_LOG}" 69 | COMMAND="${CMD_JBOSS_CLI} --command=\"patch apply ${FILE_SOURCE_EAP_PATCH}\" 2>&1 >> ${FILE_LOG}" 70 | echo ${COMMAND} >> ${FILE_LOG} 71 | eval ${COMMAND} 72 | 73 | COMMAND="unzip ${FILE_SOURCE_EAP_NATIVE} -d ${DIR_TARGET} 2>> ${FILE_LOG} 1>> /dev/null" 74 | echo ${COMMAND} >> "${FILE_LOG}" 75 | eval ${COMMAND} 76 | 77 | echo "\n[${VERSION}] Apply customizations\n${SEPARATOR}" >> "${FILE_LOG}" 78 | 79 | echo '' > "${FILE_CLI}" 80 | CLIS=( "delete_ExampleDS_6.cli" "delete_mail_outbound.cli" "enable_native_lib_6.cli" "disable_deployment_scanner.cli" "update_web_subsystem_6.cli" "enable_rbac.cli" "delete_http_interface.cli" "remove_http_headers.cli" "disable_jsp_regeneration" "remove_patching_history.cli" ) 81 | for CLI in "${CLIS[@]}" 82 | do 83 | cat "${DIR_CONF}/cli/$CLI" >> "${FILE_CLI}" 84 | echo "----->>> ${DIR_CONF}/cli/$CLI" >> "${FILE_LOG}" 85 | done 86 | 87 | echo ">>>>> Executed CLI " >> ${FILE_LOG} 88 | cat "${FILE_CLI}" >> "${FILE_LOG}" 89 | echo "<<<<< Executed CLI " >> ${FILE_LOG} 90 | 91 | EAP_CONFIGURATIONS=( "standalone-full-ha.xml" ) 92 | for EAP_CONFIG in "${EAP_CONFIGURATIONS[@]}" 93 | do 94 | COMMAND="bash -c \"nohup \"${JBOSS_HOME}/bin/standalone.sh\" -c \"${EAP_CONFIG}\" --admin-only 2>>\"${FILE_LOG}\" 1>>\"${FILE_LOG}\" &\" && sleep 10 && \"${CMD_JBOSS_CLI}\" -c --file=\"${FILE_CLI}\" 2>>\"${FILE_LOG}\" 1>>\"${FILE_LOG}\" && pkill -TERM -f \"(.*)standalone(.*)admin-only\"" 95 | echo ${COMMAND} >> ${FILE_LOG} 96 | eval ${COMMAND} 97 | done 98 | 99 | CLIS=( "delete_console_logger.cli" ) 100 | for CLI in "${CLIS[@]}" 101 | do 102 | cat "${DIR_CONF}/cli/$CLI" >> "${FILE_CLI}" 103 | echo "----->>> ${DIR_CONF}/cli/$CLI" >> "${FILE_LOG}" 104 | done 105 | 106 | echo ">>>>> Executed CLI " >> ${FILE_LOG} 107 | cat "${FILE_CLI}" >> "${FILE_LOG}" 108 | echo "<<<<< Executed CLI " >> ${FILE_LOG} 109 | 110 | EAP_CONFIGURATIONS=( "standalone.xml" "standalone-full.xml" "standalone-ha.xml" ) 111 | for EAP_CONFIG in "${EAP_CONFIGURATIONS[@]}" 112 | do 113 | COMMAND="bash -c \"nohup \"${JBOSS_HOME}/bin/standalone.sh\" -c \"${EAP_CONFIG}\" --admin-only 2>>\"${FILE_LOG}\" 1>>\"${FILE_LOG}\" &\" && sleep 10 && \"${CMD_JBOSS_CLI}\" -c --file=\"${FILE_CLI}\" 2>>\"${FILE_LOG}\" 1>>\"${FILE_LOG}\" && pkill -TERM -f \"(.*)standalone(.*)admin-only\"" 114 | echo ${COMMAND} >> "${FILE_LOG}" 115 | eval ${COMMAND} 116 | done 117 | 118 | rm ${FILE_CLI} 119 | 120 | # Copy custom JBoss Modules 121 | COMMAND="cp -Rfp ${DIR_MODULES}/ojdbc_modules/* ${JBOSS_HOME}/modules/. 2>&1 >> ${FILE_LOG}" 122 | echo ${COMMAND} >> ${FILE_LOG} 123 | eval ${COMMAND} 124 | 125 | echo "\n[${VERSION}] Package and cleanup\n${SEPARATOR}" >> "${FILE_LOG}" 126 | 127 | # Domain mode excluded 128 | COMMAND="rm -Rf ${DIR_TARGET_EAP}/domain 2>&1 >> ${FILE_LOG}" 129 | echo ${COMMAND} >> ${FILE_LOG} 130 | eval ${COMMAND} 131 | 132 | # Generated file 133 | COMMAND="rm -Rf '${DIR_TARGET_EAP}/standalone/configuration/logging.properties' 2>&1 >> ${FILE_LOG}" 134 | echo ${COMMAND} >> ${FILE_LOG} 135 | eval ${COMMAND} 136 | 137 | # Folder cleanup 138 | COMMAND="rm -Rf '${DIR_TARGET_EAP}/standalone/log/*' '${DIR_TARGET_EAP}/standalone/data/*' '${DIR_TARGET_EAP}/standalone/deployments/*' '${DIR_TARGET_EAP}/standalone/configuration/standalone_xml_history'" 139 | echo ${COMMAND} >> ${FILE_LOG} 140 | eval ${COMMAND} 141 | 142 | # Packing the EAP golden image 143 | COMMAND="cd ${DIR_TARGET}; zip -r ${FILE_TARGET_EAP} ${TARGET_EAP} 2>> ${FILE_LOG} 1>> /dev/null; mv ${FILE_TARGET_EAP} ${4} 2>&1 >> ${FILE_LOG}" 144 | echo ${COMMAND} >> ${FILE_LOG} 145 | eval ${COMMAND} 146 | 147 | # Cleanup the target directory 148 | COMMAND="rm -Rf ${DIR_TARGET} 2>&1 >> ${FILE_LOG}" 149 | echo ${COMMAND} >> ${FILE_LOG} 150 | eval ${COMMAND} 151 | -------------------------------------------------------------------------------- /roles/golden-image/files/build_7_0_x.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # This script builds the company specific Red Hat JBoss EAP gold-master distribution for EAP 7.0.x 4 | # 5 | 6 | if [ "$#" -ne 5 ] 7 | then 8 | echo "Usage: $0 " 9 | echo "Example: $0 build.log 7.0.3 /tmp/mw_repo/rh_jboss_binaries /tmp/mw_repo/conf /tmp/mw_repo/rh_jboss_golden_images" 10 | exit 1 11 | fi 12 | 13 | readonly VERSION="jboss-eap-${2}" 14 | readonly TARGET_EAP="${VERSION}_GI" 15 | readonly DIR_IN_ZIP="jboss-eap-7.0" 16 | readonly FILE_EAP_BASIS="jboss-eap-7.0.0.zip" 17 | readonly DIR_CONF="$5" 18 | readonly DIR_SOURCE="${3}" 19 | readonly DIR_MODULES="${DIR_CONF}/eap_custom_modules" 20 | readonly FILE_SOURCE_EAP="${DIR_SOURCE}/${FILE_EAP_BASIS}" 21 | readonly FILE_SOURCE_EAP_PATCH="${DIR_SOURCE}/${VERSION}-patch.zip" 22 | 23 | readonly DIR_TARGET="${4}/target" 24 | readonly FILE_LOG="${1}" 25 | readonly SEPARATOR="===============================================================================================" 26 | readonly DIR_TARGET_EAP="${DIR_TARGET}/${TARGET_EAP}" 27 | readonly FILE_TARGET_EAP="${TARGET_EAP}.zip" 28 | readonly FILE_CLI="${DIR_TARGET}/build.cli" 29 | readonly CMD_JBOSS_CLI="${DIR_TARGET_EAP}/bin/jboss-cli.sh" 30 | 31 | echo "$SEPARATOR\n Building ${VERSION} GI \n$SEPARATOR\n" 32 | 33 | echo "DIR_CONF: $DIR_CONF" >> ${FILE_LOG} 34 | echo "FILE_CLI: $FILE_CLI" >> ${FILE_LOG} 35 | echo "DIR_MODULES: $DIR_MODULES" >> ${FILE_LOG} 36 | 37 | declare COMMAND 38 | 39 | export JBOSS_HOME="${DIR_TARGET_EAP}" 40 | 41 | echo "\n[${VERSION}] Unpack JBoss EAP binaries (${FILE_EAP_BASIS}) \n${SEPARATOR}" >> "${FILE_LOG}" 42 | 43 | #set -x 44 | 45 | COMMAND="rm -Rf ${DIR_TARGET}; mkdir -p ${DIR_TARGET}" 46 | echo ${COMMAND} >> "${FILE_LOG}" 47 | eval ${COMMAND} 48 | 49 | COMMAND="unzip ${FILE_SOURCE_EAP} -d ${DIR_TARGET} 2>> ${FILE_LOG} 1>> /dev/null" 50 | echo ${COMMAND} >> "${FILE_LOG}" 51 | eval ${COMMAND} 52 | COMMAND="mv ${DIR_TARGET}/${DIR_IN_ZIP} ${DIR_TARGET_EAP} 2>&1 >> ${FILE_LOG}" 53 | echo ${COMMAND} >> "${FILE_LOG}" 54 | eval ${COMMAND} 55 | 56 | echo "\n[${VERSION}] Patch to ${VERSION}\n${SEPARATOR}" 57 | 58 | COMMAND="${CMD_JBOSS_CLI} --command=\"patch apply ${FILE_SOURCE_EAP_PATCH}\" 2>&1 >> ${FILE_LOG}" 59 | echo ${COMMAND} >> ${FILE_LOG} 60 | eval ${COMMAND} 61 | 62 | echo "\n[${VERSION}] Apply customizations\n${SEPARATOR}" 63 | 64 | echo '' > "${FILE_CLI}" 65 | CLIS=( "delete_ExampleDS_7.cli" "delete_mail_outbound.cli" "disable_deployment_scanner.cli" "remove_patching_history.cli") 66 | for CLI in "${CLIS[@]}" 67 | do 68 | cat "${DIR_CONF}/cli/$CLI" >> "${FILE_CLI}" 69 | echo "----->>> ${DIR_CONF}/cli/$CLI" >> "${FILE_LOG}" 70 | done 71 | 72 | echo ">>>>> Executed CLI " >> ${FILE_LOG} 73 | cat "${FILE_CLI}" >> "${FILE_LOG}" 74 | echo "<<<<< Executed CLI " >> ${FILE_LOG} 75 | 76 | EAP_CONFIGURATIONS=( "standalone-full-ha.xml" ) 77 | for EAP_CONFIG in "${EAP_CONFIGURATIONS[@]}" 78 | do 79 | COMMAND="bash -c \"nohup \"${JBOSS_HOME}/bin/standalone.sh\" -c \"${EAP_CONFIG}\" --admin-only 2>>\"${FILE_LOG}\" 1>>\"${FILE_LOG}\" &\" && sleep 10 && \"${CMD_JBOSS_CLI}\" -c --file=\"${FILE_CLI}\" 2>>\"${FILE_LOG}\" 1>>\"${FILE_LOG}\" && pkill -TERM -f \"(.*)standalone(.*)admin-only\"" 80 | echo ${COMMAND} >> ${FILE_LOG} 81 | eval ${COMMAND} 82 | done 83 | 84 | CLIS=( "delete_console_logger.cli" ) 85 | for CLI in "${CLIS[@]}" 86 | do 87 | cat ${DIR_CONF}/cli/$CLI >> ${FILE_CLI} 88 | echo "----->>> ${DIR_CONF}/cli/$CLI" >> ${FILE_LOG} 89 | done 90 | 91 | echo ">>>>> Executed CLI " >> ${FILE_LOG} 92 | cat ${FILE_CLI} >> ${FILE_LOG} 93 | echo "<<<<< Executed CLI " >> ${FILE_LOG} 94 | 95 | EAP_CONFIGURATIONS=( "standalone.xml" "standalone-full.xml" "standalone-ha.xml" ) 96 | for EAP_CONFIG in "${EAP_CONFIGURATIONS[@]}" 97 | do 98 | COMMAND="bash -c \"nohup \"${JBOSS_HOME}/bin/standalone.sh\" -c \"${EAP_CONFIG}\" --admin-only 2>>\"${FILE_LOG}\" 1>>\"${FILE_LOG}\" &\" && sleep 10 && \"${CMD_JBOSS_CLI}\" -c --file=\"${FILE_CLI}\" 2>>\"${FILE_LOG}\" 1>>\"${FILE_LOG}\" && pkill -TERM -f \"(.*)standalone(.*)admin-only\"" 99 | echo ${COMMAND} >> "${FILE_LOG}" 100 | eval ${COMMAND} 101 | done 102 | 103 | rm ${FILE_CLI} 104 | 105 | # Copy custom JBoss Modules 106 | COMMAND="cp -Rfp ${DIR_MODULES}/ojdbc_modules/* ${JBOSS_HOME}/modules/. 2>&1 >> ${FILE_LOG}" 107 | echo ${COMMAND} >> ${FILE_LOG} 108 | eval ${COMMAND} 109 | 110 | # Renaming for staying consistent with EAP 6.x 111 | COMMAND="mv ${DIR_TARGET_EAP}/bin/init.d/jboss-eap-rhel.sh ${DIR_TARGET_EAP}/bin/init.d/jboss-as-standalone.sh 2>&1 >> '${FILE_LOG}'" 112 | echo ${COMMAND} >> "${FILE_LOG}" 113 | eval ${COMMAND} 114 | 115 | # Renaming for staying consistent with EAP 6.x 116 | COMMAND="sed -i.bak s/jboss.management.http.port/'jboss.management.native.port'/g ${DIR_TARGET_EAP}/standalone/configuration/standalone*.xml" 117 | echo ${COMMAND} >> "${FILE_LOG}" 118 | eval ${COMMAND} 119 | 120 | COMMAND="rm -f ${DIR_TARGET_EAP}/standalone/configuration/*.bak 2>&1 >> ${FILE_LOG}" 121 | echo ${COMMAND} >> "${FILE_LOG}" 122 | eval ${COMMAND} 123 | 124 | echo "\n[${VERSION}] Package and cleanup\n${SEPARATOR}" 125 | 126 | # Domain mode excluded 127 | COMMAND="rm -Rf ${DIR_TARGET_EAP}/domain 2>&1 >> ${FILE_LOG}" 128 | echo ${COMMAND} >> ${FILE_LOG} 129 | eval ${COMMAND} 130 | 131 | # Generated file 132 | COMMAND="rm -Rf '${DIR_TARGET_EAP}/standalone/configuration/logging.properties' 2>&1 >> ${FILE_LOG}" 133 | echo ${COMMAND} >> ${FILE_LOG} 134 | eval ${COMMAND} 135 | 136 | # Folder cleanup 137 | COMMAND="rm -Rf '${DIR_TARGET_EAP}/standalone/log/*' '${DIR_TARGET_EAP}/standalone/data/*' '${DIR_TARGET_EAP}/standalone/deployments/*' '${DIR_TARGET_EAP}/standalone/configuration/standalone_xml_history'" 138 | echo ${COMMAND} >> ${FILE_LOG} 139 | eval ${COMMAND} 140 | 141 | # Packing the EAP golden image 142 | COMMAND="cd ${DIR_TARGET}; zip -r ${FILE_TARGET_EAP} ${TARGET_EAP} 2>> ${FILE_LOG} 1>> /dev/null; mv ${FILE_TARGET_EAP} ${4} 2>&1 >> ${FILE_LOG}" 143 | echo ${COMMAND} >> ${FILE_LOG} 144 | eval ${COMMAND} 145 | 146 | # Cleanup the target directory 147 | COMMAND="rm -Rf ${DIR_TARGET} 2>&1 >> ${FILE_LOG}" 148 | echo ${COMMAND} >> ${FILE_LOG} 149 | eval ${COMMAND} 150 | -------------------------------------------------------------------------------- /roles/golden-image/files/cli/create_async_logger.cli: -------------------------------------------------------------------------------- 1 | # Configuration of the ASYNC_FILE logger 2 | /subsystem=logging/async-handler=ASYNC_FILE/:add(overflow-action=BLOCK,queue-length=2048,level=WARN,subhandlers=["FILE"]) 3 | 4 | # Update of the FILE logger 5 | /subsystem=logging/periodic-rotating-file-handler=FILE:write-attribute(name="formatter", value="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n") 6 | /subsystem=logging/periodic-rotating-file-handler=FILE:write-attribute(name="suffix", value=".yyyy-MM-dd'.log'") 7 | /subsystem=logging/periodic-rotating-file-handler=FILE:write-attribute(name=level,value=INFO) 8 | 9 | # Redirection of the ROOT logger to the ASYNC_FILE logger and reduction of the logging level 10 | /subsystem=logging/root-logger=ROOT/:write-attribute(name=handlers,value=["ASYNC_FILE"]) 11 | /subsystem=logging/root-logger=ROOT/:write-attribute(name=level,value=WARN) 12 | 13 | # Log the "Started" and "Stopped" server events 14 | /subsystem=logging/async-handler=ASYNC_FILE_INFO/:add(overflow-action=BLOCK,queue-length=2048,level=INFO,subhandlers=["FILE"]) 15 | /subsystem=logging/logger=org.jboss.as/:add(level=INFO,handlers=["ASYNC_FILE_INFO"],use-parent-handlers=false) 16 | 17 | # Change log level 18 | /subsystem=logging/logger=org.jboss.as.config/:change-log-level(level=WARN) 19 | -------------------------------------------------------------------------------- /roles/golden-image/files/cli/delete_ExampleDS_6.cli: -------------------------------------------------------------------------------- 1 | # Removes the default ExampleDS 2 | /subsystem=datasources/data-source=ExampleDS:remove() 3 | -------------------------------------------------------------------------------- /roles/golden-image/files/cli/delete_ExampleDS_7.cli: -------------------------------------------------------------------------------- 1 | # Removes the default ExampleDS 2 | /subsystem=datasources/data-source=ExampleDS:remove() 3 | 4 | # Undefine the default datasource 5 | /subsystem=ee/service=default-bindings/:undefine-attribute(name=datasource) 6 | -------------------------------------------------------------------------------- /roles/golden-image/files/cli/delete_console_logger.cli: -------------------------------------------------------------------------------- 1 | # Removal of the CONSOLE logger 2 | /subsystem=logging/console-handler=CONSOLE/:remove() 3 | /subsystem=logging/root-logger=ROOT/:write-attribute(name=handlers,value=["FILE"]) 4 | -------------------------------------------------------------------------------- /roles/golden-image/files/cli/delete_http_interface.cli: -------------------------------------------------------------------------------- 1 | # Remove HTTP management interface 2 | /core-service=management/management-interface=http-interface:remove() 3 | -------------------------------------------------------------------------------- /roles/golden-image/files/cli/delete_jmx.cli: -------------------------------------------------------------------------------- 1 | # Remove jmx subsystem 2 | /subsystem=jmx/:remove() 3 | -------------------------------------------------------------------------------- /roles/golden-image/files/cli/delete_mail_outbound.cli: -------------------------------------------------------------------------------- 1 | # Remove mail outbound connection 2 | /subsystem=mail/:remove() 3 | /socket-binding-group=standard-sockets/remote-destination-outbound-socket-binding=mail-smtp:remove() 4 | -------------------------------------------------------------------------------- /roles/golden-image/files/cli/delete_unsecure_interface_6.cli: -------------------------------------------------------------------------------- 1 | # Remove the unsecure interface 2 | /interface=unsecure/:remove() 3 | 4 | #Note: needs to be extended to also remove the references to this interface 5 | -------------------------------------------------------------------------------- /roles/golden-image/files/cli/disable_deployment_scanner.cli: -------------------------------------------------------------------------------- 1 | # Disables the deployment scanner 2 | /subsystem=deployment-scanner/scanner=default:write-attribute(name=scan-interval,value=0) 3 | #/subsystem=deployment-scanner/scanner=default:remove 4 | #/subsystem=deployment-scanner:remove 5 | -------------------------------------------------------------------------------- /roles/golden-image/files/cli/disable_jsp_regeneration.cli: -------------------------------------------------------------------------------- 1 | /subsystem=web/configuration=jsp-configuration:write-attribute(name=development,value=false) 2 | -------------------------------------------------------------------------------- /roles/golden-image/files/cli/disable_silent_authentication.cli: -------------------------------------------------------------------------------- 1 | # Remove the silent authentication 2 | /core-service=management/security-realm=ManagementRealm/authentication=local:remove() 3 | /core-service=management/security-realm=ApplicationRealm/authentication=local:remove() 4 | -------------------------------------------------------------------------------- /roles/golden-image/files/cli/enable_audit_log.cli: -------------------------------------------------------------------------------- 1 | /subsystem=logging/periodic-rotating-file-handler=AUDIT/:add(suffix=.yyyy-MM-dd,formatter=%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n,level=TRACE,file={"relative-to" => "jboss.server.log.dir","path" => "audit.log"}) 2 | /subsystem=logging/logger=org.jboss.security.audit/:add(level=TRACE,category=org.jboss.security.audit,handlers=["AUDIT"]) 3 | -------------------------------------------------------------------------------- /roles/golden-image/files/cli/enable_native_lib_6.cli: -------------------------------------------------------------------------------- 1 | # Enable native connectors 2 | /subsystem=web/:write-attribute(name=native,value=true) 3 | -------------------------------------------------------------------------------- /roles/golden-image/files/cli/enable_rbac.cli: -------------------------------------------------------------------------------- 1 | # Enable RBAC 2 | /core-service=management/access=authorization:write-attribute(name=provider, value=rbac) 3 | -------------------------------------------------------------------------------- /roles/golden-image/files/cli/enable_web_access_log.cli: -------------------------------------------------------------------------------- 1 | /subsystem=web/virtual-server=default-host/configuration=access-log:add 2 | /subsystem=web/virtual-server=default-host/configuration=access-log:write-attribute(name="pattern",value="%h %l %u %t \\"%r\\" %s %b %S %T") 3 | /subsystem=web/virtual-server=default-host/configuration=access-log/setting=directory:add 4 | /subsystem=web/virtual-server=default-host/configuration=access-log/setting=directory:write-attribute(name="path",value="./") 5 | /subsystem=web/virtual-server=default-host/configuration=access-log/setting=directory:write-attribute(name="relative-to",value="jboss.server.log.dir") 6 | -------------------------------------------------------------------------------- /roles/golden-image/files/cli/remove_http_headers.cli: -------------------------------------------------------------------------------- 1 | /system-property=org.apache.coyote.http11.Http11Protocol.SERVER:add(value="SuperSecureServer") 2 | /system-property=org.apache.catalina.connector.X_POWERED_BY:add(value="false") 3 | /subsystem=web/configuration=jsp-configuration:write-attribute(name=x-powered-by,value=false) 4 | -------------------------------------------------------------------------------- /roles/golden-image/files/cli/remove_patching_history.cli: -------------------------------------------------------------------------------- 1 | /core-service=patching:ageout-history() 2 | -------------------------------------------------------------------------------- /roles/golden-image/files/cli/update_web_subsystem_6.cli: -------------------------------------------------------------------------------- 1 | # Sets a node name for mod_cluster 2 | /subsystem=web/:write-attribute(name=instance-id,value="${jboss.node.name}") 3 | # Disable welcome-root 4 | #/subsystem=web/virtual-server=default-host:write-attribute(name=enable-welcome-root,value=false) 5 | -------------------------------------------------------------------------------- /roles/golden-image/files/eap_custom_modules/ojdbc_modules/system/layers/base/com/oracle/main/module.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /roles/golden-image/files/eap_custom_modules/ojdbc_modules/system/layers/base/com/oracle/main/ojdbc6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Maarc/ansible_middleware_soe/0622a0de148ca4e9e946b53b5f21a1db8ebdb348/roles/golden-image/files/eap_custom_modules/ojdbc_modules/system/layers/base/com/oracle/main/ojdbc6.jar -------------------------------------------------------------------------------- /roles/golden-image/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Download "ojdbc6-11.2.0.4.0.jar" 4 | get_url: 5 | url: "http://maven.novamens.com/com/oracle/ojdbc6/11.2.0.4.0/ojdbc6-11.2.0.4.0.jar" 6 | dest: "{{ role_path }}/files/eap_custom_modules/ojdbc_modules/system/layers/base/com/oracle/main/ojdbc6.jar" 7 | 8 | - name: Build the Red Hat JBoss EAP 6.4.x golden images 9 | script: build_6_4_x.sh ./gi-build.log {{ item }} {{ bin_dir }} {{ gi_dir }} {{ role_path }}/files creates={{ gi_dir }}/jboss-eap-{{ item }}_GI.zip 10 | with_items: "{{ golden_images_eap_6 }}" 11 | 12 | - name: Build the Red Hat JBoss EAP 7.0.x golden images 13 | script: build_7_0_x.sh ./gi-build.log {{ item }} {{ bin_dir }} {{ gi_dir }} {{ role_path }}/files creates={{ gi_dir }}/jboss-eap-{{ item }}_GI.zip 14 | with_items: "{{ golden_images_eap_7 }}" 15 | -------------------------------------------------------------------------------- /roles/java-demo-app/LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /roles/java-demo-app/README.md: -------------------------------------------------------------------------------- 1 | Ansible role: "java-demo-app" 2 | ================================= 3 | 4 | Description 5 | ----------- 6 | 7 | Retrieves and builds some demo Java applications used by the [ansible middleware SOE](https://github.com/Maarc/ansible_middleware_soe). 8 | 9 | 10 | Requirements 11 | ------------ 12 | 13 | This role has been tested on Ansible 2.0.2.0 and 2.1.1.0. It requires Red Hat Enterprise Linux 7. 14 | 15 | 16 | Dependencies 17 | ------------ 18 | 19 | None. 20 | 21 | 22 | License 23 | ------- 24 | 25 | [Apache 2.0](./LICENSE) 26 | 27 | 28 | Authors Information 29 | ------------------ 30 | 31 | * [Marc Zottner](https://github.com/Maarc) 32 | * [Roeland van de Pol](https://github.com/roelandpol) 33 | -------------------------------------------------------------------------------- /roles/java-demo-app/default/main.yml: -------------------------------------------------------------------------------- 1 | 2 | # Nexus connectivity information 3 | nexus_user: "" 4 | nexus_password: "" 5 | nexus_host: "" 6 | nexus_repository_id: "releases" 7 | -------------------------------------------------------------------------------- /roles/java-demo-app/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Create ticket-monster directory 3 | file: 4 | path: "{{ item }}" 5 | state: directory 6 | mode: "0755" 7 | with_items: 8 | - "{{ app_dir }}" 9 | - "{{ java_code_dir }}" 10 | - "{{ java_code_dir }}/tm" 11 | 12 | - name: Download petclinic 13 | get_url: 14 | url: "http://central.maven.org/maven2/com/webcohesion/enunciate/enunciate-examples-spring-petclinic/2.3.0/enunciate-examples-spring-petclinic-2.3.0.war" 15 | dest: "{{ app_dir }}/petclinic.war" 16 | 17 | - name: Download "jenkins.war" 18 | get_url: 19 | url: "http://mirrors.jenkins-ci.org/war/latest/jenkins.war" 20 | dest: "{{ app_dir }}/jenkins.war" 21 | 22 | - name: Check existence of ticket-monster 23 | stat: 24 | path: "{{ app_dir }}/ticket-monster.war" 25 | register: tm_exists 26 | 27 | - name: Checkout ticket-monster 28 | when: tm_exists.stat.exists == false 29 | git: 30 | repo: "https://github.com/jboss-developer/ticket-monster.git" 31 | dest: "{{ java_code_dir }}/tm" 32 | version: "2.7.0.Final" 33 | force: yes 34 | 35 | - name: Build "ticket-monster.war" 36 | when: tm_exists.stat.exists == false 37 | command: "mvn -T 4 clean package -f {{ java_code_dir }}/tm/demo/pom.xml" 38 | 39 | - name: Copy "ticket-monster.war" 40 | copy: 41 | src: "{{ java_code_dir }}/tm/demo/target/ticket-monster.war" 42 | dest: "{{ app_dir }}/ticket-monster.war" 43 | 44 | - name: Download "tomcat-sample.war" 45 | get_url: 46 | url: "https://tomcat.apache.org/tomcat-8.0-doc/appdev/sample/sample.war" 47 | dest: "{{ app_dir }}/tomcat-sample.war" 48 | 49 | #- name: Upload applications to nexus 50 | # command: "curl -v -F r={{ nexus_repository_id }} -F hasPom=false -F e=war -F g=com.redhat.jboss -F a={{ item }} -F v=1.0 -F p=war -F file=@{{ app_dir }}/{{ item }} -u {{ nexus_user }}:{{ nexus_password }} {{ nexus_upload_url }}" 51 | # with_items: 52 | # - "ticket-monster.war" 53 | # - "petclinic.war" 54 | # - "jenkins.war" 55 | -------------------------------------------------------------------------------- /roles/java-demo-app/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | java_code_dir: "{{ base_repo_dir }}/java_apps/code" 4 | 5 | nexus_base_url: "http://{{ nexus_host }}/nexus/service/local" 6 | nexus_upload_url: "{{ nexus_base_url }}/artifact/maven/content" 7 | nexus_download_url: "{{ nexus_base_url }}/repositories/{{ nexus_repository_id }}/content" 8 | -------------------------------------------------------------------------------- /roles/requirements.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Ansible Tower will automatically import these roles at the end of the project import. 4 | # Please refer to http://docs.ansible.com/ansible-tower/latest/html/userguide/projects.html#ug-galaxy for more information. 5 | 6 | - src: Maarc.rh-jboss-common 7 | #src: https://github.com/Maarc/ansible-role-redhat-jboss-common 8 | 9 | - src: Maarc.rh-jboss-eap 10 | #src: https://github.com/Maarc/ansible-role-redhat-jboss-eap 11 | 12 | - src: Maarc.rh-jboss-web-server-tomcat 13 | #src: https://github.com/Maarc/ansible-role-redhat-jboss-web-server-tomcat 14 | 15 | - src: Maarc.rh-jboss-web-server-httpd 16 | #src: https://github.com/Maarc/ansible-role-redhat-jboss-web-server-httpd 17 | 18 | - src: sabre1041.redhat-csp-download 19 | #src: https://github.com/sabre1041/redhat-csp-download 20 | -------------------------------------------------------------------------------- /site.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - hosts: "dev-jws-group" 4 | roles: 5 | # Red Hat JWS Tomcat instance 6 | - {role: "Maarc.rh-jboss-web-server-tomcat", app_list: { "tomcat-sample.war" }} 7 | # Red Hat JWS Apache instance 8 | - {role: "Maarc.rh-jboss-web-server-httpd"} 9 | 10 | - hosts: "dev-eap-group" 11 | roles: 12 | - { 13 | # JBoss EAP 6 instance for the ticket-monster application 14 | role: "Maarc.rh-jboss-eap", 15 | jboss_eap_golden_image_name: "jboss-eap-6.4.11_GI", 16 | jboss_eap_instance_name: "ticket_monster", 17 | jboss_eap_instance_standalone_file: "standalone-full-ha.xml", 18 | jboss_eap_instance_port_offset: 0, 19 | app_list: { "ticket-monster.war" }, 20 | cli_list: { "add_datasource.cli", "add_mod_cluster_6.cli"}, 21 | } 22 | - { 23 | # JBoss EAP 7 instance for the petclinic application (note: toggle role and app to deploy from Nexus) 24 | role: "Maarc.rh-jboss-eap", 25 | jboss_eap_golden_image_name: "jboss-eap-7.0.3_GI", 26 | jboss_eap_instance_name: "petclinic", 27 | jboss_eap_instance_standalone_file: "standalone-full-ha.xml", 28 | jboss_eap_instance_port_offset: "1000", 29 | app_list: { "petclinic.war" }, 30 | cli_list: { "add_datasource.cli", "add_mod_cluster_7.cli"}, 31 | #app_mvn_list: [ { g: "com.redhat.jboss", a: "petclinic.war", v: "1.0", e: "war" } ], 32 | } 33 | - { 34 | # JBoss EAP 7 instance for the jenkins application 35 | role: "Maarc.rh-jboss-eap", 36 | jboss_eap_golden_image_name: "jboss-eap-7.0.3_GI", 37 | jboss_eap_instance_name: "jenkins", 38 | jboss_eap_instance_standalone_file: "standalone-full-ha.xml", 39 | jboss_eap_instance_port_offset: 2000, 40 | app_list: { "jenkins.war" }, 41 | cli_list: { "add_datasource.cli", "add_mod_cluster_7.cli"}, 42 | } 43 | -------------------------------------------------------------------------------- /vagrant/README.md: -------------------------------------------------------------------------------- 1 | This directory contains the Vagrantfile describing the Virtualbox managed virtual machines by vagrant. 2 | 3 | Starting all virtual machines: 4 | 5 | $ vagrant up 6 | 7 | Starting the Red Hat JBoss EAP host: 8 | 9 | $ vagrant up host-dev-01 10 | 11 | Starting Nexus OSS: 12 | 13 | $ vagrant up nexus 14 | 15 | Starting Ansible Tower: 16 | 17 | $ vagrant up tower 18 | -------------------------------------------------------------------------------- /vagrant/Vagrantfile: -------------------------------------------------------------------------------- 1 | # Note: no port forwarding is needed when using a private network. The VMs are reacheable directly. 2 | 3 | name='' 4 | 5 | Vagrant.configure(2) do |config| 6 | 7 | config.vm.box = "centos/7" 8 | config.vm.box_check_update = false 9 | config.ssh.insert_key = false 10 | config.ssh.forward_agent = true 11 | 12 | { 13 | 'host-dev-01' => '101', 14 | 'host-dev-02' => '102', 15 | 'host-dev-03' => '103', 16 | }.each do |short_name, id| 17 | config.vm.define short_name do |host| 18 | name = short_name 19 | host.vm.network 'private_network', ip: '192.168.0.'+id 20 | host.vm.hostname = short_name 21 | host.vm.network :forwarded_port, guest: 22, host: '2'+id, id: "ssh" 22 | end 23 | end 24 | 25 | # Nexus 2.13 instead of 3 as currently recommended by Sonatype 26 | config.vm.define 'nexus', primary: false do |host| 27 | name = 'nexus' 28 | host.vm.hostname = 'nexus' 29 | host.vm.network "private_network", ip: '192.168.0.100' 30 | host.vm.network :forwarded_port, guest: 22, host: 2100, id: "ssh" 31 | host.vm.provision "ansible" do |ansible| 32 | ansible.playbook = "nexus/nexus_2.13.yml" 33 | end 34 | end 35 | 36 | config.vm.define 'tower', primary: false do |host| 37 | config.vm.box = "ansible/tower" 38 | name = 'tower' 39 | host.vm.hostname = 'tower'; 40 | host.vm.network "private_network", ip: '192.168.0.200' 41 | host.vm.network :forwarded_port, guest: 22, host: 2200, id: "ssh" 42 | host.vm.synced_folder "/tmp/mw_repo", "/tmp/mw_repo", create: true, group: "awx", owner: "awx" 43 | host.vm.provision "ansible" do |ansible| 44 | ansible.playbook = "tower/tower.yml" 45 | end 46 | end 47 | 48 | config.vm.provider "virtualbox" do |vb| 49 | vb.name = name 50 | # 33% of the CPU from the host 51 | vb.customize ["modifyvm", :id, "--cpuexecutioncap", "33"] 52 | # 2048 MB RAM 53 | vb.memory = 2048 54 | end 55 | 56 | # In order to support Libvirt/KVM as provider 57 | config.vm.provider :libvirt do |lv| 58 | # 2048 MB RAM 59 | lv.memory = 2048 60 | # Uncomment if you want to use a specific storage pool with enough space 61 | #lv.storage_pool_name = "MYPOOL" 62 | end 63 | end 64 | -------------------------------------------------------------------------------- /vagrant/nexus/nexus.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=nexus service 3 | After=network.target 4 | 5 | [Service] 6 | Type=forking 7 | ExecStart=/opt/nexus/bin/nexus start 8 | ExecStop=/opt/nexus/bin/nexus stop 9 | User=nexus 10 | Restart=on-abort 11 | 12 | [Install] 13 | WantedBy=multi-user.target 14 | -------------------------------------------------------------------------------- /vagrant/nexus/nexus_2.13.yml: -------------------------------------------------------------------------------- 1 | # Inspired from http://eduardsi.blogspot.de/2014/01/installing-nexus-with-ansible.html 2 | # and from https://books.sonatype.com/nexus-book/3.0/reference/install.html#installation-archive 3 | # Nexus OSS: http://www.sonatype.com/download-oss-sonatype 4 | # This is installating Nexus v2 (access URL: http://hostname:8081/nexus/) 5 | 6 | - hosts: nexus 7 | vars: 8 | nexus_download_url: http://www.sonatype.org/downloads/nexus-latest-bundle.tar.gz 9 | nexus_download_dest: /tmp/nexus-latest-bundle.tar.gz 10 | nexus_extracted_dir: /tmp/nexus_extracted_dir 11 | nexus_dir: /opt/nexus 12 | 13 | tasks: 14 | 15 | - name: Install required RPM dependencies 16 | become: true 17 | yum: name={{ item }} state=present 18 | with_items: 19 | - unzip 20 | - wget 21 | - rsync 22 | - java-1.8.0-openjdk-devel 23 | - net-tools 24 | 25 | - name: Create "nexus" group 26 | become: true 27 | group: name="nexus" system="yes" state="present" gid="500" 28 | 29 | - name: Create "nexus" user 30 | become: true 31 | user: name="nexus" comment="nexus user" uid="500" group="nexus" shell="/bin/bash" 32 | 33 | - name: Download nexus 34 | get_url: url={{ nexus_download_url }} dest={{ nexus_download_dest }} 35 | register: nexus_download 36 | 37 | - name: Create {{ nexus_extracted_dir }} directory 38 | when: nexus_download.changed 39 | become: true 40 | file: path={{ nexus_extracted_dir }} state=directory owner=nexus group=nexus 41 | 42 | - name: Unpack nexus 43 | when: nexus_download.changed 44 | become: true 45 | unarchive: src={{ nexus_download_dest  }} dest={{ nexus_extracted_dir }} copy=no owner=nexus group=nexus 46 | 47 | - name: Move nexus to {{ nexus_dir }} directory 48 | when: nexus_download.changed 49 | become: true 50 | command: cp -af {{ nexus_extracted_dir }}/nexus-2.13.0-01/. {{ nexus_dir }} 51 | 52 | - name: Remove {{ nexus_extracted_dir }} directory 53 | when: nexus_download.changed 54 | become: true 55 | command: rm -rf {{ nexus_extracted_dir }} 56 | 57 | - name: Make {{ nexus_dir }} directory property of "nexus" user/group 58 | become: true 59 | file: path={{ nexus_dir }} group=nexus owner=nexus recurse=true 60 | 61 | - name: Make nexus runned by "nexus" user 62 | lineinfile: dest={{ nexus_dir }}/bin/nexus regexp="#RUN_AS_USER=" line="RUN_AS_USER=nexus" backrefs=true 63 | become: true 64 | 65 | - name: Set NEXUS_HOME 66 | become: true 67 | lineinfile: dest={{ nexus_dir }}/bin/nexus regexp="^NEXUS_HOME" line="NEXUS_HOME={{ nexus_dir }}" backrefs=true 68 | 69 | - name: Create nexus piddir 70 | become: true 71 | file: path=/var/run/nexus state=directory group=nexus owner=nexus 72 | 73 | - name: Set nexus pidir 74 | become: true 75 | lineinfile: dest={{ nexus_dir }}/bin/nexus regexp="^#PIDDIR=" line="PIDDIR=/var/run/nexus" backrefs=true 76 | 77 | - name: Set nexus working directory 78 | become: true 79 | lineinfile: dest={{ nexus_dir }}/conf/nexus.properties regexp="^nexus-work=" line="nexus-work=${bundleBasedir}/work/nexus" 80 | 81 | - name: Create systemd unit file 82 | become: true 83 | copy: owner=nexus group=nexus src="nexus.service" dest="/etc/systemd/system/nexus.service" mode="0755" 84 | register: nexus_service 85 | 86 | - name: Reload systemd 87 | when: nexus_service.changed 88 | become: true 89 | command: systemctl daemon-reload 90 | 91 | - name: Start Nexus 92 | become: true 93 | service: name="nexus" state="started" enabled="yes" 94 | -------------------------------------------------------------------------------- /vagrant/nexus/nexus_3.yml: -------------------------------------------------------------------------------- 1 | # Inspired from http://eduardsi.blogspot.de/2014/01/installing-nexus-with-ansible.html 2 | # and from https://books.sonatype.com/nexus-book/3.0/reference/install.html#installation-archive 3 | # Nexus OSS: http://www.sonatype.com/download-oss-sonatype 4 | # This is installating Nexus v3 (access URL: http://hostname:8081/) 5 | 6 | - hosts: nexus 7 | vars: 8 | nexus_download_url: http://download.sonatype.com/nexus/3/nexus-3.0.0-03-unix.tar.gz 9 | nexus_download_dest: /tmp/nexus-latest-bundle.tar.gz 10 | nexus_extracted_dir: /tmp/nexus_extracted_dir 11 | nexus_dir: /opt/nexus 12 | 13 | tasks: 14 | 15 | - name: Install required RPM dependencies 16 | become: true 17 | yum: name={{ item }} state=present 18 | with_items: 19 | - unzip 20 | - wget 21 | - rsync 22 | - java-1.8.0-openjdk-devel 23 | - net-tools 24 | 25 | - name: Create "nexus" group 26 | become: true 27 | group: name="nexus" system="yes" state="present" gid="500" 28 | 29 | - name: Create "nexus" user 30 | become: true 31 | user: name="nexus" comment="nexus user" uid="500" group="nexus" shell="/bin/bash" 32 | 33 | - name: Download nexus 34 | get_url: url={{ nexus_download_url }} dest={{ nexus_download_dest }} 35 | register: nexus_download 36 | 37 | - name: Create {{ nexus_extracted_dir }} directory 38 | when: nexus_download.changed 39 | become: true 40 | file: path={{ nexus_extracted_dir }} state=directory owner=nexus group=nexus 41 | 42 | - name: Unpack nexus 43 | when: nexus_download.changed 44 | become: true 45 | unarchive: src={{ nexus_download_dest }} dest={{ nexus_extracted_dir }} copy=no owner=nexus group=nexus 46 | 47 | - name: Move nexus to {{ nexus_dir }} directory 48 | when: nexus_download.changed 49 | become: true 50 | command: cp -af {{ nexus_extracted_dir }}/nexus-3.0.0-03/. {{ nexus_dir }} 51 | 52 | - name: Remove {{ nexus_extracted_dir }} directory 53 | when: nexus_download.changed 54 | become: true 55 | command: rm -rf {{ nexus_extracted_dir }} 56 | 57 | - name: Create systemd unit file 58 | become: true 59 | copy: owner=nexus group=nexus src="nexus.service" dest="/etc/systemd/system/nexus.service" mode="0755" 60 | register: nexus_service 61 | 62 | - name: Reload systemd 63 | when: nexus_service.changed 64 | become: true 65 | command: systemctl daemon-reload 66 | 67 | - name: Start Nexus 68 | become: true 69 | service: name="nexus" state="started" enabled="yes" 70 | -------------------------------------------------------------------------------- /vagrant/tower/tower.yml: -------------------------------------------------------------------------------- 1 | # Post-installation with various configuration elements for the Vagrant image. 2 | 3 | - hosts: tower 4 | 5 | vars: 6 | tower: 7 | orga: 8 | name: "Giraffe Group" 9 | desc: "A group of giraffes is called a tower, according to the Northern Prairie Wildlife Research Center." 10 | inv: 11 | name: "Development Virtual Machines" 12 | desc: "This inventory contains all hosts and groups managed by Vagrant." 13 | cred: 14 | name: "Vagrant Virtual Machines (ssh)" 15 | ssh_key: "/home/vagrant/.ssh/id_rsa" 16 | 17 | tasks: 18 | 19 | # Checking if a license has been copied locally 20 | - name: Stat local tower license file 21 | local_action: stat path="./tower/license" 22 | register: license 23 | 24 | - name: Check existence of the local tower license file 25 | fail: msg="Please copy your Ansible Tower license file in ./vagrant/tower" 26 | when: license.stat.exists == false 27 | 28 | - name: Copy the Tower license file 29 | become: true 30 | copy: owner="awx" group="awx" src="license" dest="/etc/tower/license" mode="0644" 31 | register: conf_01 32 | 33 | # Install prerequisites for Ansible Tower CLI 34 | - name: Install Pip 35 | become: true 36 | yum: name={{ item }} state=present 37 | with_items: 38 | - python-pip 39 | - python-wheel 40 | 41 | - name: Install Ansible Tower CLI 42 | become: true 43 | pip: name=ansible-tower-cli 44 | 45 | # Disable PRoot to prevent issues accessing the local file system 46 | # https://docs.ansible.com/ansible-tower/2.2.0/html/administration/troubleshooting.html 47 | - name: Disable PRoot 48 | become: true 49 | lineinfile: 50 | dest: "/etc/tower/settings.py" 51 | regexp: '^AWX_PROOT_ENABLED =(.*)$' 52 | line: "AWX_PROOT_ENABLED = False" 53 | backrefs: yes 54 | register: conf_02 55 | 56 | # https://docs.ansible.com/ansible-tower/latest/html/administration/troubleshooting.html 57 | - name: Set WebSockets port for live events 58 | become: true 59 | lineinfile: 60 | dest: "/var/lib/awx/public/static/local_settings.json" 61 | line: '{"websocket_port": 8080}' 62 | owner: awx 63 | group: awx 64 | create: yes 65 | register: conf_03 66 | 67 | - name: Restart Tower 68 | become: true 69 | when: conf_01.changed or conf_02.changed or conf_03.changed 70 | command: "ansible-tower-service restart" 71 | 72 | - name: "Read Tower user" 73 | command: "grep -oP '(?<=Username: )[^ \"]*' /etc/profile.d/ansible-tower.sh" 74 | register: user_out 75 | 76 | - name: "Read Tower password" 77 | command: "grep -oP '(?<=Password: )[^ \"]*' /etc/profile.d/ansible-tower.sh" 78 | register: password_out 79 | 80 | - name: "Set user and password" 81 | set_fact: 82 | user: "{{ user_out.stdout_lines[0] }}" 83 | password: "{{ password_out.stdout_lines[0] }}" 84 | 85 | ########## Create an organization (retrives organization id) 86 | - name: "Ansible Tower CLI - Create organization" 87 | shell: "tower-cli organization create --name \"{{ tower.orga.name }}\" --description \"{{ tower.orga.desc }}\" --insecure -u {{ user }} -p {{ password }} | grep -oP '([0-9])*'" 88 | register: orga_id 89 | 90 | # - debug: var=orga_id.stdout 91 | 92 | ########## Create an inventory (using the organization id) 93 | - name: "Ansible Tower CLI - Create inventory" 94 | command: "tower-cli inventory create --name \"{{ tower.inv.name }}\" --description \"{{ tower.inv.desc }}\" --organization \"{{ orga_id.stdout }}\" --insecure -u {{ user }} -p {{ password }}" 95 | 96 | ########## Fill the inventory 97 | - name: Copy inventory file 98 | become: true 99 | copy: owner="awx" group="awx" src="../../inventory/hosts-dev-tower" dest="/etc/tower" mode="0644" 100 | 101 | - name: Import inventory 102 | become: true 103 | command: "tower-manage inventory_import --inventory-name=\"{{ tower.inv.name }}\" --source=/etc/tower/hosts-dev-tower" 104 | register: inv 105 | 106 | # - debug: var=inv 107 | 108 | ########## Configure the ssh connectivity 109 | 110 | - name: "Check ssh key" 111 | stat: 112 | path: "{{ tower.cred.ssh_key }}" 113 | register: ssh_key 114 | 115 | - name: "Copy vagrant private key" 116 | when: ssh_key.stat.exists == false 117 | copy: owner=vagrant group=vagrant src="{{ lookup('env','HOME') + '/.vagrant.d/insecure_private_key' }}" dest="{{ tower.cred.ssh_key }}" mode="0600" 118 | 119 | ########## Create Tower credentials using the ssh key 120 | 121 | - name: "Ansible Tower CLI - Create credential" 122 | command: "tower-cli credential create --name \"{{ tower.cred.name }}\" --kind ssh --ssh-key-data {{ tower.cred.ssh_key }} --username vagrant --become-username root --become-method sudo --insecure -u {{ user }} -p {{ password }} --organization \"{{ orga_id.stdout }}\"" 123 | 124 | 125 | ###### Cleanup the default Tower entries 126 | 127 | - name: "Remove 'Demo Credential'" 128 | command: "tower-cli credential delete --insecure -u {{ user }} -p {{ password }} -n \"Demo Credential\"" 129 | 130 | - name: "Remove 'Demo Inventory'" 131 | command: "tower-cli inventory delete --insecure -u {{ user }} -p {{ password }} -n \"Demo Inventory\"" 132 | 133 | - name: "Remove 'Demo Project'" 134 | command: "tower-cli project delete --insecure -u {{ user }} -p {{ password }} -n \"Demo Project\"" 135 | 136 | - name: "Remove 'Demo Job Template'" 137 | command: "tower-cli job_template delete --insecure -u {{ user }} -p {{ password }} -n \"Demo Job Template\"" 138 | 139 | 140 | ########## Displays the credentials 141 | - name: "Display credentials" 142 | debug: 143 | msg: "User: {{ user }} - Password: {{ password }}" 144 | --------------------------------------------------------------------------------