diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..5caef86b7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +ansible/install_instana_agent/dt10.yml +.vscode/settings.json +.ansible/.lock diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..de0a20a03 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "ansible.python.interpreterPath": "/opt/homebrew/bin/python3", + "git.enableCommitSigning": true +} \ No newline at end of file diff --git a/ansible/Jenkinsfile-example b/ansible/Jenkinsfile-example index ab6aca5a7..1e57d966c 100644 --- a/ansible/Jenkinsfile-example +++ b/ansible/Jenkinsfile-example @@ -26,7 +26,7 @@ properties(jobProps) timestamps { ansiColor('xterm') { - node ( 'kube_pod_slave' ) { + node { checkout scm diff --git a/ansible/fix-fyre-hosts-play/Jenkinsfile b/ansible/fix-fyre-hosts-play/Jenkinsfile index c84c3d6aa..68d55681f 100644 --- a/ansible/fix-fyre-hosts-play/Jenkinsfile +++ b/ansible/fix-fyre-hosts-play/Jenkinsfile @@ -17,7 +17,7 @@ properties(jobProps) timestamps { ansiColor('xterm') { - node ( 'kube_pod_slave' ) { + node { //def scmVars = checkout scm checkout scm diff --git a/ansible/fix-fyre-hosts-play/fix-fyre-hosts-play.yml b/ansible/fix-fyre-hosts-play/fix-fyre-hosts-play.yml index 993fd6dc5..580c73eeb 100644 --- a/ansible/fix-fyre-hosts-play/fix-fyre-hosts-play.yml +++ b/ansible/fix-fyre-hosts-play/fix-fyre-hosts-play.yml @@ -2,6 +2,6 @@ - hosts: all gather_facts: true - become: yes + become: true roles: - role: fix_fyre_hosts_file diff --git a/ansible/install_instana_agent/Jenkinsfile b/ansible/install_instana_agent/Jenkinsfile index 71cb9bdc2..c8e853401 100644 --- a/ansible/install_instana_agent/Jenkinsfile +++ b/ansible/install_instana_agent/Jenkinsfile @@ -26,7 +26,7 @@ properties(jobProps) timestamps { ansiColor('xterm') { - node ( 'kube_pod_slave' ) { + node { //def scmVars = checkout scm checkout scm @@ -34,17 +34,17 @@ timestamps { sh """ set +x # hide sensitive info being echo'd to log export ANSIBLE_FORCE_COLOR=true - if [ ${params.agent_os} == 'Unix' ] ; then + if [ ${params.agent_os} == 'Unix' ] ; then ansible-playbook -i ${params.osnames}, ./ansible/install_instana_agent/install_instana_agent.yml \ - -e instana_host=${params.instana_host} \ - -e instana_port=${params.instana_port} \ - -e agent_key=${params.agent_key} \ - -e instana_mode='dynamic' \ - -e instana_runtime=' -j ' \ - -e instana_zone=${params.instana_zone} \ - -e custom_agent_url=${params.custom_agent_url} + -e instana_host=${params.instana_host} \ + -e instana_port=${params.instana_port} \ + -e agent_key=${params.agent_key} \ + -e instana_mode='dynamic' \ + -e instana_runtime=' -j ' \ + -e instana_zone=${params.instana_zone} \ + -e custom_agent_url=${params.custom_agent_url} else - ansible-playbook -i ${params.osnames}, ./ansible/install_instana_agent/install_instana_agent.yml \ + ansible-playbook -i ${params.osnames}, ./ansible/install_instana_agent/install_instana_agent.yml \ -e instana_host=${params.instana_host} \ -e instana_port=${params.instana_port} \ -e agent_key=${params.agent_key} \ diff --git a/ansible/install_instana_agent_k3s/.gitignore b/ansible/install_instana_agent_k3s/.gitignore new file mode 100644 index 000000000..550f28139 --- /dev/null +++ b/ansible/install_instana_agent_k3s/.gitignore @@ -0,0 +1 @@ +/inventory* diff --git a/ansible/install_instana_agent_k3s/Jenkinsfile b/ansible/install_instana_agent_k3s/Jenkinsfile new file mode 100644 index 000000000..923686537 --- /dev/null +++ b/ansible/install_instana_agent_k3s/Jenkinsfile @@ -0,0 +1,61 @@ +#! groovy + +// Standard job properties +def jobProps = [ + buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '50')), + disableResume(), + durabilityHint("PERFORMANCE_OPTIMIZED"), + [$class: 'RebuildSettings', autoRebuild: false, rebuildDisabled: false] +] + +def paramsList = [ + string(name: 'osnames', defaultValue: 'changeMyhostname', description: 'comma delimitted list of IPs or hostnames'), + string(name: 'instana_host', defaultValue: 'changeMyInstanaHost', description: 'Instana host'), + string(name: 'instana_port', defaultValue: 'changeMyInstanaport', description: 'Instana port'), + string(name: 'agent_key', defaultValue: 'changeMyagentKey', description: 'Instana agent key'), + choice(name: 'agent_os', choices: ['Unix', 'Windows'], description: 'Unix or Windows'), + string(name: 'instana_zone', defaultValue: 'changeMyZone', description: 'Instana agent zone'), + string(name: 'instana_region', defaultValue: 'singlebox-onprem', description: 'Windows only: Instana region'), + string(name: 'instana_unit', defaultValue: 'changeMyunit', description: 'Windows only: Instana unit'), + string(name: 'instana_tenet', defaultValue: 'changeMytenet', description: 'Windows only: Instana tenet'), + string(name: 'custom_agent_url', defaultValue: 'changeMyCustomAgentUrl', description: 'AIX only: Url to custom agent packages for AIX'), + ] +jobProps.push(parameters(paramsList)) + +properties(jobProps) + +timestamps { + ansiColor('xterm') { + node { + + //def scmVars = checkout scm + checkout scm + stage('Stage 1') { + sh """ + set +x # hide sensitive info being echo'd to log + export ANSIBLE_FORCE_COLOR=true + if [ ${params.agent_os} == 'Unix' ] ; then + ansible-playbook -i ${params.osnames}, ./ansible/install_instana_agent/install_instana_agent.yml \ + -e instana_host=${params.instana_host} \ + -e instana_port=${params.instana_port} \ + -e agent_key=${params.agent_key} \ + -e instana_mode='dynamic' \ + -e instana_runtime=' -j ' \ + -e instana_zone=${params.instana_zone} \ + -e custom_agent_url=${params.custom_agent_url} + else + ansible-playbook -i ${params.osnames}, ./ansible/install_instana_agent/install_instana_agent.yml \ + -e instana_host=${params.instana_host} \ + -e instana_port=${params.instana_port} \ + -e agent_key=${params.agent_key} \ + -e instana_zone=${params.instana_zone} \ + -e ansible_shell_type='cmd' \ + -e instana_region=${params.instana_region} \ + -e instana_unit=${params.instana_unit} \ + -e instana_tenet=${params.instana_tenet} + fi + """.stripIndent() + } + } + } +} diff --git a/ansible/install_instana_agent_k3s/README.md b/ansible/install_instana_agent_k3s/README.md new file mode 100644 index 000000000..8d4fb3b6c --- /dev/null +++ b/ansible/install_instana_agent_k3s/README.md @@ -0,0 +1,67 @@ +# Ansible Playbook for installing Instana agents + +## Assumptions: + +- Instana hosting server + +- Instana support for ppc64le / aix / s390x is a tar.gz. This playbook presumes that a custom package has been created where inside the package is an OS supported jvm in : ./instana-agent/jvm/ or a working jvm in the path on the target host + +-- custom package naming compatible with the ansible arch naming: + +``` + +instana-agent-x86_64.tar.gz +instana-agent-ppc64le.tar.gz +instana-agent-s390x.tar.gz +instana-agent-chrp.tar.gz + +``` + + +## Restrictions: + + +## Setting up inventory + +- UNIX: From the `install_instana_agent` directory copy the sample inventory file at `examples/inventory.unix.yml` to the current directory. +- Windows: From the `install_instana_agent` directory copy the sample inventory file at `examples/inventory.windows.yml` to the current directory. + +``` +cp examples/inventory.unix.yml ./inventory +``` + +or + +``` +cp examples/inventory.windows.yml ./inventory +``` + +## Run playbook + +Once you have configured the `inventory` file, run the playbook using: + +``` +ansible-playbook -i inventory install_instana_agent.yml + +``` + +## Change / update the Instana agent zone + +Set the instana_zone in the inventory, run the playbook using: + +``` +ansible-playbook -i inventory instana_agent_zone.yml + +``` +## Change the Instana agent Instana server backend + +``` +cp examples/inventory.switch.yml ./inventory +``` + +Set the Instana server info in the inventory, run the playbook using: + +``` +ansible-playbook -i inventory instana_agent_switch.yml + +``` diff --git a/ansible/install_instana_agent_k3s/examples/inventory.switch.yml b/ansible/install_instana_agent_k3s/examples/inventory.switch.yml new file mode 100644 index 000000000..70ec05c31 --- /dev/null +++ b/ansible/install_instana_agent_k3s/examples/inventory.switch.yml @@ -0,0 +1,21 @@ +all: + vars: + agent_key: '' + instana_host: '' + instana_port: '443' + + # adjust the contents below to match your configuration + hosts: + children: + Unix: + vars: + ansible_user: root # user on the target envs + hosts: + rhel8.fyre.ibm.com + # windows only required variables + Windows: + vars: + ansible_user: Administrator # user on the target envs + ansible_shell_type: cmd + hosts: + win1.fyre.ibm.com diff --git a/ansible/install_instana_agent_k3s/examples/inventory.unix.yml b/ansible/install_instana_agent_k3s/examples/inventory.unix.yml new file mode 100644 index 000000000..1eed18781 --- /dev/null +++ b/ansible/install_instana_agent_k3s/examples/inventory.unix.yml @@ -0,0 +1,20 @@ +all: + vars: + agent_key: '' + instana_host: '' + instana_port: '1444' + instana_zone: '' + custom_agent_url: '' + instana_mode: 'dynamic' # dynamic or static + instana_runtime: '-j' # blank is azul , -j is Eclipse OpenJ9 11 + + # adjust the contents below to match your configuration + hosts: + children: + Unix: + vars: + ansible_user: nest # user on the target envs + hosts: + rhel8.fyre.ibm.com: + aix7.fyre.ibm.com: + sles15.fyre.ibm.com: diff --git a/ansible/install_instana_agent_k3s/examples/inventory.windows.yml b/ansible/install_instana_agent_k3s/examples/inventory.windows.yml new file mode 100644 index 000000000..70d5dbbb8 --- /dev/null +++ b/ansible/install_instana_agent_k3s/examples/inventory.windows.yml @@ -0,0 +1,23 @@ +all: + vars: + agent_key: '' + instana_host: '' + instana_mode: '' # blank is dynamic offline is static + instana_zone: '' + instana_runtime: 'j9' # blank is azul j9 is Eclipse OpenJ9 11 + + # windows only required variables + ansible_user: Administrator # user on the target envs + ansible_shell_type: cmd + instana_region: '' # if onprem install value is: singlebox-onprem + instana_unit: '' + instana_tenet: '' + # end windows only required variables + + # adjust the contents below to match your configuration + hosts: + children: + windows: + hosts: + windoze1.fyre.ibm.com: + windoze2.fyre.ibm.com: diff --git a/ansible/install_instana_agent_k3s/install_instana_agent.yml b/ansible/install_instana_agent_k3s/install_instana_agent.yml new file mode 100644 index 000000000..eb70e0303 --- /dev/null +++ b/ansible/install_instana_agent_k3s/install_instana_agent.yml @@ -0,0 +1,4 @@ +--- +- hosts: all + roles: + - role: instana_agent_install_config_k3s diff --git a/ansible/install_instana_agent_k3s/instana_agent_switch.yml b/ansible/install_instana_agent_k3s/instana_agent_switch.yml new file mode 100644 index 000000000..f9662f07d --- /dev/null +++ b/ansible/install_instana_agent_k3s/instana_agent_switch.yml @@ -0,0 +1,4 @@ +--- +- hosts: all + roles: + - role: instana_agent_switch diff --git a/ansible/install_instana_agent_k3s/instana_agent_zone.yml b/ansible/install_instana_agent_k3s/instana_agent_zone.yml new file mode 100644 index 000000000..faccea0fa --- /dev/null +++ b/ansible/install_instana_agent_k3s/instana_agent_zone.yml @@ -0,0 +1,4 @@ +--- +- hosts: all + roles: + - role: instana_agent_zone diff --git a/ansible/nest-user-play/Jenkinsfile b/ansible/nest-user-play/Jenkinsfile index 59d0ff37b..4c7fdd5a5 100644 --- a/ansible/nest-user-play/Jenkinsfile +++ b/ansible/nest-user-play/Jenkinsfile @@ -19,7 +19,7 @@ properties(jobProps) timestamps { ansiColor('xterm') { - node ( 'kube_pod_slave' ) { + node { //def scmVars = checkout scm checkout scm diff --git a/ansible/ocp-cluster-admin-play/Jenkinsfile b/ansible/ocp-cluster-admin-play/Jenkinsfile index d8e8fe15e..475872b09 100644 --- a/ansible/ocp-cluster-admin-play/Jenkinsfile +++ b/ansible/ocp-cluster-admin-play/Jenkinsfile @@ -27,7 +27,7 @@ properties(jobProps) timestamps { ansiColor('xterm') { - node ( 'kube_pod_slave' ) { + node { checkout scm diff --git a/ansible/ocp-cluster-tag-play/Jenkinsfile-aws b/ansible/ocp-cluster-tag-play/Jenkinsfile-aws index f5e77a88c..67f82113d 100644 --- a/ansible/ocp-cluster-tag-play/Jenkinsfile-aws +++ b/ansible/ocp-cluster-tag-play/Jenkinsfile-aws @@ -21,7 +21,7 @@ properties(jobProps) timestamps { ansiColor('xterm') { - node ( 'kube_pod_slave' ) { + node { checkout scm diff --git a/ansible/osprereq-play/Jenkinsfile b/ansible/osprereq-play/Jenkinsfile index 8da5929e8..076a11ccd 100644 --- a/ansible/osprereq-play/Jenkinsfile +++ b/ansible/osprereq-play/Jenkinsfile @@ -17,7 +17,7 @@ properties(jobProps) timestamps { ansiColor('xterm') { - node ( 'kube_pod_slave' ) { + node { //def scmVars = checkout scm checkout scm diff --git a/ansible/plugins/filter/get_twas_server_name.py b/ansible/plugins/filter/get_twas_server_name.py new file mode 100644 index 000000000..ef49a761a --- /dev/null +++ b/ansible/plugins/filter/get_twas_server_name.py @@ -0,0 +1,11 @@ +import re + +class FilterModule(object): + def filters(self): + return { + 'get_twas_server_name': self.get_twas_server_name, + } + + def get_twas_server_name(self, data): + m = re.search('"([^"]*)"', data) + return m.group(1) diff --git a/ansible/provision-pool-play/Jenkinsfile-aws b/ansible/provision-pool-play/Jenkinsfile-aws index 35bec3854..581da4dc1 100644 --- a/ansible/provision-pool-play/Jenkinsfile-aws +++ b/ansible/provision-pool-play/Jenkinsfile-aws @@ -35,7 +35,7 @@ properties(jobProps) timestamps { ansiColor('xterm') { - node ( 'kube_pod_slave' ) { + node { checkout scm diff --git a/ansible/request-crc-fyre-play/Jenkinsfile b/ansible/request-crc-fyre-play/Jenkinsfile index cfb27bc10..be59fc86f 100644 --- a/ansible/request-crc-fyre-play/Jenkinsfile +++ b/ansible/request-crc-fyre-play/Jenkinsfile @@ -21,7 +21,7 @@ properties(jobProps) timestamps { ansiColor('xterm') { - node ( 'kube_pod_slave' ) { + node { //def scmVars = checkout scm checkout scm diff --git a/ansible/request-instana-host-fyre-play/Jenkinsfile b/ansible/request-instana-host-fyre-play/Jenkinsfile index 2fe827d92..51d8c9366 100644 --- a/ansible/request-instana-host-fyre-play/Jenkinsfile +++ b/ansible/request-instana-host-fyre-play/Jenkinsfile @@ -26,7 +26,7 @@ properties(jobProps) timestamps { ansiColor('xterm') { - node ( 'kube_pod_slave' ) { + node { //def scmVars = checkout scm checkout scm diff --git a/ansible/request-instana-host-fyre-play/Jenkinsfile.k3s b/ansible/request-instana-host-fyre-play/Jenkinsfile.k3s new file mode 100644 index 000000000..96979bb53 --- /dev/null +++ b/ansible/request-instana-host-fyre-play/Jenkinsfile.k3s @@ -0,0 +1,70 @@ +#! groovy + +pipeline { + agent { label 'rtp' } + + parameters { + string(name: 'stackName', defaultValue: 'changeMyStackName', description: 'name of fyre stack') + string(name: 'fyreuser', description: 'username for accessing fyre api') + password(name: 'fyreapikey', description: 'fyre api key') + password(name: 'instanaAdminPassword', description: 'Instana admin password') + string(name: 'site', defaultValue: 'rtp', description: 'default site: [ svl|rtp|hur|tor|cdl|isl ]') + string(name: 'agent_key', description: 'Instana agent_key') + string(name: 'download_key', description: 'Instana download_key') + string(name: 'sales_key', description: 'Instana sales_key') + string(name: 'tenet', description: 'Instana tenet') + string(name: 'unit', description: 'Instana unit') + string(name: 'STANCTL_CORE_SMTP_FROM', description: 'Instana host email owner') + string(name: 'STANCTL_CORE_SMTP_HOST', description: 'smtp email server') + string(name: 'STANCTL_CORE_SMTP_PORT', description: 'smtp email server port') + string(name: 'github_com_creds', description: 'git hub creds Jenkins secret') + } + environment { + sampleEnvVar = 'foo' + } + + stages { + stage('Checkout ansible community automation fork') { + when { + allOf { + //branch 'main' + triggeredBy cause: "UserIdCause" + } + } + steps { + // checkout if the repo is different + //git branch: 'main', credentialsId: 'schader_github_com', url: 'https://github.com/stevenschader/community-automation.git' + } + } + stage('create Instana Instance') { + when { + allOf { + //branch 'main' + triggeredBy cause: "UserIdCause" + } + } + steps { + sh """ + set +x # hide sensitive info being echo'd to log + cd ansible + ansible-playbook -i request-instana-host-fyre-play/examples/inventory.yaml \ + request-instana-host-fyre-play/request-instana-host-fyre-play-k3s.yml \ + -e fyreuser=$fyreuser \ + -e fyreapikey=$fyreapikey \ + -e noLog=false \ + -e stackName=$stackName \ + -e site=$site \ + -e download_key=$download_key \ + -e agent_key=$agent_key \ + -e sales_key=$sales_key \ + -e instana_tenet=$tenet \ + -e instana_unit=$unit \ + -e instanaAdminPassword=${instanaAdminPassword} \ + -e STANCTL_CORE_SMTP_FROM=${STANCTL_CORE_SMTP_FROM} \ + -e STANCTL_CORE_SMTP_HOST=${STANCTL_CORE_SMTP_HOST} \ + -e STANCTL_CORE_SMTP_PORT=${STANCTL_CORE_SMTP_PORT} + """ + } + } + } +} diff --git a/ansible/request-instana-host-fyre-play/examples/inventory b/ansible/request-instana-host-fyre-play/examples/inventory deleted file mode 100644 index 3ae83f4d1..000000000 --- a/ansible/request-instana-host-fyre-play/examples/inventory +++ /dev/null @@ -1,5 +0,0 @@ -[fyreApi] -localhost ansible_connection=local fyreuser=myfyreuser fyreapikey=myfyreapikey site=rtp - -[instana] -download_key=yourdkey agent_key=yourakey sales_key=yourskey instana_tenet=yourTenet instana_unit=yourUnit diff --git a/ansible/request-instana-host-fyre-play/examples/inventory.yaml b/ansible/request-instana-host-fyre-play/examples/inventory.yaml new file mode 100644 index 000000000..46f85a158 --- /dev/null +++ b/ansible/request-instana-host-fyre-play/examples/inventory.yaml @@ -0,0 +1,20 @@ +all: + hosts: + vars: + download_key: yourDownloadKey + agent_key: yourAgentKey + sales_key: yourSaleKey + instana_tenet: nest + instana_unit: was + STANCTL_CORE_SMTP_FROM: 'owner@instanaHost' + STANCTL_CORE_SMTP_HOST: 'your.email.relay.com' + STANCTL_CORE_SMTP_PORT: 'port' + children: + fyreApi: + hosts: + localhost: + vars: + ansible_connection: local + fyreuser: you + fyreapikey: yourFyreApiKey + site: rtp \ No newline at end of file diff --git a/ansible/request-instana-host-fyre-play/request-instana-host-fyre-play-k3s.yml b/ansible/request-instana-host-fyre-play/request-instana-host-fyre-play-k3s.yml new file mode 100644 index 000000000..bdffa4b17 --- /dev/null +++ b/ansible/request-instana-host-fyre-play/request-instana-host-fyre-play-k3s.yml @@ -0,0 +1,13 @@ +--- +- hosts: fyreApi + roles: + - role: instana_fyrevm + +- hosts: instana + vars: + - ansible_user: root + roles: + - role: fix_fyre_hosts_file + - role: timezone + - role: instana_fyrevm_k3s_settings + - role: instana_instance_k3s \ No newline at end of file diff --git a/ansible/request-ocp-fyre-play/Jenkinsfile b/ansible/request-ocp-fyre-play/Jenkinsfile index 3dc9ea578..e187aa02c 100644 --- a/ansible/request-ocp-fyre-play/Jenkinsfile +++ b/ansible/request-ocp-fyre-play/Jenkinsfile @@ -22,7 +22,7 @@ properties(jobProps) timestamps { ansiColor('xterm') { - node ( 'kube_pod_slave' ) { + node { //def scmVars = checkout scm checkout scm diff --git a/ansible/request-rhel-db2-fyre-play/Jenkinsfile b/ansible/request-rhel-db2-fyre-play/Jenkinsfile index 1f1a9668e..2685a6ac7 100644 --- a/ansible/request-rhel-db2-fyre-play/Jenkinsfile +++ b/ansible/request-rhel-db2-fyre-play/Jenkinsfile @@ -22,7 +22,7 @@ properties(jobProps) timestamps { ansiColor('xterm') { - node ( 'kube_pod_slave' ) { + node { //def scmVars = checkout scm checkout scm diff --git a/ansible/request-rhel-db2-fyre-play/Jenkinsfile.db2only b/ansible/request-rhel-db2-fyre-play/Jenkinsfile.db2only index e32bfa5a8..f36b708f9 100644 --- a/ansible/request-rhel-db2-fyre-play/Jenkinsfile.db2only +++ b/ansible/request-rhel-db2-fyre-play/Jenkinsfile.db2only @@ -20,7 +20,7 @@ properties(jobProps) timestamps { ansiColor('xterm') { - node ( 'kube_pod_slave' ) { + node { //def scmVars = checkout scm checkout scm diff --git a/ansible/request-rhel-jmeter-fyre-play/Jenkinsfile b/ansible/request-rhel-jmeter-fyre-play/Jenkinsfile index db7af015c..a115dff86 100644 --- a/ansible/request-rhel-jmeter-fyre-play/Jenkinsfile +++ b/ansible/request-rhel-jmeter-fyre-play/Jenkinsfile @@ -24,7 +24,7 @@ properties(jobProps) timestamps { ansiColor('xterm') { - node ( 'kube_pod_slave' ) { + node { //def scmVars = checkout scm checkout scm diff --git a/ansible/request-rhel-jmeter-fyre-play/Jenkinsfile.jmeter b/ansible/request-rhel-jmeter-fyre-play/Jenkinsfile.jmeter index 0772e5554..271aae1aa 100644 --- a/ansible/request-rhel-jmeter-fyre-play/Jenkinsfile.jmeter +++ b/ansible/request-rhel-jmeter-fyre-play/Jenkinsfile.jmeter @@ -11,8 +11,8 @@ def jobProps = [ def paramsList = [ string(name: 'stackName', defaultValue: 'changeMyFQDNName', description: 'FQDN of the target jmeter host'), string(name: 'jmeterUser', defaultValue: 'changeMyjmeterUser', description: 'name of non-root user ( Do not use jmeter )'), - string(name: 'javaArchive', defaultValue: 'https://github.com/ibmruntimes/semeru17-binaries/releases/download/jdk-17.0.4.1+1_openj9-0.33.1/ibm-semeru-open-jdk_x64_linux_17.0.4.1_1_openj9-0.33.1.tar.gz',description: 'url of source java archive'), - string(name: 'jmeterArchive', defaultValue: 'http://nest-reports1.fyre.ibm.com/binaries/jmeter/apache-jmeter-5.5.zip', description: 'url of source jmeter archive'), + string(name: 'javaArchive', defaultValue: 'https://github.com/ibmruntimes/semeru17-binaries/releases/download/jdk-17.0.9+9_openj9-0.41.0/ibm-semeru-open-jdk_x64_linux_17.0.9_9_openj9-0.41.0.tar.gz',description: 'url of source java archive'), + string(name: 'jmeterArchive', defaultValue: 'http://nest-ci-agent-1.fyre.ibm.com/binaries/jmeter/latest.zip', description: 'url of source jmeter archive'), string(name: 'jmeterManagerPluginUrl', defaultValue: 'https://jmeter-plugins.org/get/'), booleanParam(name: 'forceReplace', defaultValue: false, description: 'force replace java and jmeter'), booleanParam(name: 'enableVNC', defaultValue: false, description: 'configure VNC Server on jmeter host') @@ -23,7 +23,7 @@ properties(jobProps) timestamps { ansiColor('xterm') { - node ( 'kube_pod_slave' ) { + node { //def scmVars = checkout scm checkout scm diff --git a/ansible/roles/apachectl_graceful/meta/main.yml b/ansible/roles/apachectl_graceful/meta/main.yml new file mode 100644 index 000000000..b98e2740d --- /dev/null +++ b/ansible/roles/apachectl_graceful/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: http_defaults diff --git a/ansible/roles/im_update_twas/readme.md b/ansible/roles/apachectl_graceful/readme.md similarity index 100% rename from ansible/roles/im_update_twas/readme.md rename to ansible/roles/apachectl_graceful/readme.md diff --git a/ansible/roles/apachectl_graceful/tasks/apachectl_graceful.yml b/ansible/roles/apachectl_graceful/tasks/apachectl_graceful.yml new file mode 100644 index 000000000..c3dddd1fe --- /dev/null +++ b/ansible/roles/apachectl_graceful/tasks/apachectl_graceful.yml @@ -0,0 +1,36 @@ +--- +- name: Restart the apache http server gracefully + tags: Restart + block: + - name: check if apachectl is installed + stat: + path: "{{ install_ihs_base }}/{{ http_dir }}/bin" + register: ishttp + failed_when: ishttp.stat.exists == False + + - name: Unix HTTPServer operations + when: ansible_system is not search('CYG') + block: + - name: HTTPServer graceful load new / updated config + failed_when: false + shell: "{{install_ihs_base }}/{{ http_dir }}/bin/apachectl graceful" + register: gracefulOutput + + - name: apachectl gracefulOutput + debug: + msg: "{{ gracefulOutput.stdout_lines }}" + + - name: check if adminctl is installed + stat: + path: "{{ install_ihs_base }}/{{ http_dir }}/bin/adminctl" + register: ishttp + failed_when: ishttp.stat.exists == False + + - name: HTTPServer adminctl graceful load new / updated config + failed_when: false + shell: "{{install_ihs_base }}/{{ http_dir }}/bin/adminctl graceful" + register: gracefulOutput + + - name: adminctl gracefulOutput + debug: + msg: "{{ gracefulOutput.stdout_lines }}" diff --git a/ansible/roles/apachectl_graceful/tasks/main.yml b/ansible/roles/apachectl_graceful/tasks/main.yml new file mode 100644 index 000000000..f7b656d6e --- /dev/null +++ b/ansible/roles/apachectl_graceful/tasks/main.yml @@ -0,0 +1,2 @@ +--- +- include_tasks: apachectl_graceful.yml diff --git a/ansible/roles/apachectl_start/meta/main.yml b/ansible/roles/apachectl_start/meta/main.yml new file mode 100644 index 000000000..b98e2740d --- /dev/null +++ b/ansible/roles/apachectl_start/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: http_defaults diff --git a/ansible/roles/linux_kill_process/readme.md b/ansible/roles/apachectl_start/readme.md similarity index 100% rename from ansible/roles/linux_kill_process/readme.md rename to ansible/roles/apachectl_start/readme.md diff --git a/ansible/roles/apachectl_start/tasks/apachectl_start.yml b/ansible/roles/apachectl_start/tasks/apachectl_start.yml new file mode 100644 index 000000000..847961802 --- /dev/null +++ b/ansible/roles/apachectl_start/tasks/apachectl_start.yml @@ -0,0 +1,50 @@ +--- +- name: Start the apache http server + tags: apache_start + block: + - name: check if apachectl is installed + stat: + path: "{{ install_ihs_base }}/{{ http_dir }}/bin" + register: ishttp + failed_when: ishttp.stat.exists == False + + - name: Unix HTTPServer operations + when: ansible_system is not search('CYG') + block: + - name: HTTPServer start to load new / updated config + failed_when: false + shell: "{{ install_ihs_base }}/{{ http_dir }}/bin/apachectl start" + register: ihsOutput + + - name: HTTPServer apachectl start Output + debug: + msg: "{{ ihsOutput.stdout_lines }}" + + - name: Disable admin.config User otherwise must run as root + ansible.builtin.replace: + path: "{{ install_ihs_base }}/{{ http_dir }}/conf/admin.conf" + regexp: '^User' + replace: '#User' + + - name: Disable admin.config Group otherwise must run as root + ansible.builtin.replace: + path: "{{ install_ihs_base }}/{{ http_dir }}/conf/admin.conf" + regexp: '^Group' + replace: '#Group' + + - name: HTTPServer adminctl start to load new / updated config + failed_when: false + shell: "{{ install_ihs_base }}/{{ http_dir }}/bin/adminctl start" + register: adminctl + + - name: HTTPServer adminctl start Output + debug: + msg: "{{ adminctl.stdout_lines }}" + + - name: Windoze HTTPServer operations + when: ansible_system == 'Windows' or 'CYG' in ansible_system + block: + - name: Apache start + ansible.builtin.shell: "{{install_ihs_base }}/{{ http_dir }}/bin/apache -k restart -n 'IBMHTTPServer'" + - name: Apache start admin + ansible.builtin.shell: "{{install_ihs_base }}/{{ http_dir }}/bin/apache -k restart -n 'IBMAdminHTTPServer'" diff --git a/ansible/roles/apachectl_start/tasks/main.yml b/ansible/roles/apachectl_start/tasks/main.yml new file mode 100644 index 000000000..c360204aa --- /dev/null +++ b/ansible/roles/apachectl_start/tasks/main.yml @@ -0,0 +1,2 @@ +--- +- include_tasks: apachectl_start.yml diff --git a/ansible/roles/apachectl_stop/meta/main.yml b/ansible/roles/apachectl_stop/meta/main.yml new file mode 100644 index 000000000..b98e2740d --- /dev/null +++ b/ansible/roles/apachectl_stop/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: http_defaults diff --git a/ansible/roles/apachectl_stop/readme.md b/ansible/roles/apachectl_stop/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/apachectl_stop/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/apachectl_stop/tasks/apachectl_stop.yml b/ansible/roles/apachectl_stop/tasks/apachectl_stop.yml new file mode 100644 index 000000000..a88270c0e --- /dev/null +++ b/ansible/roles/apachectl_stop/tasks/apachectl_stop.yml @@ -0,0 +1,26 @@ +--- +- name: Stop the http server + tags: apache_stop + block: + - name: check if HTTPServer is installed + stat: + path: "{{ install_ihs_base }}/{{ http_dir }}/bin" + register: ishttp + failed_when: ishttp.stat.exists == False + + - name: Unix HTTPServer operations + when: ansible_system is not search('CYG') + block: + - name: HTTPServer apachectl stop + ansible.builtin.shell: "{{install_ihs_base }}/{{ http_dir }}/bin/apachectl stop" + + - name: HTTPServer adminctl stop + ansible.builtin.shell: "{{install_ihs_base }}/{{ http_dir }}/bin/adminctl stop" + + - name: Windoze HTTPServer operations + when: ansible_system == 'Windows' or 'CYG' in ansible_system + block: + - name: Apache stop + ansible.builtin.shell: "{{install_ihs_base }}/{{ http_dir }}/bin/apache -k stop -n 'IBMHTTPServer'" + - name: Apache stop admin + ansible.builtin.shell: "{{install_ihs_base }}/{{ http_dir }}/bin/apache -k stop -n 'IBMAdminHTTPServer'" diff --git a/ansible/roles/apachectl_stop/tasks/main.yml b/ansible/roles/apachectl_stop/tasks/main.yml new file mode 100644 index 000000000..8b44e32ef --- /dev/null +++ b/ansible/roles/apachectl_stop/tasks/main.yml @@ -0,0 +1,2 @@ +--- +- include_tasks: apachectl_stop.yml diff --git a/ansible/roles/authorized_keys/tasks/main.yml b/ansible/roles/authorized_keys/tasks/main.yml index 41d6d835a..cab1b5bd1 100644 --- a/ansible/roles/authorized_keys/tasks/main.yml +++ b/ansible/roles/authorized_keys/tasks/main.yml @@ -1,18 +1,18 @@ --- - name: Add authorized keys - when: authorized_keys_url is defined + when: authorized_keys_url is defined block: - - name: authorized_keys root - authorized_key: - user: root - state: present - manage_dir: yes - key: "{{ authorized_keys_url }}" - become: yes - - name: authorized_keys user - authorized_key: - user: "{{ user_username }}" - state: present - manage_dir: yes - key: "{{ authorized_keys_url }}" + - name: Authorized_keys root + authorized_key: + user: root + state: present + manage_dir: true + key: "{{ authorized_keys_url }}" + become: true + - name: Authorized_keys user + authorized_key: + user: "{{ user_username }}" + state: present + manage_dir: true + key: "{{ authorized_keys_url }}" diff --git a/ansible/roles/combine_json/readme.md b/ansible/roles/combine_json/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/combine_json/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/combine_json/tasks/combine_json.yml b/ansible/roles/combine_json/tasks/combine_json.yml new file mode 100644 index 000000000..735899a31 --- /dev/null +++ b/ansible/roles/combine_json/tasks/combine_json.yml @@ -0,0 +1,46 @@ +--- +- name: Remove previous combined json + delegate_to: localhost + ansible.builtin.file: + path: "{{ json_path }}/{{ json_file }}" + state: absent + +- name: "Find {{ json_path }}/{{ json_file }}" + delegate_to: localhost + ansible.builtin.find: + paths: "{{ json_path }}" + recurse: true + patterns: "{{ json_file }}" + register: foundem + +- name: Any json files found? + when: foundem.matched > 0 + block: + + - name: Inialize combined dict ( combined ) + delegate_to: localhost + ansible.builtin.set_fact: + combined_dict: {} + + - name: Save ( seed combined ) + delegate_to: localhost + ansible.builtin.copy: + content: "{{ combined_dict }}" + dest: "{{ json_path }}/{{ json_file }}" + mode: '0444' + + - name: Save ( combined ) + delegate_to: localhost + ansible.builtin.copy: + content: "{{ lookup('ansible.builtin.file', '{{ json_path }}/{{ json_file }}') | from_json | ansible.builtin.combine(lookup('ansible.builtin.file', '{{ item }}') | from_json )}}" + dest: "{{ json_path }}/{{ json_file }}" + mode: '0444' + with_items: "{{ foundem.files | map(attribute='path') | list }}" + + - name: Remove local source json after combine + with_items: "{{ foundem.files | map(attribute='path') | list }}" + when: foundem.matched > 0 + delegate_to: localhost + ansible.builtin.file: + path: "{{ item }}" + state: absent diff --git a/ansible/roles/combine_json/tasks/main.yml b/ansible/roles/combine_json/tasks/main.yml new file mode 100644 index 000000000..4f4df38f9 --- /dev/null +++ b/ansible/roles/combine_json/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Combine json files + ansible.builtin.include_tasks: combine_json.yml diff --git a/ansible/roles/crc_enable_telemetry/tasks/crc_enable_telemetry.yml b/ansible/roles/crc_enable_telemetry/tasks/crc_enable_telemetry.yml index c114d29e9..ebd2ea901 100644 --- a/ansible/roles/crc_enable_telemetry/tasks/crc_enable_telemetry.yml +++ b/ansible/roles/crc_enable_telemetry/tasks/crc_enable_telemetry.yml @@ -40,5 +40,5 @@ - monidx != "" when: - - crcEnableTelemetryFlag == True + - crcEnableTelemetryFlag - ansible_facts['memtotal_mb'] >= 16000 diff --git a/ansible/roles/crc_fyrevm/tasks/crc_fyrevm.yml b/ansible/roles/crc_fyrevm/tasks/crc_fyrevm.yml index 48a5ed5d4..7961a64d7 100644 --- a/ansible/roles/crc_fyrevm/tasks/crc_fyrevm.yml +++ b/ansible/roles/crc_fyrevm/tasks/crc_fyrevm.yml @@ -7,7 +7,7 @@ fyre_platform: x fyre_cpu: 6 fyre_memory: 32 - fyre_os: 'Redhat 8.2' + # fyre_os: 'Redhat 8.2' fyre_site: "{{ site }}" fyre_comment: 'RH OpenShift crc' clusterName_prefix: crc diff --git a/ansible/roles/crc_install/tasks/crc_install.yml b/ansible/roles/crc_install/tasks/crc_install.yml index 0b0c322ab..6fd9c461a 100644 --- a/ansible/roles/crc_install/tasks/crc_install.yml +++ b/ansible/roles/crc_install/tasks/crc_install.yml @@ -39,7 +39,7 @@ when: iscrc.stat.exists == False - name: Install NetworkManager FireFox - become: yes + become: true dnf: name: "{{ packages }}" state: latest @@ -51,7 +51,7 @@ state: latest - name: enable and start NetworkManager - become: yes + become: true systemd: name: NetworkManager.service state: started diff --git a/ansible/roles/crc_oc_cli/tasks/crc_oc_cli.yml b/ansible/roles/crc_oc_cli/tasks/crc_oc_cli.yml index 0d113e0b7..2b7c25823 100644 --- a/ansible/roles/crc_oc_cli/tasks/crc_oc_cli.yml +++ b/ansible/roles/crc_oc_cli/tasks/crc_oc_cli.yml @@ -25,7 +25,7 @@ command: 'mv ~/.crc/bin/oc.bin/oc ~/.crc/bin/oc' when: - isbinococ.failed == False - - isbinococ.stat.exists == True + - isbinococ.stat.exists - name: link oc kubectl file: diff --git a/ansible/roles/crc_start/tasks/crc_start.yml b/ansible/roles/crc_start/tasks/crc_start.yml index ac66346b9..8546537fc 100644 --- a/ansible/roles/crc_start/tasks/crc_start.yml +++ b/ansible/roles/crc_start/tasks/crc_start.yml @@ -25,7 +25,7 @@ - name: crc delete stdout debug: msg: "{{ crcdelete.stdout_lines }}" - when: isdotcrc.stat.exists == True + when: isdotcrc.stat.exists - name: crc setup shell: "crc setup" @@ -72,7 +72,7 @@ groups: - 'libvirt' append: yes - become: yes + become: true - name: crc status stdout debug: diff --git a/ansible/roles/crc_user/tasks/crc_user.yml b/ansible/roles/crc_user/tasks/crc_user.yml index 4c68cc083..da813d252 100644 --- a/ansible/roles/crc_user/tasks/crc_user.yml +++ b/ansible/roles/crc_user/tasks/crc_user.yml @@ -6,7 +6,7 @@ generate_ssh_key: yes shell: "/bin/bash" state: present - become: yes + become: true - name: Add user to sudoers lineinfile: @@ -16,7 +16,7 @@ line: '{{ crc_username }} ALL=(ALL) NOPASSWD: ALL' validate: 'visudo -cf %s' backup: yes - become: yes + become: true - name: update user hard ulimit nofile pam_limits: @@ -25,7 +25,7 @@ limit_item: nofile use_max: yes value: '64000' - become: yes + become: true - name: update user soft ulimit nofile pam_limits: @@ -34,7 +34,7 @@ limit_item: nofile use_max: yes value: '64000' - become: yes + become: true - name: authorized_key authorized_key: @@ -42,4 +42,4 @@ state: present manage_dir: yes key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}" - become: yes + become: true diff --git a/ansible/roles/db2jcc_jars/defaults/main.yml b/ansible/roles/db2jcc_jars/defaults/main.yml index f41c2be20..725d9c612 100644 --- a/ansible/roles/db2jcc_jars/defaults/main.yml +++ b/ansible/roles/db2jcc_jars/defaults/main.yml @@ -1,3 +1,4 @@ --- db_user: 'db2inst1' db_host: 'dbhost' +svt_db_dir: dbdir diff --git a/ansible/roles/db2jcc_jars/tasks/db2jcc_jars.yml b/ansible/roles/db2jcc_jars/tasks/db2jcc_jars.yml index 6ea4ab50c..7a0386e2f 100644 --- a/ansible/roles/db2jcc_jars/tasks/db2jcc_jars.yml +++ b/ansible/roles/db2jcc_jars/tasks/db2jcc_jars.yml @@ -10,27 +10,17 @@ src: ~/sqllib/java/db2jcc4.jar dest: /tmp/db2jcc4.jar flat: yes - - name: fetch db2jcc_license_cu.jar - fetch: - src: ~/sqllib/java/db2jcc_license_cu.jar - dest: /tmp/db2jcc_license_cu.jar - flat: yes - when: onprem.stat.exists == True + when: onprem.stat.exists - name: check container db2 for db2jcc jars stat: - path: "~/dbdir/backup/db2jcc4.jar" + path: "~/{{ svt_db_dir }}/backup/db2jcc4.jar" register: container - block: - name: fetch db2jcc4.jar fetch: - src: ~/dbdir/backup/db2jcc4.jar + src: ~/{{ svt_db_dir }}/backup/db2jcc4.jar dest: /tmp/db2jcc4.jar flat: yes - - name: fetch db2jcc_license_cu.jar - fetch: - src: ~/dbdir/backup/db2jcc_license_cu.jar - dest: /tmp/db2jcc_license_cu.jar - flat: yes - when: container.stat.exists == True + when: container.stat.exists diff --git a/ansible/roles/docker_ce_install/tasks/RedHat.yml b/ansible/roles/docker_ce_install/tasks/RedHat.yml index 802a99f28..78ee27bfb 100644 --- a/ansible/roles/docker_ce_install/tasks/RedHat.yml +++ b/ansible/roles/docker_ce_install/tasks/RedHat.yml @@ -1,7 +1,7 @@ --- # https://docs.docker.com/engine/install/centos/ - name: remove conflicting packages - become: yes + become: true ignore_errors: yes ansible.builtin.dnf: name: "{{ packages }}" diff --git a/ansible/roles/docker_ce_install/tasks/Ubuntu.yml b/ansible/roles/docker_ce_install/tasks/Ubuntu.yml index dd4f88dbe..660190edb 100644 --- a/ansible/roles/docker_ce_install/tasks/Ubuntu.yml +++ b/ansible/roles/docker_ce_install/tasks/Ubuntu.yml @@ -1,7 +1,7 @@ --- # https://docs.docker.com/engine/install/ubuntu/ - name: remove conflicting packages - become: yes + become: true ignore_errors: yes apt: name: "{{ packages }}" @@ -20,7 +20,7 @@ update_cache: yes - name: install pre-req packages - become: yes + become: true apt: name: "{{ packages }}" state: present @@ -33,7 +33,7 @@ - 'lsb-release' - name: apt update - become: yes + become: true apt: name: '*' state: latest @@ -50,7 +50,7 @@ state: present - name: install docker packages - become: yes + become: true apt: name: "{{ packages }}" state: present diff --git a/ansible/roles/docker_ce_install/tasks/main.yml b/ansible/roles/docker_ce_install/tasks/main.yml index 6b69c02a1..b900eac36 100644 --- a/ansible/roles/docker_ce_install/tasks/main.yml +++ b/ansible/roles/docker_ce_install/tasks/main.yml @@ -1,4 +1,5 @@ --- -- include_tasks: "{{ ansible_distribution }}.yml" - when: - - ansible_system == 'Linux' +- name: Docker CE install + ansible.builtin.include_tasks: "{{ ansible_distribution }}.yml" + when: + - ansible_system == 'Linux' diff --git a/ansible/roles/fix_fyre_hosts_file/tasks/fix-fyre-host-file.yml b/ansible/roles/fix_fyre_hosts_file/tasks/fix-fyre-host-file.yml index 79f3857fe..757d26814 100644 --- a/ansible/roles/fix_fyre_hosts_file/tasks/fix-fyre-host-file.yml +++ b/ansible/roles/fix_fyre_hosts_file/tasks/fix-fyre-host-file.yml @@ -7,4 +7,4 @@ regexp: "{{ansible_facts['fqdn'] }}" line: "{{ ansible_facts['default_ipv4']['address'] }} {{ ansible_facts['fqdn'] }} {{ ansible_facts['hostname'] }}" backup: yes - become: yes + become: true diff --git a/ansible/roles/get_liberty_archive/defaults/main.yml b/ansible/roles/get_liberty_archive/defaults/main.yml index 7166fd94f..8799e69d9 100644 --- a/ansible/roles/get_liberty_archive/defaults/main.yml +++ b/ansible/roles/get_liberty_archive/defaults/main.yml @@ -1,2 +1,3 @@ --- liberty_daily_or_test: 'daily' +targetDir: '.' diff --git a/ansible/roles/get_liberty_archive/tasks/get_liberty_archive.yml b/ansible/roles/get_liberty_archive/tasks/get_liberty_archive.yml index a5e5c4229..7a6d49f92 100644 --- a/ansible/roles/get_liberty_archive/tasks/get_liberty_archive.yml +++ b/ansible/roles/get_liberty_archive/tasks/get_liberty_archive.yml @@ -1,13 +1,48 @@ --- +- name: retrieve websphere liberty felement.xml to get the Relase + get_url: + url: "https://rtpgsa.ibm.com/gsa/rtpgsa/projects/l/liberty.build/liberty/WASX.LIBERTY/{{ liberty_daily_or_test }}/{{ liberty_im_driver }}/linux/zipper/felement.xml" + dest: '{{ targetDir }}/felment.xml' + username: "{{ gsa_user }}" + password: "{{ gsa_pass }}" + +- name: get the Liberty Release + community.general.xml: + path: '{{ targetDir }}/felment.xml' + xpath: /felement + content: attribute + register: xmlresp + +- name: Show an attribute value + ansible.builtin.debug: + var: xmlresp.matches[0].felement.version + +- set_fact: + updated_wlp_archive: "{{ wlp_archive | regex_replace(old,new) }}" + vars: + old: "RELEASE" + new: "{{ xmlresp.matches[0].felement.version }}" + +- name: updated wlp archive + ansible.builtin.debug: + var: "{{ updated_wlp_archive }}" + - name: retrieve websphere liberty archive get_url: - url: "https://rtpgsa.ibm.com/gsa/rtpgsa/projects/l/liberty.build/liberty/WASX.LIBERTY/{{ liberty_daily_or_test }}/{{ liberty_im_driver }}/linux/zipper/externals/installables/{{ wlp_archive }}" - dest: '{{ playbook_dir }}/{{ wlp_archive }}' + url: "https://rtpgsa.ibm.com/gsa/rtpgsa/projects/l/liberty.build/liberty/WASX.LIBERTY/{{ liberty_daily_or_test }}/{{ liberty_im_driver }}/linux/zipper/externals/installables/{{ updated_wlp_archive }}" + dest: '{{ targetDir }}/{{ updated_wlp_archive }}' username: "{{ gsa_user }}" password: "{{ gsa_pass }}" + +- name: Create a symbolic link to wlp-embeddable-full-RELEASE.zip wlp-embeddable-full.zip + ansible.builtin.file: + src: '{{ targetDir }}/{{ updated_wlp_archive }}' + dest: '{{ targetDir }}/wlp-embeddable-full.zip' + state: link + - name: retrieve websphere liberty license get_url: url: "https://rtpgsa.ibm.com/gsa/rtpgsa/projects/l/liberty.build/liberty/WASX.LIBERTY/{{ liberty_daily_or_test }}/{{ liberty_im_driver }}/linux/zipper/externals/installables/wlp-nd-license.jar" - dest: '{{ playbook_dir }}/wlp-nd-license.jar' + dest: '{{ targetDir }}/wlp-nd-license.jar' username: "{{ gsa_user }}" password: "{{ gsa_pass }}" diff --git a/ansible/roles/hardware_info/defaults/main.yml b/ansible/roles/hardware_info/defaults/main.yml new file mode 100644 index 000000000..8bfd10aba --- /dev/null +++ b/ansible/roles/hardware_info/defaults/main.yml @@ -0,0 +1,2 @@ +--- +hardware_info_json_file: "hardware_info.json" \ No newline at end of file diff --git a/ansible/roles/hardware_info/readme.md b/ansible/roles/hardware_info/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/hardware_info/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/hardware_info/tasks/hardware_info.yml b/ansible/roles/hardware_info/tasks/hardware_info.yml new file mode 100644 index 000000000..2dafa2526 --- /dev/null +++ b/ansible/roles/hardware_info/tasks/hardware_info.yml @@ -0,0 +1,121 @@ +--- +- name: Create the hardware_info facts + when: + - cpuinfo.stdout_lines is defined + - meminfo.stdout_lines is defined + block: + + - name: Create hardware_info dir + delegate_to: localhost + ansible.builtin.file: + path: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}" + state: directory + mode: '0755' + + - name: Create the hardware_info if cpus defined + when: + - cpus.stdout_lines is defined + block: + + - name: Size of cpus + delegate_to: localhost + ansible.builtin.set_fact: + max_counter: "{{ cpus.stdout_lines | length }}" + + - name: Create dict with cpus + ansible.builtin.set_fact: + hardware_cpus: "{{ hardware_cpus | default({}) | combine( { item: cpus.stdout_lines[item | int] }, recursive=True, list_merge='append' ) }}" + with_sequence: 'start=0 end={{ max_counter | int - 1 }}' + no_log: true + + - name: Add the cpus to hardware_cpus + ansible.builtin.set_fact: + hardware_cpus: '{ "cpus" : {{ hardware_cpus }}}' + + - name: Size of kernelinfo + delegate_to: localhost + ansible.builtin.set_fact: + max_counter: "{{ kernelinfo.stdout_lines | length }}" + + - name: Create dict with kernelinfo + ansible.builtin.set_fact: + hardware_kernelinfo: "{{ hardware_kernelinfo | default({}) | combine( { item: kernelinfo.stdout_lines[item | int] }, recursive=True, list_merge='append' ) }}" + with_sequence: 'start=0 end={{ max_counter | int - 1 }}' + no_log: true + + - name: Add the cpuinfo to hardware_kernelinfo + ansible.builtin.set_fact: + hardware_kernelinfo: '{ "kernelinfo" : {{ hardware_kernelinfo }}}' + + - name: Size of cpuinfo + delegate_to: localhost + ansible.builtin.set_fact: + max_counter: "{{ cpuinfo.stdout_lines | length }}" + + - name: Create dict with cpuinfo + ansible.builtin.set_fact: + hardware_cpuinfo: "{{ hardware_cpuinfo | default({}) | combine( { item: cpuinfo.stdout_lines[item | int] }, recursive=True, list_merge='append' ) }}" + with_sequence: 'start=0 end={{ max_counter | int - 1 }}' + no_log: true + + - name: Add the cpuinfo to hardware_cpuinfo + ansible.builtin.set_fact: + hardware_cpuinfo: '{ "cpuinfo" : {{ hardware_cpuinfo }}}' + + - name: Size of meminfo + delegate_to: localhost + ansible.builtin.set_fact: + max_counter: "{{ meminfo.stdout_lines | length }}" + + - name: Create dict with meminfo + ansible.builtin.set_fact: + hardware_meminfo: "{{ hardware_meminfo | default({}) | combine( { item: meminfo.stdout_lines[item | int] }, recursive=True, list_merge='append' ) }}" + with_sequence: 'start=0 end={{ max_counter | int - 1 }}' + no_log: true + + - name: Add the meminfo to hardware_meminfo + ansible.builtin.set_fact: + hardware_meminfo: '{ "meminfo" : {{ hardware_meminfo }}}' + + - name: Add the os name to hardware_osname + set_fact: + hardware_osname: + osname: "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}" + + - name: Combine hardware_info and hardware_osname + ansible.builtin.set_fact: + hardware_info: "{{ hardware_info | default({}) | combine(hardware_osname, recursive=True) }}" + + - name: Combine hardware_info and hardware_kernelinfo + ansible.builtin.set_fact: + hardware_info: "{{ hardware_info | default({}) | combine(hardware_kernelinfo, recursive=True) }}" + + - name: Combine hardware_info and hardware_cpus + when: + - cpus.stdout_lines is defined + ansible.builtin.set_fact: + hardware_info: "{{ hardware_info | default({}) | combine(hardware_cpus, recursive=True) }}" + + - name: Combine hardware_info and hardware_cpuinfo + ansible.builtin.set_fact: + hardware_info: "{{ hardware_info | default({}) | combine(hardware_cpuinfo, recursive=True) }}" + + - name: Combine hardware_info and hardware_meminfo + ansible.builtin.set_fact: + hardware_info: "{{ hardware_info | default({}) | combine(hardware_meminfo, recursive=True) }}" + + - name: Add the fqdn to hardware_info + ansible.builtin.set_fact: + hardware_info: "{{ { ansible_fqdn : hardware_info } }}" + + # - name: Debug hardware_info + # delegate_to: localhost + # ansible.builtin.debug: + # msg: "{{ hardware_info }}" + + - name: Write var to file + delegate_to: localhost + ansible.builtin.copy: + content: "{{ hardware_info | to_nice_json( sort_keys=false ) }}" + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ hardware_info_json_file }}" + mode: '0644' diff --git a/ansible/roles/hardware_info/tasks/hardware_info_aix.yml b/ansible/roles/hardware_info/tasks/hardware_info_aix.yml new file mode 100644 index 000000000..ff17db794 --- /dev/null +++ b/ansible/roles/hardware_info/tasks/hardware_info_aix.yml @@ -0,0 +1,17 @@ +--- +- name: Run lsdev |grep proc + ansible.builtin.shell: + cmd: 'lsdev |grep proc' + register: cpus +- name: Run lsattr -El proc0 + ansible.builtin.command: + cmd: lsattr -El proc0 + register: cpuinfo +- name: Run lsattr -El mem0 + ansible.builtin.command: + cmd: lsattr -El mem0 + register: meminfo +- name: Run oslevel -s + ansible.builtin.command: + cmd: oslevel -s + register: kernelinfo diff --git a/ansible/roles/hardware_info/tasks/hardware_info_linux.yml b/ansible/roles/hardware_info/tasks/hardware_info_linux.yml new file mode 100644 index 000000000..0a7bff67c --- /dev/null +++ b/ansible/roles/hardware_info/tasks/hardware_info_linux.yml @@ -0,0 +1,13 @@ +--- +- name: Run lscpu + ansible.builtin.command: + cmd: lscpu + register: cpuinfo +- name: Run lsmem + ansible.builtin.command: + cmd: lsmem + register: meminfo +- name: Run uname -a + ansible.builtin.command: + cmd: uname -a + register: kernelinfo diff --git a/ansible/roles/hardware_info/tasks/hardware_info_windoze.yml b/ansible/roles/hardware_info/tasks/hardware_info_windoze.yml new file mode 100644 index 000000000..7462a6b44 --- /dev/null +++ b/ansible/roles/hardware_info/tasks/hardware_info_windoze.yml @@ -0,0 +1,13 @@ +--- +- name: Cat /proc/cpuinfo + ansible.builtin.command: + cmd: cat /proc/cpuinfo + register: cpuinfo +- name: Cat /proc/meminfo + ansible.builtin.command: + cmd: cat /proc/meminfo + register: meminfo +- name: Run uname -a + ansible.builtin.command: + cmd: uname -a + register: kernelinfo \ No newline at end of file diff --git a/ansible/roles/hardware_info/tasks/main.yml b/ansible/roles/hardware_info/tasks/main.yml new file mode 100644 index 000000000..d997a8f53 --- /dev/null +++ b/ansible/roles/hardware_info/tasks/main.yml @@ -0,0 +1,16 @@ +--- +# each type has its own file due the way the registered variables are handled when the tasks are skipped +- name: Hardware AIX + when: ansible_architecture == 'chrp' + ansible.builtin.include_tasks: hardware_info_aix.yml + +- name: Hardware Linux + when: ansible_system == 'Linux' + ansible.builtin.include_tasks: hardware_info_linux.yml + +- name: Hardware Windoze + when: ansible_system in ['Windows', 'CYGWIN_NT', 'CYGWIN'] + ansible.builtin.include_tasks: hardware_info_windoze.yml + +- name: Hardware Information + ansible.builtin.include_tasks: hardware_info.yml diff --git a/ansible/roles/hpel2text/defaults/main.yml b/ansible/roles/hpel2text/defaults/main.yml new file mode 100644 index 000000000..3458990fa --- /dev/null +++ b/ansible/roles/hpel2text/defaults/main.yml @@ -0,0 +1,2 @@ +--- +history_days: '-3' diff --git a/ansible/roles/hpel2text/meta/main.yml b/ansible/roles/hpel2text/meta/main.yml new file mode 100644 index 000000000..1397bfd39 --- /dev/null +++ b/ansible/roles/hpel2text/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: twas_cell_defaults diff --git a/ansible/roles/hpel2text/readme.md b/ansible/roles/hpel2text/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/hpel2text/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/hpel2text/tasks/hpel2text.yml b/ansible/roles/hpel2text/tasks/hpel2text.yml new file mode 100644 index 000000000..7502defea --- /dev/null +++ b/ansible/roles/hpel2text/tasks/hpel2text.yml @@ -0,0 +1,12 @@ +--- + +- name: Any binary logdata directories? + ansible.builtin.shell: "find {{ logs_dir }}/{{ env_name }} -name logdata" + register: logdata + changed_when: false + +- name: Convert binary logs to text + ansible.builtin.shell: | + {{ binaryLogView }} view {{ item }} > {{ item | dirname }}/{{ hpel_output }} + rm -rf {{ item }} + with_items: "{{ logdata.stdout_lines }}" diff --git a/ansible/roles/hpel2text/tasks/main.yml b/ansible/roles/hpel2text/tasks/main.yml new file mode 100644 index 000000000..722f62ee2 --- /dev/null +++ b/ansible/roles/hpel2text/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Convert hpel to text + ansible.builtin.include_tasks: hpel2text.yml diff --git a/ansible/roles/http_defaults/defaults/main.yml b/ansible/roles/http_defaults/defaults/main.yml index 5b60b302f..03017c3de 100644 --- a/ansible/roles/http_defaults/defaults/main.yml +++ b/ansible/roles/http_defaults/defaults/main.yml @@ -1,10 +1,14 @@ --- -ihs_im_driver: "{{ twas_im_driver | default('f5102145.01', true) }}" +ihs_im_driver: "{{ twas_im_driver | default('f5202422.01', true) }}" ihs_daily_or_test: "{{ twas_daily_or_test | default('test', true) }}" twas_release: 'WAS90' # WAS855 install_ihs_base: "{{ install_base | default('/home/nest', true) }}" # trick the template to install onto windoze via cygwin -install_base_win: '' +cygwin: '' +ext: '.sh' +win_bit: 'arch.64bit' +dll_bit: '64bits' +mod_was: 'ap24' http_dir: 'HTTPServer' plugin_dir: 'Plugins' wct_dir: 'WCT' diff --git a/ansible/roles/http_defaults/tasks/main.yml b/ansible/roles/http_defaults/tasks/main.yml new file mode 100644 index 000000000..adfae3ed3 --- /dev/null +++ b/ansible/roles/http_defaults/tasks/main.yml @@ -0,0 +1,17 @@ +--- +- name: Set windoze http facts + ansible.builtin.set_fact: + cygwin: 'c:/cygwin64' + ext: '.bat' + win_bit: 'arch.32bit' + dll_bits: '64bits' + when: + - ansible_system == 'Windows' or 'CYG' in ansible_system + +- name: Set windoze http tWAS 855x facts + ansible.builtin.set_fact: + mod_was: 'ap22' + dll_bits: '32bits' + when: + - ansible_system == 'Windows' or 'CYG' in ansible_system + - twas_release == 'WAS855' diff --git a/ansible/roles/http_plugin_wct_versions/meta/main.yml b/ansible/roles/http_plugin_wct_versions/meta/main.yml new file mode 100644 index 000000000..bc95c5fae --- /dev/null +++ b/ansible/roles/http_plugin_wct_versions/meta/main.yml @@ -0,0 +1,5 @@ +--- +dependencies: + - role: ibm_installation_manager_cic_selector + - role: twas_cell_defaults + - role: http_defaults diff --git a/ansible/roles/http_plugin_wct_versions/readme.md b/ansible/roles/http_plugin_wct_versions/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/http_plugin_wct_versions/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/http_plugin_wct_versions/tasks/http_plugin_wct_versions.yml b/ansible/roles/http_plugin_wct_versions/tasks/http_plugin_wct_versions.yml new file mode 100644 index 000000000..acff299b3 --- /dev/null +++ b/ansible/roles/http_plugin_wct_versions/tasks/http_plugin_wct_versions.yml @@ -0,0 +1,212 @@ +--- +- name: Is IHS running? + ignore_errors: true + ansible.builtin.uri: + url: "https://localhost:{{ ihs_https_port }}" + return_content: no + validate_certs: false + register: isIHSup + +# - name: Is IHS running output +# ansible.builtin.debug: +# msg: "{{ isIHSup }}" + +- name: Create version dir + delegate_to: localhost + ansible.builtin.file: + path: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}" + state: directory + +- name: Set http status ( unknown ) + when: ( isIHSup.status not in [ 200, -1 ] ) + ansible.builtin.set_fact: + http_status: "{{ { ansible_fqdn : { 'status': 'unknown' } } }}" + +- name: Set http status ( started ) + when: isIHSup.status == 200 + ansible.builtin.set_fact: + http_status: "{{ { ansible_fqdn : { 'status': 'started' } } }}" + +- name: Set http status ( stopped ) + when: isIHSup.status == -1 + ansible.builtin.set_fact: + http_status: "{{ { ansible_fqdn : { 'status': 'stopped' } } }}" + +- name: Write http status to json file + delegate_to: localhost + ansible.builtin.copy: + content: "{{ http_status | to_nice_json( sort_keys=false ) }}" + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ http_status_json_file }}" + mode: '0444' + +- name: Read the IHS.product xml file + ansible.builtin.include_role: + name: twas_cell_product_version_level + vars: + twas_product: IHS + target_dir: "{{ http_dir }}" + staging_json_file: "ihs_{{ version_level_json_file }}" + +- name: HTTPServer version + ansible.builtin.shell: "{{ install_ihs_base }}/{{ http_dir }}/bin/versionInfo{{ ext }} -ifixDetail" + register: HTTPServerVersionOutput + +# - name: HTTPServerVersionOutput +# ansible.builtin.debug: +# msg: "{{ HTTPServerVersionOutput.stdout_lines }}" + +- name: Size of stdout_lines + delegate_to: localhost + ansible.builtin.set_fact: + max_counter: "{{ HTTPServerVersionOutput.stdout_lines | length }}" + +- name: Create dict with http version + ansible.builtin.set_fact: + http_version: "{{ http_version | default({}) | combine( { item: HTTPServerVersionOutput.stdout_lines[item | int] }, recursive=True, list_merge='append' ) }}" + with_sequence: 'start=0 end={{ max_counter | int - 1 }}' + no_log: true + +- name: New dict http_version + ansible.builtin.set_fact: + versions: "{{{ ansible_fqdn : http_version }}}" + +# - name: New dict append_this +# delegate_to: localhost +# ansible.builtin.debug: +# msg: "{{ versions }}" + +- name: Write http versionInfo to json file + delegate_to: localhost + ansible.builtin.copy: + content: "{{ versions | to_nice_json( sort_keys=false ) }}" + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ http_versioninfo_json_file }}" + mode: '0444' + +- name: Read the IHS.product xml file + ansible.builtin.include_role: + name: twas_cell_product_version_level + vars: + twas_product: PLG + target_dir: "{{ plugin_dir }}" + staging_json_file: "plg_{{ version_level_json_file }}" + +- name: Plugin version + ansible.builtin.shell: "{{ install_ihs_base }}/{{ plugin_dir }}/bin/versionInfo{{ ext }} -ifixDetail" + register: PluginVersionOutput + +# - name: PluginVersionOutput +# ansible.builtin.debug: +# msg: "{{ PluginVersionOutput.stdout_lines }}" + +- name: Size of stdout_lines + delegate_to: localhost + ansible.builtin.set_fact: + max_counter: "{{ PluginVersionOutput.stdout_lines | length }}" + +- name: Create dict with plugin version(s) + ansible.builtin.set_fact: + plugin_version: "{{ plugin_version | default({}) | combine( { item: PluginVersionOutput.stdout_lines[item | int] }, recursive=True, list_merge='append' ) }}" + with_sequence: 'start=0 end={{ max_counter | int - 1 }}' + no_log: true + +- name: New dict plugin_version + ansible.builtin.set_fact: + versions: "{{{ ansible_fqdn : plugin_version }}}" + +# - name: New dict append_this +# delegate_to: localhost +# ansible.builtin.debug: +# msg: "{{ versions }}" + +- name: Write plugin versionInfo to json file + delegate_to: localhost + ansible.builtin.copy: + content: "{{ versions | to_nice_json( sort_keys=false ) }}" + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ plugin_versioninfo_json_file }}" + mode: '0444' + +- name: Read the WCT.product xml file + ansible.builtin.include_role: + name: twas_cell_product_version_level + vars: + twas_product: WCT + target_dir: "{{ wct_dir }}" + staging_json_file: "wct_{{ version_level_json_file }}" + +- name: WCT version + ansible.builtin.shell: "{{ install_ihs_base }}/{{ wct_dir }}/bin/versionInfo{{ ext }} -ifixDetail" + register: WCTVersionOutput + +# - name: WCTVersionOutput +# ansible.builtin.debug: +# msg: "{{ WCTVersionOutput.stdout_lines }}" + +- name: Size of stdout_lines + delegate_to: localhost + ansible.builtin.set_fact: + max_counter: "{{ WCTVersionOutput.stdout_lines | length }}" + +- name: Create dict with wct version(s) + ansible.builtin.set_fact: + wct_version: "{{ wct_version | default({}) | combine( { item: WCTVersionOutput.stdout_lines[item | int] }, recursive=True, list_merge='append' ) }}" + with_sequence: 'start=0 end={{ max_counter | int - 1 }}' + no_log: true + +- name: New dict wct_version + ansible.builtin.set_fact: + versions: "{{{ ansible_fqdn : wct_version }}}" + +# - name: New dict append_this +# delegate_to: localhost +# ansible.builtin.debug: +# msg: "{{ versions }}" + +- name: Write wct versionInfo to json file + delegate_to: localhost + ansible.builtin.copy: + content: "{{ versions | to_nice_json( sort_keys=false ) }}" + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ wct_versioninfo_json_file }}" + mode: '0444' + +- name: Check if version_level exists + delegate_to: localhost + ansible.builtin.stat: + path: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ version_level_json_file }}" + register: isjson + +- name: Block to init the seed version_level.json + when: isjson.stat.exists == False + block: + + - name: Inialize combined dict ( http_plugin_wct ) + delegate_to: localhost + ansible.builtin.set_fact: + combined_dict: {} + + - name: Save ( seed combined ) ( http_plugin_wct ) + delegate_to: localhost + ansible.builtin.copy: + content: "{{ combined_dict }}" + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ version_level_json_file }}" + mode: '0444' + +- name: Save IHS/PLG/WCT to version_level json ( combined ) + delegate_to: localhost + ansible.builtin.copy: + content: "{{ lookup('ansible.builtin.file', '{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ version_level_json_file }}') | from_json | ansible.builtin.combine(lookup('ansible.builtin.file', '{{ item }}') | from_json, recursive=True, list_merge='append' )}}" + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ version_level_json_file }}" + mode: '0444' + with_items: + - "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/ihs_{{ version_level_json_file }}" + - "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/plg_{{ version_level_json_file }}" + - "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/wct_{{ version_level_json_file }}" + +- name: Remove local source json after combine + with_items: + - "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/ihs_{{ version_level_json_file }}" + - "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/plg_{{ version_level_json_file }}" + - "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/wct_{{ version_level_json_file }}" + delegate_to: localhost + ansible.builtin.file: + state: absent + path: "{{ item }}" diff --git a/ansible/roles/http_plugin_wct_versions/tasks/main.yml b/ansible/roles/http_plugin_wct_versions/tasks/main.yml new file mode 100644 index 000000000..bd5ac325c --- /dev/null +++ b/ansible/roles/http_plugin_wct_versions/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: VersionInfo http/plugin/wct + ansible.builtin.include_tasks: http_plugin_wct_versions.yml diff --git a/ansible/roles/http_start/tasks/http_start.yml b/ansible/roles/http_start/tasks/http_start.yml index 4e6d42c8c..db08e8048 100644 --- a/ansible/roles/http_start/tasks/http_start.yml +++ b/ansible/roles/http_start/tasks/http_start.yml @@ -1,24 +1,35 @@ --- - -- name: start httpd - shell: "{{install_ihs_base }}/{{ http_dir }}/bin/apachectl start" - register: starthttpdOutput +- name: Unix http operations + when: ansible_system is not search('CYG') + block: + - name: start httpd + shell: "{{install_ihs_base }}/{{ http_dir }}/bin/apachectl start" + register: starthttpdOutput + - name: start adminctl + shell: "{{install_ihs_base }}/{{ http_dir }}/bin/adminctl start " + register: startadminctlOutput -- name: starthttpdOutput - debug: - msg: "{{ starthttpdOutput.stdout_lines }}" +- name: Windoze http operations + when: ansible_system == 'Windows' or 'CYG' in ansible_system + block: + - name: Start apache -k start -n IBMHTTPServer + ansible.builtin.shell: "{{ install_ihs_base }}/{{ http_dir }}/bin/apache -k start -n 'IBMHTTPServer'" + register: starthttpdOutput + - name: Start apache -k start -n IBMAdminHTTPServer + ansible.builtin.shell: "{{ install_ihs_base }}/{{ http_dir }}/bin/apache -k start -n 'IBMAdminHTTPServer'" + register: startadminctlOutput -- name: start adminctl - shell: "{{install_ihs_base }}/{{ http_dir }}/bin/adminctl start " - register: startadminctlOutput +- name: starthttpdOutput + ansible.builtin.debug: + msg: "{{ starthttpdOutput.stdout_lines }}" - name: startadminctlOutput - debug: - msg: "{{ startadminctlOutput.stdout_lines }}" + ansible.builtin.debug: + msg: "{{ startadminctlOutput.stdout_lines }}" - name: Check server-status uri: - url: "https://localhost:{{ ihs_https_port }}" + url: "https://localhost:{{ ihs_https_port }}/server-status" return_content: no validate_certs: false diff --git a/ansible/roles/http_stop/tasks/http_stop.yml b/ansible/roles/http_stop/tasks/http_stop.yml index 8d4f9d761..4cec16854 100644 --- a/ansible/roles/http_stop/tasks/http_stop.yml +++ b/ansible/roles/http_stop/tasks/http_stop.yml @@ -1,17 +1,28 @@ --- - -- name: stop httpd - shell: "{{install_ihs_base }}/{{ http_dir }}/bin/apachectl stop" - register: stophttpdOutput +- name: Unix http operations + when: ansible_system is not search('CYG') + block: + - name: Stop httpd + shell: "{{install_ihs_base }}/{{ http_dir }}/bin/apachectl stop" + register: stophttpdOutput + - name: Stop adminctl + shell: "{{install_ihs_base }}/{{ http_dir }}/bin/adminctl stop " + register: stopadminctlOutput -- name: stophttpdOutput - debug: - msg: "{{ stophttpdOutput.stdout_lines }}" +- name: Windoze http operations + when: ansible_system == 'Windows' or 'CYG' in ansible_system + block: + - name: Stop apache -k start -n IBMHTTPServer + ansible.builtin.shell: "{{ install_ihs_base }}/{{ http_dir }}/bin/apache -k stop -n 'IBMHTTPServer'" + register: starthttpdOutput + - name: Stop apache -k start -n IBMAdminHTTPServer + ansible.builtin.shell: "{{ install_ihs_base }}/{{ http_dir }}/bin/apache -k stop -n 'IBMAdminHTTPServer'" + register: startadminctlOutput -- name: stop adminctl - shell: "{{install_ihs_base }}/{{ http_dir }}/bin/adminctl stop " - register: stopadminctlOutput +- name: StophttpdOutput + ansible.builtin.debug: + msg: "{{ stophttpdOutput.stdout_lines }}" -- name: stopadminctlOutput - debug: - msg: "{{ stopadminctlOutput.stdout_lines }}" +- name: Strict-Transport-SecuritytopadminctlOutput + ansible.builtin.debug: + msg: "{{ stopadminctlOutput.stdout_lines }}" diff --git a/ansible/roles/ibm_installation_manager/defaults/main.yml b/ansible/roles/ibm_installation_manager/defaults/main.yml index fbd972bdc..36aaacca5 100644 --- a/ansible/roles/ibm_installation_manager/defaults/main.yml +++ b/ansible/roles/ibm_installation_manager/defaults/main.yml @@ -1,8 +1,8 @@ --- -im_archive_driver_version: '1922' -im_archive_driver: '1.9.2002.20220323_1321' +im_archive_driver_version: '1.10.0' +im_archive_driver: '1.10.0.20240926_1654' im_archive: 'https://rtpgsa.ibm.com/gsa/rtpgsa/home/w/a/wasngi/web/public/NGI/IM/recommended/drivers/{{ im_archive_driver_version }}/ga' -install_base: '/home/nest' +# install_base: '/home/nest' # trick the template to install onto windoze via cygwin -install_base_win: '' +cygwin: '' shared_dir: 'IM-shared' diff --git a/ansible/roles/ibm_installation_manager/tasks/ibm_installation_manager.yml b/ansible/roles/ibm_installation_manager/tasks/ibm_installation_manager.yml index e99cf1730..bfdb16e64 100644 --- a/ansible/roles/ibm_installation_manager/tasks/ibm_installation_manager.yml +++ b/ansible/roles/ibm_installation_manager/tasks/ibm_installation_manager.yml @@ -4,7 +4,7 @@ ### "ansible_architecture": "x86_64", ### "ansible_architecture": "chrp", --- AIX -- name: check if imcl installed as a prereq +- name: Check if imcl installed as a prereq stat: path: "{{ install_base }}/IM/eclipse/tools/imcl" changed_when: false @@ -22,9 +22,8 @@ - ansible_system == 'Linux' - set_fact: archive_name_match: 'agent.installer.win32.win32.x86_64_{{ im_archive_driver }}.zip' - install_base_win: 'c:\cygwin' + cygwin: 'c:/cygwin64' when: - - ansible_architecture == 'x86_64' - ansible_system == 'Windows' or 'CYG' in ansible_system - set_fact: archive_name_match: 'agent.installer.linux.gtk.s390x_{{ im_archive_driver }}.zip' @@ -32,7 +31,7 @@ - ansible_architecture == 's390x' - ansible_system == 'Linux' - set_fact: - archive_name_match: 'agent.installer.aix.gtk.ppc_{{ im_archive_driver }}.zip' + archive_name_match: 'agent.installer.aix.gtk.ppc64_{{ im_archive_driver }}.zip' when: - ansible_architecture == 'chrp' - set_fact: @@ -54,36 +53,63 @@ ln -s /QOpenSys/pkgs/bin/zip /QOpenSys/usr/bin/zip ln -s /QOpenSys/pkgs/bin/unzip /QOpenSys/usr/bin/unzip -- name: temp im install dir +- name: Temp im install dir file: path: "{{ install_base }}/im_install" state: directory -- name: copy ibm_im_responsefile.xml template + +- name: Clean up previous ibm_im_responsefile.xml + ansible.builtin.file: + path: "{{ install_base }}/im_install/ibm_im_responsefile.xml" + state: absent + +- name: Copy ibm_im_responsefile.xml template template: src: ibm_im_responsefile.xml.j2 dest: "{{ install_base }}/im_install/ibm_im_responsefile.xml" -- name: get im archive - get_url: +- name: What is install_base set to + debug: + msg: "{{ install_base }}" + +- name: Get im archive + ansible.builtin.get_url: url: "{{ im_archive }}/{{ archive_name_match }}" - dest: "{{ install_base }}/im_install/im.zip" + dest: /tmp/im.zip url_username: "{{ gsa_user }}" url_password: "{{ gsa_pass }}" + mode: '0755' + validate_certs: false -- name: unarchive im.zip +- name: Unarchive im.zip unarchive: - src: "{{ install_base }}/im_install/im.zip" + src: /tmp/im.zip dest: "{{ install_base }}/im_install" remote_src: True +- name: Clean up im.zip + ansible.builtin.file: + path: /tmp/im.zip + state: absent + # default install location: ~/IBM/InstallationManager/eclipse/tools # tools command: ~/IBM/InstallationManager/eclipse/tools/imcl -- name: ./userinstc -acceptLicense -accessRights nonAdmin -input ibm_im_responsefile.xml +- name: Run the install ./userinstc -acceptLicense -accessRights nonAdmin -input ibm_im_responsefile.xml shell: './userinstc -acceptLicense -accessRights nonAdmin -input ibm_im_responsefile.xml' args: - chdir: '{{ install_base }}/im_install' + chdir: "{{ install_base }}/im_install" register: userinstcOutput -- name: userinstc output +- name: Userinstc output debug: msg: "{{ userinstcOutput.stdout_lines }}" + +- name: Clean up im_install temp repo + ansible.builtin.file: + path: "{{ install_base }}/im_install" + state: absent + +- name: Install IBM Digital Certs root certificate + when: ibm_cert_url is defined + ansible.builtin.include_role: + name: install_ibm_cert \ No newline at end of file diff --git a/ansible/roles/ibm_installation_manager/templates/ibm_im_responsefile.xml.j2 b/ansible/roles/ibm_installation_manager/templates/ibm_im_responsefile.xml.j2 index 8ba7261c5..66ed3c1ae 100644 --- a/ansible/roles/ibm_installation_manager/templates/ibm_im_responsefile.xml.j2 +++ b/ansible/roles/ibm_installation_manager/templates/ibm_im_responsefile.xml.j2 @@ -1,14 +1,14 @@ - + - - + + - + diff --git a/ansible/roles/ibm_installation_manager_cic_selector/defaults/main.yml b/ansible/roles/ibm_installation_manager_cic_selector/defaults/main.yml index ac6465329..3e4ccf027 100644 --- a/ansible/roles/ibm_installation_manager_cic_selector/defaults/main.yml +++ b/ansible/roles/ibm_installation_manager_cic_selector/defaults/main.yml @@ -12,6 +12,7 @@ cic_selector_os: Linux: 'linux' Windows: 'win32' CYGWIN_NT-10.0-20348: 'win32' # hard coded to a specific cygwin version + CYGWIN_NT-10.0-26100: 'win32' # hard coded to a specific cygwin version ZOS: 'zos' OS400: 'os400' # cmvc defect to get this fixed : 803544 diff --git a/ansible/roles/ibm_rhsm/tasks/RedHat.yml b/ansible/roles/ibm_rhsm/tasks/RedHat.yml index 45b6a1c7f..c2c32d5d8 100755 --- a/ansible/roles/ibm_rhsm/tasks/RedHat.yml +++ b/ansible/roles/ibm_rhsm/tasks/RedHat.yml @@ -2,7 +2,7 @@ ### fails with complex passwords - name: retrieve ftp3.linux.ibm.com/redhat/ibm-rhsm.sh - become: yes + become: true get_url: url: "ftp://{{ ftp3_username }}:{{ ftp3_password }}@ftp3.linux.ibm.com/redhat/ibm-rhsm.sh" dest: ~/ibm-rhsm.sh @@ -22,19 +22,19 @@ # dest: "~/ibm-rhsm.sh" - name: change perms ibm-rhsm.sh - become: yes + become: true ansible.builtin.file: path: ~/ibm-rhsm.sh mode: '0755' - name: register rhel host - become: yes + become: true environment: FTP3USER: "{{ ftp3_username }}" FTP3PASS: "{{ ftp3_password }}" - shell: "~/ibm-rhsm.sh --register --force" + shell: "echo y | ~/ibm-rhsm.sh --register --force" register: rhel_register - name: rhel_register output debug: - msg: "{{ rhel_register.stdout_lines }}" + msg: "{{ rhel_register.stdout_lines }}" diff --git a/ansible/roles/ibm_vbgc/defaults/main.yml b/ansible/roles/ibm_vbgc/defaults/main.yml new file mode 100644 index 000000000..a65ba5d61 --- /dev/null +++ b/ansible/roles/ibm_vbgc/defaults/main.yml @@ -0,0 +1,7 @@ +--- +# NOTE That the binary has been installed to this location +# https://www.ibm.com/support/pages/garbage-collection-and-memory-visualizer +vbgc_filename: 'verbosegc.log' + +IBM_GCMV_BINARY: "/mnt/data/binaries/gcmv/gcmv" +IBM_GCMV: "{{ IBM_GCMV_BINARY }} -nosplash -display 2100x1080 -rc -application com.ibm.java.diagnostics.visualizer.headless.application " diff --git a/ansible/roles/ibm_vbgc/files/gcmv.genheap.epf b/ansible/roles/ibm_vbgc/files/gcmv.genheap.epf new file mode 100644 index 000000000..a006b20d9 --- /dev/null +++ b/ansible/roles/ibm_vbgc/files/gcmv.genheap.epf @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ansible/roles/ibm_vbgc/readme.md b/ansible/roles/ibm_vbgc/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/ibm_vbgc/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/ibm_vbgc/scripts/create_vbgc_chart.sh b/ansible/roles/ibm_vbgc/scripts/create_vbgc_chart.sh new file mode 100644 index 000000000..5be5dfbab --- /dev/null +++ b/ansible/roles/ibm_vbgc/scripts/create_vbgc_chart.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +set -euo pipefail + +set -x +export DISPLAY=:1 +IBM_GCMV=$@ + +# ls -l /home/nest/gcmv/gcmv + +# echo "IBM_GCMV=$IBM_GCMV" +find . -name verbosegc* > vbgcfiles.txt +while read line +do + outputDir=$( dirname $line) + mkdir -p $outputDir/IBM_GCMV + t1="$(dirname $line)/gctmp" + export JAVA_TOOL_OPTIONS="-Djava.io.tmpdir=$t1 -Dosgi.configuration.area=$t1 -Duser.home=$t1" + $IBM_GCMV -data=$t1 -p ./gcmv.genheap.epf -f $line -o $outputDir/IBM_GCMV + rm -rf $line $t1 gcmv.genheap.epf +done < vbgcfiles.txt +# purge the temp dir's for the GCMV +find . -name gcmemoryvisualizerhtmlDataset1 -type d | xargs rm -rf +set +x \ No newline at end of file diff --git a/ansible/roles/ibm_vbgc/scripts/merge_into_single_file.sh b/ansible/roles/ibm_vbgc/scripts/merge_into_single_file.sh new file mode 100644 index 000000000..1297799b6 --- /dev/null +++ b/ansible/roles/ibm_vbgc/scripts/merge_into_single_file.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash +# locate valid Liberty IBM and Oracle Jdk verbose gc files +find . -name verbosegc* > fileList.txt +find . -name verboseGC* >> fileList.txt +# z/OS verboseGC files ends with SYSOUT.txt +find . -name '*SYSOUT.txt' >> fileList.txt +gcdir="" +prevgcdir="" + +while read line +do + # logic to concat all verbose* files + gcdir=$(dirname $line) + if [ "$prevgcdir" != "$gcdir" ] ; then + prevgcdir=$gcdir + cd $gcdir + # check to see if there are more than 1 gc file + if ls -1 | grep -q SYSOUT; then + vbgcfile='*SYSOUT.txt' + else + vbgcfile='verbose*' + fi + read countgc _ _ <<< $(ls -1 $vbgcfile | wc) + if [ "$countgc" -gt "1" ] ; then + list=$(ls -1 $vbgcfile) + params=" " + while read gcfile + do + params="${params} ${gcfile}" + done <<< "$list" + + echo "creating verbosegc.$$.log using params: ${params}" + + time cat $params > verbosegc.$$.log + rm -f $params + else # only 1 file rename it + tmpbasename=$(basename $line) + mv $tmpbasename verbosegc.$$.log + fi + + cd - + fi +done < fileList.txt # end while read +rm -f fileList.txt + diff --git a/ansible/roles/ibm_vbgc/tasks/ibm_vbgc.yml b/ansible/roles/ibm_vbgc/tasks/ibm_vbgc.yml new file mode 100644 index 000000000..fde9d7f89 --- /dev/null +++ b/ansible/roles/ibm_vbgc/tasks/ibm_vbgc.yml @@ -0,0 +1,36 @@ +--- + +- name: Find all the verbosegc log files and concat into 1 file + delegate_to: localhost + ansible.builtin.script: scripts/merge_into_single_file.sh + args: + chdir: "{{ vbgc_dir }}" + register: gcfilesoutput + +- name: Verbose gc files concat output + ansible.builtin.debug: + msg: "{{ gcfilesoutput.stdout_lines }}" + +- name: Copy the gcmv.genheap.epf config file to working dir + delegate_to: localhost + copy: + src: files/gcmv.genheap.epf + dest: "{{ vbgc_dir }}" + mode: '0755' + +- name: Run the IBM GCMV script + delegate_to: localhost + ansible.builtin.script: "scripts/create_vbgc_chart.sh '{{ IBM_GCMV }}'" + args: + chdir: "{{ vbgc_dir }}" + register: vbgcoutput + +- name: IBM GCMV output + ansible.builtin.debug: + msg: "{{ vbgcoutput.stdout_lines }}" + +- name: Clean up gcmv.genheap.epf + delegate_to: localhost + ansible.builtin.file: + path: "{{ vbgc_dir }}/gcmv.genheap.epf" + state: absent diff --git a/ansible/roles/ibm_vbgc/tasks/main.yml b/ansible/roles/ibm_vbgc/tasks/main.yml new file mode 100644 index 000000000..f8ebc757d --- /dev/null +++ b/ansible/roles/ibm_vbgc/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: IBM VerboseGC logic + ansible.builtin.include_tasks: ibm_vbgc.yml diff --git a/ansible/roles/ibm_vbgc_report/readme.md b/ansible/roles/ibm_vbgc_report/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/ibm_vbgc_report/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/ibm_vbgc_report/tasks/ibm_vbgc_report.yml b/ansible/roles/ibm_vbgc_report/tasks/ibm_vbgc_report.yml new file mode 100644 index 000000000..18ca028bd --- /dev/null +++ b/ansible/roles/ibm_vbgc_report/tasks/ibm_vbgc_report.yml @@ -0,0 +1,96 @@ +--- + +- name: Check if env logs directory exists + delegate_to: localhost + ansible.builtin.stat: + path: "{{ vbgc_report_dir }}" + register: isvbgc + +- name: Find the verbosegc report directory line plots + when: isvbgc.stat.exists + block: + + - name: Find all the verbosegc line plots ( indicates data ) + delegate_to: localhost + ansible.builtin.shell: 'find . -name "Line plot.*"' + args: + chdir: "{{ vbgc_report_dir }}" + register: lineplotoutput + changed_when: false + ignore_errors: true + no_log: true + + - name: Find all the verbosegc index.html ( indicates data ) + delegate_to: localhost + ansible.builtin.shell: 'find . -name "index.html"|grep IBM_GCMV' + args: + chdir: "{{ vbgc_report_dir }}" + register: indexhtmloutput + changed_when: false + ignore_errors: true + no_log: true + + - name: Any vbgc line plots? + when: + - lineplotoutput.stdout | length > 0 + - indexhtmloutput.stdout | length > 0 + block: + + - name: Verbose gc line plot files output + ansible.builtin.debug: + msg: "{{ lineplotoutput.stdout_lines }}" + + - name: Verbose gc index.html files output + ansible.builtin.debug: + msg: "{{ indexhtmloutput.stdout_lines }}" + + - name: Copy gcmv_single_report.html.j2 + delegate_to: localhost + ansible.builtin.template: + src: gcmv_single_report.html.j2 + dest: "{{ vbgc_report_dir }}/gcmv_single_report.html" + mode: '0644' + + - name: Add line plot/ index.html url + delegate_to: localhost + ansible.builtin.lineinfile: + path: "{{ vbgc_report_dir }}/gcmv_single_report.html" + insertafter: '' + line: | + {{ item }} + {{ item }} + with_items: + - "{{ lineplotoutput.stdout_lines }}" + + - name: Copy gcmv_reports.html.j2 + delegate_to: localhost + ansible.builtin.template: + src: gcmv_report.html.j2 + dest: "{{ vbgc_report_dir }}/gcmv_report.html" + mode: '0644' + + # disable the black until one can figure out how to check for errors in the reports + # check for keywords indicative of problems + # gcmvissues=$(egrep -c 'Excessive|Problem|Leak' $reportIndex/Report/index.html) + # [ $gcmvissues == 0 ] && vcolor="black" || vcolor="red" + # {{ item }} Report + + # below, the :1 is an error, the :0 is no error + # [nest@nest-dev Controllers]$ find . -name index.html| xargs egrep -c 'Excessive|Problem|Leak' + # ./nest-cc-1.fyre.ibm.com/servers/cc/logs/IBM_GCMV/Report/index.html:1 + # ./nest-cc-3.fyre.ibm.com/servers/cc/logs/IBM_GCMV/Report/index.html:0 + # ./nest-cc-2.fyre.ibm.com/servers/cc/logs/IBM_GCMV/Report/index.html:0 + + # some ideas + # debug: msg="{{ ansible_hostname | regex_replace('^ip-', '') }}" + - name: Add line plot gcmv_report + delegate_to: localhost + ansible.builtin.lineinfile: + path: "{{ vbgc_report_dir }}/gcmv_report.html" + insertafter: '' + line: | +
+ + {{ item }} + with_items: + - "{{ indexhtmloutput.stdout_lines }}" diff --git a/ansible/roles/ibm_vbgc_report/tasks/main.yml b/ansible/roles/ibm_vbgc_report/tasks/main.yml new file mode 100644 index 000000000..13d4d7c7e --- /dev/null +++ b/ansible/roles/ibm_vbgc_report/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: IBM VerboseGC report logic + ansible.builtin.include_tasks: ibm_vbgc_report.yml diff --git a/ansible/roles/ibm_vbgc_report/templates/gcmv_report.html.j2 b/ansible/roles/ibm_vbgc_report/templates/gcmv_report.html.j2 new file mode 100644 index 000000000..d03ad0c5c --- /dev/null +++ b/ansible/roles/ibm_vbgc_report/templates/gcmv_report.html.j2 @@ -0,0 +1,13 @@ +
+GCMV processed @ {{ '%Y-%m-%d %H:%M:%S' | strftime(ansible_date_time.epoch) }}
+-----------------------------------------------------
+
+GCMV line plots ( All ) +
+Individual GCMV reports +
+----------------------------------------------------- +
+ + +
\ No newline at end of file diff --git a/ansible/roles/ibm_vbgc_report/templates/gcmv_single_report.html.j2 b/ansible/roles/ibm_vbgc_report/templates/gcmv_single_report.html.j2 new file mode 100644 index 000000000..a0cb5d03c --- /dev/null +++ b/ansible/roles/ibm_vbgc_report/templates/gcmv_single_report.html.j2 @@ -0,0 +1,7 @@ +
+GCMV processed @ {{ '%Y-%m-%d %H:%M:%S' | strftime(ansible_date_time.epoch) }}
+-----------------------------------------------------
+
+ + +
\ No newline at end of file diff --git a/ansible/roles/im_cleanup_http/tasks/im_cleanup_http.yml b/ansible/roles/im_cleanup_http/tasks/im_cleanup_http.yml index 0bf4f38e8..2ef236b47 100644 --- a/ansible/roles/im_cleanup_http/tasks/im_cleanup_http.yml +++ b/ansible/roles/im_cleanup_http/tasks/im_cleanup_http.yml @@ -1,75 +1,161 @@ --- -# blindly try fuser ( linux ) -- name: blindly try fuser ( linux ) - ignore_errors: true - shell: "fuser -k {{ item }}" - register: killOutput - failed_when: ( killOutput.rc not in [ 0, 1, 2, 127 ] ) - with_items: - - "{{ install_ihs_base }}/{{ http_dir }}" +- name: Check if previous ihs installed + ansible.builtin.stat: + path: "{{ install_ihs_base }}/{{ http_dir }}bin" + register: isihs + +- name: Windoze http operations + when: ansible_system == 'Windows' or 'CYG' in ansible_system + block: + - name: Does IBMHTTPServer service exist? + ansible.builtin.shell: "sc query IBMHTTPServer" + register: isIBMHTTPServer + failed_when: isIBMHTTPServer.rc not in [0,36] + - name: IBMHTTPServer is enabled + when: isIBMHTTPServer.rc == 0 + block: + - name: Stop http + when: isIBMHTTPServer.stdout is search('RUNNING') + ansible.builtin.shell: "{{ install_ihs_base }}/{{ http_dir }}/bin/apache -k stop -n 'IBMHTTPServer'" + - name: Uninstall httpd Windoze service + ansible.builtin.shell: "{{ install_ihs_base }}/{{ http_dir }}/bin/apache -k uninstall -n 'IBMHTTPServer'" + + - name: Does IBMAdminHTTPServer service exist? + ansible.builtin.shell: "sc query IBMAdminHTTPServer" + register: isIBMAdminHTTPServer + failed_when: isIBMAdminHTTPServer.rc not in [0,36] + - name: IBMAdminHTTPServer is enabled + when: isIBMAdminHTTPServer.rc == 0 + block: + - name: Stop http admin + when: isIBMAdminHTTPServer.stdout is search('RUNNING') + ansible.builtin.shell: "{{ install_ihs_base }}/{{ http_dir }}/bin/apache -k stop -n 'IBMAdminHTTPServer' -f conf/admin.conf" + - name: Uninstall httpd Windoze service + ignore_errors: true + ansible.builtin.shell: "{{ install_ihs_base }}/{{ http_dir }}/bin/apache -k uninstall -n 'IBMAdminHTTPServer' -f conf/admin.conf" + +- name: Unix http operations + when: ansible_system is not search('CYG') + block: + - name: Stop any httpd proccess gracefully + when: isihs.stat.exists + block: + - name: stop httpd + ignore_errors: true + ansible.builtin.shell: "{{ install_ihs_base }}/{{ http_dir }}/bin/apachectl stop" + - name: Stop adminctl + ignore_errors: true + ansible.builtin.shell: "{{ install_ihs_base }}/{{ http_dir }}/bin/adminctl stop" + - name: Force pkill httpd ( linux ) + ignore_errors: true + ansible.builtin.shell: "pkill httpd" + register: killOutput + failed_when: ( killOutput.rc not in [ 0, 1 ] ) + when: + - ansible_architecture != 'chrp' + +- name: Check if previous WCT installed + ansible.builtin.stat: + path: "{{ install_ihs_base }}/{{ wct_dir }}/bin/versionInfo{{ ext }}" + register: iswct + +- name: Uninstall WCT WAS90 + when: iswct.stat.exists + block: + - name: uninstall wct WAS90 + ansible.builtin.shell: "{{ install_ihs_base }}/IM/eclipse/tools/imcl uninstall {{ im_wct_package[twas_release] }} {{ im_wct_java_package }} -installationDirectory {{ cygwin }}{{ install_ihs_base }}/{{ wct_dir }}" + register: uninstallWCTOutput + when: twas_release == 'WAS90' + + - name: UninstallWCTOutput WAS90 + ansible.builtin.debug: + msg: "{{ uninstallWCTOutput.stdout_lines }}" + failed_when: ( uninstallWCTOutput.rc not in [ 0 ] ) + when: twas_release == 'WAS90' + + - name: Uninstall wct WAS855 + ansible.builtin.shell: "{{ install_ihs_base }}/IM/eclipse/tools/imcl uninstall {{ im_wct_package[twas_release] }} -installationDirectory {{ cygwin }}{{ install_ihs_base }}/{{ wct_dir }}" + register: uninstallWCTOutput + when: twas_release == 'WAS855' -- name: check if previous ihs installed - stat: - path: "{{install_ihs_base }}/{{ http_dir }}/bin/apachectl" + - name: UninstallWCTOutput WAS855 + ansible.builtin.debug: + msg: "{{ uninstallWCTOutput.stdout_lines }}" + failed_when: ( uninstallWCTOutput.rc not in [ 0 ] ) + when: twas_release == 'WAS855' + +- name: Check if previous Plugin installed + ansible.builtin.stat: + path: "{{ install_ihs_base }}/{{ plugin_dir }}/bin/versionInfo{{ ext }}" + register: isplg + +- name: Uninstall plugin + when: isplg.stat.exists + block: + - name: uninstall plugin WAS90 + ansible.builtin.shell: "{{ install_ihs_base }}/IM/eclipse/tools/imcl uninstall {{ im_plugin_package[twas_release] }} {{ im_plugin_java_package }} -installationDirectory {{ cygwin }}{{ install_ihs_base }}/{{ plugin_dir }}" + register: uninstallPLGOutput + when: twas_release == 'WAS90' + + - name: UninstallPLGOutput WAS90 + ansible.builtin.debug: + msg: "{{ uninstallPLGOutput.stdout_lines }}" + failed_when: ( uninstallPLGOutput.rc not in [ 0 ] ) + when: twas_release == 'WAS890' + + - name: Uninstall plugin WAS855 + ansible.builtin.shell: "{{ install_ihs_base }}/IM/eclipse/tools/imcl uninstall {{ im_plugin_package[twas_release] }} -installationDirectory {{ cygwin }}{{ install_ihs_base }}/{{ plugin_dir }}" + register: uninstallPLGOutput + when: twas_release == 'WAS855' + + - name: uninstallPLGOutput WAS855 + ansible.builtin.debug: + msg: "{{ uninstallPLGOutput.stdout_lines }}" + failed_when: ( uninstallPLGOutput.rc not in [ 0 ] ) + when: twas_release == 'WAS855' + +- name: Check if previous IHS installed + ansible.builtin.stat: + path: "{{ install_ihs_base }}/{{ http_dir }}/bin/versionInfo{{ ext }}" register: isihs -- name: stop httpd - ignore_errors: true - shell: "{{install_ihs_base }}/{{ http_dir }}/bin/apachectl stop" - when: isihs.stat.exists == True - -- name: stop adminctl - ignore_errors: true - shell: "{{install_ihs_base }}/{{ http_dir }}/bin/adminctl stop" - when: isihs.stat.exists == True - -- name: uninstall IM - ignore_errors: true - shell: "{{ install_ihs_base }}/IM/eclipse/tools/imcl uninstallAll" - register: uninstallOutput - failed_when: ( uninstallOutput.rc not in [ 0, 1 ] ) - -- name: uninstallAll output - debug: - msg: "{{ uninstallOutput.stdout_lines }}" - -# windoze /cygdrive/c/Users/Administrator/AppData/Roaming/IBM/Installation Manager/uninstall/userinstc -# ansible_user: Administrator -- name: uninstall Windoze ibm installation manager - ignore_errors: true - shell: "~/AppData/Roaming/IBM/Installation Manager/uninstall/userinstc" - register: uninstallOutput - failed_when: ( uninstallOutput.rc not in [ 0, 1 ] ) - when: - - ansible_system == 'Windows' or 'CYG' in ansible_system - -- name: uninstall *nix ibm installation manager - ignore_errors: true - shell: "~/var/ibm/InstallationManager/uninstall/uninstallc" - register: uninstallOutput - failed_when: ( uninstallOutput.rc not in [ 0, 1 ] ) - when: - - ansible_system != 'Windows' and 'CYG' not in ansible_system - -- name: uninstallAll output - debug: - msg: "{{ uninstallOutput.stdout_lines }}" - -- name: Remove previous http dir - file: +- name: Uninstall IHS WAS90 + when: isihs.stat.exists + block: + - name: Uninstall http WAS90 + ansible.builtin.shell: "{{ install_ihs_base }}/IM/eclipse/tools/imcl uninstall {{ im_http_package[twas_release] }} {{ im_http_java_package }} -installationDirectory {{ cygwin }}{{ install_ihs_base }}/{{ http_dir }}" + register: uninstallIHSOutput + failed_when: ( uninstallIHSOutput.rc not in [ 0 ] ) + when: twas_release == 'WAS90' + + - name: UninstallIHSOutput WAS90 + ansible.builtin.debug: + msg: "{{ uninstallIHSOutput.stdout_lines }}" + failed_when: ( uninstallIHSOutput.rc not in [ 0 ] ) + when: twas_release == 'WAS90' + + - name: Uninstall http WAS855 + ansible.builtin.shell: "{{ install_ihs_base }}/IM/eclipse/tools/imcl uninstall {{ im_http_package[twas_release] }} -installationDirectory {{ cygwin }}{{ install_ihs_base }}/{{ http_dir }}" + register: uninstallIHSOutput + failed_when: ( uninstallIHSOutput.rc not in [ 0 ] ) + when: twas_release == 'WAS855' + + - name: UninstallIHSOutput WAS855 + ansible.builtin.debug: + msg: "{{ uninstallIHSOutput.stdout_lines }}" + failed_when: ( uninstallIHSOutput.rc not in [ 0 ] ) + when: twas_release == 'WAS855' + +- name: Remove previous http/plugin/wct/ dir + ansible.builtin.file: path: "{{ item }}" state: absent with_items: - - "{{ install_ihs_base }}/{{ shared_dir }}" - - "{{ install_ihs_base }}/{{ http_dir }}" - - "{{ install_ihs_base }}/{{ plugin_dir }}" - - "{{ install_ihs_base }}/{{ wct_dir }}" - - "{{ install_ihs_base }}/im_install" - - "{{ install_ihs_base }}/IM" - - "{{ install_ihs_base }}/javasharedresources" - - "{{ install_ihs_base }}/im_http_plugin.xml" - - "{{ install_ihs_base }}/wct_definition.xml" - - "{{ install_ihs_base }}/https_conf" - - "~/var/" - - "~/etc/" + - "{{ install_ihs_base }}/{{ http_dir }}" + - "{{ install_ihs_base }}/{{ plugin_dir }}" + - "{{ install_ihs_base }}/{{ wct_dir }}" + - "{{ install_ihs_base }}/im_http_plugin.xml" + - "{{ install_ihs_base }}/wct_definition.xml" + - "{{ install_ihs_base }}/https_conf" + - "{{ install_ihs_base }}/.ibm" # WCT seems to be the only IBM WAS product that uses this" diff --git a/ansible/roles/im_cleanup_im/defaults/main.yml b/ansible/roles/im_cleanup_im/defaults/main.yml new file mode 100644 index 000000000..ef84dd51c --- /dev/null +++ b/ansible/roles/im_cleanup_im/defaults/main.yml @@ -0,0 +1,5 @@ +--- +shared_dir: 'IM-shared' +install_base: '/home/nest' +# trick the template to install onto windoze via cygwin +cygwin: '' diff --git a/ansible/roles/im_cleanup_im/readme.md b/ansible/roles/im_cleanup_im/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/im_cleanup_im/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/im_cleanup_im/tasks/im_cleanup_im.yml b/ansible/roles/im_cleanup_im/tasks/im_cleanup_im.yml new file mode 100644 index 000000000..4dd711d95 --- /dev/null +++ b/ansible/roles/im_cleanup_im/tasks/im_cleanup_im.yml @@ -0,0 +1,66 @@ +--- +- name: Set windoze facts + ansible.builtin.set_fact: + cygwin: 'c:/cygwin64' + ext: '.bat' + when: + - ansible_system == 'Windows' or 'CYG' in ansible_system + +- name: Windoze path debug + ansible.builtin.debug: + msg: + - "cygwin={{ cygwin }}" + - "install_base={{ install_base }}" + +- name: Check if imcl is installed + ansible.builtin.stat: + path: "{{ install_base }}/IM/eclipse/tools/imcl" + register: isimcl + +- name: IM installed? + when: isimcl.stat.exists + block: + - name: IM uninstallAll *nix + when: ansible_system is not search('CYG') + block: + - name: UninstallAll *nix + ignore_errors: true + ansible.builtin.shell: "{{ install_base }}/IM/eclipse/tools/imcl uninstallAll" + register: uninstallOutput + failed_when: ( uninstallOutput.rc not in [ 0, 1 ] ) + + - name: UninstallAll output + debug: + msg: "{{ uninstallOutput.stdout_lines }}" + + - name: Uninstall *nix ibm installation manager + ignore_errors: false + ansible.builtin.shell: "~/var/ibm/InstallationManager/uninstall/uninstallc" + register: uninstallOutput + failed_when: ( uninstallOutput.rc not in [ 0, 1 ] ) + + - name: UninstallAll output + ansible.builtin.debug: + msg: "{{ uninstallOutput.stdout_lines }}" + when: uninstallOutput.stdout_line is defined + + - name: Uninstall IBM Installation Manager windoze + when: ansible_system == 'Windows' or 'CYG' in ansible_system + ignore_errors: false + ansible.builtin.shell: "{{ cygwin }}{{ install_base }}/IM/eclipse/tools/imcl uninstall com.ibm.cic.agent" + register: uninstallOutput + failed_when: ( uninstallOutput.rc not in [ 0, 1 ] ) + changed_when: false + + - name: Remove IM directories + ansible.builtin.file: + path: "{{ item }}" + state: absent + with_items: + - "{{ cygwin }}{{ install_base }}/{{ shared_dir }}" + - "{{ cygwin }}{{ install_base }}/im_install" + - "{{ cygwin }}{{ install_base }}/IM" + - "{{ cygwin }}{{ install_base }}/javasharedresources" + - "{{ cygwin }}/users/{{ ansible_user }}/AppData/Roaming/IBM" + - "~/var/" + - "~/etc/" diff --git a/ansible/roles/im_cleanup_im/tasks/main.yml b/ansible/roles/im_cleanup_im/tasks/main.yml new file mode 100644 index 000000000..318c1e925 --- /dev/null +++ b/ansible/roles/im_cleanup_im/tasks/main.yml @@ -0,0 +1,2 @@ +--- +- include_tasks: im_cleanup_im.yml diff --git a/ansible/roles/im_cleanup_liberty/defaults/main.yml b/ansible/roles/im_cleanup_liberty/defaults/main.yml index 2db264b2e..0d71a7e9b 100644 --- a/ansible/roles/im_cleanup_liberty/defaults/main.yml +++ b/ansible/roles/im_cleanup_liberty/defaults/main.yml @@ -1,2 +1,2 @@ --- -shared_dir: 'IM-shared' +im_force_liberty: false \ No newline at end of file diff --git a/ansible/roles/im_cleanup_liberty/tasks/im_cleanup_liberty.yml b/ansible/roles/im_cleanup_liberty/tasks/im_cleanup_liberty.yml index 06e7a31fd..e1ee1eb93 100644 --- a/ansible/roles/im_cleanup_liberty/tasks/im_cleanup_liberty.yml +++ b/ansible/roles/im_cleanup_liberty/tasks/im_cleanup_liberty.yml @@ -1,72 +1,74 @@ --- -# blindly try fuser ( linux ) -- name: blindly try fuser ( linux ) - ignore_errors: true - shell: "fuser -k {{ item }}" - register: killOutput - failed_when: ( killOutput.rc not in [ 0, 1, 2, 127 ] ) - with_items: - - "{{ install_base }}/{{ liberty_dir }}" - -- name: check if previous liberty installed - stat: - path: "{{install_base }}/{{ liberty_dir }}/bin/server" +- name: Check if previous liberty installed + ansible.builtin.stat: + path: "{{ install_base }}/{{ liberty_dir }}/bin/server" register: islib -- name: stop any running servers - ignore_errors: true - shell: "{{ wlp_cmd }} {{install_base }}/{{ liberty_dir }}/bin/server stop {{ item }}" - register: stopOutput - failed_when: ( stopOutput.rc not in [ 0, 2, 23, 127 ] ) - with_items: - - "{{ wl_server }}" - - "{{ cc_server }}" - when: islib.stat.exists == True +- name: Uninstall Liberty + when: + - islib.stat is defined + - islib.stat.exists + block: + - name: Stop any running servers + ignore_errors: true + ansible.builtin.shell: "{{ install_base }}/{{ liberty_dir }}/bin/server stop {{ item }}" + register: stopOutput + failed_when: ( stopOutput.rc not in [ 0, 2, 23, 127 ] ) + with_items: + - "{{ wl_server }}" + - "{{ cc_server }}" + + # blindly try fuser ( linux ) + - name: Blindly try fuser ( linux ) + when: ansible_system is not search('CYG') + ignore_errors: true + ansible.builtin.shell: "fuser -k {{ item }}" + register: killOutput + failed_when: ( killOutput.rc not in [ 0, 1, 2, 127 ] ) + changed_when: false + with_items: + - "{{ install_base }}/{{ liberty_dir }}" + + # Windoze uninstallAll seems to be hanging, try to flush the hosts brain + # - name: Windoze reboot to flush brain + # when: ansible_system == 'Windows' or 'CYG' in ansible_system + # block: + # - name: Restart windoze + # ansible.builtin.shell: 'shutdown /r' + # become: true + # - name: Wait for the reboot and reconnect + # wait_for: + # port: 22 + # host: '{{ (ansible_ssh_host|default(ansible_host))|default(inventory_hostname) }}' + # search_regex: OpenSSH + # delay: 60 + # timeout: 60 + # retries: 10 + # connection: local -- name: uninstall liberty - ignore_errors: true - shell: "{{ install_base }}/IM/eclipse/tools/imcl uninstallAll" - register: uninstallOutput - failed_when: ( uninstallOutput.rc not in [ 0, 1 ] ) - -- name: uninstallAll output - debug: - msg: "{{ uninstallOutput.stdout_lines }}" + - name: Blindly try kill ( windoze ) + when: ansible_system == 'Windows' or 'CYG' in ansible_system + ignore_errors: true + ansible.builtin.shell: "ps -W|grep java|awk '{print $1}'|xargs kill -f" + register: killOutput + failed_when: ( killOutput.rc not in [ 0, 123 ] ) + changed_when: false -# windoze /cygdrive/c/Users/Administrator/AppData/Roaming/IBM/Installation Manager/uninstall/userinstc -# ansible_user: Administrator -- name: uninstall Windoze ibm installation manager - ignore_errors: true - shell: "~/AppData/Roaming/IBM/Installation Manager/uninstall/userinstc" - register: uninstallOutput - failed_when: ( uninstallOutput.rc not in [ 0, 1 ] ) - when: - - ansible_system == 'Windows' or 'CYG' in ansible_system + - name: Uninstall liberty and java + ansible.builtin.shell: "{{ install_base }}/IM/eclipse/tools/imcl uninstall {{ im_liberty_package }} com.ibm.java.jdk.v{{ im_java_short_version }}" + register: uninstallOutput + failed_when: ( uninstallOutput.rc not in [ 0, 1 ] ) -- name: uninstall *nix ibm installation manager - ignore_errors: true - shell: "~/var/ibm/InstallationManager/uninstall/uninstallc" - register: uninstallOutput - failed_when: ( uninstallOutput.rc not in [ 0, 1 ] ) - when: - - ansible_system != 'Windows' and 'CYG' not in ansible_system - -- name: uninstallAll output - debug: - msg: "{{ uninstallOutput.stdout_lines }}" + - name: UninstallAll output + ansible.builtin.debug: + msg: "{{ uninstallOutput.stdout_lines }}" + when: uninstallOutput.stdout_line is defined - name: Remove previous liberty dir - file: + ansible.builtin.file: path: "{{ item }}" state: absent with_items: - - "{{ install_base }}/{{ liberty_dir }}" - - "{{ wlp_usr_dir }}" - - "{{ install_base }}/{{ shared_dir }}" - - "{{ install_base }}/im_install" - - "{{ install_base }}/IM" - - "{{ install_base }}/javasharedresources" - - "{{ install_base }}/im_liberty.xml" - - "~/var/" - - "~/etc/" + - "{{ install_base }}/{{ liberty_dir }}" + - "{{ wlp_usr_dir }}" diff --git a/ansible/roles/im_cleanup_liberty_more/defaults/main.yml b/ansible/roles/im_cleanup_liberty_more/defaults/main.yml new file mode 100644 index 000000000..0d71a7e9b --- /dev/null +++ b/ansible/roles/im_cleanup_liberty_more/defaults/main.yml @@ -0,0 +1,2 @@ +--- +im_force_liberty: false \ No newline at end of file diff --git a/ansible/roles/im_cleanup_liberty_more/meta/main.yml b/ansible/roles/im_cleanup_liberty_more/meta/main.yml new file mode 100644 index 000000000..285b3d3fa --- /dev/null +++ b/ansible/roles/im_cleanup_liberty_more/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: liberty_defaults diff --git a/ansible/roles/im_cleanup_liberty_more/readme.md b/ansible/roles/im_cleanup_liberty_more/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/im_cleanup_liberty_more/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/im_cleanup_liberty_more/tasks/im_cleanup_liberty_more.yml b/ansible/roles/im_cleanup_liberty_more/tasks/im_cleanup_liberty_more.yml new file mode 100644 index 000000000..31da6636a --- /dev/null +++ b/ansible/roles/im_cleanup_liberty_more/tasks/im_cleanup_liberty_more.yml @@ -0,0 +1,31 @@ +--- + +- name: Check if IM installed + ansible.builtin.stat: + path: "{{ install_base }}/IM/eclipse/tools/imcl" + register: isim + +- name: Uninstall MoRE Liberty + when: + - isim.stat is defined + - isim.stat.exists + block: + + - name: Check if previous MoRE installed + ansible.builtin.shell: "{{ install_base }}/IM/eclipse/tools/imcl listInstalledPackages | grep {{ im_twas_more_package[twas_more_release] }}" + register: checkMoREOutput + failed_when: ( checkMoREOutput.rc not in [ 0, 1 ] ) + + - name: Uninstall MoRE Liberty + when: checkMoREOutput.rc == 0 + block: + + - name: Uninstall MoRE + ansible.builtin.shell: "{{ install_base }}/IM/eclipse/tools/imcl uninstall {{ im_twas_more_package[twas_more_release] }}" + register: uninstallOutput + failed_when: ( uninstallOutput.rc not in [ 0, 1 ] ) + + - name: UninstallAll output + ansible.builtin.debug: + msg: "{{ uninstallOutput.stdout_lines }}" + when: uninstallOutput.stdout_line is defined diff --git a/ansible/roles/im_cleanup_liberty_more/tasks/main.yml b/ansible/roles/im_cleanup_liberty_more/tasks/main.yml new file mode 100644 index 000000000..765f30b59 --- /dev/null +++ b/ansible/roles/im_cleanup_liberty_more/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Unisntall the Liberty MoRe + ansible.builtin.include_tasks: im_cleanup_liberty_more.yml diff --git a/ansible/roles/im_update_twas/meta/main.yml b/ansible/roles/im_cleanup_twas/meta/main.yml similarity index 100% rename from ansible/roles/im_update_twas/meta/main.yml rename to ansible/roles/im_cleanup_twas/meta/main.yml diff --git a/ansible/roles/im_cleanup_twas/readme.md b/ansible/roles/im_cleanup_twas/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/im_cleanup_twas/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/im_cleanup_twas/tasks/im_cleanup_twas.yml b/ansible/roles/im_cleanup_twas/tasks/im_cleanup_twas.yml new file mode 100644 index 000000000..c70907be0 --- /dev/null +++ b/ansible/roles/im_cleanup_twas/tasks/im_cleanup_twas.yml @@ -0,0 +1,50 @@ +--- +- name: Check if tWAS is installed + ansible.builtin.stat: + path: "{{ cygwin }}{{ install_base }}/{{ twas_dir }}" + register: istwas + +- name: Uninstall tWAS + when: + - istwas.stat is defined + - istwas.stat.exists + block: + - name: Check if imcl installed as a prereq + ansible.builtin.stat: + path: "{{ install_base }}/IM/eclipse/tools/imcl" + register: isimcl + failed_when: isimcl.stat.exists == False + + # blindly try fuser ( linux ) + - name: Blindly try fuser ( linux ) + ignore_errors: true + shell: "fuser -k {{install_base }}/{{ twas_dir }}" + register: killOutput + failed_when: ( killOutput.rc not in [ 0, 1, 2, 127 ] ) + changed_when: false + when: ansible_system is not search('CYG') + + - name: Blindly try kill ( windoze ) + ignore_errors: true + ansible.builtin.shell: "ps -W|grep java|awk '{print $1}'|xargs kill -f" + register: killOutput + failed_when: ( killOutput.rc not in [ 0, 123 ] ) + changed_when: false + when: + - ansible_system == 'Windows' or 'CYG' in ansible_system + + - name: Uninstall twas + ansible.builtin.shell: "{{ cygwin }}{{ install_base }}/IM/eclipse/tools/imcl uninstall {{ im_twas_package[twas_release] }} {{ im_twas_java_package }} -installationDirectory {{ cygwin }}{{ install_base }}/{{ twas_dir }}" + register: uninstallOutput + failed_when: ( uninstallOutput.rc not in [ 0, 1 ] ) + + - name: Uninstall twas output + ansible.builtin.debug: + msg: "{{ uninstallOutput.stdout_lines }}" + + - name: Remove previous twas dir + ansible.builtin.file: + path: "{{ item }}" + state: absent + with_items: + - "{{ cygwin }}{{ install_base }}/{{ twas_dir }}" diff --git a/ansible/roles/im_cleanup_twas/tasks/main.yml b/ansible/roles/im_cleanup_twas/tasks/main.yml new file mode 100644 index 000000000..74b1d2a3a --- /dev/null +++ b/ansible/roles/im_cleanup_twas/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Uninstall tWAS + ansible.builtin.include_tasks: im_cleanup_twas.yml diff --git a/ansible/roles/im_cleanup_twas_app_client/meta/main.yml b/ansible/roles/im_cleanup_twas_app_client/meta/main.yml new file mode 100644 index 000000000..cae48b34e --- /dev/null +++ b/ansible/roles/im_cleanup_twas_app_client/meta/main.yml @@ -0,0 +1,5 @@ +--- +dependencies: + - role: ibm_installation_manager_cic_selector + - role: load_secrets + - role: twas_cell_defaults diff --git a/ansible/roles/im_cleanup_twas_app_client/readme.md b/ansible/roles/im_cleanup_twas_app_client/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/im_cleanup_twas_app_client/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/im_cleanup_twas_app_client/tasks/im_cleanup_twas_app_client.yml b/ansible/roles/im_cleanup_twas_app_client/tasks/im_cleanup_twas_app_client.yml new file mode 100644 index 000000000..88a3cfb2a --- /dev/null +++ b/ansible/roles/im_cleanup_twas_app_client/tasks/im_cleanup_twas_app_client.yml @@ -0,0 +1,33 @@ +--- + +- name: Check if AppClient is installed + ansible.builtin.stat: + path: "{{ cygwin }}{{ install_base }}/{{ app_dir }}" + register: isappclient + +- name: Uninstall AppClient + when: + - isappclient.stat is defined + - isappclient.stat.exists + block: + - name: Check if imcl installed as a prereq + ansible.builtin.stat: + path: "{{ install_base }}/IM/eclipse/tools/imcl" + register: isimcl + failed_when: isimcl.stat.exists == False + + - name: Uninstall AppClient + ansible.builtin.shell: "{{ cygwin }}{{ install_base }}/IM/eclipse/tools/imcl uninstall {{ im_appclient_package[twas_release] }} {{ im_twas_java_package }} -installationDirectory {{ cygwin }}{{ install_base }}/{{ app_dir }}" + register: uninstallOutput + failed_when: ( uninstallOutput.rc not in [ 0, 1 ] ) + + - name: Uninstall AppClient output + ansible.builtin.debug: + msg: "{{ uninstallOutput.stdout_lines }}" + + - name: Remove previous twas appclient dir + ansible.builtin.file: + path: "{{ item }}" + state: absent + with_items: + - "{{ cygwin }}{{ install_base }}/{{ app_dir }}" diff --git a/ansible/roles/im_cleanup_twas_app_client/tasks/main.yml b/ansible/roles/im_cleanup_twas_app_client/tasks/main.yml new file mode 100644 index 000000000..cfe6b69e9 --- /dev/null +++ b/ansible/roles/im_cleanup_twas_app_client/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Uninstall AppClient + ansible.builtin.include_tasks: im_cleanup_twas_app_client.yml diff --git a/ansible/roles/im_hack_to_disable_repos/tasks/im_hack_to_disable_repos.yml b/ansible/roles/im_hack_to_disable_repos/tasks/im_hack_to_disable_repos.yml new file mode 100644 index 000000000..ffde03cc5 --- /dev/null +++ b/ansible/roles/im_hack_to_disable_repos/tasks/im_hack_to_disable_repos.yml @@ -0,0 +1,39 @@ +--- +- name: Set the file to adjust (*nix) + when: ansible_system is not search('CYG') + ansible.builtin.set_fact: + pref_file: "{{ ansible_user_dir }}/var/ibm/InstallationManager/.settings/com.ibm.cic.agent.core.prefs" + +- name: Set the file to adjust (windoze) + when: ansible_system == 'Windows' or 'CYG' in ansible_system + ansible.builtin.set_fact: + pref_file: "/cygdrive/c/Users/{{ user_username }}/AppData/Roaming/IBM/Installation Manager/.settings/com.ibm.cic.agent.core.prefs" + +- name: Check if com.ibm.cic.agent.core.prefs exists + ansible.builtin.stat: + path: "{{ pref_file }}" + register: isprefs + +- name: IM repo hack + when: isprefs.stat.exists + block: + - name: IM hack to remove current gsa repos + ansible.builtin.lineinfile: + path: "{{ pref_file }}" + regexp: "^com.ibm.cic.common.core.preferences.repositoryLocations*" + state: absent + backup: true + + - name: IM disable offering.service.repositories.areUsed + ansible.builtin.lineinfile: + path: "{{ pref_file }}" + search_string: "offering.service.repositories.areUsed=false" + line: "offering.service.repositories.areUsed=false" + state: present + + - name: IM disable com.ibm.cic.common.core.preferences.searchForUpdates + ansible.builtin.lineinfile: + path: "{{ pref_file }}" + search_string: "com.ibm.cic.common.core.preferences.searchForUpdates=false" + line: "com.ibm.cic.common.core.preferences.searchForUpdates=false" + state: present diff --git a/ansible/roles/im_hack_to_disable_repos/tasks/main.yml b/ansible/roles/im_hack_to_disable_repos/tasks/main.yml new file mode 100644 index 000000000..2e98be788 --- /dev/null +++ b/ansible/roles/im_hack_to_disable_repos/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Im_hack_to_disable_repos + ansible.builtin.include_tasks: im_hack_to_disable_repos.yml diff --git a/ansible/roles/im_install_http_plugin/defaults/main.yml b/ansible/roles/im_install_http_plugin/defaults/main.yml index a0498da4d..dc8ce6278 100644 --- a/ansible/roles/im_install_http_plugin/defaults/main.yml +++ b/ansible/roles/im_install_http_plugin/defaults/main.yml @@ -1,3 +1,18 @@ --- # trick the template to install onto windoze via cygwin -install_ihs_base_win: '' +cygwin: '' +id_ibm_http_server: 'IBM HTTP Server' +id_ibm_http_plugin: 'Web server plug-ins for IBM WebSphere Application Server' +id_ibm_wct_tools: 'WebSphere Customization Tools' + +regex_profile_id_ibm_http_server: " 1.10 java11 ) + ansible.builtin.file: + path: "{{ install_ihs_base }}/IM/secureStorageFile.store" + state: absent + +- name: Generate secureStorageFile.store + ansible.builtin.shell: "{{ install_ihs_base }}/IM/eclipse/tools/imutilsc saveCredential -url https://rtpgsa.ibm.com -userName {{ gsa_user }} -userPassword {{ gsa_pass }} -secureStorageFile {{ install_ihs_base }}/IM/secureStorageFile.store" + +- name: install http plugins wct + ansible.builtin.shell: "time {{ install_ihs_base }}/IM/eclipse/tools/imcl input ./im_http_plugin.xml -acceptLicense -secureStorageFile {{ install_ihs_base }}/IM/secureStorageFile.store" + register: installOutput + +- name: InstallOutput + ansible.builtin.debug: + msg: "{{ installOutput.stdout_lines }}" + +# pure hack to get zLinux s390x WCT 32bit java to use 64bit java +- name: Hack tWAS855 zLinux s390x WCT super hack + ansible.builtin.shell: "rm -rf {{ install_ihs_base }}/{{ wct_dir }}/java/jre ; ln -s {{ install_ihs_base }}/{{ plugin_dir }}/java/jre {{ install_ihs_base }}/WCT/java/jre" + when: - ansible_architecture == 's390x' - twas_release == 'WAS855' - - name: configure plugin - shell: "{{install_ihs_base }}/WCT/WCT/wctcmd.sh -tool pct -defLocPathname {{ install_ihs_base }}/{{ plugin_dir }} -defLocName ihsWebServer -createDefinition -response wct_definition.xml -importDefinitionLocation" +# pure hack to get linux RHEL10 WCT 32bit java to use 64bit java +- name: Hack tWAS855 linux RHEL10 WCT super hack + ansible.builtin.shell: "rm -rf {{ install_ihs_base }}/{{ wct_dir }}/java/jre ; ln -s {{ install_ihs_base }}/{{ plugin_dir }}/java/jre {{ install_ihs_base }}/WCT/java/jre" + when: + - ansible_distribution == "RedHat" + - ansible_distribution_major_version == "10" + +- name: New install configuration + when: + - ihs_upgrade_only is not defined + block: + - name: Copy https_conf template + ansible.builtin.template: + src: https_conf_{{ twas_release }}.j2 + dest: "https_conf" + + #https://www.ibm.com/docs/en/was/9.0.5?topic=cwspi-configuring-web-server-plug-in-using-pct-tool + - name: Copy wct_definition.xml template + ansible.builtin.template: + src: wct_definition.xml.j2 + dest: "wct_definition.xml" + + # if windoze switch all forward slash to backslash to allow the wct command to work + - name: Replace forward slash with backslash for widoze wct command + when: ansible_system == 'Windows' or 'CYG' in ansible_system + ansible.builtin.replace: + path: "wct_definition.xml" + regexp: '/' + replace: '\\' + + - name: Copy ihsserverkey{{ ext }} template + ansible.builtin.template: + src: ihsserverkey{{ ext }}.j2 + dest: "{{ cygwin }}{{ install_ihs_base }}/{{ http_dir }}/conf/ihsserverkey{{ ext }}" + mode: 0755 + + - name: Check for any old WCT IHS/Plugin configs + ansible.builtin.shell: "{{ install_ihs_base }}/{{ wct_dir }}/WCT/wctcmd{{ ext }} -tool pct -listDefinitionLocations" + register: isPluginConfigured + + - name: WCT/WCT/wctcmd{{ ext }} -tool pct -listDefinitionLocations output + ansible.builtin.debug: + msg: "{{ isPluginConfigured.stdout_lines }}" + + - name: Remove the old WCT IHS/Plugin configs + ansible.builtin.shell: "{{ install_ihs_base }}/{{ wct_dir }}/WCT/wctcmd{{ ext }} -tool pct -removeDefinitionLocation -defLocPathname {{ cygwin }}{{ install_ihs_base }}/{{ plugin_dir }} -defLocName {{ webServerName }}" + register: isPluginConfigured + when: + - isPluginConfigured.rc == 0 + - isPluginConfigured.stdout is not search('No definition') + + # - name: Convert forward slash to back slash for windoze + # when: ansible_system == 'Windows' or 'CYG' in ansible_system + # ansible.builtin.replace: + # path: wct_definition.xml + # regexp: '\/' + # replace: '\\' + + - name: Configure plugin + ansible.builtin.shell: "{{ install_ihs_base }}/{{ wct_dir }}/WCT/wctcmd{{ ext }} -tool pct -defLocPathname {{ cygwin }}{{ install_ihs_base }}/{{ plugin_dir }} -defLocName {{ webServerName }} -createDefinition -response wct_definition.xml -importDefinitionLocation" register: configurepluginOutput - - name: configurepluginOutput - debug: - msg: "{{ configurepluginOutput.stdout_lines }}" + - name: ConfigurepluginOutput + ansible.builtin.debug: + msg: "{{ configurepluginOutput.stdout_lines }}" - name: Insert/Update https config - blockinfile: + ansible.builtin.blockinfile: path: "{{ install_ihs_base }}/{{ http_dir }}/conf/httpd.conf" block: | LoadModule ibm_ssl_module modules/mod_ibm_ssl.so - Listen {{ ihs_https_port }} + Listen 0.0.0.0:{{ ihs_https_port }} SSLCheckCertificateExpiration 30 - ServerName {{ ansible_hostname }} - SSLEnable - Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" + ServerName {{ ansible_fqdn }} + SSLEnable + Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" - KeyFile {{ install_ihs_base }}/{{ http_dir }}/conf/ihsserverkey.kdb - - lineinfile: + KeyFile {{ cygwin }}{{ install_ihs_base }}/{{ http_dir }}/conf/ihsserverkey.kdb + + - name: IHS disable access_log + ansible.builtin.replace: dest: "{{ install_ihs_base }}/{{ http_dir }}/conf/httpd.conf" - state: absent + regexp: 'CustomLog logs/access_log common' + replace: '#CustomLog logs/access_log common' + + - name: IHS Header for 855x + ansible.builtin.lineinfile: + dest: "{{ install_ihs_base }}/{{ http_dir }}/conf/httpd.conf" + state: absent regexp: "Header always set Strict-Transport-Security" when: twas_release == 'WAS855' - - name: update admin.config @@AdminPort@@ - replace: + - name: Update admin.config @@AdminPort@@ + ansible.builtin.replace: path: "{{ install_ihs_base }}/{{ http_dir }}/conf/admin.conf" regexp: '@@AdminPort@@' replace: "{{ ihs_admin_port }}" + - name: Disable admin.config User otherwise must run as root + ansible.builtin.replace: + path: "{{ install_ihs_base }}/{{ http_dir }}/conf/admin.conf" + regexp: '^User' + replace: '#User' + + - name: Disable admin.config Group otherwise must run as root + ansible.builtin.replace: + path: "{{ install_ihs_base }}/{{ http_dir }}/conf/admin.conf" + regexp: '^Group' + replace: '#Group' + - name: enable server-status - replace: + ansible.builtin.replace: path: "{{ install_ihs_base }}/{{ http_dir }}/conf/httpd.conf" regexp: ' Require all denied' after: ' SetHandler server-status' - before: 'To allow access from a specific IP:' replace: '# Require all denied' - - - name: configure plugin - shell: "{{install_ihs_base }}/{{ http_dir }}/conf/ihsserverkey.sh" + + - name: enable server-status windoze tWAS855x + ansible.builtin.replace: + path: "{{ install_ihs_base }}/{{ http_dir }}/conf/httpd.conf" + regexp: ' Deny from all' + after: ' SetHandler server-status' + replace: '# Deny from all' + + - name: Configure http admin.passwd + ansible.builtin.shell: "{{ install_ihs_base }}/{{ http_dir }}/bin/htpasswd -bc admin.passwd {{ ihs_admin_user }} {{ ihs_admin_pass }}" + args: + chdir: "{{ install_ihs_base }}/{{ http_dir }}/conf" + register: configAdminPassOutput + + - name: configAdminPassOutput + ansible.builtin.debug: + msg: "{{ configAdminPassOutput.stdout_lines }}" + + - name: Configure plugin + ansible.builtin.shell: "{{install_ihs_base }}/{{ http_dir }}/conf/ihsserverkey{{ ext }}" args: chdir: "{{ install_ihs_base }}/{{ http_dir }}/conf" register: createihsseververkdbOutput - - - name: createihsseververkdbOutput - debug: - msg: "{{ createihsseververkdbOutput.stdout_lines }}" - - - name: listInstalledPackages - shell: "{{ install_ihs_base }}/IM/eclipse/tools/imcl listInstalledPackages" + + - name: CheckreateihsseververkdbOutput + ansible.builtin.debug: + msg: "{{ createihsseververkdbOutput.stdout_lines }}" + + - name: ListInstalledPackages + ansible.builtin.shell: "{{ install_ihs_base }}/IM/eclipse/tools/imcl listInstalledPackages -long" register: packageOutput - - - name: packageOutput - debug: - msg: "{{ packageOutput.stdout_lines }}" - - - name: start httpd - shell: "{{install_ihs_base }}/{{ http_dir }}/bin/apachectl start" - register: starthttpdOutput - - - name: starthttpdOutput - debug: - msg: "{{ starthttpdOutput.stdout_lines }}" - - - name: start adminctl - shell: "{{install_ihs_base }}/{{ http_dir }}/bin/adminctl start " - register: startadminctlOutput - - - name: startadminctlOutput - debug: - msg: "{{ startadminctlOutput.stdout_lines }}" - + + - name: PackageOutput + ansible.builtin.debug: + msg: "{{ packageOutput.stdout_lines }}" + + - name: Unix http operations + when: ansible_system is not search('CYG') + block: + - name: Start httpd ( *nix ) + ansible.builtin.shell: "{{install_ihs_base }}/{{ http_dir }}/bin/apachectl start" + register: starthttpdOutput + - name: StarthttpdOutput + ansible.builtin.debug: + msg: "{{ starthttpdOutput.stdout_lines }}" + - name: Start adminctl + ansible.builtin.shell: "{{install_ihs_base }}/{{ http_dir }}/bin/adminctl start " + register: startadminctlOutput + - name: StartadminctlOutput + ansible.builtin.debug: + msg: "{{ startadminctlOutput.stdout_lines }}" + + # for some reason having logs in c:/cygwin64/nest/HTTPServer/logs does not work + - name: Windoze http operations + when: ansible_system == 'Windows' or 'CYG' in ansible_system + block: + - name: Windoze create c:/temp/logs + ansible.builtin.file: + path: "c:/temp/logs" + state: directory + + - name: Windoze switch log dir to c:/temp/logs + ansible.builtin.replace: + dest: "{{ install_ihs_base }}/{{ http_dir }}/conf/httpd.conf" + regexp: 'Log logs' + replace: 'Log c:/temp/logs' + + - name: Windoze switch log dir to c:/temp/logs pid + ansible.builtin.replace: + dest: "{{ install_ihs_base }}/{{ http_dir }}/conf/httpd.conf" + regexp: 'PidFile logs' + replace: 'PidFile c:/temp/logs' + + - name: Windoze create config/{{ webServerName }} + ansible.builtin.file: + path: "{{ cygwin }}{{ install_ihs_base }}/{{ plugin_dir }}/config/{{ webServerName }}" + state: directory + - name: Windoze create logs/{{ webServerName }} + ansible.builtin.file: + path: "{{ cygwin }}{{ install_ihs_base }}/{{ plugin_dir }}/logs/{{ webServerName }}" + state: directory + + - name: Install httpd Windoze service + ansible.builtin.shell: "{{ install_ihs_base }}/{{ http_dir }}/bin/apache -k install -n 'IBMHTTPServer' -f {{ cygwin }}{{ install_ihs_base }}/{{ http_dir }}/conf/httpd.conf" + register: apache_k_install + - name: Apache_k_install output + ansible.builtin.debug: + msg: "{{ apache_k_install.stdout_lines }}" + + ## Unable to find a simple command line option to allow user loginAsService, switch logs to c:/temp/logs + # - name: Change Windoze service account + # ansible.builtin.shell: "sc config IBMHTTPServer obj='.\\{{ user_username }}' password={{ user_password }} type=own" + # register: sc_config + # - name: Change Windoze service account output + # ansible.builtin.debug: + # msg: "{{ sc_config.stdout_lines }}" + + - name: Start apache -k start -n IBMHTTPServer + ansible.builtin.shell: "{{ install_ihs_base }}/{{ http_dir }}/bin/apache -k start -n 'IBMHTTPServer'" + register: starthttpdOutput + - name: StarthttpdOutput + ansible.builtin.debug: + msg: "{{ starthttpdOutput.stdout_lines }}" + + - name: Windoze switch log dir to c:/temp/logs for admin + ansible.builtin.replace: + dest: "{{ install_ihs_base }}/{{ http_dir }}/conf/admin.conf" + regexp: 'Log logs' + replace: 'Log c:/temp/logs' + + - name: Windoze switch log dir to c:/temp/logs for admin pid + ansible.builtin.replace: + dest: "{{ install_ihs_base }}/{{ http_dir }}/conf/admin.conf" + regexp: 'PidFile logs' + replace: 'PidFile c:/temp/logs' + + - name: Install httpd admin Windoze service + ansible.builtin.shell: "{{ install_ihs_base }}/{{ http_dir }}/bin/apache -k install -n 'IBMAdminHTTPServer' -f {{ cygwin }}{{ install_ihs_base }}/{{ http_dir }}/conf/admin.conf" + register: apache_k_admin_install + - name: Apache_k_admin_install output + ansible.builtin.debug: + msg: "{{ apache_k_install.stdout_lines }}" + + # # Unable to find a simple command line option to allow user loginAsService, switch logs to c:/temp/logs + # - name: Change Windoze service account admin + # ansible.builtin.shell: "sc config IBMAdminHTTPServer obj='.\\{{ user_username }}' password={{ user_password }} type=own" + # register: sc_config + # - name: Change Windoze service account admin output + # ansible.builtin.debug: + # msg: "{{ sc_config.stdout_lines }}" + + - name: Start apache -k start -n IBMAdminHTTPServer + ansible.builtin.shell: "{{ install_ihs_base }}/{{ http_dir }}/bin/apache -k start -n 'IBMAdminHTTPServer'" + register: starthttpdOutput + - name: StarthttpdOutput + ansible.builtin.debug: + msg: "{{ starthttpdOutput.stdout_lines }}" + - name: Check server-status - uri: - url: "https://localhost:{{ ihs_https_port }}" + ansible.builtin.uri: + url: "https://localhost:{{ ihs_https_port }}/server-status" return_content: no validate_certs: false -- name: Versions - tags: version - block: - - name: HTTPServer version - shell: "{{install_ihs_base }}/{{ http_dir }}/bin/versionInfo.sh" - register: HTTPServerVersionOutput + register: isIHSup + + - name: Is IHS running output + ansible.builtin.debug: + msg: "{{ isIHSup }}" - - name: HTTPServerVersionOutput - debug: - msg: "{{ HTTPServerVersionOutput.stdout_lines }}" +- name: HTTPServer version + ansible.builtin.shell: "{{ install_ihs_base }}/{{ http_dir }}/bin/versionInfo{{ ext }} -ifixDetail" + register: HTTPServerVersionOutput - - name: Plugin version - shell: "{{install_ihs_base }}/{{ plugin_dir }}/bin/versionInfo.sh" - register: PluginVersionOutput +- name: HTTPServerVersionOutput + ansible.builtin.debug: + msg: "{{ HTTPServerVersionOutput.stdout_lines }}" + failed_when: ihs_im_driver not in HTTPServerVersionOutput.stdout - - name: PluginVersionOutput - debug: - msg: "{{ PluginVersionOutput.stdout_lines }}" +- name: Plugin version + ansible.builtin.shell: "{{ install_ihs_base }}/{{ plugin_dir }}/bin/versionInfo{{ ext }} -ifixDetail" + register: PluginVersionOutput - - name: WCT version - shell: "{{install_ihs_base }}/{{ wct_dir }}/bin/versionInfo.sh" - register: WCTVersionOutput +- name: PluginVersionOutput + ansible.builtin.debug: + msg: "{{ PluginVersionOutput.stdout_lines }}" + failed_when: ihs_im_driver not in PluginVersionOutput.stdout - - name: WCTVersionOutput - debug: - msg: "{{ WCTVersionOutput.stdout_lines }}" +- name: WCT version + ansible.builtin.shell: "{{ install_ihs_base }}/{{ wct_dir }}/bin/versionInfo{{ ext }} -ifixDetail" + register: WCTVersionOutput +- name: WCTVersionOutput + ansible.builtin.debug: + msg: "{{ WCTVersionOutput.stdout_lines }}" + failed_when: ihs_im_driver not in WCTVersionOutput.stdout diff --git a/ansible/roles/im_install_http_plugin/templates/https_conf_WAS855.j2 b/ansible/roles/im_install_http_plugin/templates/https_conf_WAS855.j2 index 08007e0cc..7e16037e0 100644 --- a/ansible/roles/im_install_http_plugin/templates/https_conf_WAS855.j2 +++ b/ansible/roles/im_install_http_plugin/templates/https_conf_WAS855.j2 @@ -1,7 +1,7 @@ LoadModule ibm_ssl_module modules/mod_ibm_ssl.so -Listen {{ ihs_https_port }} +Listen 0.0.0.0:{{ ihs_https_port }} - ServerName {{ ansible_hostname }} + ServerName {{ ansible_fqdn }} SSLEnable KeyFile {{ install_ihs_base }}/{{ http_dir }}/conf/ihsserverkey.kdb diff --git a/ansible/roles/im_install_http_plugin/templates/https_conf_WAS90.j2 b/ansible/roles/im_install_http_plugin/templates/https_conf_WAS90.j2 index 8f56f90c0..0daae817d 100644 --- a/ansible/roles/im_install_http_plugin/templates/https_conf_WAS90.j2 +++ b/ansible/roles/im_install_http_plugin/templates/https_conf_WAS90.j2 @@ -1,8 +1,8 @@ LoadModule ibm_ssl_module modules/mod_ibm_ssl.so -Listen {{ ihs_https_port }} +Listen 0.0.0.0:{{ ihs_https_port }} SSLCheckCertificateExpiration 30 - ServerName {{ ansible_hostname }} + ServerName {{ ansible_fqdn }} SSLEnable Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" diff --git a/ansible/roles/im_install_http_plugin/templates/ihsserverkey.bat.j2 b/ansible/roles/im_install_http_plugin/templates/ihsserverkey.bat.j2 new file mode 100644 index 000000000..5139a3d73 --- /dev/null +++ b/ansible/roles/im_install_http_plugin/templates/ihsserverkey.bat.j2 @@ -0,0 +1,10 @@ +rm -f ihsserverkey.kdb ihsserverkey.rdb ihsserverkey.crl ihsserverkey.sth + +echo "Creating ihsserverkey.kdb' +call ../bin/gskcmd.bat -keydb -create -db ihsserverkey.kdb -type cms -pw 'Just4T3st!ng' -stash -expire 7300 +echo "Creating certificates" +call ../bin/gskcmd.bat -cert -create -db ihsserverkey.kdb -type cms -label ihs -pw 'Just4T3st!ng' -DN CN={{ ansible_fqdn }} -size 2048 -default_cert yes -expire 7300 +call ../bin/gskcmd.bat -cert -details -label "ihs" -db ihsserverkey.kdb -pw 'Just4T3st!ng' +echo "Completed creating IHS certificates" +call ../bin/gskcmd.bat -cert -list -db ihsserverkey.kdb -pw 'Just4T3st!ng' +call ../bin/gskcmd.bat -cert -extract -db ihsserverkey.kdb -type cms -label ihs -pw 'Just4T3st!ng' -target {{ ansible_fqdn }}.base64.cert \ No newline at end of file diff --git a/ansible/roles/im_install_http_plugin/templates/im_http_plugin_WAS855.xml.j2 b/ansible/roles/im_install_http_plugin/templates/im_http_plugin_WAS855.xml.j2 index afe14fa9c..1941540ae 100644 --- a/ansible/roles/im_install_http_plugin/templates/im_http_plugin_WAS855.xml.j2 +++ b/ansible/roles/im_install_http_plugin/templates/im_http_plugin_WAS855.xml.j2 @@ -1,12 +1,12 @@ - + - + @@ -16,9 +16,9 @@ - + - + @@ -26,7 +26,7 @@ - + diff --git a/ansible/roles/im_install_http_plugin/templates/im_http_plugin_WAS90.xml.j2 b/ansible/roles/im_install_http_plugin/templates/im_http_plugin_WAS90.xml.j2 index 772aa8e2b..53ca8d658 100644 --- a/ansible/roles/im_install_http_plugin/templates/im_http_plugin_WAS90.xml.j2 +++ b/ansible/roles/im_install_http_plugin/templates/im_http_plugin_WAS90.xml.j2 @@ -1,12 +1,12 @@ - + - + @@ -23,7 +23,7 @@ - + @@ -33,7 +33,7 @@ - + diff --git a/ansible/roles/im_install_http_plugin/templates/wct_definition.xml.j2 b/ansible/roles/im_install_http_plugin/templates/wct_definition.xml.j2 index 87d5d295c..dd2644a90 100644 --- a/ansible/roles/im_install_http_plugin/templates/wct_definition.xml.j2 +++ b/ansible/roles/im_install_http_plugin/templates/wct_definition.xml.j2 @@ -11,7 +11,7 @@ ihsAdminUserID="{{ ihs_admin_user }}" mapWebserverToApplications="false" profileName="" wasMachineHostName="localhost" -webServerConfigFile1="{{ install_ihs_base }}/{{ http_dir }}/conf/httpd.conf" +webServerConfigFile1="{{ cygwin }}{{ install_ihs_base }}/{{ http_dir }}/conf/httpd.conf" webServerDefinition="{{ webServerName }}" webServerHostName="" webServerInstallArch="" diff --git a/ansible/roles/im_install_liberty/defaults/main.yml b/ansible/roles/im_install_liberty/defaults/main.yml index e8b7a2d57..64100b5a6 100644 --- a/ansible/roles/im_install_liberty/defaults/main.yml +++ b/ansible/roles/im_install_liberty/defaults/main.yml @@ -1,14 +1,10 @@ --- -liberty_im_driver: 'cl211120211019-1900.52.linux' +liberty_im_driver: 'cl240620240603-2001.31.linux' liberty_daily_or_test: 'test' -install_base: '/home/nest' -liberty_dir: 'wlp' shared_dir: 'IM-shared' -wl_server: 'server' -cc_server: 'cc' gsa_user: 'gsauser' gsa_pass: 'gsapass' ibm_user: 'external_ibmuser' ibm_pass: 'external_ibmpass' -im_liberty_package: 'com.ibm.websphere.liberty.NDTRIAL.v85' -im_java_package: 'com.ibm.java.jdk.v11' +im_liberty_package: 'com.ibm.websphere.liberty.ND' +im_java_short_version: '11' # com.ibm.java.jdk.v17 com.ibm.java.jdk.v11, com.ibm.java.jdk.8 diff --git a/ansible/roles/im_install_liberty/meta/main.yml b/ansible/roles/im_install_liberty/meta/main.yml index f8748d4b7..202e9c14e 100644 --- a/ansible/roles/im_install_liberty/meta/main.yml +++ b/ansible/roles/im_install_liberty/meta/main.yml @@ -2,3 +2,4 @@ dependencies: - role: load_secrets - role: ibm_installation_manager_cic_selector + - role: liberty_defaults diff --git a/ansible/roles/im_install_liberty/tasks/im_install_liberty.yml b/ansible/roles/im_install_liberty/tasks/im_install_liberty.yml index 78a835c16..a0aa54511 100644 --- a/ansible/roles/im_install_liberty/tasks/im_install_liberty.yml +++ b/ansible/roles/im_install_liberty/tasks/im_install_liberty.yml @@ -1,97 +1,84 @@ --- -### "ansible_architecture": "s390x", -### "ansible_architecture": "ppc64le", -### "ansible_architecture": "x86_64", -### "ansible_architecture": "chrp", --- AIX - name: Install tags: install block: - - name: check if imcl installed as a prereq - stat: + - name: Check if imcl installed as a prereq + ansible.builtin.stat: path: "{{ install_base }}/IM/eclipse/tools/imcl" register: isimcl failed_when: isimcl.stat.exists == False - - name: copy im_liberty.xml template + - name: Copy im_liberty.xml template when: ansible_system != 'OS400' - template: + ansible.builtin.template: src: im_liberty.xml.j2 dest: "im_liberty.xml" - - name: copy OS400 im_liberty.xml template + - name: Copy OS400 im_liberty.xml template when: ansible_system == 'OS400' - template: + ansible.builtin.template: src: im_liberty.OS400.xml.j2 dest: "im_liberty.xml" - - name: stop any running servers - ignore_errors: true - shell: "{{install_base }}/{{ liberty_dir }}/bin/server stop {{ item }}" - register: stopOutput - failed_when: ( stopOutput.rc not in [ 0, 2, 23, 127 ] ) - with_items: - - "{{ wl_server }}" - - "{{ cc_server }}" - - # blindly try fuser ( linux ) - - name: blindly try fuser ( linux ) - ignore_errors: true - shell: "fuser -k {{install_base }}/{{ liberty_dir }}" - register: killOutput - failed_when: ( killOutput.rc not in [ 0, 1, 2, 127 ] ) - - - name: uninstall liberty and java - shell: "{{ install_base }}/IM/eclipse/tools/imcl uninstall {{ im_liberty_package }} {{ im_java_package }}" - register: uninstallOutput - failed_when: ( uninstallOutput.rc not in [ 0, 1 ] ) - - - name: uninstall liberty and java output - debug: - msg: "{{ uninstallOutput.stdout_lines }}" - - - name: Remove previous liberty dir - file: - path: "{{ item }}" + - name: Remove previous secureStorageFile.store ( IM 1.9.x -> 1.10 java11 ) + ansible.builtin.file: + path: "{{ install_base }}/IM/secureStorageFile.store" state: absent - with_items: - - "{{ install_base }}/{{ liberty_dir }}" - - name: generate secureStorageFile.store - shell: "{{ install_base }}/IM/eclipse/tools/imutilsc saveCredential -url https://rtpgsa.ibm.com -userName {{ gsa_user }} -userPassword '{{ gsa_pass }}' -secureStorageFile {{ install_base }}/IM/secureStorageFile.store" + - name: Generate secureStorageFile.store + ansible.builtin.shell: "{{ install_base }}/IM/eclipse/tools/imutilsc saveCredential -url https://rtpgsa.ibm.com -userName {{ gsa_user }} -userPassword '{{ gsa_pass }}' -secureStorageFile {{ install_base }}/IM/secureStorageFile.store" - - name: generate external ibm secureStorageFile.store - shell: "{{ install_base }}/IM/eclipse/tools/imutilsc saveCredential -url http://www.ibm.com/software/repositorymanager -userName {{ external_ibmuser }} -userPassword '{{ external_ibmpass }}' -secureStorageFile {{ install_base }}/IM/secureStorageFile.store" + - name: Fenerate external ibm secureStorageFile.store + ansible.builtin.shell: "{{ install_base }}/IM/eclipse/tools/imutilsc saveCredential -url http://www.ibm.com/software/repositorymanager -userName {{ external_ibmuser }} -userPassword '{{ external_ibmpass }}' -secureStorageFile {{ install_base }}/IM/secureStorageFile.store" - - name: install liberty - shell: "{{ install_base }}/IM/eclipse/tools/imcl input ./im_liberty.xml -acceptLicense -secureStorageFile {{ install_base }}/IM/secureStorageFile.store" + - name: Install liberty + ansible.builtin.shell: "time {{ install_base }}/IM/eclipse/tools/imcl input ./im_liberty.xml -acceptLicense -secureStorageFile {{ install_base }}/IM/secureStorageFile.store" register: installOutput - - name: installOutput - debug: + - name: InstallOutput + ansible.builtin.debug: msg: "{{ installOutput.stdout_lines }}" - - name: listInstalledPackages - shell: "{{ install_base }}/IM/eclipse/tools/imcl listInstalledPackages" + - name: ListInstalledPackages + ansible.builtin.shell: "{{ install_base }}/IM/eclipse/tools/imcl listInstalledPackages -long" register: packageOutput - - name: packageOutput - debug: + - name: PackageOutput + ansible.builtin.debug: msg: "{{ packageOutput.stdout_lines }}" - - name: copy server.env template to override default wlp_user_dir and wlp_output_dir + - name: Copy server.env template to override default wlp_user_dir and wlp_output_dir when: ansible_system == 'OS400' - template: - src: server.env.j2 - dest: "{{install_base }}/{{ liberty_dir }}/etc/server.env" + ansible.builtin.template: + src: server.env.os400.j2 + dest: "{{ install_base }}/{{ liberty_dir }}/etc/server.env" + + - name: Java17+ on distributed + when: ansible_system != 'OS400' + block: + - name: Create ~/wlp/etc directory + ansible.builtin.file: + path: '{{ item }}' + state: directory + with_items: + - "{{ install_base }}/{{ liberty_dir }}/etc" + - "{{ wlp_usr_dir }}/shared/apps" + - "{{ wlp_usr_dir }}/shared/config" + - "{{ wlp_usr_dir }}/shared/resources" + + - name: Copy server.env template to set JAVA_HOME ( requirement for java17+ ) + ansible.builtin.template: + src: server.env.j2 + dest: "{{ install_base }}/{{ liberty_dir }}/etc/server.env" - name: Versions tags: version block: - name: Liberty version - shell: "{{install_base }}/{{ liberty_dir }}/bin/server version" + ansible.builtin.shell: "{{install_base }}/{{ liberty_dir }}/bin/server version" register: libertyVersionOutput - - name: libertyVersionOutput - debug: + - name: LibertyVersionOutput + ansible.builtin.debug: msg: "{{ libertyVersionOutput.stdout_lines }}" diff --git a/ansible/roles/im_install_liberty/templates/im_liberty.OS400.xml.j2 b/ansible/roles/im_install_liberty/templates/im_liberty.OS400.xml.j2 index f6ff21d96..731bf1fc4 100644 --- a/ansible/roles/im_install_liberty/templates/im_liberty.OS400.xml.j2 +++ b/ansible/roles/im_install_liberty/templates/im_liberty.OS400.xml.j2 @@ -14,10 +14,6 @@ - diff --git a/ansible/roles/im_install_liberty/templates/im_liberty.xml.j2 b/ansible/roles/im_install_liberty/templates/im_liberty.xml.j2 index 76517b81f..8e3eab60e 100644 --- a/ansible/roles/im_install_liberty/templates/im_liberty.xml.j2 +++ b/ansible/roles/im_install_liberty/templates/im_liberty.xml.j2 @@ -1,13 +1,13 @@ - + - + - + @@ -16,10 +16,6 @@ - @@ -29,7 +25,7 @@ - + diff --git a/ansible/roles/im_install_liberty/templates/server.env.j2 b/ansible/roles/im_install_liberty/templates/server.env.j2 index d47658b57..bd8ad8447 100644 --- a/ansible/roles/im_install_liberty/templates/server.env.j2 +++ b/ansible/roles/im_install_liberty/templates/server.env.j2 @@ -1,2 +1,2 @@ -WLP_OUTPUT_DIR={{ wlp_output }} -WLP_USER_DIR={{ wlp_usr_dir }} +JAVA_HOME={{ cygwin }}{{ install_base }}/{{ liberty_dir }}/java/{{ im_java_short_version }}.0 +WLP_USER_DIR={{ cygwin }}{{ wlp_usr_dir }} \ No newline at end of file diff --git a/ansible/roles/im_install_liberty/templates/server.env.os400.j2 b/ansible/roles/im_install_liberty/templates/server.env.os400.j2 new file mode 100644 index 000000000..d47658b57 --- /dev/null +++ b/ansible/roles/im_install_liberty/templates/server.env.os400.j2 @@ -0,0 +1,2 @@ +WLP_OUTPUT_DIR={{ wlp_output }} +WLP_USER_DIR={{ wlp_usr_dir }} diff --git a/ansible/roles/im_install_liberty_more/defaults/main.yml b/ansible/roles/im_install_liberty_more/defaults/main.yml new file mode 100644 index 000000000..ec9b9fdd8 --- /dev/null +++ b/ansible/roles/im_install_liberty_more/defaults/main.yml @@ -0,0 +1,10 @@ +--- +liberty_im_driver: 'cl240620240603-2001.31.linux' +liberty_daily_or_test: 'test' +shared_dir: 'IM-shared' +gsa_user: 'gsauser' +gsa_pass: 'gsapass' +ibm_user: 'external_ibmuser' +ibm_pass: 'external_ibmpass' +im_liberty_package: 'com.ibm.websphere.liberty.ND' +im_java_short_version: '17' # com.ibm.java.jdk.v17 com.ibm.java.jdk.v11, com.ibm.java.jdk.8 diff --git a/ansible/roles/im_install_liberty_more/meta/main.yml b/ansible/roles/im_install_liberty_more/meta/main.yml new file mode 100644 index 000000000..202e9c14e --- /dev/null +++ b/ansible/roles/im_install_liberty_more/meta/main.yml @@ -0,0 +1,5 @@ +--- +dependencies: + - role: load_secrets + - role: ibm_installation_manager_cic_selector + - role: liberty_defaults diff --git a/ansible/roles/im_install_liberty_more/readme.md b/ansible/roles/im_install_liberty_more/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/im_install_liberty_more/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/im_install_liberty_more/tasks/im_install_liberty_more.yml b/ansible/roles/im_install_liberty_more/tasks/im_install_liberty_more.yml new file mode 100644 index 000000000..3b2f0887a --- /dev/null +++ b/ansible/roles/im_install_liberty_more/tasks/im_install_liberty_more.yml @@ -0,0 +1,49 @@ +--- + +- name: Install + tags: install + block: + - name: Check if imcl installed as a prereq + ansible.builtin.stat: + path: "{{ install_base }}/IM/eclipse/tools/imcl" + register: isimcl + failed_when: isimcl.stat.exists == False + + - name: Copy im_liberty_more.xml template + when: ansible_system != 'OS400' + ansible.builtin.template: + src: im_liberty_more.xml.j2 + dest: "im_liberty_more.xml" + + - name: Copy OS400 im_liberty.xml template + when: ansible_system == 'OS400' + ansible.builtin.template: + src: im_liberty.OS400_more.xml.j2 + dest: "im_liberty_more.xml" + + - name: Remove previous secureStorageFile.store ( IM 1.9.x -> 1.10 java11 ) + ansible.builtin.file: + path: "{{ install_base }}/IM/secureStorageFile.store" + state: absent + + - name: Generate secureStorageFile.store + shell: "{{ install_base }}/IM/eclipse/tools/imutilsc saveCredential -url https://rtpgsa.ibm.com -userName {{ gsa_user }} -userPassword '{{ gsa_pass }}' -secureStorageFile {{ install_base }}/IM/secureStorageFile.store" + + - name: Generate external ibm secureStorageFile.store + shell: "{{ install_base }}/IM/eclipse/tools/imutilsc saveCredential -url http://www.ibm.com/software/repositorymanager -userName {{ external_ibmuser }} -userPassword '{{ external_ibmpass }}' -secureStorageFile {{ install_base }}/IM/secureStorageFile.store" + + - name: Install Liberty MoRE + shell: "time {{ install_base }}/IM/eclipse/tools/imcl input ./im_liberty_more.xml -acceptLicense -secureStorageFile {{ install_base }}/IM/secureStorageFile.store" + register: installOutput + + - name: InstallOutput + ansible.builtin.debug: + msg: "{{ installOutput.stdout_lines }}" + + - name: ListInstalledPackages + shell: "{{ install_base }}/IM/eclipse/tools/imcl listInstalledPackages -long" + register: packageOutput + + - name: IM PackageOutput + ansible.builtin.debug: + msg: "{{ packageOutput.stdout_lines }}" diff --git a/ansible/roles/im_install_liberty_more/tasks/main.yml b/ansible/roles/im_install_liberty_more/tasks/main.yml new file mode 100644 index 000000000..0d4fc146e --- /dev/null +++ b/ansible/roles/im_install_liberty_more/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Install Liberty MoRE + ansible.builtin.include_tasks: im_install_liberty_more.yml diff --git a/ansible/roles/im_install_liberty_more/templates/im_liberty.OS400_more.xml.j2 b/ansible/roles/im_install_liberty_more/templates/im_liberty.OS400_more.xml.j2 new file mode 100644 index 000000000..c3a688ac3 --- /dev/null +++ b/ansible/roles/im_install_liberty_more/templates/im_liberty.OS400_more.xml.j2 @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ansible/roles/im_install_liberty_more/templates/im_liberty_more.xml.j2 b/ansible/roles/im_install_liberty_more/templates/im_liberty_more.xml.j2 new file mode 100644 index 000000000..8e3eab60e --- /dev/null +++ b/ansible/roles/im_install_liberty_more/templates/im_liberty_more.xml.j2 @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ansible/roles/im_install_twas/tasks/im_install_twas.yml b/ansible/roles/im_install_twas/tasks/im_install_twas.yml index c77134184..be5e99792 100644 --- a/ansible/roles/im_install_twas/tasks/im_install_twas.yml +++ b/ansible/roles/im_install_twas/tasks/im_install_twas.yml @@ -1,105 +1,66 @@ --- -### "ansible_architecture": "s390x", -### "ansible_architecture": "ppc64le", -### "ansible_architecture": "x86_64", -### "ansible_architecture": "chrp", --- AIX - - name: Install tags: install block: - - name: check if imcl installed as a prereq - stat: + - name: Check if imcl installed as a prereq + ansible.builtin.stat: path: "{{ install_base }}/IM/eclipse/tools/imcl" register: isimcl failed_when: isimcl.stat.exists == False - - name: copy im_twas.xml template - template: - src: "im_twas_{{ twas_release }}.xml.j2" - dest: "im_twas.xml" - - # - name: stop any running servers - # ignore_errors: true - # shell: "{{install_base }}/{{ liberty_dir }}/bin/server stop {{ item }}" - # register: stopOutput - # failed_when: ( stopOutput.rc not in [ 0, 2, 23, 127 ] ) - # with_items: - # - "{{ wl_server }}" - # - "{{ cc_server }}" + - name: Copy im_twas.xml template + ansible.builtin.template: + src: "im_twas_{{ twas_release }}.xml.j2" + dest: "im_twas.xml" - # blindly try fuser ( linux ) - - name: blindly try fuser ( linux ) - ignore_errors: true - shell: "fuser -k {{install_base }}/{{ twas_dir }}" - register: killOutput - failed_when: ( killOutput.rc not in [ 0, 1, 2, 127 ] ) + # - name: stop any running servers + # ignore_errors: true + # shell: "{{install_base }}/{{ liberty_dir }}/bin/server stop {{ item }}" + # register: stopOutput + # failed_when: ( stopOutput.rc not in [ 0, 2, 23, 127 ] ) + # with_items: + # - "{{ wl_server }}" + # - "{{ cc_server }}" - - name: uninstall twas - shell: "{{ install_base }}/IM/eclipse/tools/imcl uninstall {{ im_twas_package[twas_release] }}" - register: uninstallOutput - failed_when: ( uninstallOutput.rc not in [ 0, 1 ] ) - - - name: uninstall twas output - debug: - msg: "{{ uninstallOutput.stdout_lines }}" + - name: Generate secureStorageFile.store + ansible.builtin.shell: "{{ cygwin }}{{ install_base }}/IM/eclipse/tools/imutilsc saveCredential -url https://rtpgsa.ibm.com -userName {{ gsa_user }} -userPassword '{{ gsa_pass }}' -secureStorageFile {{ install_base }}/IM/secureStorageFile.store" - - name: uninstall AppClient - shell: "{{ install_base }}/IM/eclipse/tools/imcl uninstall {{ im_appclient_package[twas_release] }}" - register: uninstallOutput - failed_when: ( uninstallOutput.rc not in [ 0, 1 ] ) - - - name: uninstall AppClient output - debug: - msg: "{{ uninstallOutput.stdout_lines }}" + # this command is hanging on the pok zlinux boxes for some crazy networking reason + # this hangs too: curl -Lk http://www.ibm.com/software/repositorymanager + # which works on rtp hosts + - name: generate external ibm secureStorageFile.store + shell: "{{ install_base }}/IM/eclipse/tools/imutilsc saveCredential -url http://www.ibm.com/software/repositorymanager -userName {{ external_ibmuser }} -userPassword '{{ external_ibmpass }}' -secureStorageFile {{ install_base }}/IM/secureStorageFile.store" - - name: Remove previous twas appclient dir - file: + - name: Remove previous twas dir + ansible.builtin.file: path: "{{ item }}" state: absent with_items: - - "{{ install_base }}/{{ twas_dir }}" - - "{{ install_base }}/{{ app_dir }}" - - - name: generate secureStorageFile.store - shell: "{{ install_base }}/IM/eclipse/tools/imutilsc saveCredential -url https://rtpgsa.ibm.com -userName {{ gsa_user }} -userPassword '{{ gsa_pass }}' -secureStorageFile {{ install_base }}/IM/secureStorageFile.store" + - "{{ cygwin }}{{ install_base }}/{{ twas_dir }}" - # this command is hanging on the pok zlinux boxes for some crazy networking reason - # this hangs too: curl -Lk http://www.ibm.com/software/repositorymanager - # which works on rtp hosts - # - name: generate external ibm secureStorageFile.store - # shell: "{{ install_base }}/IM/eclipse/tools/imutilsc saveCredential -url http://www.ibm.com/software/repositorymanager -userName {{ external_ibmuser }} -userPassword '{{ external_ibmpass }}' -secureStorageFile {{ install_base }}/IM/secureStorageFile.store" - - - name: install twas - shell: "{{ install_base }}/IM/eclipse/tools/imcl input ./im_twas.xml -acceptLicense -secureStorageFile {{ install_base }}/IM/secureStorageFile.store" + - name: Install tWAS + ansible.builtin.shell: "time {{ cygwin }}{{ install_base }}/IM/eclipse/tools/imcl input ./im_twas.xml -acceptLicense -secureStorageFile {{ install_base }}/IM/secureStorageFile.store" register: installOutput - - name: installOutput - debug: - msg: "{{ installOutput.stdout_lines }}" + - name: InstallOutput + ansible.builtin.debug: + msg: "{{ installOutput.stdout_lines }}" - - name: listInstalledPackages - shell: "{{ install_base }}/IM/eclipse/tools/imcl listInstalledPackages" + - name: ListInstalledPackages + ansible.builtin.shell: "{{ cygwin }}{{ install_base }}/IM/eclipse/tools/imcl listInstalledPackages -long" register: packageOutput - - name: packageOutput - debug: - msg: "{{ packageOutput.stdout_lines }}" + - name: PackageOutput + ansible.builtin.debug: + msg: "{{ packageOutput.stdout_lines }}" - name: Versions - tags: version + tags: version block: - name: tWAS version - shell: "{{install_base }}/{{ twas_dir }}/bin/versionInfo.sh" + ansible.builtin.shell: "{{ cygwin }}{{ install_base }}/{{ twas_dir }}/bin/versionInfo{{ ext }} -ifixDetail" register: twasVersionOutput - - name: twasVersionOutput - debug: - msg: "{{ twasVersionOutput.stdout_lines }}" - - - name: AppClient version - shell: "{{install_base }}/{{ app_dir }}/bin/versionInfo.sh" - register: appVersionOutput - - - name: appVersionOutput - debug: - msg: "{{ appVersionOutput.stdout_lines }}" + - name: Output twasVersionOutput + ansible.builtin.debug: + msg: "{{ twasVersionOutput.stdout_lines }}" diff --git a/ansible/roles/im_install_twas/tasks/main.yml b/ansible/roles/im_install_twas/tasks/main.yml index 50c5c4dc3..a4118718f 100644 --- a/ansible/roles/im_install_twas/tasks/main.yml +++ b/ansible/roles/im_install_twas/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: im_install_twas.yml +- name: Install tWAS + ansible.builtin.include_tasks: im_install_twas.yml diff --git a/ansible/roles/im_install_twas/templates/im_twas_WAS855.xml.j2 b/ansible/roles/im_install_twas/templates/im_twas_WAS855.xml.j2 index 4e16973d8..825ccd41b 100644 --- a/ansible/roles/im_install_twas/templates/im_twas_WAS855.xml.j2 +++ b/ansible/roles/im_install_twas/templates/im_twas_WAS855.xml.j2 @@ -1,29 +1,19 @@ - + - + - + - - - - - - - - - - diff --git a/ansible/roles/im_install_twas/templates/im_twas_WAS90.xml.j2 b/ansible/roles/im_install_twas/templates/im_twas_WAS90.xml.j2 index d7aea2c91..874f41bc8 100644 --- a/ansible/roles/im_install_twas/templates/im_twas_WAS90.xml.j2 +++ b/ansible/roles/im_install_twas/templates/im_twas_WAS90.xml.j2 @@ -1,12 +1,12 @@ - + - + @@ -15,16 +15,6 @@ - - - - - - - - - - diff --git a/ansible/roles/im_install_twas_app_client/meta/main.yml b/ansible/roles/im_install_twas_app_client/meta/main.yml new file mode 100644 index 000000000..cae48b34e --- /dev/null +++ b/ansible/roles/im_install_twas_app_client/meta/main.yml @@ -0,0 +1,5 @@ +--- +dependencies: + - role: ibm_installation_manager_cic_selector + - role: load_secrets + - role: twas_cell_defaults diff --git a/ansible/roles/im_install_twas_app_client/readme.md b/ansible/roles/im_install_twas_app_client/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/im_install_twas_app_client/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/im_install_twas_app_client/tasks/im_install_twas_app_client.yml b/ansible/roles/im_install_twas_app_client/tasks/im_install_twas_app_client.yml new file mode 100644 index 000000000..896862ade --- /dev/null +++ b/ansible/roles/im_install_twas_app_client/tasks/im_install_twas_app_client.yml @@ -0,0 +1,57 @@ +--- +- name: Install + tags: install + block: + - name: Check if imcl installed as a prereq + ansible.builtin.stat: + path: "{{ install_base }}/IM/eclipse/tools/imcl" + register: isimcl + failed_when: isimcl.stat.exists == False + + - name: Copy im_appclient.xml template + ansible.builtin.template: + src: "im_appclient_{{ twas_release }}.xml.j2" + dest: "im_appclient.xml" + + - name: Generate secureStorageFile.store + ansible.builtin.shell: "{{ cygwin }}{{ install_base }}/IM/eclipse/tools/imutilsc saveCredential -url https://rtpgsa.ibm.com -userName {{ gsa_user }} -userPassword '{{ gsa_pass }}' -secureStorageFile {{ install_base }}/IM/secureStorageFile.store" + + # this command is hanging on the pok zlinux boxes for some crazy networking reason + # this hangs too: curl -Lk http://www.ibm.com/software/repositorymanager + # which works on rtp hosts + # - name: generate external ibm secureStorageFile.store + # shell: "{{ install_base }}/IM/eclipse/tools/imutilsc saveCredential -url http://www.ibm.com/software/repositorymanager -userName {{ external_ibmuser }} -userPassword '{{ external_ibmpass }}' -secureStorageFile {{ install_base }}/IM/secureStorageFile.store" + + - name: Remove previous appclient dir + ansible.builtin.file: + path: "{{ item }}" + state: absent + with_items: + - "{{ cygwin }}{{ install_base }}/{{ app_dir }}" + + - name: Install AppClient + ansible.builtin.shell: "time {{ cygwin }}{{ install_base }}/IM/eclipse/tools/imcl input ./im_appclient.xml -acceptLicense -secureStorageFile {{ install_base }}/IM/secureStorageFile.store" + register: installOutput + + - name: InstallOutput + ansible.builtin.debug: + msg: "{{ installOutput.stdout_lines }}" + + - name: ListInstalledPackages + ansible.builtin.shell: "{{ cygwin }}{{ install_base }}/IM/eclipse/tools/imcl listInstalledPackages -long" + register: packageOutput + + - name: PackageOutput + ansible.builtin.debug: + msg: "{{ packageOutput.stdout_lines }}" + +- name: Versions + tags: version + block: + - name: AppClient version + ansible.builtin.shell: "{{ cygwin }}{{ install_base }}/{{ app_dir }}/bin/versionInfo{{ ext }} -ifixDetail" + register: appVersionOutput + + - name: Output appVersionOutput + ansible.builtin.debug: + msg: "{{ appVersionOutput.stdout_lines }}" diff --git a/ansible/roles/im_install_twas_app_client/tasks/main.yml b/ansible/roles/im_install_twas_app_client/tasks/main.yml new file mode 100644 index 000000000..b801e15c3 --- /dev/null +++ b/ansible/roles/im_install_twas_app_client/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Install tWAS AppClient + ansible.builtin.include_tasks: im_install_twas_app_client.yml diff --git a/ansible/roles/im_update_twas/templates/im_twas_WAS855.xml.j2 b/ansible/roles/im_install_twas_app_client/templates/im_appclient_WAS855.xml.j2 similarity index 64% rename from ansible/roles/im_update_twas/templates/im_twas_WAS855.xml.j2 rename to ansible/roles/im_install_twas_app_client/templates/im_appclient_WAS855.xml.j2 index 4e16973d8..11e97d8e3 100644 --- a/ansible/roles/im_update_twas/templates/im_twas_WAS855.xml.j2 +++ b/ansible/roles/im_install_twas_app_client/templates/im_appclient_WAS855.xml.j2 @@ -1,20 +1,12 @@ - + - - - - - - - - - + diff --git a/ansible/roles/im_rollback_twas/templates/im_twas_WAS90.xml.j2 b/ansible/roles/im_install_twas_app_client/templates/im_appclient_WAS90.xml.j2 similarity index 63% rename from ansible/roles/im_rollback_twas/templates/im_twas_WAS90.xml.j2 rename to ansible/roles/im_install_twas_app_client/templates/im_appclient_WAS90.xml.j2 index d7aea2c91..43d5fdca1 100644 --- a/ansible/roles/im_rollback_twas/templates/im_twas_WAS90.xml.j2 +++ b/ansible/roles/im_install_twas_app_client/templates/im_appclient_WAS90.xml.j2 @@ -1,21 +1,12 @@ - + - - - - - - - - - - + diff --git a/ansible/roles/im_install_twas_more/meta/main.yml b/ansible/roles/im_install_twas_more/meta/main.yml new file mode 100644 index 000000000..cae48b34e --- /dev/null +++ b/ansible/roles/im_install_twas_more/meta/main.yml @@ -0,0 +1,5 @@ +--- +dependencies: + - role: ibm_installation_manager_cic_selector + - role: load_secrets + - role: twas_cell_defaults diff --git a/ansible/roles/im_install_twas_more/readme.md b/ansible/roles/im_install_twas_more/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/im_install_twas_more/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/im_install_twas_more/tasks/im_install_twas_more.yml b/ansible/roles/im_install_twas_more/tasks/im_install_twas_more.yml new file mode 100644 index 000000000..c34365c28 --- /dev/null +++ b/ansible/roles/im_install_twas_more/tasks/im_install_twas_more.yml @@ -0,0 +1,60 @@ +--- +- name: Install MoRe + tags: install + block: + - name: Check if imcl installed as a prereq + ansible.builtin.stat: + path: "{{ install_base }}/IM/eclipse/tools/imcl" + register: isimcl + failed_when: isimcl.stat.exists == False + + - name: Copy im_twas.xml template + ansible.builtin.template: + src: "im_twas_more_{{ twas_release }}.xml.j2" + dest: "im_twas_more.xml" + mode: '0755' + + # - name: stop any running servers + # ignore_errors: true + # shell: "{{install_base }}/{{ liberty_dir }}/bin/server stop {{ item }}" + # register: stopOutput + # failed_when: ( stopOutput.rc not in [ 0, 2, 23, 127 ] ) + # with_items: + # - "{{ wl_server }}" + # - "{{ cc_server }}" + + - name: Generate secureStorageFile.store + ansible.builtin.shell: "{{ cygwin }}{{ install_base }}/IM/eclipse/tools/imutilsc saveCredential -url https://rtpgsa.ibm.com -userName {{ gsa_user }} -userPassword '{{ gsa_pass }}' -secureStorageFile {{ install_base }}/IM/secureStorageFile.store" + + # this command is hanging on the pok zlinux boxes for some crazy networking reason + # this hangs too: curl -Lk http://www.ibm.com/software/repositorymanager + # which works on rtp hosts + - name: generate external ibm secureStorageFile.store + shell: "{{ cygwin }}{{ install_base }}/IM/eclipse/tools/imutilsc saveCredential -url http://www.ibm.com/software/repositorymanager -userName {{ external_ibmuser }} -userPassword '{{ external_ibmpass }}' -secureStorageFile {{ install_base }}/IM/secureStorageFile.store" + + - name: Install tWAS MoRE + ansible.builtin.shell: "time {{ cygwin }}{{ install_base }}/IM/eclipse/tools/imcl input ./im_twas_more.xml -acceptLicense -secureStorageFile {{ install_base }}/IM/secureStorageFile.store" + register: installOutput + + - name: InstallOutput + ansible.builtin.debug: + msg: "{{ installOutput.stdout_lines }}" + + - name: ListInstalledPackages + ansible.builtin.shell: "{{ cygwin }}{{ install_base }}/IM/eclipse/tools/imcl listInstalledPackages -long" + register: packageOutput + + - name: PackageOutput + ansible.builtin.debug: + msg: "{{ packageOutput.stdout_lines }}" + +- name: Versions + tags: version + block: + - name: tWAS version + ansible.builtin.shell: "{{ cygwin }}{{ install_base }}/{{ twas_dir }}/bin/versionInfo{{ ext }} -ifixDetail" + register: twasVersionOutput + + - name: Output twasVersionOutput + ansible.builtin.debug: + msg: "{{ twasVersionOutput.stdout_lines }}" diff --git a/ansible/roles/im_install_twas_more/tasks/main.yml b/ansible/roles/im_install_twas_more/tasks/main.yml new file mode 100644 index 000000000..ff15cc7ee --- /dev/null +++ b/ansible/roles/im_install_twas_more/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Install tWAS MoRE + ansible.builtin.include_tasks: im_install_twas_more.yml diff --git a/ansible/roles/im_install_twas_more/templates/im_twas_more_WAS90.xml.j2 b/ansible/roles/im_install_twas_more/templates/im_twas_more_WAS90.xml.j2 new file mode 100644 index 000000000..c285b0ec1 --- /dev/null +++ b/ansible/roles/im_install_twas_more/templates/im_twas_more_WAS90.xml.j2 @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/ansible/roles/im_rollback_appclient/meta/main.yml b/ansible/roles/im_rollback_appclient/meta/main.yml new file mode 100644 index 000000000..83555b652 --- /dev/null +++ b/ansible/roles/im_rollback_appclient/meta/main.yml @@ -0,0 +1,4 @@ +--- +dependencies: + - role: twas_cell_defaults + - role: http_defaults diff --git a/ansible/roles/im_rollback_appclient/readme.md b/ansible/roles/im_rollback_appclient/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/im_rollback_appclient/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/im_rollback_appclient/tasks/im_rollback_appclient.yml b/ansible/roles/im_rollback_appclient/tasks/im_rollback_appclient.yml new file mode 100644 index 000000000..ec74487fd --- /dev/null +++ b/ansible/roles/im_rollback_appclient/tasks/im_rollback_appclient.yml @@ -0,0 +1,15 @@ +--- +- name: Find AppClient Rollback version + ansible.builtin.include_role: + name: im_rollback_find_version + vars: + was_product_dir: "{{ install_base }}/{{ app_dir }}" + im_package_id: "{{ im_appclient_package[twas_release] }}" + +- name: Rollback AppClient + ansible.builtin.include_role: + name: im_rollback_was_product + vars: + was_product_dir: "{{ install_base }}/{{ app_dir }}" + im_package_id: "{{ im_appclient_package[twas_release] }}" + when: rollback_version is defined diff --git a/ansible/roles/im_rollback_appclient/tasks/main.yml b/ansible/roles/im_rollback_appclient/tasks/main.yml new file mode 100644 index 000000000..d57b32993 --- /dev/null +++ b/ansible/roles/im_rollback_appclient/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Im_rollback_appclient + ansible.builtin.include_tasks: im_rollback_appclient.yml diff --git a/ansible/roles/im_rollback_appclient90_jdk/meta/main.yml b/ansible/roles/im_rollback_appclient90_jdk/meta/main.yml new file mode 100644 index 000000000..83555b652 --- /dev/null +++ b/ansible/roles/im_rollback_appclient90_jdk/meta/main.yml @@ -0,0 +1,4 @@ +--- +dependencies: + - role: twas_cell_defaults + - role: http_defaults diff --git a/ansible/roles/im_rollback_appclient90_jdk/readme.md b/ansible/roles/im_rollback_appclient90_jdk/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/im_rollback_appclient90_jdk/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/im_rollback_appclient90_jdk/tasks/im_rollback_appclient90_jdk.yml b/ansible/roles/im_rollback_appclient90_jdk/tasks/im_rollback_appclient90_jdk.yml new file mode 100644 index 000000000..5dd966653 --- /dev/null +++ b/ansible/roles/im_rollback_appclient90_jdk/tasks/im_rollback_appclient90_jdk.yml @@ -0,0 +1,18 @@ +--- +- name: Find tWAS WAS90 JDK Rollback version + block: + - name: Find tWAS WAS90 JDK Rollback version + ansible.builtin.include_role: + name: im_rollback_find_version + vars: + was_product_dir: "{{ install_base }}/{{ app_dir }}" + im_package_id: "{{ im_twas_java_package }}" + + - name: Rollback tWAS WAS90 JDK + ansible.builtin.include_role: + name: im_rollback_was_product + vars: + was_product_dir: "{{ install_base }}/{{ app_dir }}" + im_package_id: "{{ im_twas_java_package }}" + when: rollback_version is defined + when: twas_release == 'WAS90' \ No newline at end of file diff --git a/ansible/roles/im_rollback_appclient90_jdk/tasks/main.yml b/ansible/roles/im_rollback_appclient90_jdk/tasks/main.yml new file mode 100644 index 000000000..a9c4d8962 --- /dev/null +++ b/ansible/roles/im_rollback_appclient90_jdk/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Im_rollback_appclient90_jdk + ansible.builtin.include_tasks: im_rollback_appclient90_jdk.yml diff --git a/ansible/roles/im_rollback_find_version/meta/main.yml b/ansible/roles/im_rollback_find_version/meta/main.yml new file mode 100644 index 000000000..83555b652 --- /dev/null +++ b/ansible/roles/im_rollback_find_version/meta/main.yml @@ -0,0 +1,4 @@ +--- +dependencies: + - role: twas_cell_defaults + - role: http_defaults diff --git a/ansible/roles/im_rollback_find_version/readme.md b/ansible/roles/im_rollback_find_version/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/im_rollback_find_version/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/im_rollback_find_version/tasks/im_rollback_find_version.yml b/ansible/roles/im_rollback_find_version/tasks/im_rollback_find_version.yml new file mode 100644 index 000000000..ba9cf2e4e --- /dev/null +++ b/ansible/roles/im_rollback_find_version/tasks/im_rollback_find_version.yml @@ -0,0 +1,39 @@ +--- +- name: Find Rollback WebSphere Product Version + tags: rollback + block: + - name: Check if imcl installed as a prereq + ansible.builtin.stat: + path: "{{ install_base }}/IM/eclipse/tools/imcl" + register: isimcl + failed_when: isimcl.stat.exists == False + + # examples of output + # com.ibm.cic.agent_1.9.2009.20240621_1105 : + # com.ibm.java.jdk.v8_8.0.8025.20240408_0724 : 8.0.8020.20240116_0839,8.0.8015.20231031_0036 + # com.ibm.websphere.ND.v90_9.0.5020.20240605_1405 : 9.0.5019.20240304_1205,9.0.5018.20231113_1345 + # com.ibm.java.jdk.v8_8.0.8020.20240116_0839 : 8.0.8015.20231031_0036 + # com.ibm.websphere.APPCLIENT.v90_9.0.5018.20231113_1345 : + # if there is more than 1 rollback, pick the most recent + + - name: Find Rollback WebSphere Product Version + ansible.builtin.shell: + "{{ install_base }}/IM/eclipse/tools/imcl listInstalledPackages -rollbackVersions -installationDirectory {{ cygwin }}{{ was_product_dir }} | grep {{ im_package_id }}|awk -F ' : ' '{print $2}'|awk -F ',' '{print $1}'" + register: rollbackOutput + failed_when: ( rollbackOutput.rc not in [ 0 ] ) + changed_when: false + + - name: Find Rollback WebSphere Product Version output + ansible.builtin.debug: + msg: "{{ rollbackOutput.stdout_lines }}" + + # if there is no rollback version don't set the rollback_version it will be not defined + - name: Set fact rollback version + ansible.builtin.set_fact: + rollback_version: "{{ im_package_id }}_{{ rollbackOutput.stdout }}" + when: rollbackOutput.stdout | length > 0 + + - name: Print rollback version if its valid + ansible.builtin.debug: + msg: "{{ rollback_version }}" + when: rollback_version is defined diff --git a/ansible/roles/im_rollback_find_version/tasks/main.yml b/ansible/roles/im_rollback_find_version/tasks/main.yml new file mode 100644 index 000000000..4b0f3a894 --- /dev/null +++ b/ansible/roles/im_rollback_find_version/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Im_rollback_find_version + ansible.builtin.include_tasks: im_rollback_find_version.yml diff --git a/ansible/roles/im_rollback_http/meta/main.yml b/ansible/roles/im_rollback_http/meta/main.yml new file mode 100644 index 000000000..83555b652 --- /dev/null +++ b/ansible/roles/im_rollback_http/meta/main.yml @@ -0,0 +1,4 @@ +--- +dependencies: + - role: twas_cell_defaults + - role: http_defaults diff --git a/ansible/roles/im_rollback_http/readme.md b/ansible/roles/im_rollback_http/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/im_rollback_http/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/im_rollback_http/tasks/im_rollback_http.yml b/ansible/roles/im_rollback_http/tasks/im_rollback_http.yml new file mode 100644 index 000000000..74262bb29 --- /dev/null +++ b/ansible/roles/im_rollback_http/tasks/im_rollback_http.yml @@ -0,0 +1,90 @@ +--- +- name: Find HTTP Rollback version + ansible.builtin.include_role: + name: im_rollback_find_version + vars: + was_product_dir: "{{ install_ihs_base }}/{{ http_dir }}" + im_package_id: "{{ im_http_package[twas_release] }}" + +- name: Rollback HTTP + ansible.builtin.include_role: + name: im_rollback_was_product + vars: + was_product_dir: "{{ install_ihs_base }}/{{ http_dir }}" + im_package_id: "{{ im_http_package[twas_release] }}" + when: rollback_version is defined + +- name: Find HTTP Java Rollback version + ansible.builtin.include_role: + name: im_rollback_find_version + vars: + was_product_dir: "{{ install_ihs_base }}/{{ http_dir }}" + im_package_id: "{{ im_twas_java_package }}" + +- name: Rollback HTTP Java + ansible.builtin.include_role: + name: im_rollback_was_product + vars: + was_product_dir: "{{ install_ihs_base }}/{{ http_dir }}" + im_package_id: "{{ im_twas_java_package }}" + when: rollback_version is defined + +- name: Find Plugin Rollback version + ansible.builtin.include_role: + name: im_rollback_find_version + vars: + was_product_dir: "{{ install_ihs_base }}/{{ plugin_dir }}" + im_package_id: "{{ im_plugin_package[twas_release] }}" + +- name: Rollback Plugin + ansible.builtin.include_role: + name: im_rollback_was_product + vars: + was_product_dir: "{{ install_ihs_base }}/{{ plugin_dir }}" + im_package_id: "{{ im_plugin_package[twas_release] }}" + when: rollback_version is defined + +- name: Find Plugin Java Rollback version + ansible.builtin.include_role: + name: im_rollback_find_version + vars: + was_product_dir: "{{ install_ihs_base }}/{{ plugin_dir }}" + im_package_id: "{{ im_twas_java_package }}" + +- name: Rollback Plugin Java + ansible.builtin.include_role: + name: im_rollback_was_product + vars: + was_product_dir: "{{ install_ihs_base }}/{{ plugin_dir }}" + im_package_id: "{{ im_twas_java_package }}" + when: rollback_version is defined + +- name: Find WCT Rollback version + ansible.builtin.include_role: + name: im_rollback_find_version + vars: + was_product_dir: "{{ install_ihs_base }}/{{ wct_dir }}" + im_package_id: "{{ im_wct_package[twas_release] }}" + +- name: Rollback WCT + ansible.builtin.include_role: + name: im_rollback_was_product + vars: + was_product_dir: "{{ install_ihs_base }}/{{ wct_dir }}" + im_package_id: "{{ im_wct_package[twas_release] }}" + when: rollback_version is defined + +- name: Find WCT Java Rollback version + ansible.builtin.include_role: + name: im_rollback_find_version + vars: + was_product_dir: "{{ install_ihs_base }}/{{ wct_dir }}" + im_package_id: "{{ im_twas_java_package }}" + +- name: Rollback WCT Java + ansible.builtin.include_role: + name: im_rollback_was_product + vars: + was_product_dir: "{{ install_ihs_base }}/{{ wct_dir }}" + im_package_id: "{{ im_twas_java_package }}" + when: rollback_version is defined \ No newline at end of file diff --git a/ansible/roles/im_rollback_http/tasks/main.yml b/ansible/roles/im_rollback_http/tasks/main.yml new file mode 100644 index 000000000..104211e45 --- /dev/null +++ b/ansible/roles/im_rollback_http/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Im_rollback_http + ansible.builtin.include_tasks: im_rollback_http.yml diff --git a/ansible/roles/im_rollback_liberty/meta/main.yml b/ansible/roles/im_rollback_liberty/meta/main.yml new file mode 100644 index 000000000..285b3d3fa --- /dev/null +++ b/ansible/roles/im_rollback_liberty/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: liberty_defaults diff --git a/ansible/roles/im_rollback_liberty/readme.md b/ansible/roles/im_rollback_liberty/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/im_rollback_liberty/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/im_rollback_liberty/tasks/im_rollback_liberty.yml b/ansible/roles/im_rollback_liberty/tasks/im_rollback_liberty.yml new file mode 100644 index 000000000..1de2e2d2c --- /dev/null +++ b/ansible/roles/im_rollback_liberty/tasks/im_rollback_liberty.yml @@ -0,0 +1,15 @@ +--- +- name: Find Liberty Rollback version + ansible.builtin.include_role: + name: im_rollback_find_version + vars: + was_product_dir: "{{ install_base }}/{{ liberty_dir }}" + im_package_id: "{{ im_liberty_package }}" + +- name: Rollback Liberty + ansible.builtin.include_role: + name: im_rollback_was_product + vars: + was_product_dir: "{{ install_base }}/{{ liberty_dir }}" + im_package_id: "{{ im_liberty_package }}" + when: rollback_version is defined diff --git a/ansible/roles/im_rollback_liberty/tasks/main.yml b/ansible/roles/im_rollback_liberty/tasks/main.yml new file mode 100644 index 000000000..8e419fe6b --- /dev/null +++ b/ansible/roles/im_rollback_liberty/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Im_rollback_liberty + ansible.builtin.include_tasks: im_rollback_liberty.yml diff --git a/ansible/roles/im_rollback_liberty_jdk/meta/main.yml b/ansible/roles/im_rollback_liberty_jdk/meta/main.yml new file mode 100644 index 000000000..285b3d3fa --- /dev/null +++ b/ansible/roles/im_rollback_liberty_jdk/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: liberty_defaults diff --git a/ansible/roles/im_rollback_liberty_jdk/readme.md b/ansible/roles/im_rollback_liberty_jdk/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/im_rollback_liberty_jdk/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/im_rollback_liberty_jdk/tasks/im_rollback_liberty_jdk.yml b/ansible/roles/im_rollback_liberty_jdk/tasks/im_rollback_liberty_jdk.yml new file mode 100644 index 000000000..5abdf7a93 --- /dev/null +++ b/ansible/roles/im_rollback_liberty_jdk/tasks/im_rollback_liberty_jdk.yml @@ -0,0 +1,15 @@ +--- +- name: Find Liberty jdk Rollback version + ansible.builtin.include_role: + name: im_rollback_find_version + vars: + was_product_dir: "{{ install_base }}/{{ liberty_dir }}" + im_package_id: "{{ im_liberty_jdk_package }}{{ im_java_short_version }}" + +- name: Rollback Liberty jdk + ansible.builtin.include_role: + name: im_rollback_was_product + vars: + was_product_dir: "{{ install_base }}/{{ liberty_dir }}" + im_package_id: "{{ im_liberty_jdk_package }}{{ im_java_short_version }}" + when: rollback_version is defined diff --git a/ansible/roles/im_rollback_liberty_jdk/tasks/main.yml b/ansible/roles/im_rollback_liberty_jdk/tasks/main.yml new file mode 100644 index 000000000..42cc95705 --- /dev/null +++ b/ansible/roles/im_rollback_liberty_jdk/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Im_rollback_liberty jdk + ansible.builtin.include_tasks: im_rollback_liberty_jdk.yml diff --git a/ansible/roles/im_rollback_twas/meta/main.yml b/ansible/roles/im_rollback_twas/meta/main.yml index 2f6be2969..83555b652 100644 --- a/ansible/roles/im_rollback_twas/meta/main.yml +++ b/ansible/roles/im_rollback_twas/meta/main.yml @@ -1,4 +1,4 @@ --- dependencies: - - role: load_secrets - role: twas_cell_defaults + - role: http_defaults diff --git a/ansible/roles/im_rollback_twas/tasks/im_rollback_twas.yml b/ansible/roles/im_rollback_twas/tasks/im_rollback_twas.yml index 5fecb6ba6..27ede274b 100644 --- a/ansible/roles/im_rollback_twas/tasks/im_rollback_twas.yml +++ b/ansible/roles/im_rollback_twas/tasks/im_rollback_twas.yml @@ -1,18 +1,15 @@ --- -- name: rollback tWAS - tags: rollback - block: - - name: check if imcl installed as a prereq - stat: - path: "{{ install_base }}/IM/eclipse/tools/imcl" - register: isimcl - failed_when: isimcl.stat.exists == False +- name: Find tWAS Rollback version + ansible.builtin.include_role: + name: im_rollback_find_version + vars: + was_product_dir: "{{ install_base }}/{{ twas_dir }}" + im_package_id: "{{ im_twas_package[twas_release] }}" - - name: rollback twas - shell: "{{ install_base }}/IM/eclipse/tools/imcl rollback {{ twas_rollback_version }}" - register: rollbackOutput - failed_when: ( rollbackOutput.rc not in [ 0, 1 ] ) - - - name: rollback twas output - debug: - msg: "{{ rollbackOutput.stdout_lines }}" +- name: Rollback tWAS + ansible.builtin.include_role: + name: im_rollback_was_product + vars: + was_product_dir: "{{ install_base }}/{{ twas_dir }}" + im_package_id: "{{ im_twas_package[twas_release] }}" + when: rollback_version is defined diff --git a/ansible/roles/im_rollback_twas/tasks/main.yml b/ansible/roles/im_rollback_twas/tasks/main.yml index 81169223f..0674b5a82 100644 --- a/ansible/roles/im_rollback_twas/tasks/main.yml +++ b/ansible/roles/im_rollback_twas/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: im_rollback_twas.yml +- name: Im_rollback_twas + ansible.builtin.include_tasks: im_rollback_twas.yml diff --git a/ansible/roles/im_rollback_twas/templates/im_twas_WAS855.xml.j2 b/ansible/roles/im_rollback_twas/templates/im_twas_WAS855.xml.j2 deleted file mode 100644 index 4e16973d8..000000000 --- a/ansible/roles/im_rollback_twas/templates/im_twas_WAS855.xml.j2 +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ansible/roles/im_rollback_twas90_jdk/meta/main.yml b/ansible/roles/im_rollback_twas90_jdk/meta/main.yml new file mode 100644 index 000000000..83555b652 --- /dev/null +++ b/ansible/roles/im_rollback_twas90_jdk/meta/main.yml @@ -0,0 +1,4 @@ +--- +dependencies: + - role: twas_cell_defaults + - role: http_defaults diff --git a/ansible/roles/im_rollback_twas90_jdk/readme.md b/ansible/roles/im_rollback_twas90_jdk/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/im_rollback_twas90_jdk/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/im_rollback_twas90_jdk/tasks/im_rollback_twas90_jdk.yml b/ansible/roles/im_rollback_twas90_jdk/tasks/im_rollback_twas90_jdk.yml new file mode 100644 index 000000000..32d4e4362 --- /dev/null +++ b/ansible/roles/im_rollback_twas90_jdk/tasks/im_rollback_twas90_jdk.yml @@ -0,0 +1,18 @@ +--- +- name: Find tWAS WAS90 JDK Rollback version + block: + - name: Find tWAS WAS90 JDK Rollback version + ansible.builtin.include_role: + name: im_rollback_find_version + vars: + was_product_dir: "{{ install_base }}/{{ twas_dir }}" + im_package_id: "{{ im_twas_java_package }}" + + - name: Rollback tWAS WAS90 JDK + ansible.builtin.include_role: + name: im_rollback_was_product + vars: + was_product_dir: "{{ install_base }}/{{ twas_dir }}" + im_package_id: "{{ im_twas_java_package }}" + when: rollback_version is defined + when: twas_release == 'WAS90' \ No newline at end of file diff --git a/ansible/roles/im_rollback_twas90_jdk/tasks/main.yml b/ansible/roles/im_rollback_twas90_jdk/tasks/main.yml new file mode 100644 index 000000000..1f22d63c2 --- /dev/null +++ b/ansible/roles/im_rollback_twas90_jdk/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Im_rollback_twas90_jdk + ansible.builtin.include_tasks: im_rollback_twas90_jdk.yml diff --git a/ansible/roles/im_rollback_twas_more/meta/main.yml b/ansible/roles/im_rollback_twas_more/meta/main.yml new file mode 100644 index 000000000..83555b652 --- /dev/null +++ b/ansible/roles/im_rollback_twas_more/meta/main.yml @@ -0,0 +1,4 @@ +--- +dependencies: + - role: twas_cell_defaults + - role: http_defaults diff --git a/ansible/roles/im_rollback_twas_more/readme.md b/ansible/roles/im_rollback_twas_more/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/im_rollback_twas_more/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/im_rollback_twas_more/tasks/im_rollback_twas_more.yml b/ansible/roles/im_rollback_twas_more/tasks/im_rollback_twas_more.yml new file mode 100644 index 000000000..939915c12 --- /dev/null +++ b/ansible/roles/im_rollback_twas_more/tasks/im_rollback_twas_more.yml @@ -0,0 +1,15 @@ +--- +- name: Find tWAS MoRE Rollback version + ansible.builtin.include_role: + name: im_rollback_find_version + vars: + was_product_dir: "{{ install_base }}/{{ twas_dir }}" + im_package_id: "{{ im_twas_more_package[twas_more_release] }}" + +- name: Rollback tWAS MoRE + ansible.builtin.include_role: + name: im_rollback_was_product + vars: + was_product_dir: "{{ install_base }}/{{ twas_dir }}" + im_package_id: "{{ im_twas_more_package[twas_more_release] }}" + when: rollback_version is defined diff --git a/ansible/roles/im_rollback_twas_more/tasks/main.yml b/ansible/roles/im_rollback_twas_more/tasks/main.yml new file mode 100644 index 000000000..92548abb1 --- /dev/null +++ b/ansible/roles/im_rollback_twas_more/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Im_rollback_twas_more + ansible.builtin.include_tasks: im_rollback_twas_more.yml diff --git a/ansible/roles/im_rollback_was_product/meta/main.yml b/ansible/roles/im_rollback_was_product/meta/main.yml new file mode 100644 index 000000000..83555b652 --- /dev/null +++ b/ansible/roles/im_rollback_was_product/meta/main.yml @@ -0,0 +1,4 @@ +--- +dependencies: + - role: twas_cell_defaults + - role: http_defaults diff --git a/ansible/roles/im_rollback_was_product/readme.md b/ansible/roles/im_rollback_was_product/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/im_rollback_was_product/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/im_rollback_was_product/tasks/im_rollback_was_product.yml b/ansible/roles/im_rollback_was_product/tasks/im_rollback_was_product.yml new file mode 100644 index 000000000..3c0421710 --- /dev/null +++ b/ansible/roles/im_rollback_was_product/tasks/im_rollback_was_product.yml @@ -0,0 +1,23 @@ +--- +- name: Rollback WebSphere Product + tags: rollback + block: + - name: Check if imcl installed as a prereq + ansible.builtin.stat: + path: "{{ install_base }}/IM/eclipse/tools/imcl" + register: isimcl + failed_when: isimcl.stat.exists == False + + - name: Rollback WebSphere Product command + ansible.builtin.debug: + msg: "{{ install_base }}/IM/eclipse/tools/imcl rollback {{ rollback_version }} -installationDirectory {{ cygwin }}{{ was_product_dir }}" + + - name: Rollback WebSphere Product + ansible.builtin.command: + cmd: "{{ install_base }}/IM/eclipse/tools/imcl rollback {{ rollback_version }} -installationDirectory {{ cygwin }}{{ was_product_dir }}" + register: rollbackOutput + failed_when: ( rollbackOutput.rc not in [ 0, 1 ] ) + + - name: Rollback WebSphere Product output + ansible.builtin.debug: + msg: "{{ rollbackOutput.stdout_lines }}" diff --git a/ansible/roles/im_rollback_was_product/tasks/main.yml b/ansible/roles/im_rollback_was_product/tasks/main.yml new file mode 100644 index 000000000..0e7cb1a8e --- /dev/null +++ b/ansible/roles/im_rollback_was_product/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Im_rollback_was_product + ansible.builtin.include_tasks: im_rollback_was_product.yml diff --git a/ansible/roles/im_update_twas/tasks/im_update_twas.yml b/ansible/roles/im_update_twas/tasks/im_update_twas.yml deleted file mode 100644 index 39005559a..000000000 --- a/ansible/roles/im_update_twas/tasks/im_update_twas.yml +++ /dev/null @@ -1,55 +0,0 @@ ---- -### "ansible_architecture": "s390x", -### "ansible_architecture": "ppc64le", -### "ansible_architecture": "x86_64", -### "ansible_architecture": "chrp", --- AIX - -- name: Update tWAS - tags: update - block: - - name: check if imcl installed as a prereq - stat: - path: "{{ install_base }}/IM/eclipse/tools/imcl" - register: isimcl - failed_when: isimcl.stat.exists == False - - - name: copy im_twas.xml template - template: - src: "im_twas_{{ twas_release }}.xml.j2" - dest: "im_twas.xml" - - - name: generate secureStorageFile.store - shell: "{{ install_base }}/IM/eclipse/tools/imutilsc saveCredential -url https://rtpgsa.ibm.com -userName {{ gsa_user }} -userPassword '{{ gsa_pass }}' -secureStorageFile {{ install_base }}/IM/secureStorageFile.store" - - # this command is hanging on the pok zlinux boxes for some crazy networking reason - # this hangs too: curl -Lk http://www.ibm.com/software/repositorymanager - # which works on rtp hosts - # - name: generate external ibm secureStorageFile.store - # shell: "{{ install_base }}/IM/eclipse/tools/imutilsc saveCredential -url http://www.ibm.com/software/repositorymanager -userName {{ external_ibmuser }} -userPassword '{{ external_ibmpass }}' -secureStorageFile {{ install_base }}/IM/secureStorageFile.store" - - - name: update twas - shell: "{{ install_base }}/IM/eclipse/tools/imcl input ./im_twas.xml -acceptLicense -secureStorageFile {{ install_base }}/IM/secureStorageFile.store" - register: updateOutput - - - name: updateOutput - debug: - msg: "{{ updateOutput.stdout_lines }}" - - - name: listInstalledPackages - shell: "{{ install_base }}/IM/eclipse/tools/imcl listInstalledPackages" - register: packageOutput - - - name: packageOutput - debug: - msg: "{{ packageOutput.stdout_lines }}" - -- name: Versions - tags: version - block: - - name: tWAS version - shell: "{{install_base }}/{{ twas_dir }}/bin/versionInfo.sh" - register: twasVersionOutput - - - name: twasVersionOutput - debug: - msg: "{{ twasVersionOutput.stdout_lines }}" diff --git a/ansible/roles/im_update_twas/tasks/main.yml b/ansible/roles/im_update_twas/tasks/main.yml deleted file mode 100644 index 1bfeca5ba..000000000 --- a/ansible/roles/im_update_twas/tasks/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- include_tasks: im_update_twas.yml diff --git a/ansible/roles/im_upgrade_appclient/.DS_Store b/ansible/roles/im_upgrade_appclient/.DS_Store new file mode 100644 index 000000000..6c1305500 Binary files /dev/null and b/ansible/roles/im_upgrade_appclient/.DS_Store differ diff --git a/ansible/roles/im_upgrade_appclient/meta/main.yml b/ansible/roles/im_upgrade_appclient/meta/main.yml new file mode 100644 index 000000000..3f5693422 --- /dev/null +++ b/ansible/roles/im_upgrade_appclient/meta/main.yml @@ -0,0 +1,4 @@ +--- +dependencies: + - role: ibm_installation_manager_cic_selector + - role: twas_cell_defaults diff --git a/ansible/roles/im_upgrade_appclient/readme.md b/ansible/roles/im_upgrade_appclient/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/im_upgrade_appclient/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/im_upgrade_appclient/tasks/im_upgrade_appclient.yml b/ansible/roles/im_upgrade_appclient/tasks/im_upgrade_appclient.yml new file mode 100644 index 000000000..2d2a5f8fb --- /dev/null +++ b/ansible/roles/im_upgrade_appclient/tasks/im_upgrade_appclient.yml @@ -0,0 +1,45 @@ +--- +- name: Upgrade Appclient using simple command + tags: upgrade + block: + - name: Check if imcl installed as a prereq + ansible.builtin.stat: + path: "{{ install_base }}/IM/eclipse/tools/imcl" + register: isimcl + failed_when: isimcl.stat.exists == False + + - name: Remove previous secureStorageFile.store ( IM 1.9.x -> 1.10 java11 ) + ansible.builtin.file: + path: "{{ install_base }}/IM/secureStorageFile.store" + state: absent + + - name: Generate secureStorageFile.store + ansible.builtin.shell: "{{ install_base }}/IM/eclipse/tools/imutilsc saveCredential -url https://rtpgsa.ibm.com -userName {{ gsa_user }} -userPassword '{{ gsa_pass }}' -secureStorageFile {{ install_base }}/IM/secureStorageFile.store" + + - name: Upgrade WAS product + ansible.builtin.shell: "time {{ install_base }}/IM/eclipse/tools/imcl updateAll -installationDirectory {{ install_base }}/{{ app_dir }} -acceptLicense -secureStorageFile {{ install_base }}/IM/secureStorageFile.store -repositories 'https://rtpgsa.ibm.com/gsa/rtpgsa/projects/w/was.build/botp/{{ twas_release }}.IM/{{ twas_daily_or_test }}/{{ twas_im_driver }}.linux/linux/zipper/repository'" + register: upgradeOutput + + - name: UpgradeOutput + ansible.builtin.debug: + msg: "{{ upgradeOutput.stdout_lines }}" + + - name: ListInstalledPackages + ansible.builtin.shell: "{{ install_base }}/IM/eclipse/tools/imcl listInstalledPackages -long" + register: packageOutput + + - name: packageOutput + ansible.builtin.debug: + msg: "{{ packageOutput.stdout_lines }}" + +- name: Versions + tags: version + block: + - name: WAS version + ansible.builtin.shell: "{{ install_base }}/{{ app_dir }}/bin/versionInfo{{ ext }} -ifixDetail" + register: wasVersionOutput + + - name: WasVersionOutput + ansible.builtin.debug: + msg: "{{ wasVersionOutput.stdout_lines }}" + failed_when: twas_im_driver not in wasVersionOutput.stdout diff --git a/ansible/roles/im_upgrade_appclient/tasks/main.yml b/ansible/roles/im_upgrade_appclient/tasks/main.yml new file mode 100644 index 000000000..786790b52 --- /dev/null +++ b/ansible/roles/im_upgrade_appclient/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Im_upgrade_appclient + ansible.builtin.include_tasks: im_upgrade_appclient.yml diff --git a/ansible/roles/im_upgrade_im/defaults/main.yml b/ansible/roles/im_upgrade_im/defaults/main.yml new file mode 100644 index 000000000..57f4895ec --- /dev/null +++ b/ansible/roles/im_upgrade_im/defaults/main.yml @@ -0,0 +1,6 @@ +--- +shared_dir: 'IM-shared' +install_base: '/home/nest' +# trick the template to install onto windoze via cygwin +cygwin: '' +im_upgrade_repo: 'https://public.dhe.ibm.com/software/rationalsdp/v7/im/updates/' diff --git a/ansible/roles/im_upgrade_im/readme.md b/ansible/roles/im_upgrade_im/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/im_upgrade_im/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/im_upgrade_im/tasks/im_upgrade_im.yml b/ansible/roles/im_upgrade_im/tasks/im_upgrade_im.yml new file mode 100644 index 000000000..a3fc647e5 --- /dev/null +++ b/ansible/roles/im_upgrade_im/tasks/im_upgrade_im.yml @@ -0,0 +1,53 @@ +--- +- name: Upgrade IM repo + ansible.builtin.debug: + msg: "IM repo->{{ im_upgrade_repo }}" + +- name: Install IBM Digital Certs root certificate + when: ibm_cert_url is defined + ansible.builtin.include_role: + name: install_ibm_cert + +- name: Test connection to repo since this does fail test commit + get_url: + url: "{{ im_upgrade_repo }}" + dest: /tmp/test_im_upgrade_repo.html + mode: '0755' + validate_certs: false + timeout: 2 + register: repoexists + ignore_errors: true + +- name: Delete temp file + file: + state: absent + path: /tmp/test_im_upgrade_repo.html + +- name: Repo is not reachable + ansible.builtin.debug: + msg: "IM repo->{{ im_upgrade_repo }} is not reachable, skipping im upgrade" + when: repoexists.msg is search('Request failed') + +- name: Repo is alive + when: repoexists.msg is search('OK') + block: + - name: Remove previous secureStorageFile.store ( IM 1.9.x -> 1.10 java11 ) + ansible.builtin.file: + path: "{{ cygwin }}{{ install_base }}/IM/secureStorageFile.store" + state: absent + + - name: Check if windoze and implement .imlock timing hack ( pause 4 minutes ) + when: ansible_system == 'Windows' or 'CYG' in ansible_system + ansible.builtin.pause: + seconds: 240 + + - name: Upgrade IM to the latest level + ansible.builtin.shell: "{{ cygwin }}{{ install_base }}/IM/eclipse/tools/imcl install com.ibm.cic.agent -repositories {{ im_upgrade_repo }}" + register: updateOutput + + - name: Upgrade output + ansible.builtin.debug: + msg: "{{ updateOutput.stdout_lines }}" + failed_when: ( updateOutput.rc not in [ 0, 1 ] ) + + diff --git a/ansible/roles/im_upgrade_im/tasks/main.yml b/ansible/roles/im_upgrade_im/tasks/main.yml new file mode 100644 index 000000000..a8e300ef3 --- /dev/null +++ b/ansible/roles/im_upgrade_im/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Im_upgrade_im.yml + include_tasks: im_upgrade_im.yml diff --git a/ansible/roles/im_upgrade_liberty/meta/main.yml b/ansible/roles/im_upgrade_liberty/meta/main.yml new file mode 100644 index 000000000..add36326e --- /dev/null +++ b/ansible/roles/im_upgrade_liberty/meta/main.yml @@ -0,0 +1,5 @@ +--- +dependencies: + # - role: load_secrets + - role: ibm_installation_manager_cic_selector + - role: liberty_defaults diff --git a/ansible/roles/im_upgrade_liberty/tasks/im_upgrade_liberty.yml b/ansible/roles/im_upgrade_liberty/tasks/im_upgrade_liberty.yml new file mode 100644 index 000000000..7ce58a114 --- /dev/null +++ b/ansible/roles/im_upgrade_liberty/tasks/im_upgrade_liberty.yml @@ -0,0 +1,93 @@ +--- +- name: Zip up the current folder + when: more_enabled is not defined + community.general.archive: + path: "{{ wlp_usr_dir }}/*" + dest: "{{ install_base }}/{{ ansible_hostname }}.liberty_usr.save.zip" + mode: '0755' + exclude_path: + - "{{ wlp_usr_dir }}/shared/stackGroups" + exclusion_patterns: + - '*.jar' + - '*.zip' + - '*.tar' + - '*.tgz' + - '*.gz' + - 'javacore*' + - 'core*' + - 'heapdump*' + - 'Snap*' + - 'tranlog' + - 'messaging' + format: zip + +- name: Check if previous liberty installed + ansible.builtin.stat: + path: "{{ install_base }}/wlp/bin/server" + register: islib + +- name: Perform liberty operations + when: islib.stat.exists + block: + - name: Check liberty install type. + ansible.builtin.shell: "{{ install_base }}/wlp/bin/productInfo version --verbose" + register: productOutput + + - name: Upgrade liberty version + tags: upgrade + when: "'InstallationManager' in productOutput.stdout" + block: + - name: Check if imcl installed as a prereq + ansible.builtin.stat: + path: "{{ install_base }}/IM/eclipse/tools/imcl" + register: isimcl + failed_when: isimcl.stat.exists == False + + - name: Generate secureStorageFile.store + ansible.builtin.shell: "{{ cygwin }}{{ install_base }}/IM/eclipse/tools/imutilsc saveCredential -url https://rtpgsa.ibm.com -userName {{ gsa_user }} -userPassword '{{ gsa_pass }}' -secureStorageFile {{ cygwin }}{{ install_base }}/IM/secureStorageFile.store" + register: saveCredentialOutput + + - name: saveCredentialOutput external + ansible.builtin.debug: + msg: "{{ saveCredentialOutput.stdout_lines }}" + + - name: Generate external ibm secureStorageFile.store + ansible.builtin.shell: "{{ cygwin }}{{ install_base }}/IM/eclipse/tools/imutilsc saveCredential -url http://www.ibm.com/software/repositorymanager -userName {{ external_ibmuser }} -userPassword '{{ external_ibmpass }}' -secureStorageFile {{ cygwin }}{{ install_base }}/IM/secureStorageFile.store" + register: saveCredentialOutput + + - name: saveCredentialOutput + ansible.builtin.debug: + msg: "{{ saveCredentialOutput.stdout_lines }}" + + - name: Check if windoze and implement .imlock timing hack ( pause 2 minutes ) + when: ansible_system == 'Windows' or 'CYG' in ansible_system + ansible.builtin.pause: + seconds: 120 + + - name: Upgrade liberty + ansible.builtin.shell: "{{ install_base }}/IM/eclipse/tools/imcl install {{ im_liberty_package }} \ + -repositories https://rtpgsa.ibm.com/gsa/rtpgsa/projects/l/liberty.build/liberty/WASX.LIBERTY/{{ liberty_daily_or_test }}/{{ liberty_im_driver }}/linux/zipper/externals/installables/repository/ \ + -installationDirectory {{ cygwin }}{{ install_base }}/{{ liberty_dir }} \ + -acceptLicense -secureStorageFile {{ cygwin }}{{ install_base }}/IM/secureStorageFile.store \ + -preferences com.ibm.cic.common.core.preferences.eclipseCache={{ cygwin }}{{ install_base }}/{{ shared_dir }}" + register: UpgradeOutput + + - name: UpgradeOutput + ansible.builtin.debug: + msg: "{{ UpgradeOutput.stdout_lines }}" + + - name: ListInstalledPackages + ansible.builtin.shell: "{{ install_base }}/IM/eclipse/tools/imcl listInstalledPackages -long" + register: packageOutput + + - name: PackageOutput + ansible.builtin.debug: + msg: "{{ packageOutput.stdout_lines }}" + + - name: Print the Liberty version + ansible.builtin.shell: "{{ install_base }}/{{ liberty_dir }}/bin/server version" + register: versionOutput + + - name: PackageOutput + ansible.builtin.debug: + msg: "{{ versionOutput.stdout_lines }}" diff --git a/ansible/roles/im_upgrade_liberty/tasks/main.yml b/ansible/roles/im_upgrade_liberty/tasks/main.yml new file mode 100644 index 000000000..83bfa4be2 --- /dev/null +++ b/ansible/roles/im_upgrade_liberty/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Upgrade the liberty servers + ansible.builtin.include_tasks: im_upgrade_liberty.yml diff --git a/ansible/roles/im_upgrade_liberty_jdk/meta/main.yml b/ansible/roles/im_upgrade_liberty_jdk/meta/main.yml new file mode 100644 index 000000000..add36326e --- /dev/null +++ b/ansible/roles/im_upgrade_liberty_jdk/meta/main.yml @@ -0,0 +1,5 @@ +--- +dependencies: + # - role: load_secrets + - role: ibm_installation_manager_cic_selector + - role: liberty_defaults diff --git a/ansible/roles/im_upgrade_liberty_jdk/tasks/im_upgrade_liberty_jdk.yml b/ansible/roles/im_upgrade_liberty_jdk/tasks/im_upgrade_liberty_jdk.yml new file mode 100644 index 000000000..2fb20df98 --- /dev/null +++ b/ansible/roles/im_upgrade_liberty_jdk/tasks/im_upgrade_liberty_jdk.yml @@ -0,0 +1,92 @@ +--- + +- name: Check if previous liberty installed + ansible.builtin.stat: + path: "{{ install_base }}/wlp/bin/server" + register: islib + +- name: Perform liberty operations + when: islib.stat.exists + block: + - name: Check liberty install type + ansible.builtin.shell: "{{ install_base }}/wlp/bin/productInfo version --verbose" + register: productOutput + + - name: Upgrade liberty version + tags: upgrade + when: "'InstallationManager' in productOutput.stdout" + block: + - name: Check if imcl installed as a prereq + ansible.builtin.stat: + path: "{{ install_base }}/IM/eclipse/tools/imcl" + register: isimcl + failed_when: isimcl.stat.exists == False + + - name: Generate secureStorageFile.store + ansible.builtin.shell: "{{ cygwin }}{{ install_base }}/IM/eclipse/tools/imutilsc saveCredential -url https://rtpgsa.ibm.com -userName {{ gsa_user }} -userPassword '{{ gsa_pass }}' -secureStorageFile {{ cygwin }}{{ install_base }}/IM/secureStorageFile.store" + register: saveCredentialOutput + + - name: saveCredentialOutput + ansible.builtin.debug: + msg: "{{ saveCredentialOutput.stdout_lines }}" + + - name: Generate external ibm secureStorageFile.store + ansible.builtin.shell: "{{ cygwin }}{{ install_base }}/IM/eclipse/tools/imutilsc saveCredential -url http://www.ibm.com/software/repositorymanager -userName {{ external_ibmuser }} -userPassword '{{ external_ibmpass }}' -secureStorageFile {{ cygwin }}{{ install_base }}/IM/secureStorageFile.store" + register: saveCredentialOutput + + - name: saveCredentialOutput + ansible.builtin.debug: + msg: "{{ saveCredentialOutput.stdout_lines }}" + + - name: Upgrade liberty jdk + ansible.builtin.shell: "time {{ install_base }}/IM/eclipse/tools/imcl install {{ im_liberty_jdk_package }}{{ im_java_short_version }} \ + -repositories https://www.ibm.com/software/repositorymanager/{{ im_liberty_jdk_package }}{{ im_java_short_version }} \ + -installationDirectory {{ cygwin }}{{ install_base }}/{{ liberty_dir }} \ + -acceptLicense -secureStorageFile {{ cygwin }}{{ install_base }}/IM/secureStorageFile.store \ + -preferences com.ibm.cic.common.core.preferences.eclipseCache={{ cygwin }}{{ install_base }}/{{ shared_dir }}" + register: UpgradeOutput + + - name: UpgradeOutput + ansible.builtin.debug: + msg: "{{ UpgradeOutput.stdout_lines }}" + + - name: Check if usr/servers has server.env + ansible.builtin.stat: + path: "{{ wlp_usr_dir }}/servers/{{ wl_server }}/server.env" + register: isserverenv + + - name: Remove JAVA_HOME from any servers server.env + when: isserverenv.stat.exists + ansible.builtin.lineinfile: + path: "{{ wlp_usr_dir }}/servers/{{ wl_server }}/server.env" + regexp: "^JAVA_HOME*" + state: absent + + - name: Check if wlp/etc/server.env the global JAVA_HOME in server.env + ansible.builtin.stat: + path: "{{ install_base }}/{{ liberty_dir }}/etc/server.env" + register: isserverenv + + - name: Adust the global JAVA_HOME in server.env + when: isserverenv.stat.exists + ansible.builtin.lineinfile: + path: "{{ install_base }}/{{ liberty_dir }}/etc/server.env" + regexp: "^JAVA_HOME*" + line: 'JAVA_HOME={{ install_base }}/{{ liberty_dir }}/java/{{ im_java_short_version }}.0' + state: present + + - name: ListInstalledPackages + ansible.builtin.shell: "{{ install_base }}/IM/eclipse/tools/imcl listInstalledPackages -long" + register: packageOutput + + - name: PackageOutput + ansible.builtin.debug: + msg: "{{ packageOutput.stdout_lines }}" + + - name: Print the Liberty version + ansible.builtin.shell: "{{ install_base }}/{{ liberty_dir }}/bin/server version" + register: versionOutput + + - name: PackageOutput + ansible.builtin.debug: + msg: "{{ versionOutput.stdout_lines }}" diff --git a/ansible/roles/im_upgrade_liberty_jdk/tasks/main.yml b/ansible/roles/im_upgrade_liberty_jdk/tasks/main.yml new file mode 100644 index 000000000..51d0a6d19 --- /dev/null +++ b/ansible/roles/im_upgrade_liberty_jdk/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Upgrade the liberty servers Java + ansible.builtin.include_tasks: im_upgrade_liberty_jdk.yml diff --git a/ansible/roles/im_upgrade_twas/.DS_Store b/ansible/roles/im_upgrade_twas/.DS_Store new file mode 100644 index 000000000..6c1305500 Binary files /dev/null and b/ansible/roles/im_upgrade_twas/.DS_Store differ diff --git a/ansible/roles/im_upgrade_twas/meta/main.yml b/ansible/roles/im_upgrade_twas/meta/main.yml new file mode 100644 index 000000000..3f5693422 --- /dev/null +++ b/ansible/roles/im_upgrade_twas/meta/main.yml @@ -0,0 +1,4 @@ +--- +dependencies: + - role: ibm_installation_manager_cic_selector + - role: twas_cell_defaults diff --git a/ansible/roles/im_upgrade_twas/readme.md b/ansible/roles/im_upgrade_twas/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/im_upgrade_twas/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/im_upgrade_twas/tasks/im_upgrade_twas.yml b/ansible/roles/im_upgrade_twas/tasks/im_upgrade_twas.yml new file mode 100644 index 000000000..2418b8319 --- /dev/null +++ b/ansible/roles/im_upgrade_twas/tasks/im_upgrade_twas.yml @@ -0,0 +1,14 @@ +--- +- name: Upgrade WebSphere tWAS + tags: upgrade + block: + - name: Copy im_was_upgrade.xml template + ansible.builtin.template: + src: "im_upgrade_twas_{{ twas_release }}.xml.j2" + dest: "im_was_upgrade.xml" + + - name: Upgrade tWAS / JDK product + ansible.builtin.include_role: + name: im_upgrade_was_product + vars: + was_product_dir: "{{ install_base }}/{{ twas_dir }}" diff --git a/ansible/roles/im_upgrade_twas/tasks/main.yml b/ansible/roles/im_upgrade_twas/tasks/main.yml new file mode 100644 index 000000000..a4ef9ccc9 --- /dev/null +++ b/ansible/roles/im_upgrade_twas/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Im_upgrade_twas + ansible.builtin.include_tasks: im_upgrade_twas.yml diff --git a/ansible/roles/im_upgrade_twas/templates/im_upgrade_twas_WAS855.xml.j2 b/ansible/roles/im_upgrade_twas/templates/im_upgrade_twas_WAS855.xml.j2 new file mode 100644 index 000000000..825ccd41b --- /dev/null +++ b/ansible/roles/im_upgrade_twas/templates/im_upgrade_twas_WAS855.xml.j2 @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/ansible/roles/im_update_twas/templates/im_twas_WAS90.xml.j2 b/ansible/roles/im_upgrade_twas/templates/im_upgrade_twas_WAS90.xml.j2 similarity index 51% rename from ansible/roles/im_update_twas/templates/im_twas_WAS90.xml.j2 rename to ansible/roles/im_upgrade_twas/templates/im_upgrade_twas_WAS90.xml.j2 index d7aea2c91..874f41bc8 100644 --- a/ansible/roles/im_update_twas/templates/im_twas_WAS90.xml.j2 +++ b/ansible/roles/im_upgrade_twas/templates/im_upgrade_twas_WAS90.xml.j2 @@ -1,12 +1,12 @@ - + - + @@ -15,16 +15,6 @@ - - - - - - - - - - diff --git a/ansible/roles/im_upgrade_twas_more/.DS_Store b/ansible/roles/im_upgrade_twas_more/.DS_Store new file mode 100644 index 000000000..6c1305500 Binary files /dev/null and b/ansible/roles/im_upgrade_twas_more/.DS_Store differ diff --git a/ansible/roles/im_upgrade_twas_more/meta/main.yml b/ansible/roles/im_upgrade_twas_more/meta/main.yml new file mode 100644 index 000000000..3f5693422 --- /dev/null +++ b/ansible/roles/im_upgrade_twas_more/meta/main.yml @@ -0,0 +1,4 @@ +--- +dependencies: + - role: ibm_installation_manager_cic_selector + - role: twas_cell_defaults diff --git a/ansible/roles/im_upgrade_twas_more/readme.md b/ansible/roles/im_upgrade_twas_more/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/im_upgrade_twas_more/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/im_upgrade_twas_more/tasks/im_upgrade_twas_more.yml b/ansible/roles/im_upgrade_twas_more/tasks/im_upgrade_twas_more.yml new file mode 100644 index 000000000..eecde1378 --- /dev/null +++ b/ansible/roles/im_upgrade_twas_more/tasks/im_upgrade_twas_more.yml @@ -0,0 +1,15 @@ +--- +- name: Upgrade WebSphere tWAS MoRE + tags: upgrade + block: + - name: Copy im_was_upgrade.xml template + ansible.builtin.template: + src: "im_upgrade_twas_more_{{ twas_release }}.xml.j2" + dest: "im_was_upgrade.xml" + mode: '0644' + + - name: Upgrade tWAS MoRE product + ansible.builtin.include_role: + name: im_upgrade_was_product + vars: + was_product_dir: "{{ install_base }}/{{ twas_dir }}" diff --git a/ansible/roles/im_upgrade_twas_more/tasks/main.yml b/ansible/roles/im_upgrade_twas_more/tasks/main.yml new file mode 100644 index 000000000..afbdf72f1 --- /dev/null +++ b/ansible/roles/im_upgrade_twas_more/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Im_upgrade_twas_more + ansible.builtin.include_tasks: im_upgrade_twas_more.yml diff --git a/ansible/roles/im_upgrade_twas_more/templates/im_upgrade_twas_more_WAS90.xml.j2 b/ansible/roles/im_upgrade_twas_more/templates/im_upgrade_twas_more_WAS90.xml.j2 new file mode 100644 index 000000000..c285b0ec1 --- /dev/null +++ b/ansible/roles/im_upgrade_twas_more/templates/im_upgrade_twas_more_WAS90.xml.j2 @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/ansible/roles/im_upgrade_was_product/meta/main.yml b/ansible/roles/im_upgrade_was_product/meta/main.yml new file mode 100644 index 000000000..3f5693422 --- /dev/null +++ b/ansible/roles/im_upgrade_was_product/meta/main.yml @@ -0,0 +1,4 @@ +--- +dependencies: + - role: ibm_installation_manager_cic_selector + - role: twas_cell_defaults diff --git a/ansible/roles/im_upgrade_was_product/readme.md b/ansible/roles/im_upgrade_was_product/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/im_upgrade_was_product/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/im_upgrade_was_product/tasks/im_upgrade_was_product.yml b/ansible/roles/im_upgrade_was_product/tasks/im_upgrade_was_product.yml new file mode 100644 index 000000000..609fd6a7f --- /dev/null +++ b/ansible/roles/im_upgrade_was_product/tasks/im_upgrade_was_product.yml @@ -0,0 +1,48 @@ +--- +- name: Upgrade + tags: upgrade + block: + - name: Check if imcl installed as a prereq + ansible.builtin.stat: + path: "{{ install_base }}/IM/eclipse/tools/imcl" + register: isimcl + failed_when: isimcl.stat.exists == False + + - name: Remove previous secureStorageFile.store ( IM 1.9.x -> 1.10 java11 ) + ansible.builtin.file: + path: "{{ install_base }}/IM/secureStorageFile.store" + state: absent + + - name: Generate secureStorageFile.store + ansible.builtin.shell: "{{ cygwin }}{{ install_base }}/IM/eclipse/tools/imutilsc saveCredential -url https://rtpgsa.ibm.com -userName {{ gsa_user }} -userPassword '{{ gsa_pass }}' -secureStorageFile {{ cygwin }}{{ install_base }}/IM/secureStorageFile.store" + + # - name: generate external ibm secureStorageFile.store + # ansible.builtin.shell: "{{ install_base }}/IM/eclipse/tools/imutilsc saveCredential -url http://www.ibm.com/software/repositorymanager -userName {{ external_ibmuser }} -userPassword '{{ external_ibmpass }}' -secureStorageFile {{ install_base }}/IM/secureStorageFile.store" + + - name: Upgrade WAS product + ansible.builtin.shell: "time {{ cygwin }}{{ install_base }}/IM/eclipse/tools/imcl input ./im_was_upgrade.xml -acceptLicense -secureStorageFile {{ cygwin }}{{ install_base }}/IM/secureStorageFile.store" + register: upgradeOutput + + - name: UpgradeOutput + ansible.builtin.debug: + msg: "{{ upgradeOutput.stdout_lines }}" + + - name: ListInstalledPackages + ansible.builtin.shell: "{{ install_base }}/IM/eclipse/tools/imcl listInstalledPackages -long" + register: packageOutput + + - name: packageOutput + ansible.builtin.debug: + msg: "{{ packageOutput.stdout_lines }}" + +- name: Versions + tags: version + block: + - name: WAS version + ansible.builtin.shell: "{{ was_product_dir }}/bin/versionInfo{{ ext }} -ifixDetail" + register: wasVersionOutput + + - name: WasVersionOutput + ansible.builtin.debug: + msg: "{{ wasVersionOutput.stdout_lines }}" + failed_when: twas_im_driver not in wasVersionOutput.stdout diff --git a/ansible/roles/im_upgrade_was_product/tasks/main.yml b/ansible/roles/im_upgrade_was_product/tasks/main.yml new file mode 100644 index 000000000..afb82c4da --- /dev/null +++ b/ansible/roles/im_upgrade_was_product/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Im_upgrade_was_product + ansible.builtin.include_tasks: im_upgrade_was_product.yml diff --git a/ansible/roles/im_versions_http_plugin_wct/meta/main.yml b/ansible/roles/im_versions_http_plugin_wct/meta/main.yml new file mode 100644 index 000000000..bc95c5fae --- /dev/null +++ b/ansible/roles/im_versions_http_plugin_wct/meta/main.yml @@ -0,0 +1,5 @@ +--- +dependencies: + - role: ibm_installation_manager_cic_selector + - role: twas_cell_defaults + - role: http_defaults diff --git a/ansible/roles/im_versions_http_plugin_wct/readme.md b/ansible/roles/im_versions_http_plugin_wct/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/im_versions_http_plugin_wct/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/im_versions_http_plugin_wct/tasks/im_versions_http_plugin_wct.yml b/ansible/roles/im_versions_http_plugin_wct/tasks/im_versions_http_plugin_wct.yml new file mode 100644 index 000000000..4b473a2fa --- /dev/null +++ b/ansible/roles/im_versions_http_plugin_wct/tasks/im_versions_http_plugin_wct.yml @@ -0,0 +1,41 @@ +--- +- name: IM listInstalledPackages + ansible.builtin.shell: "{{ install_base }}/IM/eclipse/tools/imcl listInstalledPackages -long" + register: packageOutput + +# - name: IM packageOutput +# ansible.builtin.debug: +# msg: "{{ packageOutput.stdout_lines }}" + +- name: Create version dir + delegate_to: localhost + ansible.builtin.file: + path: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}" + state: directory + +- name: Size of stdout_lines + delegate_to: localhost + ansible.builtin.set_fact: + max_counter: "{{ packageOutput.stdout_lines | length }}" + +- name: Create dict with http/plugin/wct version(s) + ansible.builtin.set_fact: + http_version: "{{ http_version | default( {} ) | combine( { item: packageOutput.stdout_lines[item | int] }, recursive=True, list_merge='append' ) }}" + with_sequence: 'start=0 end={{ max_counter | int - 1 }}' + no_log: true + +- name: New dict http_version + ansible.builtin.set_fact: + versions: "{{ { ansible_fqdn : http_version } }}" + +# - name: New dict append_this +# delegate_to: localhost +# ansible.builtin.debug: +# msg: "{{ versions }}" + +- name: Write http IM versions to json file + delegate_to: localhost + ansible.builtin.copy: + content: "{{ versions | to_nice_json( sort_keys=false ) }}" + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ im_version_json_file }}" + mode: '0444' diff --git a/ansible/roles/im_versions_http_plugin_wct/tasks/main.yml b/ansible/roles/im_versions_http_plugin_wct/tasks/main.yml new file mode 100644 index 000000000..e79fa5d01 --- /dev/null +++ b/ansible/roles/im_versions_http_plugin_wct/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: IM versions http/plugin/wct + ansible.builtin.include_tasks: im_versions_http_plugin_wct.yml diff --git a/ansible/roles/im_versions_liberty/meta/main.yml b/ansible/roles/im_versions_liberty/meta/main.yml new file mode 100644 index 000000000..285b3d3fa --- /dev/null +++ b/ansible/roles/im_versions_liberty/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: liberty_defaults diff --git a/ansible/roles/im_versions_liberty/readme.md b/ansible/roles/im_versions_liberty/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/im_versions_liberty/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/im_versions_liberty/tasks/im_versions_liberty.yml b/ansible/roles/im_versions_liberty/tasks/im_versions_liberty.yml new file mode 100644 index 000000000..c5be230bf --- /dev/null +++ b/ansible/roles/im_versions_liberty/tasks/im_versions_liberty.yml @@ -0,0 +1,45 @@ +--- +- name: Check if imcl installed + ansible.builtin.stat: + path: "{{ install_base }}/IM/eclipse/tools/imcl" + register: isimcl + +- name: Imcl listInstalledPackages + when: isimcl.stat.exists + block: + - name: Imcl listInstalledPackages + ansible.builtin.shell: "{{ install_base }}/IM/eclipse/tools/imcl listInstalledPackages -long" + register: packageOutput + + - name: Create version dir + delegate_to: localhost + ansible.builtin.file: + path: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}" + state: directory + mode: '0755' + + - name: Size of stdout_lines + delegate_to: localhost + set_fact: + max_counter: "{{ packageOutput.stdout_lines | length }}" + + - name: Create dict with IM version(s) + ansible.builtin.set_fact: + list_package: "{{ list_package | default({}) | combine( { item: packageOutput.stdout_lines[item | int] }, recursive=True, list_merge='append' ) }}" + with_sequence: 'start=0 end={{ max_counter | int - 1 }}' + no_log: true + + - name: New dict list_package + ansible.builtin.set_fact: + package: "{{{ ansible_fqdn : list_package }}}" + + # - name: New dict append_this + # delegate_to: localhost + # ansible.builtin.debug: + # msg: "{{ package }}" + + - name: write var to file + delegate_to: localhost + copy: + content: "{{ package | to_nice_json }}" + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ im_version_json_file }}" diff --git a/ansible/roles/im_versions_liberty/tasks/main.yml b/ansible/roles/im_versions_liberty/tasks/main.yml new file mode 100644 index 000000000..17152d13c --- /dev/null +++ b/ansible/roles/im_versions_liberty/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: IM Versions + ansible.builtin.include_tasks: im_versions_liberty.yml diff --git a/ansible/roles/im_versions_twas/meta/main.yml b/ansible/roles/im_versions_twas/meta/main.yml new file mode 100644 index 000000000..3f5693422 --- /dev/null +++ b/ansible/roles/im_versions_twas/meta/main.yml @@ -0,0 +1,4 @@ +--- +dependencies: + - role: ibm_installation_manager_cic_selector + - role: twas_cell_defaults diff --git a/ansible/roles/im_versions_twas/readme.md b/ansible/roles/im_versions_twas/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/im_versions_twas/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/im_versions_twas/tasks/im_versions_twas.yml b/ansible/roles/im_versions_twas/tasks/im_versions_twas.yml new file mode 100644 index 000000000..288ec4bff --- /dev/null +++ b/ansible/roles/im_versions_twas/tasks/im_versions_twas.yml @@ -0,0 +1,43 @@ +--- +- name: listInstalledPackages + ansible.builtin.shell: "{{ install_base }}/IM/eclipse/tools/imcl listInstalledPackages -long" + register: packageOutput + +# - name: packageOutput +# ansible.builtin.debug: +# msg: "{{ packageOutput.stdout_lines }}" + +- name: Create version dir + delegate_to: localhost + ansible.builtin.file: + path: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}" + state: directory + owner: "{{ ansible_user }}" + group: "{{ ansible_user }}" + mode: '0755' + +- name: Size of stdout_lines + delegate_to: localhost + ansible.builtin.set_fact: + max_counter: "{{ packageOutput.stdout_lines | length }}" + +- name: Create dict with IM version(s) + ansible.builtin.set_fact: + list_package: "{{ list_package | default({}) | combine( { item: packageOutput.stdout_lines[item | int] }, recursive=True, list_merge='append' ) }}" + with_sequence: 'start=0 end={{ max_counter | int - 1 }}' + no_log: true + +- name: New dict list_package + ansible.builtin.set_fact: + package: "{{ { ansible_fqdn : list_package } }}" + +# - name: New dict append_this +# delegate_to: localhost +# ansible.builtin.debug: +# msg: "{{ package }}" + +- name: Write var to file + delegate_to: localhost + ansible.builtin.copy: + content: "{{ package | to_nice_json }}" + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ im_version_json_file }}" diff --git a/ansible/roles/im_versions_twas/tasks/main.yml b/ansible/roles/im_versions_twas/tasks/main.yml new file mode 100644 index 000000000..6c09bc096 --- /dev/null +++ b/ansible/roles/im_versions_twas/tasks/main.yml @@ -0,0 +1,2 @@ +--- +- include_tasks: im_versions_twas.yml diff --git a/ansible/roles/install_ibm_cert/defaults/main.yml b/ansible/roles/install_ibm_cert/defaults/main.yml new file mode 100644 index 000000000..fb810840e --- /dev/null +++ b/ansible/roles/install_ibm_cert/defaults/main.yml @@ -0,0 +1,6 @@ +--- +ibm_cert_url: 'changeme' +ibm_cert_jre_path: '{{ install_base }}/IM/eclipse/' +ibm_cert_alias: 'ibm_digital_certs_root' + +# Made with Bob diff --git a/ansible/roles/install_ibm_cert/tasks/install_ibm_cert.yml b/ansible/roles/install_ibm_cert/tasks/install_ibm_cert.yml new file mode 100644 index 000000000..d354d4c07 --- /dev/null +++ b/ansible/roles/install_ibm_cert/tasks/install_ibm_cert.yml @@ -0,0 +1,107 @@ +--- + +- name: Check if JRE directory exists + ansible.builtin.stat: + path: "{{ ibm_cert_jre_path }}" + register: jre_dir + +- name: Verify JRE directory exists + ansible.builtin.fail: + msg: "JRE directory {{ ibm_cert_jre_path }} does not exist" + when: not jre_dir.stat.exists + +- name: Find Java keytool + ansible.builtin.find: + paths: "{{ ibm_cert_jre_path }}" + patterns: "keytool,keytool.exe" + recurse: true + register: keytool_find + +- name: Set keytool path + ansible.builtin.set_fact: + keytool_path: "{{ keytool_find.files[0].path }}" + is_windows_keytool: "{{ keytool_find.files[0].path.endswith('.exe') }}" + when: keytool_find.matched > 0 + +- name: Verify keytool exists + ansible.builtin.fail: + msg: "keytool not found in {{ ibm_cert_jre_path }}" + when: keytool_find.matched == 0 + +- name: Find Java cacerts keystore + ansible.builtin.find: + paths: "{{ ibm_cert_jre_path }}" + patterns: "cacerts" + recurse: true + register: cacerts_find + +- name: Set cacerts path + ansible.builtin.set_fact: + cacerts_path: "{{ cacerts_find.files[0].path }}" + cacerts_path_win: "{{ cacerts_find.files[0].path | regex_replace('^/cygdrive/([a-z])/', '\\1:/') | regex_replace('^/home/', 'C:/cygwin64/home/') | replace('/', '\\\\') }}" + when: cacerts_find.matched > 0 + +- name: Verify cacerts exists + ansible.builtin.fail: + msg: "cacerts keystore not found in {{ ibm_cert_jre_path }}" + when: cacerts_find.matched == 0 + +- name: Check if certificate already exists in keystore + ansible.builtin.command: > + {{ keytool_path }} -list -keystore {{ is_windows_keytool | default(false) | ternary(cacerts_path_win, cacerts_path) }} + -storepass changeit -alias {{ ibm_cert_alias }} + register: cert_check + failed_when: false + changed_when: false + no_log: true + +- name: Install IBM Digital Certs root certificate + when: cert_check.rc != 0 + block: + + - name: Download IBM Digital Certs root certificate + ansible.builtin.get_url: + url: "{{ ibm_cert_url }}" + dest: ./ibm_root.cer + validate_certs: false + mode: '0644' + + - name: Get absolute path of certificate file + ansible.builtin.stat: + path: ./ibm_root.cer + register: cert_file_stat + + - name: Set certificate file path for Windows + ansible.builtin.set_fact: + cert_file_path: "{{ is_windows_keytool | default(false) | ternary(cert_file_stat.stat.path | regex_replace('^/cygdrive/([a-z])/', '\\1:/') | regex_replace('^/home/', 'C:/cygwin64/home/') | replace('/', '\\\\'), cert_file_stat.stat.path) }}" + + - name: Import certificate into Java keystore + ansible.builtin.command: > + {{ keytool_path }} -import -trustcacerts -noprompt + -keystore {{ is_windows_keytool | default(false) | ternary(cacerts_path_win, cacerts_path) }} -storepass changeit + -alias {{ ibm_cert_alias }} -file {{ cert_file_path }} + register: cert_import + changed_when: cert_import.rc == 0 + + - name: Remove temporary certificate file + ansible.builtin.file: + path: ./ibm_root.cer + state: absent + + - name: Verify certificate installation + ansible.builtin.command: > + {{ keytool_path }} -list -keystore {{ is_windows_keytool | default(false) | ternary(cacerts_path_win, cacerts_path) }} + -storepass changeit -alias {{ ibm_cert_alias }} + register: cert_verify + changed_when: false + + - name: Certificate installation result + ansible.builtin.debug: + msg: "IBM Digital Certs root certificate successfully installed" + +- name: Certificate already installed + ansible.builtin.debug: + msg: "IBM Digital Certs root certificate already exists in keystore" + when: cert_check.rc == 0 + +# Made with Bob diff --git a/ansible/roles/install_ibm_cert/tasks/main.yml b/ansible/roles/install_ibm_cert/tasks/main.yml new file mode 100644 index 000000000..3dff3d0a8 --- /dev/null +++ b/ansible/roles/install_ibm_cert/tasks/main.yml @@ -0,0 +1,5 @@ +--- +- name: Install IBM Digital Certs root certificate + ansible.builtin.include_tasks: install_ibm_cert.yml + +# Made with Bob diff --git a/ansible/roles/instana_agent_install_config/tasks/custom_package_cron.yml b/ansible/roles/instana_agent_install_config/tasks/custom_package_cron.yml index d5ba6009e..f6cfc6946 100644 --- a/ansible/roles/instana_agent_install_config/tasks/custom_package_cron.yml +++ b/ansible/roles/instana_agent_install_config/tasks/custom_package_cron.yml @@ -4,4 +4,4 @@ name: "start custom instana agent at reboot" special_time: reboot job: "{{ instana_dir_custom }}/bin/start >/dev/null 2>&1" - become: yes + become: true diff --git a/ansible/roles/instana_agent_install_config/tasks/install_agent_custom.yml b/ansible/roles/instana_agent_install_config/tasks/install_agent_custom.yml index 2657a4f28..5f3cb08d3 100644 --- a/ansible/roles/instana_agent_install_config/tasks/install_agent_custom.yml +++ b/ansible/roles/instana_agent_install_config/tasks/install_agent_custom.yml @@ -4,4 +4,4 @@ src: "{{ custom_agent_url }}/instana-agent-{{ ansible_architecture }}.tar.gz" dest: /opt remote_src: yes - become: yes + become: true diff --git a/ansible/roles/instana_agent_install_config/tasks/install_agent_custom_chrp.yml b/ansible/roles/instana_agent_install_config/tasks/install_agent_custom_chrp.yml index b220a6bd0..4d8d2e4b5 100644 --- a/ansible/roles/instana_agent_install_config/tasks/install_agent_custom_chrp.yml +++ b/ansible/roles/instana_agent_install_config/tasks/install_agent_custom_chrp.yml @@ -4,4 +4,4 @@ src: "{{ custom_agent_url }}/instana-agent-{{ ansible_architecture }}.zip" dest: /opt remote_src: yes - become: yes + become: true diff --git a/ansible/roles/instana_agent_install_config/tasks/install_agent_normal.yml b/ansible/roles/instana_agent_install_config/tasks/install_agent_normal.yml index bbad32a75..da2022e01 100644 --- a/ansible/roles/instana_agent_install_config/tasks/install_agent_normal.yml +++ b/ansible/roles/instana_agent_install_config/tasks/install_agent_normal.yml @@ -1,12 +1,12 @@ --- - name: get the install agent script - become: yes + become: true get_url: url: "{{ get_normal_linux_agent }}" dest: ~/setup_agent.sh mode: 0755 - name: install the linux agent - become: yes + become: true command: "{{ install_normal_linux_agent }}" register: isInstana - debug: diff --git a/ansible/roles/instana_agent_install_config/tasks/remove_directory.yml b/ansible/roles/instana_agent_install_config/tasks/remove_directory.yml index 167cb5ac5..38af290b2 100644 --- a/ansible/roles/instana_agent_install_config/tasks/remove_directory.yml +++ b/ansible/roles/instana_agent_install_config/tasks/remove_directory.yml @@ -1,11 +1,11 @@ --- - name: remove custom package tree - become: yes + become: true file: path: "{{ instana_dir_custom }}" state: absent - name: remove normal package tree - become: yes + become: true file: path: "{{ instana_dir_normal }}" state: absent diff --git a/ansible/roles/instana_agent_install_config/tasks/remove_package.yml b/ansible/roles/instana_agent_install_config/tasks/remove_package.yml index 231f21700..58df8dc2c 100644 --- a/ansible/roles/instana_agent_install_config/tasks/remove_package.yml +++ b/ansible/roles/instana_agent_install_config/tasks/remove_package.yml @@ -1,6 +1,6 @@ --- - name: Remove the instana package - become: yes + become: true ansible.builtin.package: name: - "instana-agent-dynamic" diff --git a/ansible/roles/instana_agent_install_config/tasks/start.yml b/ansible/roles/instana_agent_install_config/tasks/start.yml index 62229c04c..70c4653b5 100644 --- a/ansible/roles/instana_agent_install_config/tasks/start.yml +++ b/ansible/roles/instana_agent_install_config/tasks/start.yml @@ -8,13 +8,13 @@ - name: start instana agent command: "{{ instana_dir_custom }}/bin/start" register: istart - become: yes + become: true ignore_errors: yes no_log: True - name: Instana start debug: msg: "{{ istart.stdout_lines }}" - when: isInstana.stat.exists == True + when: isInstana.stat.exists - name: check if instana normal is installed stat: @@ -24,11 +24,11 @@ - block: - name: start instana agents command: "{{ instana_dir_normal }}/bin/start" - become: yes + become: true register: istart ignore_errors: yes no_log: True - name: Instana start debug: msg: "{{ istart.stdout_lines }}" - when: isInstana.stat.exists == True + when: isInstana.stat.exists diff --git a/ansible/roles/instana_agent_install_config/tasks/stop.yml b/ansible/roles/instana_agent_install_config/tasks/stop.yml index d9ef2d645..d2049504b 100644 --- a/ansible/roles/instana_agent_install_config/tasks/stop.yml +++ b/ansible/roles/instana_agent_install_config/tasks/stop.yml @@ -8,13 +8,13 @@ - name: stop any instana agents running command: "{{ instana_dir_custom }}/bin/stop" register: istop - become: yes + become: true ignore_errors: yes no_log: True - name: Instana stop debug: msg: "{{ istop.stdout_lines }}" - when: isInstana.stat.exists == True + when: isInstana.stat.exists - name: check if instana is installed stat: @@ -24,11 +24,11 @@ - block: - name: stop any instana agents running command: "{{ instana_dir_normal }}/bin/stop" - become: yes + become: true register: istop ignore_errors: yes no_log: True - name: Instana stop debug: msg: "{{ istop.stdout_lines }}" - when: isInstana.stat.exists == True + when: isInstana.stat.exists diff --git a/ansible/roles/instana_agent_install_config_k3s/defaults/main.yml b/ansible/roles/instana_agent_install_config_k3s/defaults/main.yml new file mode 100644 index 000000000..b21b4fcf2 --- /dev/null +++ b/ansible/roles/instana_agent_install_config_k3s/defaults/main.yml @@ -0,0 +1,16 @@ +### instana dir's are hard coded +instana_dir_custom: '/opt/instana-agent' +instana_dir_normal: '/opt/instana/agent' +agent_key: 'thisIsAllowsOverridden' +instana_host: 'thisIsAllowsOverridden' +instana_port: '8443' +instana_region: 'singlebox-onprem' +custom_agent_url: 'thisIsAllowsOverridden' +instana_zone: '' # default is undefined +instana_mode: '' # Windows: blank is dynamic offline is static Unix: dynamic or static +instana_runtime: ' -j ' # Windows: blank is azul j9 is Eclipse OpenJ9 11, Unix: blank or -j +get_normal_linux_agent: 'https://setup.instana.io/agent' +install_normal_linux_agent: "~/setup_agent.sh -a {{ agent_key }} -d {{ download_key }} -t {{ instana_mode }} -e agent-acceptor.{{ instana_host }}:{{ instana_port }} -y -s {{ instana_runtime }}" +# windoze not updated nor untested +get_unattended_windows_exe: 'https://{{ instana_host }}/assets/agent/{{ instana_unit }}/{{ instana_tenet }}?agentKey={{ agent_key }}&type=exe64{{ instana_runtime }}{{ instana_mode }}®ion={{ instana_region }}' +AgentBootstrap: 'AgentBootstrap.exe INSTANA_AGENT_ENDPOINT={{ instana_host }} INSTANA_AGENT_ENDPOINT_PORT={{ instana_port }} INSTANA_AGENT_KEY={{ agent_key }} /quiet' diff --git a/ansible/roles/instana_agent_install_config_k3s/readme.md b/ansible/roles/instana_agent_install_config_k3s/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/instana_agent_install_config_k3s/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/instana_agent_install_config_k3s/tasks/RedHat.remove_repo.yml b/ansible/roles/instana_agent_install_config_k3s/tasks/RedHat.remove_repo.yml new file mode 100644 index 000000000..5f3b5bd63 --- /dev/null +++ b/ansible/roles/instana_agent_install_config_k3s/tasks/RedHat.remove_repo.yml @@ -0,0 +1,7 @@ +--- +- name: Remove instana-agent repository (and clean up left-over metadata) + become: true + ansible.builtin.yum_repository: + name: instana-agent + state: absent + notify: yum-clean-metadata \ No newline at end of file diff --git a/ansible/roles/instana_agent_install_config_k3s/tasks/SLES.remove_repo.yml b/ansible/roles/instana_agent_install_config_k3s/tasks/SLES.remove_repo.yml new file mode 100644 index 000000000..b33398aa2 --- /dev/null +++ b/ansible/roles/instana_agent_install_config_k3s/tasks/SLES.remove_repo.yml @@ -0,0 +1,6 @@ +--- +- name: Remove instana-agent repository + become: true + community.general.zypper_repository: + name: instana-agent + state: absent diff --git a/ansible/roles/instana_agent_install_config_k3s/tasks/Ubuntu.remove_repo.yml b/ansible/roles/instana_agent_install_config_k3s/tasks/Ubuntu.remove_repo.yml new file mode 100644 index 000000000..256aa81bf --- /dev/null +++ b/ansible/roles/instana_agent_install_config_k3s/tasks/Ubuntu.remove_repo.yml @@ -0,0 +1,6 @@ +--- +- name: Remove instana-agent repository + become: true + ansible.builtin.apt_repository: + repo: deb https://packages.instana.io/agent/deb generic main + state: absent diff --git a/ansible/roles/instana_agent_install_config_k3s/tasks/Windows.yml b/ansible/roles/instana_agent_install_config_k3s/tasks/Windows.yml new file mode 100644 index 000000000..198509d79 --- /dev/null +++ b/ansible/roles/instana_agent_install_config_k3s/tasks/Windows.yml @@ -0,0 +1,17 @@ +--- +- name: get the install agent script + win_get_url: + url: "{{ get_unattended_windows_exe }}" + dest: ./AgentBootstrap.exe + validate_certs: no + timeout: 1500 # just in case connections are slow +- name: install the windows agent + win_command: "{{ AgentBootstrap }}" + register: isInstana +- debug: + msg: "{{ isInstana.stdout_lines }}" +- name: Set service startup mode to auto and ensure it is started + win_service: + name: instana-agent-service + start_mode: auto + state: started diff --git a/ansible/roles/instana_agent_install_config_k3s/tasks/custom_package_cron.yml b/ansible/roles/instana_agent_install_config_k3s/tasks/custom_package_cron.yml new file mode 100644 index 000000000..f6cfc6946 --- /dev/null +++ b/ansible/roles/instana_agent_install_config_k3s/tasks/custom_package_cron.yml @@ -0,0 +1,7 @@ +--- +- name: Creates instana crontab manual reboot start + ansible.builtin.cron: + name: "start custom instana agent at reboot" + special_time: reboot + job: "{{ instana_dir_custom }}/bin/start >/dev/null 2>&1" + become: true diff --git a/ansible/roles/instana_agent_install_config_k3s/tasks/install_agent_custom.yml b/ansible/roles/instana_agent_install_config_k3s/tasks/install_agent_custom.yml new file mode 100644 index 000000000..5f3cb08d3 --- /dev/null +++ b/ansible/roles/instana_agent_install_config_k3s/tasks/install_agent_custom.yml @@ -0,0 +1,7 @@ +--- +- name: install custom Instana archive + unarchive: + src: "{{ custom_agent_url }}/instana-agent-{{ ansible_architecture }}.tar.gz" + dest: /opt + remote_src: yes + become: true diff --git a/ansible/roles/instana_agent_install_config_k3s/tasks/install_agent_custom_chrp.yml b/ansible/roles/instana_agent_install_config_k3s/tasks/install_agent_custom_chrp.yml new file mode 100644 index 000000000..4d8d2e4b5 --- /dev/null +++ b/ansible/roles/instana_agent_install_config_k3s/tasks/install_agent_custom_chrp.yml @@ -0,0 +1,7 @@ +--- +- name: install custom AIX Instana archive + unarchive: + src: "{{ custom_agent_url }}/instana-agent-{{ ansible_architecture }}.zip" + dest: /opt + remote_src: yes + become: true diff --git a/ansible/roles/instana_agent_install_config_k3s/tasks/install_agent_normal.yml b/ansible/roles/instana_agent_install_config_k3s/tasks/install_agent_normal.yml new file mode 100644 index 000000000..651a14a9d --- /dev/null +++ b/ansible/roles/instana_agent_install_config_k3s/tasks/install_agent_normal.yml @@ -0,0 +1,15 @@ +--- +- name: get the install agent script + become: true + get_url: + url: "{{ get_normal_linux_agent }}" + dest: ~/setup_agent.sh + mode: 0755 + force: yes + validate_certs: no +- name: install the linux agent + become: true + command: "{{ install_normal_linux_agent }}" + register: isInstana +- debug: + msg: "{{ isInstana.stdout_lines }}" diff --git a/ansible/roles/instana_agent_install_config_k3s/tasks/main.yml b/ansible/roles/instana_agent_install_config_k3s/tasks/main.yml new file mode 100644 index 000000000..e6ce46297 --- /dev/null +++ b/ansible/roles/instana_agent_install_config_k3s/tasks/main.yml @@ -0,0 +1,9 @@ +# "ansible_distribution": "Microsoft Windows Server 2019 Datacenter" +# "ansible_distribution": "CYGWIN_NT-10.0-17763" +--- +- include_tasks: Windows.yml + when: + - ansible_shell_type is defined + - ansible_shell_type == 'cmd' or ansible_shell_type == 'powershell' +- include_tasks: unix.yml + when: ansible_shell_type is undefined diff --git a/ansible/roles/instana_agent_install_config_k3s/tasks/remove_directory.yml b/ansible/roles/instana_agent_install_config_k3s/tasks/remove_directory.yml new file mode 100644 index 000000000..38af290b2 --- /dev/null +++ b/ansible/roles/instana_agent_install_config_k3s/tasks/remove_directory.yml @@ -0,0 +1,11 @@ +--- +- name: remove custom package tree + become: true + file: + path: "{{ instana_dir_custom }}" + state: absent +- name: remove normal package tree + become: true + file: + path: "{{ instana_dir_normal }}" + state: absent diff --git a/ansible/roles/instana_agent_install_config_k3s/tasks/remove_package.yml b/ansible/roles/instana_agent_install_config_k3s/tasks/remove_package.yml new file mode 100644 index 000000000..94bdc2916 --- /dev/null +++ b/ansible/roles/instana_agent_install_config_k3s/tasks/remove_package.yml @@ -0,0 +1,11 @@ +--- +- name: Remove the instana package + become: true + ignore_errors: true + ansible.builtin.package: + name: + - "instana-agent-dynamic" + - "instana-agent-dynamic-j9" + - "instana-agent-static" + - "instana-agent-static-j9" + state: absent diff --git a/ansible/roles/instana_agent_install_config_k3s/tasks/start.yml b/ansible/roles/instana_agent_install_config_k3s/tasks/start.yml new file mode 100644 index 000000000..b587c9ee0 --- /dev/null +++ b/ansible/roles/instana_agent_install_config_k3s/tasks/start.yml @@ -0,0 +1,34 @@ +--- +- name: check if instana custom is installed + stat: + path: "{{ instana_dir_custom }}/bin/start" + register: isInstana + +- block: + - name: start instana agent + command: "{{ instana_dir_custom }}/bin/start" + register: istart + become: true + ignore_errors: true + no_log: True + - name: Instana start + debug: + msg: "{{ istart.stdout_lines }}" + when: isInstana.stat.exists + +- name: check if instana normal is installed + stat: + path: "{{ instana_dir_normal }}/bin/start" + register: isInstana + +- block: + - name: start instana agents + command: "{{ instana_dir_normal }}/bin/start" + become: true + register: istart + ignore_errors: true + no_log: True + - name: Instana start + debug: + msg: "{{ istart.stdout_lines }}" + when: isInstana.stat.exists diff --git a/ansible/roles/instana_agent_install_config_k3s/tasks/stop.yml b/ansible/roles/instana_agent_install_config_k3s/tasks/stop.yml new file mode 100644 index 000000000..cba496399 --- /dev/null +++ b/ansible/roles/instana_agent_install_config_k3s/tasks/stop.yml @@ -0,0 +1,34 @@ +--- +- name: check if instana is installed + stat: + path: "{{ instana_dir_custom }}/bin/stop" + register: isInstana + +- block: + - name: stop any instana agents running + command: "{{ instana_dir_custom }}/bin/stop" + register: istop + become: true + ignore_errors: true + no_log: True + - name: Instana stop + debug: + msg: "{{ istop.stdout_lines }}" + when: isInstana.stat.exists + +- name: check if instana is installed + stat: + path: "{{ instana_dir_normal }}/bin/stop" + register: isInstana + +- block: + - name: stop any instana agents running + command: "{{ instana_dir_normal }}/bin/stop" + become: true + register: istop + ignore_errors: true + no_log: True + - name: Instana stop + debug: + msg: "{{ istop.stdout_lines }}" + when: isInstana.stat.exists diff --git a/ansible/roles/instana_agent_install_config_k3s/tasks/unix.yml b/ansible/roles/instana_agent_install_config_k3s/tasks/unix.yml new file mode 100644 index 000000000..0a1b928d6 --- /dev/null +++ b/ansible/roles/instana_agent_install_config_k3s/tasks/unix.yml @@ -0,0 +1,17 @@ +--- +### "ansible_architecture": "s390x", +### "ansible_architecture": "ppc64le", +### "ansible_architecture": "x86_64", +### "ansible_architecture": "chrp", --- AIX +- include_tasks: stop.yml +- include_tasks: remove_package.yml +- include_tasks: remove_directory.yml +- include_tasks: "{{ ansible_distribution }}.remove_repo.yml" +- include_tasks: install_agent_normal.yml + when: + - ansible_architecture == 'x86_64' or ansible_architecture == 's390x' or ansible_architecture == 'ppc64le' +- include_tasks: install_agent_custom_chrp.yml + when: + - ansible_architecture == 'chrp' +- include_tasks: start.yml +- include_tasks: zone.yml diff --git a/ansible/roles/instana_agent_install_config_k3s/tasks/zone.yml b/ansible/roles/instana_agent_install_config_k3s/tasks/zone.yml new file mode 100644 index 000000000..c8a786c9e --- /dev/null +++ b/ansible/roles/instana_agent_install_config_k3s/tasks/zone.yml @@ -0,0 +1,4 @@ +--- +- name: set the instana agent zone if present + include_role: + name: instana_agent_zone diff --git a/ansible/roles/instana_agent_switch/tasks/main.yml b/ansible/roles/instana_agent_switch/tasks/main.yml index 555957e83..c37d67ebd 100644 --- a/ansible/roles/instana_agent_switch/tasks/main.yml +++ b/ansible/roles/instana_agent_switch/tasks/main.yml @@ -16,7 +16,7 @@ - name: set custom instana_dir var set_fact: instana_dir: "{{ instana_dir_custom }}/etc/instana/" - when: isInstana.stat.exists == True + when: isInstana.stat.exists - name: check if instana normal is installed stat: @@ -25,9 +25,9 @@ - name: set normal instana_dir var set_fact: instana_dir: "{{ instana_dir_normal }}/etc/instana/" - when: isInstana.stat.exists == True + when: isInstana.stat.exists - name: set the Instana server in etc/instana/com.instana.agent.main.sender.Backend.cfg - become: yes + become: true template: src: com.instana.agent.main.sender.Backend.cfg.j2 dest: "{{ instana_dir }}com.instana.agent.main.sender.Backend.cfg" diff --git a/ansible/roles/instana_agent_zone/tasks/main.yml b/ansible/roles/instana_agent_zone/tasks/main.yml index ea67e949a..83f3ba02b 100644 --- a/ansible/roles/instana_agent_zone/tasks/main.yml +++ b/ansible/roles/instana_agent_zone/tasks/main.yml @@ -17,7 +17,7 @@ - name: set custom instana_dir var set_fact: instana_dir: "{{ instana_dir_custom }}/etc/instana/" - when: isInstana.stat.exists == True + when: isInstana.stat.exists - name: check if instana normal is installed stat: @@ -26,9 +26,9 @@ - name: set normal instana_dir var set_fact: instana_dir: "{{ instana_dir_normal }}/etc/instana/" - when: isInstana.stat.exists == True + when: isInstana.stat.exists - name: set the zone in etc/instana/configuration-zone.yaml - become: yes + become: true template: src: configuration-zone.yaml.j2 dest: "{{ instana_dir }}configuration-zone.yaml" diff --git a/ansible/roles/instana_fyrevm/tasks/instana_fyrevm.yml b/ansible/roles/instana_fyrevm/tasks/instana_fyrevm.yml index 0d2f267ea..3c70e1042 100644 --- a/ansible/roles/instana_fyrevm/tasks/instana_fyrevm.yml +++ b/ansible/roles/instana_fyrevm/tasks/instana_fyrevm.yml @@ -8,7 +8,7 @@ fyre_cpu: 16 fyre_memory: 64 fyre_additional_disk: 2048 - fyre_os: 'RedHat 9.0' + fyre_os: 'RedHat 9.4' fyre_site: "{{ site }}" fyre_comment: 'Instana Host' clusterName_prefix: instana diff --git a/ansible/roles/instana_fyrevm_k3s_settings/readme.md b/ansible/roles/instana_fyrevm_k3s_settings/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/instana_fyrevm_k3s_settings/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/instana_fyrevm_k3s_settings/tasks/instana_fyrevm_k3s_settings.yml b/ansible/roles/instana_fyrevm_k3s_settings/tasks/instana_fyrevm_k3s_settings.yml new file mode 100644 index 000000000..9ee1eef95 --- /dev/null +++ b/ansible/roles/instana_fyrevm_k3s_settings/tasks/instana_fyrevm_k3s_settings.yml @@ -0,0 +1,22 @@ +--- +# https://www.ibm.com/docs/en/instana-observability/current?topic=edition-preparing#kernel-parameters + +- ansible.posix.sysctl: + name: vm.swappiness + value: '0' + state: present + reload: true + +- ansible.posix.sysctl: + name: fs.inotify.max_user_instances + value: '8192' + state: present + reload: true + +- name: check transparent_hugepage + shell: "cat /sys/kernel/mm/transparent_hugepage/enabled" + register: transparent_hugepage + +- name: transparent_hugepage should be -> always madvise [never] + debug: + msg: "{{ transparent_hugepage.stdout_lines }}" \ No newline at end of file diff --git a/ansible/roles/instana_fyrevm_k3s_settings/tasks/main.yml b/ansible/roles/instana_fyrevm_k3s_settings/tasks/main.yml new file mode 100644 index 000000000..b2e62a6b2 --- /dev/null +++ b/ansible/roles/instana_fyrevm_k3s_settings/tasks/main.yml @@ -0,0 +1,3 @@ +--- + +- include_tasks: instana_fyrevm_k3s_settings.yml diff --git a/ansible/roles/instana_instance_k3s/defaults/main.yml b/ansible/roles/instana_instance_k3s/defaults/main.yml new file mode 100644 index 000000000..7148526c0 --- /dev/null +++ b/ansible/roles/instana_instance_k3s/defaults/main.yml @@ -0,0 +1,4 @@ +### WebSphere Automation instance artifacts +InstanaAdminUserPassword: 'password' +InstanaServiceUserPassword: 'password' +STANCTL_CORE_SMTP_PORT: '25' diff --git a/ansible/roles/instana_instance_k3s/readme.md b/ansible/roles/instana_instance_k3s/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/instana_instance_k3s/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/instana_instance_k3s/tasks/RedHat.yml b/ansible/roles/instana_instance_k3s/tasks/RedHat.yml new file mode 100644 index 000000000..5a5e4d868 --- /dev/null +++ b/ansible/roles/instana_instance_k3s/tasks/RedHat.yml @@ -0,0 +1,50 @@ +--- + +- name: remove Instana repository + become: true + ansible.builtin.yum_repository: + name: instana-product + state: absent + +- name: Add Instana repository + become: true + ansible.builtin.yum_repository: + name: instana-product + description: instana-product + baseurl: "https://_:{{ download_key }}@artifact-public.instana.io/artifactory/rel-rpm-public-virtual/" + gpgkey: "https://_:{{ download_key }}@artifact-public.instana.io/artifactory/api/security/keypair/public/repositories/rel-rpm-public-virtual" + gpgcheck: false + repo_gpgcheck: true + enabled: true + +- name: Upgrade all packages + become: true + ansible.builtin.dnf: + name: "*" + state: latest + +- name: install required OS packages + become: true + ansible.builtin.dnf: + state: latest + name: + - jq + - stanctl + - container-selinux + +- name: show the stanctl version + command: 'stanctl --version' + register: stanctlOutput + +- name: stanctl stdout_lines + debug: + msg: "{{ stanctlOutput.stdout }}" + +- name: set transparent_hugepage + become: true + shell: 'grubby --args="transparent_hugepage=never" --update-kernel ALL' + +- name: Unconditionally reboot the machine with all defaults + ansible.builtin.reboot: + + diff --git a/ansible/roles/instana_instance_k3s/tasks/instana_instance_k3s.yml b/ansible/roles/instana_instance_k3s/tasks/instana_instance_k3s.yml new file mode 100644 index 000000000..dd2e4ec88 --- /dev/null +++ b/ansible/roles/instana_instance_k3s/tasks/instana_instance_k3s.yml @@ -0,0 +1,161 @@ +--- + +### schader@us.ibm.com +### https://www.ibm.com/docs/en/instana-observability/current?topic=premises-installing-instana-backend-docker#prerequisites +- name: check /dev/vdb1 + shell: 'fdisk -l /dev/vdb1' + ignore_errors: true + register: vdb1 + +- name: setup vdb1 + when: vdb1.rc != 0 + block: + #START BLOCK + ### umount for re-run testing + - name: umount /dev/vdb1 + mount: + path: /mnt + src: /dev/vdb1 + state: unmounted + ignore_errors: true + + - name: copy fdisk.create + template: + src: fdisk.create.j2 + dest: fdisk.create + + - name: create the /dev/vdb partition + shell: 'fdisk /dev/vdb < fdisk.create' + register: fdisk_create + + - name: fdisk create stdout_lines + debug: + msg: "{{ fdisk_create.stdout_lines }}" + + - name: mkfs.xfs -f /dev/vdb1 + command: 'mkfs.xfs -f /dev/vdb1' + register: mkfsOutput + + - name: mkfs create stdout_lines + debug: + msg: "{{ mkfsOutput.stdout_lines }}" + + - name: /mnt directory + file: + path: /mnt + state: directory + + - name: mount /dev/vdb1 + mount: + path: /mnt + src: /dev/vdb1 + state: mounted + fstype: xfs + register: mountOutput + + - name: mount output + debug: + msg: "{{ mountOutput }}" + + - name: prereq directories + file: + path: '{{ item }}' + state: directory + recurse: yes + with_items: + - '/mnt/instana/stanctl/data' + - '/mnt/instana/stanctl/metrics' + - '/mnt/instana/stanctl/analytics' + - '/mnt/instana/stanctl/objects' + + - name: get the blkid /dev/vdb1 + command: 'blkid -s UUID -o value /dev/vdb1' + register: blkidOutput + + - name: blkidOutput stdout_lines + debug: + msg: "{{ blkidOutput.stdout }}" + + - name: remove ( only needed for re-runs on existing host ) /mnt in /etc/fstab + lineinfile: + path: '/etc/fstab' + regexp: '^/mnt' + state: absent + backup: yes + + - name: add new /mnt in /etc/fstab + lineinfile: + path: '/etc/fstab' + regexp: '^/mnt' + line: 'UUID="{{ blkidOutput.stdout }}" /mnt xfs defaults 1 1' + backup: yes +#END BLOCK + + +## https://www.ibm.com/docs/en/instana-observability/current?topic=edition-installing#installing-the-sitedatakeywordself_se_short-in-an-online-environment +## --core-tls-crt +## --core-tls-key + +- name: remove stanctl agent delete -q + shell: "stanctl agent delete -q" + ignore_errors: true + register: instanaOutput + +- name: instana remove output + debug: + msg: "{{ instanaOutput.stdout_lines }}" + +- name: remove stanctl cluster delete -q + shell: "stanctl cluster delete -q" + ignore_errors: true + register: instanaOutput + +- name: instana remove output + debug: + msg: "{{ instanaOutput.stdout_lines }}" + +- name: copy env file + template: + src: env.j2 + dest: /root/.env + +- name: stanctl up with arguments + shell: "stanctl up --install-type demo --core-base-domain {{ ansible_facts['fqdn'] }} --download-key {{ download_key }} --sales-key {{ sales_key }} --unit-tenant-name {{ instana_tenet }} --unit-unit-name {{ instana_unit }} --unit-initial-admin-password {{ instanaAdminPassword }} --timeout 60m" + register: instanaOutput + +- name: instana init output + debug: + msg: "{{ instanaOutput.stdout_lines }}" + +- name: stanctl agent apply + shell: "stanctl agent apply" + register: instanaOutput + +- name: stanctl agent apply output + debug: + msg: "{{ instanaOutput.stdout_lines }}" + +- name: instana local agent monitoring + shell: 'stanctl license info' + register: licenseOutput + +- name: instana license output + debug: + msg: "{{ licenseOutput.stdout_lines }}" + +- name: instana license info + shell: 'stanctl license info' + register: licenseOutput + +- name: instana license output + debug: + msg: "{{ licenseOutput.stdout_lines }}" + +- name: instana version + shell: 'stanctl --version' + register: instanaVersion + changed_when: false + +- name: instana version output + debug: + msg: "{{ instanaVersion.stdout_lines }}" diff --git a/ansible/roles/instana_instance_k3s/tasks/main.yml b/ansible/roles/instana_instance_k3s/tasks/main.yml new file mode 100644 index 000000000..40d458788 --- /dev/null +++ b/ansible/roles/instana_instance_k3s/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- include_tasks: "{{ ansible_distribution }}.yml" +- include_tasks: instana_instance_k3s.yml diff --git a/ansible/roles/instana_instance_k3s/templates/env.j2 b/ansible/roles/instana_instance_k3s/templates/env.j2 new file mode 100644 index 000000000..8fdc0bf6c --- /dev/null +++ b/ansible/roles/instana_instance_k3s/templates/env.j2 @@ -0,0 +1,8 @@ +STANCTL_CORE_SMTP_CHECK_SERVER_IDENTITY=false +STANCTL_CORE_SMTP_FROM='{{ STANCTL_CORE_SMTP_FROM }}' +STANCTL_CORE_SMTP_HOST='{{ STANCTL_CORE_SMTP_HOST}}' +STANCTL_CORE_SMTP_PORT='{{ STANCTL_CORE_SMTP_PORT }}' +STANCTL_CORE_SMTP_START_TLS=false +STANCTL_CORE_SMTP_USE_SSL=false +STANCTL_CORE_TLS_CRT=(auto-generated) +STANCTL_CORE_TLS_KEY=(auto-generated) \ No newline at end of file diff --git a/ansible/roles/instana_instance_k3s/templates/fdisk.create.j2 b/ansible/roles/instana_instance_k3s/templates/fdisk.create.j2 new file mode 100644 index 000000000..673b270fa --- /dev/null +++ b/ansible/roles/instana_instance_k3s/templates/fdisk.create.j2 @@ -0,0 +1,8 @@ +n +p +1 + + +i +w +q diff --git a/ansible/roles/instana_instance_k3s/templates/fdisk.delete.j2 b/ansible/roles/instana_instance_k3s/templates/fdisk.delete.j2 new file mode 100644 index 000000000..cf5d93074 --- /dev/null +++ b/ansible/roles/instana_instance_k3s/templates/fdisk.delete.j2 @@ -0,0 +1,4 @@ +i +d +w +q diff --git a/ansible/roles/instana_instance_on_prem/tasks/RedHat.yml b/ansible/roles/instana_instance_on_prem/tasks/RedHat.yml index 941ba11c5..d0df45913 100644 --- a/ansible/roles/instana_instance_on_prem/tasks/RedHat.yml +++ b/ansible/roles/instana_instance_on_prem/tasks/RedHat.yml @@ -1,7 +1,7 @@ --- - name: install jq - become: yes + become: true ansible.builtin.dnf: state: latest name: @@ -9,13 +9,13 @@ - postfix - name: configure the Instana repo - become: yes + become: true template: src: instana.rhel.repo.j2 dest: /etc/yum.repos.d/Instana-Product.repo - name: install instana-console - become: yes + become: true dnf: name: "instana-console" state: present diff --git a/ansible/roles/instana_instance_on_prem/tasks/Ubuntu.yml b/ansible/roles/instana_instance_on_prem/tasks/Ubuntu.yml index bad155efd..2b829e4aa 100644 --- a/ansible/roles/instana_instance_on_prem/tasks/Ubuntu.yml +++ b/ansible/roles/instana_instance_on_prem/tasks/Ubuntu.yml @@ -1,6 +1,6 @@ --- - name: install utility packages - become: yes + become: true apt: name: "{{ packages }}" state: present @@ -25,7 +25,7 @@ update_cache: yes - name: install pre-req packages - become: yes + become: true apt: name: "instana-console" state: present diff --git a/ansible/roles/issue_net/defaults/main.yml b/ansible/roles/issue_net/defaults/main.yml new file mode 100644 index 000000000..66796ba1d --- /dev/null +++ b/ansible/roles/issue_net/defaults/main.yml @@ -0,0 +1,2 @@ +--- +issueContent: '' diff --git a/ansible/roles/issue_net/readme.md b/ansible/roles/issue_net/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/issue_net/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/issue_net/tasks/main.yml b/ansible/roles/issue_net/tasks/main.yml new file mode 100644 index 000000000..3b1c549e6 --- /dev/null +++ b/ansible/roles/issue_net/tasks/main.yml @@ -0,0 +1,11 @@ +- name: Check if issue.net exists + ansible.builtin.stat: + path: /etc/issue.net + register: isissue + +- name: Replace issue.net content + when: isissue.stat.exists + become: true + ansible.builtin.copy: + content: '{{ issueContent }}' + dest: /etc/issue.net diff --git a/ansible/roles/jmeter/tasks/main.yml b/ansible/roles/jmeter/tasks/main.yml index f156007fd..1131859a2 100644 --- a/ansible/roles/jmeter/tasks/main.yml +++ b/ansible/roles/jmeter/tasks/main.yml @@ -26,6 +26,7 @@ get_url: url: "{{ jmeterArchive }}" dest: /tmp/jmeter.tgz + validate_certs: false - name: Remove previous Jmeter dir file: @@ -65,10 +66,11 @@ line: 'export PATH="$PATH:{{ jmeterDir }}/{{ jVersion.stdout }}/bin"' backup: yes mode: '0644' - become: yes + become: true - name: retrieve jmeter-plugin-manager.jar get_url: url: "{{ jmeterManagerPluginUrl }}" dest: "{{ jmeterDir }}/{{ jVersion.stdout }}/lib/ext/jmeter-plugin-manager.jar" - when: isjmeter.stat.exists == False or forceReplace|bool == True + validate_certs: false + when: isjmeter.stat.exists == False or forceReplace|bool diff --git a/ansible/roles/jmeterStatus/tasks/main.yml b/ansible/roles/jmeterStatus/tasks/main.yml new file mode 100644 index 000000000..8e0b0d4fe --- /dev/null +++ b/ansible/roles/jmeterStatus/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Print Jmeter container status + ansible.builtin.include_tasks: print_jmeter_status.yml diff --git a/ansible/roles/jmeterStatus/tasks/print_jmeter_status.yml b/ansible/roles/jmeterStatus/tasks/print_jmeter_status.yml new file mode 100644 index 000000000..524ae3a1b --- /dev/null +++ b/ansible/roles/jmeterStatus/tasks/print_jmeter_status.yml @@ -0,0 +1,62 @@ +--- +- name: Print Jmeter status + when: groups.stress is defined + block: + + - name: Create local logs dir + delegate_to: localhost + ansible.builtin.file: + path: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}" + state: directory + mode: '0755' + + - name: Gather info for container + containers.podman.podman_container_info: + name: '{{ svt_jmeter_container_name }}' + register: container_info + + - name: Jmeter container is not running + delegate_to: localhost + when: container_info.containers[0] is not defined + ansible.builtin.template: + src: container_status_notrunning.json.j2 + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ status_json_file }}" + mode: '0444' + + - name: Jmeter container is running + when: + - container_info.containers[0] is defined + - container_info.containers[0].State.Status == 'running' + block: + + - name: Get the Jmeter container status + containers.podman.podman_container_exec: + name: "{{ svt_jmeter_container_name }}" + command: "jmeter_json_payload.sh" + register: jmeterStatus + + - name: Handle invalid JSON + when: jmeterStatus is not search('latestTimestamp') + block: + + - name: Jmeter status is not valid JSON + delegate_to: localhost + ansible.builtin.template: + src: container_status_notrunning.json.j2 + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ status_json_file }}" + mode: '0444' + + - name: Jmeter status is valid JSON + when: jmeterStatus is search('latestTimestamp') + block: + + - name: Add the hostname to the status + ansible.builtin.set_fact: + jmeter_status: "{{{ ansible_fqdn : jmeterStatus.stdout | from_json }}}" + + - name: Save Jmeter status to stress_status + delegate_to: localhost + ansible.builtin.copy: + content: "{{ jmeter_status }}" + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ status_json_file }}" + mode: '0444' diff --git a/ansible/roles/jmeterStatus/templates/container_status_notrunning.json.j2 b/ansible/roles/jmeterStatus/templates/container_status_notrunning.json.j2 new file mode 100644 index 000000000..a18a2e60f --- /dev/null +++ b/ansible/roles/jmeterStatus/templates/container_status_notrunning.json.j2 @@ -0,0 +1,6 @@ +{ + "{{ ansible_fqdn }}": { + "name": "{{ svt_jmeter_container_name }}", + "Status": "not running" + } +} \ No newline at end of file diff --git a/ansible/roles/jmeter_container_get_logs/defaults/main.yml b/ansible/roles/jmeter_container_get_logs/defaults/main.yml new file mode 100644 index 000000000..16a0afe5c --- /dev/null +++ b/ansible/roles/jmeter_container_get_logs/defaults/main.yml @@ -0,0 +1,3 @@ +--- + +env_name: myLibertyEnv diff --git a/ansible/roles/jmeter_container_get_logs/readme.md b/ansible/roles/jmeter_container_get_logs/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/jmeter_container_get_logs/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/jmeter_container_get_logs/tasks/jmeter_container_get_logs.yml b/ansible/roles/jmeter_container_get_logs/tasks/jmeter_container_get_logs.yml new file mode 100644 index 000000000..6e2b013e3 --- /dev/null +++ b/ansible/roles/jmeter_container_get_logs/tasks/jmeter_container_get_logs.yml @@ -0,0 +1,39 @@ +--- + +- name: log directory + delegate_to: localhost + file: + path: "logs/{{ env_name }}/jmeter" + state: absent + +- name: log directory + delegate_to: localhost + file: + path: "logs/{{ env_name }}/jmeter" + state: directory + +- name: archive the logs dir to fetch + community.general.archive: + path: + - "/home/{{ ansible_user }}/jmeter.log" + # - "/home/{{ ansible_user }}/jmeter.error" + dest: logs.tar + format: tar + +- name: fetch the jmeter log archive + ansible.builtin.fetch: + src: logs.tar + dest: "logs/{{ env_name }}/jmeter" + + # unarchive fails to find handler +- name: Extract the jemeter log archive + delegate_to: localhost + shell: tar xf logs.tar + args: + chdir: "logs/{{ env_name }}/jmeter/{{ ansible_fqdn }}" + +- name: remove logs.tar + delegate_to: localhost + file: + path: "logs/{{ env_name }}/jmeter/{{ ansible_fqdn }}/logs.tar" + state: absent diff --git a/ansible/roles/jmeter_container_get_logs/tasks/main.yml b/ansible/roles/jmeter_container_get_logs/tasks/main.yml new file mode 100644 index 000000000..d6f437954 --- /dev/null +++ b/ansible/roles/jmeter_container_get_logs/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Retrieve jmeter container jmeter_get_logs.yml + ansible.builtin.include_tasks: jmeter_container_get_logs.yml diff --git a/ansible/roles/jmeter_get_logs/tasks/jmeter_get_logs.yml b/ansible/roles/jmeter_get_logs/tasks/jmeter_get_logs.yml index 747b3242a..040b3592d 100644 --- a/ansible/roles/jmeter_get_logs/tasks/jmeter_get_logs.yml +++ b/ansible/roles/jmeter_get_logs/tasks/jmeter_get_logs.yml @@ -15,25 +15,25 @@ - name: archive the logs dir to fetch community.general.archive: path: - - "/home/{{ ansible_user }}/jmeter.log" - - "/home/{{ ansible_user }}/jmeter.error" - dest: logs.tar - format: tar + - "/home/{{ ansible_user }}/jmeter.*" + dest: logs.zip + format: zip + mode: '0755' - name: fetch the jmeter log archive ansible.builtin.fetch: - src: logs.tar - dest: "logs/{{ env_name }}/jmeter" + src: logs.zip + dest: "{{ logs_dir }}/{{ env_name }}/jmeter" - # unarchive fails to find handler - name: Extract the jemeter log archive delegate_to: localhost - shell: tar xf logs.tar - args: - chdir: "logs/{{ env_name }}/jmeter/{{ ansible_fqdn }}" + ansible.builtin.unarchive: + src: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/logs.zip" + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}" + remote_src: false -- name: remove logs.tar +- name: remove logs.zip delegate_to: localhost file: - path: "logs/{{ env_name }}/jmeter/{{ ansible_fqdn }}/logs.tar" + path: "{{ logs_dir }}/{{ env_name }}/jmeter/{{ ansible_fqdn }}/logs.zip" state: absent diff --git a/ansible/roles/jmeter_java/tasks/main.yml b/ansible/roles/jmeter_java/tasks/main.yml index a7610595a..13cf97596 100644 --- a/ansible/roles/jmeter_java/tasks/main.yml +++ b/ansible/roles/jmeter_java/tasks/main.yml @@ -20,6 +20,7 @@ get_url: url: "{{ javaArchive }}" dest: /tmp/java.tgz + validate_certs: false - name: Remove previous Java dir file: @@ -59,5 +60,5 @@ line: 'export PATH="{{ javaDir }}/{{ jVersion.stdout }}/bin:$PATH"' backup: yes mode: '0644' - become: yes - when: isjava.stat.exists == False or forceReplace|bool == True + become: true + when: isjava.stat.exists == False or forceReplace|bool diff --git a/ansible/roles/jmeter_prereqs/tasks/main.yml b/ansible/roles/jmeter_prereqs/tasks/main.yml index bb7393cf3..5e4e68d4a 100644 --- a/ansible/roles/jmeter_prereqs/tasks/main.yml +++ b/ansible/roles/jmeter_prereqs/tasks/main.yml @@ -1,7 +1,7 @@ --- - name: Install RHEL jmeter pre-reqs - become: yes + become: true dnf: name: "{{ packages }}" state: latest diff --git a/ansible/roles/liberty_clear_dumps/defaults/main.yml b/ansible/roles/liberty_clear_dumps/defaults/main.yml new file mode 100644 index 000000000..41262860a --- /dev/null +++ b/ansible/roles/liberty_clear_dumps/defaults/main.yml @@ -0,0 +1,3 @@ +--- +env_name: mytWASEnv +dumps_dir: "{{ playbook_dir }}" # location on the ansible controller diff --git a/ansible/roles/liberty_clear_dumps/meta/main.yml b/ansible/roles/liberty_clear_dumps/meta/main.yml new file mode 100644 index 000000000..285b3d3fa --- /dev/null +++ b/ansible/roles/liberty_clear_dumps/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: liberty_defaults diff --git a/ansible/roles/liberty_clear_dumps/readme.md b/ansible/roles/liberty_clear_dumps/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/liberty_clear_dumps/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/liberty_clear_dumps/tasks/liberty_clear_dumps.yml b/ansible/roles/liberty_clear_dumps/tasks/liberty_clear_dumps.yml new file mode 100644 index 000000000..61e4727bc --- /dev/null +++ b/ansible/roles/liberty_clear_dumps/tasks/liberty_clear_dumps.yml @@ -0,0 +1,55 @@ +--- +- name: Any heapdumps? + ansible.builtin.shell: "find {{ wlp_usr_dir }}/servers/{{ wl_server }} -name 'heapdump*'" + register: isheap + changed_when: false + +- name: Remove Liberty heapdumps + ansible.builtin.file: + path: "{{ item }}" + state: absent + with_items: '{{ isheap.stdout_lines }}' + +- name: Any javacores? + ansible.builtin.shell: "find {{ wlp_usr_dir }}/servers/{{ wl_server }} -name 'javacore*'" + register: isjavacore + changed_when: false + +- name: Remove Liberty javacores + ansible.builtin.file: + path: "{{ item }}" + state: absent + with_items: '{{ isjavacore.stdout_lines }}' + +- name: Any cores? + ansible.builtin.shell: "find {{ wlp_usr_dir }}/servers/{{ wl_server }} -name 'core*'" + register: iscore + changed_when: false + +- name: Remove Liberty cores + ansible.builtin.file: + path: "{{ item }}" + state: absent + with_items: '{{ iscore.stdout_lines }}' + +- name: Any Snaps? + ansible.builtin.shell: "find {{ wlp_usr_dir }}/servers/{{ wl_server }} -name 'Snap*'" + register: issnap + changed_when: false + +- name: Remove Liberty Snaps + ansible.builtin.file: + path: "{{ item }}" + state: absent + with_items: '{{ issnap.stdout_lines }}' + +- name: Any jitdumps? + ansible.builtin.shell: "find {{ wlp_usr_dir }}/servers/{{ wl_server }} -name 'jitdump*'" + register: isjitdump + changed_when: false + +- name: Remove Liberty jitdumps + ansible.builtin.file: + path: "{{ item }}" + state: absent + with_items: '{{ isjitdump.stdout_lines }}' \ No newline at end of file diff --git a/ansible/roles/liberty_clear_dumps/tasks/main.yml b/ansible/roles/liberty_clear_dumps/tasks/main.yml new file mode 100644 index 000000000..c6119f75a --- /dev/null +++ b/ansible/roles/liberty_clear_dumps/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Clear liberty javacore and heapdumps + include_tasks: liberty_clear_dumps.yml diff --git a/ansible/roles/liberty_clear_logs/meta/main.yml b/ansible/roles/liberty_clear_logs/meta/main.yml new file mode 100644 index 000000000..285b3d3fa --- /dev/null +++ b/ansible/roles/liberty_clear_logs/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: liberty_defaults diff --git a/ansible/roles/liberty_clear_logs/readme.md b/ansible/roles/liberty_clear_logs/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/liberty_clear_logs/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/liberty_clear_logs/tasks/liberty_clear_logs.yml b/ansible/roles/liberty_clear_logs/tasks/liberty_clear_logs.yml new file mode 100644 index 000000000..2c81838a0 --- /dev/null +++ b/ansible/roles/liberty_clear_logs/tasks/liberty_clear_logs.yml @@ -0,0 +1,26 @@ +--- +- name: Remove Liberty logs dir + ansible.builtin.file: + path: "{{ wlp_usr_dir }}/servers/{{ wl_server }}/logs" + state: absent + +- name: Any extra logs? + when: extra_logs is defined + block: + + - name: Remove Liberty extra_logs dir + ansible.builtin.file: + path: "{{ item }}" + state: absent + with_items: + - "{{ extra_logs }}" + + - name: Create Liberty extra_logs dir + become: true + ansible.builtin.file: + path: "{{ item }}" + state: directory + mode: '0777' + with_items: + - "{{ extra_logs }}" + diff --git a/ansible/roles/liberty_clear_logs/tasks/main.yml b/ansible/roles/liberty_clear_logs/tasks/main.yml new file mode 100644 index 000000000..dddad4c5c --- /dev/null +++ b/ansible/roles/liberty_clear_logs/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Clear the Liberty logs directory + ansible.builtin.include_tasks: liberty_clear_logs.yml diff --git a/ansible/roles/liberty_collective/tasks/liberty_collective.yml b/ansible/roles/liberty_collective/tasks/liberty_collective.yml index be288b099..08320b932 100644 --- a/ansible/roles/liberty_collective/tasks/liberty_collective.yml +++ b/ansible/roles/liberty_collective/tasks/liberty_collective.yml @@ -3,34 +3,34 @@ tags: configure block: - name: check if liberty is installed - stat: + ansible.builtin.stat: path: "{{ install_base }}/{{ liberty_dir }}/bin/server" register: isliberty failed_when: isliberty.stat.exists == False - name: does controller exist? - stat: + ansible.builtin.stat: path: "{{ wlp_usr_dir }}/servers/{{ cc_server }}" register: iscc - name: stop existing controller process ignore_errors: true - shell: "{{ wlp_cmd }} {{install_base }}/{{ liberty_dir }}/bin/server stop {{ cc_server }}" - when: iscc.stat.exists == True + ansible.builtin.shell: "{{ wlp_cmd }} {{install_base }}/{{ liberty_dir }}/bin/server stop {{ cc_server }}" + when: iscc.stat.exists register: op - - debug: - msg: '{{ op }}' + - ansible.builtin.debug: + msg: '{{ op }}' - name: Remove current controller server - file: + ansible.builtin.file: path: "{{ item }}" state: absent with_items: - "{{ wlp_usr_dir }}/servers/{{ cc_server }}" - name: OS400 Remove current controller server output - file: + ansible.builtin.file: path: "{{ item }}" state: absent with_items: @@ -38,110 +38,143 @@ when: ansible_system == 'OS400' - name: create server - shell: "{{ wlp_cmd }} {{install_base }}/{{ liberty_dir }}/bin/server create {{ cc_server }}" + ansible.builtin.shell: "{{ wlp_cmd }} {{install_base }}/{{ liberty_dir }}/bin/server create {{ cc_server }}" register: op - - debug: - msg: '{{ op.stdout_lines }}' + - ansible.builtin.debug: + msg: '{{ op.stdout_lines }}' - name: create controller - shell: "{{install_base }}/{{ liberty_dir }}/bin/collective create {{ cc_server }} --keystorePassword={{ liberty_admin_pass }} --createConfigFile=controller.xml" + ansible.builtin.shell: "{{install_base }}/{{ liberty_dir }}/bin/collective create {{ cc_server }} --hostName={{ cc_primary_server }} --keystorePassword={{ liberty_admin_pass }} --createConfigFile=controller.xml" args: chdir: "{{ wlp_usr_dir }}/servers/{{ cc_server }}" register: op - - debug: - msg: '{{ op.stdout_lines }}' + - ansible.builtin.debug: + msg: '{{ op.stdout_lines }}' - name: update admin user - replace: + ansible.builtin.replace: path: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/controller.xml" regexp: 'userName=""' replace: 'userName="{{ liberty_admin_user }}"' - name: update admin password - replace: + ansible.builtin.replace: path: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/controller.xml" regexp: 'userPassword=""' replace: 'userPassword="{{ liberty_admin_pass }}"' - name: update to tlsv1.2 - lineinfile: + ansible.builtin.lineinfile: path: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/controller.xml" - regexp: '^sslProtocol="TLSv1.2"' + regexp: 'sslProtocol="TLSv1.2"' insertafter: '' + line: ' ' + - name: include controller.xml in server.xml - lineinfile: + ansible.builtin.lineinfile: path: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/server.xml" regexp: '^controller.xml' insertbefore: '' line: ' ' + - name: configure remoteFileAccess for controller + ansible.builtin.lineinfile: + path: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/server.xml" + regexp: '^remoteFileAccess' + insertbefore: '' + line: ' ${server.config.dir}' + - name: listen externally - lineinfile: + ansible.builtin.lineinfile: path: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/server.xml" regexp: '^host="*"' insertbefore: 'httpPort=' line: ' host="*"' + # There's version confilict with jsp and mpHealth + - name: Remove jsp2.3 from feautres + ansible.builtin.lineinfile: + line: ' jsp-2.3' + path: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/server.xml" + state: absent + - name: add controller features - lineinfile: + ansible.builtin.lineinfile: path: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/server.xml" regexp: '^controller.xml' insertbefore: '' line: "{{ item }}" with_items: - - ' restConnector-1.0' + - ' pages-3.1' + - ' restConnector-2.0' - ' localConnector-1.0' - ' adminCenter-1.0' - ' ssl-1.0' - ' dynamicRouting-1.0' - ' scalingController-1.0' - - ' monitor-1.0' + - ' mpMetrics-5.1' + - ' mpHealth-4.0' - name: copy jvm.options template - template: + ansible.builtin.template: src: jvm.options.j2 dest: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/jvm.options" - name: set IBM i perms - include_role: + ansible.builtin.include_role: name: liberty_ibmi_grantauth # must use nohup else the server stops after the controller process exits - name: Start Liberty Controller Server failed_when: false - command: + ansible.builtin.command: cmd: "{{ wlp_nohup }} {{ wlp_cmd }} {{install_base }}/{{ liberty_dir }}/bin/server start {{ cc_server }} --clean" register: op - - debug: + - ansible.builtin.debug: msg: '{{ op.stdout_lines }}' - name: check server status failed_when: false - command: + ansible.builtin.command: cmd: "{{ wlp_cmd }} {{install_base }}/{{ liberty_dir }}/bin/server status {{ cc_server }}" register: op - - debug: + - ansible.builtin.debug: msg: '{{ op.stdout_lines }}' + when: controller_role == 'primary' \ No newline at end of file diff --git a/ansible/roles/liberty_collective/templates/jvm.options.j2 b/ansible/roles/liberty_collective/templates/jvm.options.j2 index 03b09d18a..d1ea64182 100644 --- a/ansible/roles/liberty_collective/templates/jvm.options.j2 +++ b/ansible/roles/liberty_collective/templates/jvm.options.j2 @@ -1,6 +1,5 @@ --Dhttps.protocols=TLSv1.2 --Xms{{ min_heap }} --Xmx{{ max_heap }} +#-Xms{{ min_heap }} +#-Xmx{{ max_heap }} #openJ9 jvm.options -verbose:gc -Xdump:heap diff --git a/ansible/roles/liberty_collective_backup_controllers/defaults/main.yml b/ansible/roles/liberty_collective_backup_controllers/defaults/main.yml new file mode 100644 index 000000000..007844303 --- /dev/null +++ b/ansible/roles/liberty_collective_backup_controllers/defaults/main.yml @@ -0,0 +1,3 @@ +--- +min_heap: '256m' +max_heap: '1024m' diff --git a/ansible/roles/liberty_collective_backup_controllers/meta/main.yml b/ansible/roles/liberty_collective_backup_controllers/meta/main.yml new file mode 100644 index 000000000..285b3d3fa --- /dev/null +++ b/ansible/roles/liberty_collective_backup_controllers/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: liberty_defaults diff --git a/ansible/roles/liberty_collective_backup_controllers/readme.md b/ansible/roles/liberty_collective_backup_controllers/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/liberty_collective_backup_controllers/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/liberty_collective_backup_controllers/tasks/liberty_collective_backup_controllers.yml b/ansible/roles/liberty_collective_backup_controllers/tasks/liberty_collective_backup_controllers.yml new file mode 100644 index 000000000..32b618aac --- /dev/null +++ b/ansible/roles/liberty_collective_backup_controllers/tasks/liberty_collective_backup_controllers.yml @@ -0,0 +1,210 @@ +--- +- name: Configure + when: + - controller_role is defined + - controller_role == 'backup' + tags: configure + block: + - name: Check if liberty is installed + ansible.builtin.stat: + path: "{{ install_base }}/{{ liberty_dir }}/bin/server" + register: isliberty + failed_when: isliberty.stat.exists == False + + - name: Does controller exist? + ansible.builtin.stat: + path: "{{ wlp_usr_dir }}/servers/{{ cc_server }}" + register: iscc + + - name: Stop existing controller process + ignore_errors: true + ansible.builtin.shell: "{{ wlp_cmd }} {{install_base }}/{{ liberty_dir }}/bin/server stop {{ cc_server }}" + when: iscc.stat.exists + register: op + + - name: Stop existing controller process output + ansible.builtin.debug: + msg: '{{ op }}' + + - name: Remove current controller server + ansible.builtin.file: + path: "{{ item }}" + state: absent + with_items: + - "{{ wlp_usr_dir }}/servers/{{ cc_server }}" + + - name: OS400 Remove current controller server output + ansible.builtin.file: + path: "{{ item }}" + state: absent + with_items: + - "{{ wlp_output }}/{{ cc_server }}" + when: ansible_system == 'OS400' + + - name: Create backup controller server + ansible.builtin.shell: "{{ wlp_cmd }} {{install_base }}/{{ liberty_dir }}/bin/server create {{ cc_server }}" + register: op + + - name: Check backup controller server + ansible.builtin.debug: + msg: '{{ op.stdout_lines }}' + + - name: Replicate backup controller + ansible.builtin.shell: + "{{ install_base }}/{{ liberty_dir }}/bin/collective replicate {{ cc_server }} \ + --host={{ cc_primary_server }} \ + --port={{ cc_primary_port }} \ + --user={{ liberty_admin_user }} \ + --password={{ liberty_admin_pass }} \ + --keystorePassword={{ liberty_admin_pass }} \ + --hostName={{ ansible_fqdn }} \ + --autoAcceptCertificates=true \ + --createConfigFile=controller.xml" + args: + chdir: "{{ wlp_usr_dir }}/servers/{{ cc_server }}" + register: op + + - name: Replicate backup controller output + ansible.builtin.debug: + msg: '{{ op.stdout_lines }}' + + - name: Update admin user + ansible.builtin.replace: + path: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/controller.xml" + regexp: 'userName=""' + replace: 'userName="{{ liberty_admin_user }}"' + - name: Update admin password + ansible.builtin.replace: + path: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/controller.xml" + regexp: 'userPassword=""' + replace: 'userPassword="{{ liberty_admin_pass }}"' + + - name: Update to tlsv1.2 + ansible.builtin.lineinfile: + path: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/controller.xml" + regexp: 'sslProtocol="TLSv1.2"' + insertafter: '' + line: ' ' + + - name: Include controller.xml in server.xml + ansible.builtin.lineinfile: + path: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/server.xml" + regexp: '^controller.xml' + insertbefore: '' + line: ' ' + + - name: Configure remoteFileAccess for controller + ansible.builtin.lineinfile: + path: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/server.xml" + regexp: '^remoteFileAccess' + insertbefore: '' + line: ' ${server.config.dir}' + + - name: Listen externally + ansible.builtin.lineinfile: + path: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/server.xml" + regexp: '^host="*"' + insertbefore: 'httpPort=' + line: ' host="*"' + + # There's version confilict with jsp and mpHealth + - name: Remove jsp2.3 from feautres + ansible.builtin.lineinfile: + line: ' jsp-2.3' + path: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/server.xml" + state: absent + + - name: Add controller features + ansible.builtin.lineinfile: + path: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/server.xml" + regexp: '^controller.xml' + insertbefore: '' + line: "{{ item }}" + with_items: + - ' pages-3.1' + - ' restConnector-2.0' + - ' localConnector-1.0' + - ' adminCenter-1.0' + - ' ssl-1.0' + - ' dynamicRouting-1.0' + - ' scalingController-1.0' + - ' mpMetrics-5.1' + - ' mpHealth-4.0' + + - name: Copy jvm.options template + ansible.builtin.template: + src: jvm.options.j2 + dest: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/jvm.options" + mode: '0755' + + - name: Set IBM i perms + ansible.builtin.include_role: + name: liberty_ibmi_grantauth + + # must use nohup else the server stops after the controller process exits + - name: Start Liberty Controller Server + failed_when: false + ansible.builtin.command: + cmd: "{{ wlp_nohup }} {{ wlp_cmd }} {{ install_base }}/{{ liberty_dir }}/bin/server start {{ cc_server }} --clean" + register: op + + - name: Start Liberty Controller Server output + ansible.builtin.debug: + msg: '{{ op.stdout_lines }}' + + - name: Add replica backup controller + ansible.builtin.shell: + "{{install_base }}/{{ liberty_dir }}/bin/collective addReplica {{ ansible_fqdn }}:10010 \ + --host={{ cc_primary_server }} \ + --port={{ cc_primary_port }} \ + --user={{ liberty_admin_user }} \ + --password={{ liberty_admin_pass }} \ + --autoAcceptCertificates=true" + args: + chdir: "{{ wlp_usr_dir }}/servers/{{ cc_server }}" + register: op + + - name: Check server status + failed_when: false + ansible.builtin.command: + cmd: "{{ wlp_cmd }} {{ install_base }}/{{ liberty_dir }}/bin/server status {{ cc_server }}" + register: op + + - name: Check server status output + ansible.builtin.debug: + msg: '{{ op.stdout_lines }}' + diff --git a/ansible/roles/liberty_collective_backup_controllers/tasks/main.yml b/ansible/roles/liberty_collective_backup_controllers/tasks/main.yml new file mode 100644 index 000000000..70537b28b --- /dev/null +++ b/ansible/roles/liberty_collective_backup_controllers/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Liberty backup controllers + ansible.builtin.include_tasks: liberty_collective_backup_controllers.yml diff --git a/ansible/roles/liberty_collective_backup_controllers/templates/jvm.options.j2 b/ansible/roles/liberty_collective_backup_controllers/templates/jvm.options.j2 new file mode 100644 index 000000000..d1ea64182 --- /dev/null +++ b/ansible/roles/liberty_collective_backup_controllers/templates/jvm.options.j2 @@ -0,0 +1,7 @@ +#-Xms{{ min_heap }} +#-Xmx{{ max_heap }} +#openJ9 jvm.options +-verbose:gc +-Xdump:heap +-Xaggressive +-Xverbosegclog:logs/verbosegc.log,200,10000 diff --git a/ansible/roles/liberty_daytrader10/defaults/main.yml b/ansible/roles/liberty_daytrader10/defaults/main.yml new file mode 100644 index 000000000..353474828 --- /dev/null +++ b/ansible/roles/liberty_daytrader10/defaults/main.yml @@ -0,0 +1,21 @@ +--- +install_base: '/home/nest' +liberty_dir: 'wlp' +wl_server: 'server' +min_heap: '1G' +max_heap: '3G' +cluster_name: 'DayTrader10' +db_user: 'db2inst1' +db_user1: 'db2inst1' +db_pass: 'guessme' +db_pass1: 'guessme' +db_host: 'dbhost' +db_host1: 'dbhost' +db_port: '50000' +db_port1: '50000' +db_name: 'tradedb' +# could be sessions if separate db +db_name1: 'tradedb' +console_log_level: 'OFF' +liberty_max_logs: 20 +liberty_max_file_size: 20 # MB diff --git a/ansible/roles/liberty_daytrader10/meta/main.yml b/ansible/roles/liberty_daytrader10/meta/main.yml new file mode 100644 index 000000000..285b3d3fa --- /dev/null +++ b/ansible/roles/liberty_daytrader10/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: liberty_defaults diff --git a/ansible/roles/liberty_daytrader10/readme.md b/ansible/roles/liberty_daytrader10/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/liberty_daytrader10/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/liberty_daytrader10/tasks/liberty_daytrader10.yml b/ansible/roles/liberty_daytrader10/tasks/liberty_daytrader10.yml new file mode 100644 index 000000000..8a230a206 --- /dev/null +++ b/ansible/roles/liberty_daytrader10/tasks/liberty_daytrader10.yml @@ -0,0 +1,88 @@ +--- +- name: DayTrader10 + tags: daytrader10 + block: + - name: check if liberty is installed + ansible.builtin.stat: + path: "{{ install_base }}/{{ liberty_dir }}/bin/server" + register: isliberty + failed_when: isliberty.stat.exists == False + + - name: copy jvm.options template + ansible.builtin.template: + src: jvm.options.j2 + dest: "{{ wlp_usr_dir }}/servers/{{ wl_server }}/jvm.options" + - name: copy server.xml template + ansible.builtin.template: + src: server.xml.j2 + dest: "{{ wlp_usr_dir }}/servers/{{ wl_server }}/server.xml" + - name: copy bootstrap.properties template + ansible.builtin.template: + src: bootstrap.properties.j2 + dest: "{{ wlp_usr_dir }}/servers/{{ wl_server }}/bootstrap.properties" + + - name: copy application war + ansible.builtin.copy: + src: "{{ appLoc }}" # files/io.openliberty.sample.daytrader10.war + dest: "{{ wlp_usr_dir }}/shared/apps/io.openliberty.sample.daytrader10.war" + mode: '0755' + + - name: db2jars dir + ansible.builtin.file: + path: '{{ item }}' + state: directory + recurse: yes + with_items: + - "{{ wlp_usr_dir }}/shared/resources/db2jars" + + - name: copy db2jcc4.jar + ansible.builtin.copy: + src: /tmp/db2jcc4.jar + dest: "{{ wlp_usr_dir }}/shared/resources/db2jars/db2jcc4.jar" + mode: '0755' + + - name: autoAcceptCertificates + ansible.builtin.lineinfile: + path: "{{ wlp_usr_dir }}/servers/{{ wl_server }}/server.env" + regexp: 'autoAcceptCertificates' + line: 'JVM_ARGS=-Dcom.ibm.websphere.collective.utility.autoAcceptCertificates=true' + + #### THIS IS ONLY TEMP SCHADER dirty fix + - name: THIS IS ONLY TEMP SCHADER dirty fix - switch to 64bit jdk + ansible.builtin.replace: + path: "{{install_base }}/{{ liberty_dir }}/etc/default.env" + regexp: '32bit' + replace: '64bit' + when: ansible_system == 'OS400' + + - name: Conditional role + ansible.builtin.include_role: + name: liberty_ibmi_grantauth + + - name: Stop Liberty Server + ansible.builtin.command: + cmd: "{{ wlp_cmd }} {{install_base }}/{{ liberty_dir }}/bin/server stop {{ wl_server }}" + register: cmdOutput + failed_when: ( cmdOutput.rc not in [ 0, 1 ] ) + + - debug: + msg: '{{ cmdOutput.stdout_lines }}' + + # must use nohup else the server stops after the controlling process exits + - name: Start Liberty Server + ansible.builtin.command: + cmd: "{{ wlp_nohup }} {{ wlp_cmd }} {{install_base }}/{{ liberty_dir }}/bin/server start {{ wl_server }} --clean" + register: cmdOutput + failed_when: ( cmdOutput.rc not in [ 0, 1 ] ) + + - debug: + msg: '{{ cmdOutput.stdout_lines }}' + + - name: check server status + ansible.builtin.command: + cmd: "{{ wlp_cmd }} {{install_base }}/{{ liberty_dir }}/bin/server status {{ wl_server }}" + register: cmdOutput + failed_when: ( cmdOutput.rc not in [ 0, 1 ] ) + + - debug: + msg: '{{ cmdOutput.stdout_lines }}' diff --git a/ansible/roles/liberty_daytrader10/tasks/main.yml b/ansible/roles/liberty_daytrader10/tasks/main.yml new file mode 100644 index 000000000..d9dcbba7d --- /dev/null +++ b/ansible/roles/liberty_daytrader10/tasks/main.yml @@ -0,0 +1,2 @@ +--- +- include_tasks: liberty_daytrader10.yml diff --git a/ansible/roles/liberty_daytrader10/templates/bootstrap.properties.j2 b/ansible/roles/liberty_daytrader10/templates/bootstrap.properties.j2 new file mode 100644 index 000000000..46cfd0ef9 --- /dev/null +++ b/ansible/roles/liberty_daytrader10/templates/bootstrap.properties.j2 @@ -0,0 +1,3 @@ +com.ibm.ws.logging.console.log.level={{ console_log_level }} +com.ibm.ws.logging.max.files={{ liberty_max_logs }} +com.ibm.ws.logging.max.file.size={{ liberty_max_file_size }} \ No newline at end of file diff --git a/ansible/roles/liberty_daytrader10/templates/jvm.options.j2 b/ansible/roles/liberty_daytrader10/templates/jvm.options.j2 new file mode 100644 index 000000000..86a0b9624 --- /dev/null +++ b/ansible/roles/liberty_daytrader10/templates/jvm.options.j2 @@ -0,0 +1,7 @@ +-Xms{{ min_heap }} +-Xmx{{ max_heap }} +#openJ9 jvm.options +-verbose:gc +-Xdump:heap +-Xaggressive +-Xverbosegclog:logs/verbosegc.log,200,10000 diff --git a/ansible/roles/liberty_daytrader10/templates/server.xml.j2 b/ansible/roles/liberty_daytrader10/templates/server.xml.j2 new file mode 100644 index 000000000..b4f93f947 --- /dev/null +++ b/ansible/roles/liberty_daytrader10/templates/server.xml.j2 @@ -0,0 +1,119 @@ + + + jakartaee-10.0 + mpHealth-4.0 + mpMetrics-5.1 + clusterMember-1.0 + monitor-1.0 + sessionDatabase-1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + admin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${server.config.dir} + + diff --git a/ansible/roles/liberty_daytrader8/defaults/main.yml b/ansible/roles/liberty_daytrader8/defaults/main.yml index fa188d805..95fc7bf92 100644 --- a/ansible/roles/liberty_daytrader8/defaults/main.yml +++ b/ansible/roles/liberty_daytrader8/defaults/main.yml @@ -16,3 +16,6 @@ db_port1: '50000' db_name: 'tradedb' # could be sessions if separate db db_name1: 'tradedb' +console_log_level: OFF +liberty_max_logs: 20 +liberty_max_file_size: 20 # MB diff --git a/ansible/roles/liberty_daytrader8/files/io.openliberty.sample.daytrader8.war b/ansible/roles/liberty_daytrader8/files/io.openliberty.sample.daytrader8.war deleted file mode 100644 index 3ccf8d5fa..000000000 Binary files a/ansible/roles/liberty_daytrader8/files/io.openliberty.sample.daytrader8.war and /dev/null differ diff --git a/ansible/roles/liberty_daytrader8/tasks/liberty_daytrader8.yml b/ansible/roles/liberty_daytrader8/tasks/liberty_daytrader8.yml index 9f3bf57ef..1b0e5ee04 100644 --- a/ansible/roles/liberty_daytrader8/tasks/liberty_daytrader8.yml +++ b/ansible/roles/liberty_daytrader8/tasks/liberty_daytrader8.yml @@ -16,10 +16,14 @@ template: src: server.xml.j2 dest: "{{ wlp_usr_dir }}/servers/{{ wl_server }}/server.xml" + - name: copy bootstrap.properties template + template: + src: bootstrap.properties.j2 + dest: "{{ wlp_usr_dir }}/servers/{{ wl_server }}/bootstrap.properties" - name: copy application war copy: - src: files/io.openliberty.sample.daytrader8.war + src: "{{ appLoc }}" # files/io.openliberty.sample.daytrader8.war dest: "{{ wlp_usr_dir }}/shared/apps/io.openliberty.sample.daytrader8.war" mode: '0755' @@ -36,11 +40,6 @@ src: /tmp/db2jcc4.jar dest: "{{ wlp_usr_dir }}/shared/resources/db2jars/db2jcc4.jar" mode: '0755' - - name: copy db2jcc_license_cu.jar - copy: - src: /tmp/db2jcc_license_cu.jar - dest: "{{ wlp_usr_dir }}/shared/resources/db2jars/db2jcc_license_cu.jar" - mode: '0755' - name: autoAcceptCertificates lineinfile: diff --git a/ansible/roles/liberty_daytrader8/templates/bootstrap.properties.j2 b/ansible/roles/liberty_daytrader8/templates/bootstrap.properties.j2 new file mode 100644 index 000000000..46cfd0ef9 --- /dev/null +++ b/ansible/roles/liberty_daytrader8/templates/bootstrap.properties.j2 @@ -0,0 +1,3 @@ +com.ibm.ws.logging.console.log.level={{ console_log_level }} +com.ibm.ws.logging.max.files={{ liberty_max_logs }} +com.ibm.ws.logging.max.file.size={{ liberty_max_file_size }} \ No newline at end of file diff --git a/ansible/roles/liberty_daytrader8/templates/jvm.options.j2 b/ansible/roles/liberty_daytrader8/templates/jvm.options.j2 index 03b09d18a..86a0b9624 100644 --- a/ansible/roles/liberty_daytrader8/templates/jvm.options.j2 +++ b/ansible/roles/liberty_daytrader8/templates/jvm.options.j2 @@ -1,4 +1,3 @@ --Dhttps.protocols=TLSv1.2 -Xms{{ min_heap }} -Xmx{{ max_heap }} #openJ9 jvm.options diff --git a/ansible/roles/liberty_daytrader8/templates/server.xml.j2 b/ansible/roles/liberty_daytrader8/templates/server.xml.j2 index edcbb433e..bf7eb634d 100644 --- a/ansible/roles/liberty_daytrader8/templates/server.xml.j2 +++ b/ansible/roles/liberty_daytrader8/templates/server.xml.j2 @@ -20,6 +20,7 @@ scalingMember-1.0 requestTiming-1.0 monitor-1.0 + mpHealth-3.1 @@ -27,7 +28,8 @@ - + + @@ -73,7 +75,7 @@ - + @@ -92,8 +94,8 @@ @@ -126,4 +128,7 @@ + + ${server.config.dir} + diff --git a/ansible/roles/liberty_defaults/defaults/main.yml b/ansible/roles/liberty_defaults/defaults/main.yml index fb7e2cbd0..46a0f6a28 100644 --- a/ansible/roles/liberty_defaults/defaults/main.yml +++ b/ansible/roles/liberty_defaults/defaults/main.yml @@ -1,4 +1,6 @@ --- +cygwin: '' +ext: '.sh' install_base: '/home/nest' liberty_dir: 'wlp' liberty_admin_user: 'admin' @@ -7,5 +9,12 @@ liberty_admin_port: '9080' liberty_admin_ports: '9443' liberty_http_port: '9080' liberty_http_ports: '9443' +controller_role: primary +cc_primary_port: '{{ liberty_http_ports }}' cc_server: 'cc' wl_server: 'server' +shared_dir: 'IM-shared' +im_liberty_package: 'com.ibm.websphere.liberty.ND' +im_liberty_jdk_package: 'com.ibm.java.jdk.v' # no java version since we are using this to rollback / upgrade +im_java_short_version: '21' # com.ibm.java.jdk.v17 com.ibm.java.jdk.v11, com.ibm.java.jdk.8 +verboseGC: true diff --git a/ansible/roles/liberty_defaults/tasks/main.yml b/ansible/roles/liberty_defaults/tasks/main.yml index e2b206bf7..9fa07fed1 100644 --- a/ansible/roles/liberty_defaults/tasks/main.yml +++ b/ansible/roles/liberty_defaults/tasks/main.yml @@ -1,17 +1,22 @@ --- -- name: set wlp_cmd, wlp_nohup, wlp_usr_dir, wlp_output - set_fact: - wlp_cmd: " " - wlp_nohup: "nohup " - wlp_usr_dir: "{{ install_base }}/{{ liberty_dir }}/usr" - wlp_output: "{{ install_base }}/{{ liberty_dir }}/usr/servers" +- name: Set wlp_cmd, wlp_nohup + ansible.builtin.set_fact: + wlp_cmd: " " + wlp_nohup: "nohup " when: ansible_system != 'OS400' -- name: set OS400 wlp_cmd, wlp_nohup, wlp_usr_dir, wlp_output - set_fact: - wlp_cmd: "qsh " - wlp_nohup: "" - wlp_owner: qejbsvr - wlp_usr_dir: "/QIBM/UserData/WebSphere/Liberty/V85/ND/wlp/usr" - wlp_output: "/QIBM/UserData/WebSphere/Liberty/V85/ND/wlp/output/servers" + +- name: Set OS400 wlp_cmd, wlp_nohup, wlp_usr_dir, wlp_output + ansible.builtin.set_fact: + wlp_cmd: "qsh " + wlp_nohup: "" + wlp_owner: qejbsvr + wlp_usr_dir: "/QIBM/UserData/WebSphere/Liberty/V85/ND/wlp/usr" + wlp_output: "/QIBM/UserData/WebSphere/Liberty/V85/ND/wlp/output/servers" when: ansible_system == 'OS400' +- name: Check windoze + ansible.builtin.set_fact: + cygwin: 'c:/cygwin64' + ext: '.bat' + when: + - ansible_system == 'Windows' or 'CYG' in ansible_system diff --git a/ansible/roles/liberty_dynamicRouting/tasks/liberty_dynamicRouting.yml b/ansible/roles/liberty_dynamicRouting/tasks/liberty_dynamicRouting.yml index 42063bbbf..9b98a0392 100644 --- a/ansible/roles/liberty_dynamicRouting/tasks/liberty_dynamicRouting.yml +++ b/ansible/roles/liberty_dynamicRouting/tasks/liberty_dynamicRouting.yml @@ -1,8 +1,9 @@ --- -- name: dynamicRouting +- name: delay:ynamicRouting + when: controller_role == 'primary' tags: dynamicRouting block: - - name: check if liberty is installed + - name: Check if liberty is installed stat: path: "{{ install_base }}/{{ liberty_dir }}/bin/dynamicRouting" register: isliberty @@ -12,16 +13,16 @@ # im_install_http_plugin/templates/wct_definition.xml.j2 # im_install_http_plugin/defaults/main.yml # liberty_dynamicRouting/defaults/main.yml - - name: generate the dynamic routing files + - name: Generate the dynamic routing files failed_when: false - shell: "{{install_base }}/{{ liberty_dir }}/bin/dynamicRouting setup --port={{ liberty_admin_ports }} --host={{ ansible_hostname }} --user={{ liberty_admin_user }} --password={{ liberty_admin_pass }} --keystorePassword={{ liberty_admin_pass }} --pluginINstallRoot={{ install_ihs_base }}/{{ plugin_dir }} --autoAcceptCertificates --webServernames=webserver1" + shell: "{{ install_base }}/{{ liberty_dir }}/bin/dynamicRouting setup --port={{ liberty_admin_ports }} --host={{ cc_primary_server }} --user={{ liberty_admin_user }} --password={{ liberty_admin_pass }} --keystorePassword={{ liberty_admin_pass }} --pluginInstallRoot={{ install_ihs_base }}/{{ plugin_dir }} --autoAcceptCertificates --webServernames=webserver1" args: chdir: "{{ wlp_usr_dir }}/servers/{{ cc_server }}" register: dynamicRoutingOutput - - name: dynamicRoutingOutput - debug: - msg: "{{ dynamicRoutingOutput.stdout_lines }}" + - name: DynamicRoutingOutput + debug: + msg: "{{ dynamicRoutingOutput.stdout_lines }}" - name: Remove file local fetched files delegate_to: localhost @@ -32,11 +33,11 @@ - plugin-cfg.xml - plugin-key.p12 - - name: fetch generated files + - name: Fetch generated files fetch: src: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/{{ item }}" dest: "{{ item }}" flat: yes with_items: - - plugin-cfg.xml - - plugin-key.p12 + - plugin-cfg.xml + - plugin-key.p12 diff --git a/ansible/roles/liberty_dynamicRouting_plugin/tasks/liberty_dynamicRouting_plugin.yml b/ansible/roles/liberty_dynamicRouting_plugin/tasks/liberty_dynamicRouting_plugin.yml index 1fb3a6786..2dfb74b83 100644 --- a/ansible/roles/liberty_dynamicRouting_plugin/tasks/liberty_dynamicRouting_plugin.yml +++ b/ansible/roles/liberty_dynamicRouting_plugin/tasks/liberty_dynamicRouting_plugin.yml @@ -1,30 +1,31 @@ --- - name: dynamicRouting_plugin + when: controller_role == 'primary' tags: dynamicRouting block: - name: check if ihs is installed stat: - path: "{{ install_ihs_base }}/{{ http_dir }}/bin/gskcapicmd" + path: "{{ install_ihs_base }}/{{ http_dir }}/bin" register: ishttp failed_when: ishttp.stat.exists == False - name: copy generated files copy: src: "{{ item }}" - dest: "{{install_ihs_base }}/{{ plugin_dir }}/config/webserver1/{{ item }}" + dest: "{{ install_ihs_base }}/{{ plugin_dir }}/config/{{ webServerName }}/{{ item }}" with_items: - plugin-cfg.xml - plugin-key.p12 - name: Remove any previous plugin-key* files file: - path: "{{install_ihs_base }}/{{ plugin_dir }}/config/webserver1/{{ item }}" + path: "{{ install_ihs_base }}/{{ plugin_dir }}/config/{{ webServerName }}/{{ item }}" state: absent with_items: - - plugin-key.kdb - - plugin-key.rdb - - plugin-key.crl - - plugin-key.sth + - plugin-key.kdb + - plugin-key.rdb + - plugin-key.crl + - plugin-key.sth # some values defaults from # im_install_http_plugin/templates/wct_definition.xml.j2 @@ -32,9 +33,9 @@ # liberty_dynamicRouting/defaults/main.yml - name: gskcapicmd convert failed_when: false - shell: "{{install_ihs_base }}/{{ http_dir }}/bin/gskcapicmd -keydb -convert -pw {{ liberty_admin_pass }} -db plugin-key.p12 -old_format pkcs12 -target plugin-key.kdb -new_format cms -stash" + shell: "{{ install_ihs_base }}/{{ http_dir }}/bin/gskcapicmd{{ ext }} -keydb -convert -pw {{ liberty_admin_pass }} -db plugin-key.p12 -old_format pkcs12 -target plugin-key.kdb -new_format cms -stash" args: - chdir: "{{install_ihs_base }}/{{ plugin_dir }}/config/webserver1" + chdir: "{{ install_ihs_base }}/{{ plugin_dir }}/config/{{ webServerName }}" register: gskcapicmdOutput - name: gskcapicmdOutput @@ -43,7 +44,7 @@ - name: gskcapicmd setdefault cert aliase failed_when: false - shell: "{{install_ihs_base }}/{{ http_dir }}/bin/gskcapicmd -cert -setdefault -pw {{ liberty_admin_pass }} -db plugin-key.kdb -label default" + shell: "{{ install_ihs_base }}/{{ http_dir }}/bin/gskcapicmd{{ ext }} -cert -setdefault -pw {{ liberty_admin_pass }} -db plugin-key.kdb -label default" args: chdir: "{{install_ihs_base }}/{{ plugin_dir }}/config/webserver1" register: gskcapicmdcertOutput @@ -52,11 +53,67 @@ debug: msg: "{{ gskcapicmdcertOutput.stdout_lines }}" - - name: HTTPServer graceful load new routing + - name: Windoze HTTPServer restart + when: ansible_system == 'Windows' or 'CYG' in ansible_system + block: + # adjust the windoze paths due to some cygwin failures + # + # + # for some reason having logs in c:/cygwin64/nest/HTTPServer/logs does not work, I think too many symlink levels + - name: Windoze create c:/temp/logs + ansible.builtin.file: + path: "c:/temp/logs" + state: directory + - name: Windoze create c:/temp/keys + ansible.builtin.file: + path: "c:/temp/keys" + state: directory + - name: Switch the windoze path to the http_plugin.log + ansible.builtin.replace: + path: "{{ install_ihs_base }}/{{ plugin_dir }}/config/{{ webServerName }}/plugin-cfg.xml" + regexp: '{{ install_ihs_base }}/{{ plugin_dir }}/logs/{{ webServerName }}' + replace: 'c:/temp/logs' + - name: Switch the windoze path to the plugin-key* keyring files + ansible.builtin.replace: + path: "{{ install_ihs_base }}/{{ plugin_dir }}/config/{{ webServerName }}/plugin-cfg.xml" + regexp: '{{ install_ihs_base }}/{{ plugin_dir }}/config/{{ webServerName }}' + replace: 'c:/temp/keys' + - name: Switch the windoze path to the plugin-key* PluginInstallRoot files + ansible.builtin.replace: + path: "{{ install_ihs_base }}/{{ plugin_dir }}/config/{{ webServerName }}/plugin-cfg.xml" + regexp: '{{ install_ihs_base }}/{{ plugin_dir }}' + replace: '{{ cygwin }}{{ install_ihs_base }}/{{ plugin_dir }}' + - name: Copy the modified windoze file to c:/temp/keys + ansible.builtin.copy: + src: "{{ install_ihs_base }}/{{ plugin_dir }}/config/{{ webServerName }}/{{ item }}" + dest: '/cygdrive/c/temp/keys/{{ item }}' + remote_src: true + local_follow: false + with_items: + - plugin-key.kdb + - plugin-key.rdb + - plugin-key.crl + - plugin-key.sth + - name: Remove any previous plugin-key* files ( windoze ) + ansible.builtin.file: + path: "{{ install_ihs_base }}/{{ plugin_dir }}/config/{{ webServerName }}/{{ item }}" + state: absent + with_items: + - plugin-key.kdb + - plugin-key.rdb + - plugin-key.crl + - plugin-key.sth + - name: Add windoze text file with info about where the plugin-key files are + ansible.builtin.copy: + content: 'all plugin-key* files are in c:/temp/keys/' + dest: "{{ install_ihs_base }}/{{ plugin_dir }}/config/{{ webServerName }}/where_are_plugin_key_files.txt" + - name: Apache stop + ansible.builtin.shell: "{{install_ihs_base }}/{{ http_dir }}/bin/apache -k stop -n 'IBMHTTPServer'" + - name: Apache start + ansible.builtin.shell: "{{install_ihs_base }}/{{ http_dir }}/bin/apache -k start -n 'IBMHTTPServer'" + + - name: HTTPServer graceful load new routing ( *nix ) + when: ansible_system is not search('CYG') failed_when: false - shell: "{{install_ihs_base }}/{{ http_dir }}/bin/apachectl graceful" - register: gracefulOutput + shell: "{{ install_ihs_base }}/{{ http_dir }}/bin/apachectl graceful" - - name: gracefulOutput - debug: - msg: "{{ gracefulOutput.stdout_lines }}" diff --git a/ansible/roles/liberty_enterMaintenanceMode/defaults/main.yml b/ansible/roles/liberty_enterMaintenanceMode/defaults/main.yml new file mode 100644 index 000000000..ed97d539c --- /dev/null +++ b/ansible/roles/liberty_enterMaintenanceMode/defaults/main.yml @@ -0,0 +1 @@ +--- diff --git a/ansible/roles/liberty_enterMaintenanceMode/meta/main.yml b/ansible/roles/liberty_enterMaintenanceMode/meta/main.yml new file mode 100644 index 000000000..285b3d3fa --- /dev/null +++ b/ansible/roles/liberty_enterMaintenanceMode/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: liberty_defaults diff --git a/ansible/roles/liberty_enterMaintenanceMode/readme.md b/ansible/roles/liberty_enterMaintenanceMode/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/liberty_enterMaintenanceMode/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/liberty_enterMaintenanceMode/tasks/liberty_enterMaintenanceMode.yml b/ansible/roles/liberty_enterMaintenanceMode/tasks/liberty_enterMaintenanceMode.yml new file mode 100644 index 000000000..d9063f554 --- /dev/null +++ b/ansible/roles/liberty_enterMaintenanceMode/tasks/liberty_enterMaintenanceMode.yml @@ -0,0 +1,56 @@ +--- +- name: Liberty enterMaintenanceMode + tags: enterMaintenanceMode + block: + - name: Check if liberty is installed + ansible.builtin.stat: + path: "{{ install_base }}/{{ liberty_dir }}/bin/collective" + register: isliberty + failed_when: isliberty.stat.exists == False + + - name: Is cc_hostname defined? + when: cc_hostname is defined + block: + - name: Test connection to controller + ansible.builtin.get_url: + url: "https://{{ cc_hostname }}:{{ liberty_admin_ports }}/adminCenter" + dest: "/tmp/cc_alive_{{ cc_hostname }}" + mode: '0755' + validate_certs: false + timeout: 2 + register: ccalive + ignore_errors: true + + - name: Delete temp file + ansible.builtin.file: + state: absent + path: "/tmp/cc_alive_{{ cc_hostname }}" + + - name: Controller is not reachable + ansible.builtin.debug: + msg: "Controller->{{ cc_hostname }}:{{ liberty_admin_ports }} is not reachable, skipping maint op" + when: ccalive.msg is search('Request failed') or ccalive.status_code is not defined + + - name: Controller is alive + when: + - ccalive.status_code is defined + - ccalive.status_code == 200 + block: + - name: Liberty enterMaintenanceMode + ansible.builtin.shell: + "{{ install_base }}/{{ liberty_dir }}/bin/collective enterMaintenanceMode \ + --host={{ cc_hostname }} \ + --port={{ liberty_admin_ports }} \ + --user={{ liberty_admin_user }} \ + --password={{ liberty_admin_pass }} \ + --hostName={{ ansible_fqdn }} \ + --usrDir={{ cygwin }}{{ wlp_usr_dir }} \ + --server={{ wl_server }} \ + --autoAcceptCertificates \ + --break \ + --force" + register: enterMaintenanceModeOutput + + - name: Liberty enterMaintenanceModeOutput + ansible.builtin.debug: + msg: "{{ enterMaintenanceModeOutput.stdout_lines }}" diff --git a/ansible/roles/liberty_enterMaintenanceMode/tasks/main.yml b/ansible/roles/liberty_enterMaintenanceMode/tasks/main.yml new file mode 100644 index 000000000..2d6f59615 --- /dev/null +++ b/ansible/roles/liberty_enterMaintenanceMode/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Liberty enterMaintenanceMode + ansible.builtin.include_tasks: liberty_enterMaintenanceMode.yml diff --git a/ansible/roles/liberty_exitMaintenanceMode/defaults/main.yml b/ansible/roles/liberty_exitMaintenanceMode/defaults/main.yml new file mode 100644 index 000000000..ed97d539c --- /dev/null +++ b/ansible/roles/liberty_exitMaintenanceMode/defaults/main.yml @@ -0,0 +1 @@ +--- diff --git a/ansible/roles/liberty_exitMaintenanceMode/meta/main.yml b/ansible/roles/liberty_exitMaintenanceMode/meta/main.yml new file mode 100644 index 000000000..285b3d3fa --- /dev/null +++ b/ansible/roles/liberty_exitMaintenanceMode/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: liberty_defaults diff --git a/ansible/roles/liberty_exitMaintenanceMode/readme.md b/ansible/roles/liberty_exitMaintenanceMode/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/liberty_exitMaintenanceMode/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/liberty_exitMaintenanceMode/tasks/liberty_exitMaintenanceMode.yml b/ansible/roles/liberty_exitMaintenanceMode/tasks/liberty_exitMaintenanceMode.yml new file mode 100644 index 000000000..a4f61b8ce --- /dev/null +++ b/ansible/roles/liberty_exitMaintenanceMode/tasks/liberty_exitMaintenanceMode.yml @@ -0,0 +1,54 @@ +--- +- name: Liberty exitMaintenanceMode + tags: exitMaintenanceMode + block: + - name: Check if liberty is installed + ansible.builtin.stat: + path: "{{ install_base }}/{{ liberty_dir }}/bin/collective" + register: isliberty + failed_when: isliberty.stat.exists == False + + - name: Is cc_hostname defined? + when: cc_hostname is defined + block: + - name: Test connection to controller + get_url: + url: "https://{{ cc_hostname }}:{{ liberty_admin_ports }}/adminCenter" + dest: "/tmp/cc_alive_{{ cc_hostname }}" + mode: '0755' + validate_certs: false + timeout: 2 + register: ccalive + ignore_errors: true + + - name: Delete temp file + file: + state: absent + path: "/tmp/cc_alive_{{ cc_hostname }}" + + - name: Controller is not reachable + ansible.builtin.debug: + msg: "Controller->{{ cc_hostname }}:{{ liberty_admin_ports }} is not reachable, skipping maint op" + when: ccalive.msg is search('Request failed') or ccalive.status_code is not defined + + - name: Controller is alive + when: + - ccalive.status_code is defined + - ccalive.status_code == 200 + block: + - name: Liberty exitMaintenanceMode + ansible.builtin.shell: + "{{ install_base }}/{{ liberty_dir }}/bin/collective exitMaintenanceMode \ + --host={{ cc_hostname }} \ + --port={{ liberty_admin_ports }} \ + --user={{ liberty_admin_user }} \ + --password={{ liberty_admin_pass }} \ + --hostName={{ ansible_fqdn }} \ + --usrDir={{ cygwin }}{{ wlp_usr_dir }} \ + --server={{ wl_server }} \ + --autoAcceptCertificates" + register: exitMaintenanceModeOutput + + - name: Liberty exitMaintenanceModeModeOutput + ansible.builtin.debug: + msg: "{{ exitMaintenanceModeOutput.stdout_lines }}" diff --git a/ansible/roles/liberty_exitMaintenanceMode/tasks/main.yml b/ansible/roles/liberty_exitMaintenanceMode/tasks/main.yml new file mode 100644 index 000000000..c412af47a --- /dev/null +++ b/ansible/roles/liberty_exitMaintenanceMode/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Liberty exitMaintenanceMode + ansible.builtin.include_tasks: liberty_exitMaintenanceMode.yml diff --git a/ansible/roles/liberty_fetch_plugins/tasks/liberty_fetch_plugins.yml b/ansible/roles/liberty_fetch_plugins/tasks/liberty_fetch_plugins.yml index 6febf60fb..08e0ec7e2 100644 --- a/ansible/roles/liberty_fetch_plugins/tasks/liberty_fetch_plugins.yml +++ b/ansible/roles/liberty_fetch_plugins/tasks/liberty_fetch_plugins.yml @@ -1,18 +1,21 @@ --- -- name: Remove plugin-cfg.xml and plugin-key.p12 local fetched files - delegate_to: localhost - file: - path: "{{ item }}" - state: absent - with_items: - - plugin-cfg.xml - - plugin-key.p12 +- name: dynamicRouting + when: controller_role == 'primary' + block: + - name: Remove plugin-cfg.xml and plugin-key.p12 local fetched files + delegate_to: localhost + file: + path: "{{ item }}" + state: absent + with_items: + - plugin-cfg.xml + - plugin-key.p12 -- name: fetch plugin-cfg.xml and plugin-key.p12 generated files - fetch: - src: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/{{ item }}" - dest: "{{ item }}" - flat: yes - with_items: - - plugin-cfg.xml - - plugin-key.p12 + - name: fetch plugin-cfg.xml and plugin-key.p12 generated files + fetch: + src: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/{{ item }}" + dest: "{{ item }}" + flat: yes + with_items: + - plugin-cfg.xml + - plugin-key.p12 diff --git a/ansible/roles/liberty_get_configs/defaults/main.yml b/ansible/roles/liberty_get_configs/defaults/main.yml new file mode 100644 index 000000000..898029c80 --- /dev/null +++ b/ansible/roles/liberty_get_configs/defaults/main.yml @@ -0,0 +1,4 @@ +--- + +env_name: myLibertyEnv +configs_dir: "{{ playbook_dir }}" # location on the ansible controller diff --git a/ansible/roles/liberty_get_configs/meta/main.yml b/ansible/roles/liberty_get_configs/meta/main.yml new file mode 100644 index 000000000..285b3d3fa --- /dev/null +++ b/ansible/roles/liberty_get_configs/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: liberty_defaults diff --git a/ansible/roles/liberty_get_configs/readme.md b/ansible/roles/liberty_get_configs/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/liberty_get_configs/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/liberty_get_configs/tasks/liberty_get_configs.yml b/ansible/roles/liberty_get_configs/tasks/liberty_get_configs.yml new file mode 100644 index 000000000..6d999307e --- /dev/null +++ b/ansible/roles/liberty_get_configs/tasks/liberty_get_configs.yml @@ -0,0 +1,158 @@ +--- +- name: Any Liberty configs block + when: not (more_enabled | default(false)) + block: + - name: Any configs? + ansible.builtin.stat: + path: "{{ wlp_usr_dir }}/servers/{{ wl_server }}/server.xml" + register: isconfig + + - name: Config archive logic + when: isconfig.stat.exists + block: + - name: Archive the liberty config files to fetch + community.general.archive: + path: + - "{{ wlp_usr_dir }}/shared/*" # needs * to allow the exclude_path to work + - "{{ wlp_usr_dir }}/servers/{{ wl_server }}/bootstrap.properties" + - "{{ wlp_usr_dir }}/servers/{{ wl_server }}/*.xml" + - "{{ wlp_usr_dir }}/servers/{{ wl_server }}/jvm.options" + - "{{ wlp_usr_dir }}/servers/{{ wl_server }}/server.env" + - "{{ wlp_usr_dir }}/servers/{{ wl_server }}/configDropins" + - "{{ wlp_usr_dir }}/servers/{{ wl_server }}/dropins" + # Instead of including the entire apps directory and trying to exclude expanded, + # we'll explicitly include only what we want from the apps directory + - "{{ wlp_usr_dir }}/servers/{{ wl_server }}/apps/*.xml" + - "{{ wlp_usr_dir }}/servers/{{ wl_server }}/apps/*.ear" + - "{{ wlp_usr_dir }}/servers/{{ wl_server }}/apps/*.war" + dest: configs.zip + exclude_path: + - "{{ wlp_usr_dir }}/shared/stackGroups" + exclusion_patterns: + - '*.jar' + - '*.zip' + - '*.tar' + - '*.tgz' + - '*.gz' + format: zip + +- name: Any MoRE Liberty configs block + when: more_enabled | default(false) + block: + + - name: set fact + set_fact: + more_config_dir: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/config/cells/{{ cellName }}/nodes/{{ profile_name }}/managedLiberty/usr/servers/{{ wl_server }}" + + - name: Any configs? + ansible.builtin.stat: + path: "{{ more_config_dir }}/server.xml" + register: isconfig + + - name: Config archive logic + when: isconfig.stat.exists + block: + - name: Archive the liberty config files to fetch + community.general.archive: + path: + # - "{{ wlp_usr_dir }}/shared/*" # needs * to allow the exclude_path to work + - "{{ more_config_dir }}/bootstrap.properties" + - "{{ more_config_dir }}/*.xml" + - "{{ more_config_dir }}/jvm.options" + - "{{ more_config_dir }}/server.env" + - "{{ more_config_dir }}/configDropins" + - "{{ more_config_dir }}/dropins" + # Instead of including the entire apps directory and trying to exclude expanded, + # we'll explicitly include only what we want from the apps directory + - "{{ more_config_dir }}/apps/*.xml" + - "{{ more_config_dir }}/apps/*.ear" + - "{{ more_config_dir }}/apps/*.war" + dest: configs.zip + exclude_path: + - "{{ more_config_dir }}/shared/stackGroups" + exclusion_patterns: + - '*.jar' + - '*.zip' + - '*.tar' + - '*.tgz' + - '*.gz' + format: zip + +- name: Any configs.zip + ansible.builtin.stat: + path: configs.zip + register: isconfigszip + +- name: Config archive logic + when: isconfigszip.stat.exists + block: + + - name: Fetch the liberty config archive + ansible.builtin.fetch: + src: configs.zip + dest: "{{ configs_dir }}/{{ env_name }}/" + + - name: Remove temp configs.zip + ansible.builtin.file: + path: configs.zip + state: absent + + - name: Extract the liberty config archive + delegate_to: localhost + ansible.builtin.unarchive: + src: "{{ configs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/configs.zip" + dest: "{{ configs_dir }}/{{ env_name }}/{{ ansible_fqdn }}" + remote_src: false + when: not (more_enabled | default(false)) + + - name: Block Extract the MoRE liberty config archive + when: more_enabled | default(false) + block: + - name: Create the target server config directory + delegate_to: localhost + ansible.builtin.file: + path: "{{ configs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/servers/{{ wl_server }}" + state: directory + mode: '0755' + + - name: Extract the MoRE liberty config archive + delegate_to: localhost + ansible.builtin.unarchive: + src: "{{ configs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/configs.zip" + dest: "{{ configs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/servers/{{ wl_server }}" + remote_src: false + + - name: Find files with restricted permissions + ansible.builtin.find: + paths: "{{ configs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/servers/{{ wl_server }}/" + file_type: file + recurse: true + register: found_files + no_log: true + + - name: Change permissions from to 0755 + ansible.builtin.file: + path: "{{ item.path }}" + mode: '0755' + loop: "{{ found_files.files }}" + when: item.mode != '0755' + no_log: true + + # - name: List the contents of the config zip file ( debug ) + # delegate_to: localhost + # ansible.builtin.shell: "unzip -l {{ configs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/configs.zip" + # register: zipcontents + + # - name: List the contents of the config zip file output ( debug ) + # debug: + # msg: "{{ zipcontents.stdout_lines }}" + + - name: Remove configs.zip + delegate_to: localhost + file: + path: "{{ configs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/configs.zip" + state: absent + + - name: Server config directory location + debug: + msg: "{{ configs_dir }}/{{ env_name }}/{{ ansible_fqdn }}" diff --git a/ansible/roles/liberty_get_configs/tasks/main.yml b/ansible/roles/liberty_get_configs/tasks/main.yml new file mode 100644 index 000000000..f7f4defa9 --- /dev/null +++ b/ansible/roles/liberty_get_configs/tasks/main.yml @@ -0,0 +1,2 @@ +--- +- include_tasks: liberty_get_configs.yml \ No newline at end of file diff --git a/ansible/roles/liberty_get_dumps/defaults/main.yml b/ansible/roles/liberty_get_dumps/defaults/main.yml new file mode 100644 index 000000000..e44403963 --- /dev/null +++ b/ansible/roles/liberty_get_dumps/defaults/main.yml @@ -0,0 +1,3 @@ +--- +env_name: myLibertyEnv +dumps_dir: "{{ playbook_dir }}" # location on the ansible controller diff --git a/ansible/roles/liberty_get_dumps/meta/main.yml b/ansible/roles/liberty_get_dumps/meta/main.yml new file mode 100644 index 000000000..285b3d3fa --- /dev/null +++ b/ansible/roles/liberty_get_dumps/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: liberty_defaults diff --git a/ansible/roles/liberty_get_dumps/readme.md b/ansible/roles/liberty_get_dumps/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/liberty_get_dumps/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/liberty_get_dumps/tasks/liberty_get_dumps.yml b/ansible/roles/liberty_get_dumps/tasks/liberty_get_dumps.yml new file mode 100644 index 000000000..5d9f0093c --- /dev/null +++ b/ansible/roles/liberty_get_dumps/tasks/liberty_get_dumps.yml @@ -0,0 +1,130 @@ +--- +- name: Any Liberty dumps block + when: + - not (more_enabled | default(false)) + block: + - name: Any Cores? + ansible.builtin.shell: "ls {{ wlp_usr_dir }}/servers/{{ wl_server }}/javacore*" + register: iscore + failed_when: iscore.rc not in [0,2] + ignore_errors: True + #allows it to pass for z/OS + - name: Any Heapdumps? + ansible.builtin.shell: "ls {{ wlp_usr_dir }}/servers/{{ wl_server }}/heapdump*" + register: isheap + failed_when: isheap.rc not in [0,2] + ignore_errors: True + + - name: Dump archive logic + when: iscore.rc == 0 or isheap.rc == 0 + block: + - name: Archive the liberty dump zip to fetch + ignore_errors: True + community.general.archive: + path: + - "{{ wlp_usr_dir }}/servers/{{ wl_server }}/javacore*" + - "{{ wlp_usr_dir }}/servers/{{ wl_server }}/heapdump*" + dest: dumps.zip + format: zip + exclusion_patterns: + - '*.zip' + - '*.tar' + - '*.gz' + +- name: Any MoRE Liberty dumps block + when: more_enabled | default(false) + block: + - name: Any Cores? + ansible.builtin.shell: "ls {{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/logs/{{ wl_server }}/logs/javacore*" + register: iscore + failed_when: iscore.rc not in [0,2] + ignore_errors: True + #allows it to pass for z/OS + - name: Any Heapdumps? + ansible.builtin.shell: "ls {{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/logs/{{ wl_server }}/logs/heapdump*" + register: isheap + failed_when: isheap.rc not in [0,2] + ignore_errors: True + + - name: Dump archive logic + when: iscore.rc == 0 or isheap.rc == 0 + block: + - name: Archive the liberty dump zip to fetch + ignore_errors: True + community.general.archive: + path: + - "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/logs/{{ wl_server }}/logs/javacore*" + - "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/logs/{{ wl_server }}/logs/heapdump*" + dest: dumps.zip + format: zip + exclusion_patterns: + - '*.zip' + - '*.tar' + - '*.gz' + +- name: Any dumps.zip + ansible.builtin.stat: + path: dumps.zip + register: isdumpszip + +- name: Dump archive logic + when: isdumpszip.stat.exists + block: + - name: Create local server dir + delegate_to: localhost + ansible.builtin.file: + path: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/servers/{{ wl_server }}/" + state: directory + + - name: Fetch the liberty dump archive + ansible.builtin.fetch: + flat: true + src: dumps.zip + dest: "{{ dumps_dir }}/{{ env_name }}/{{ ansible_fqdn }}/servers/{{ wl_server }}/" + + - name: Remove temp dumps.zip + ansible.builtin.file: + path: dumps.zip + state: absent + + # - name: List the contents of the dump zip file ( debug ) + # delegate_to: localhost + # ansible.builtin.shell: "unzip -l {{ dumps_dir }}/{{ env_name }}/{{ ansible_fqdn }}/servers/{{ wl_server }}/dumps.zip" + # register: zipcontents + + # - name: List the contents of the dump zip file output ( debug ) + # debug: + # msg: "{{ zipcontents.stdout_lines }}" + + - name: Extract the liberty dump archive + delegate_to: localhost + ansible.builtin.unarchive: + src: "{{ dumps_dir }}/{{ env_name }}/{{ ansible_fqdn }}/servers/{{ wl_server }}/dumps.zip" + dest: "{{ dumps_dir }}/{{ env_name }}/{{ ansible_fqdn }}/servers/{{ wl_server }}/" + remote_src: false + + - name: Find files with restricted permissions + ansible.builtin.find: + paths: "{{ dumps_dir }}/{{ env_name }}/{{ ansible_fqdn }}/servers/{{ wl_server }}/" + file_type: file + recurse: true + register: found_files + no_log: true + + - name: Change permissions from to 0755 + ansible.builtin.file: + path: "{{ item.path }}" + mode: '0755' + loop: "{{ found_files.files }}" + when: item.mode != '0755' + no_log: true + + - name: Remove dumps.zip + delegate_to: localhost + file: + path: "{{ dumps_dir }}/{{ env_name }}/{{ ansible_fqdn }}/servers/{{ wl_server }}/dumps.zip" + state: absent + + - name: Dumps directory location + debug: + msg: "{{ dumps_dir }}/{{ env_name }}/{{ ansible_fqdn }}/servers/{{ wl_server }}" diff --git a/ansible/roles/liberty_get_dumps/tasks/main.yml b/ansible/roles/liberty_get_dumps/tasks/main.yml new file mode 100644 index 000000000..01238713a --- /dev/null +++ b/ansible/roles/liberty_get_dumps/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Get Liberty javacore / heapdumps + include_tasks: liberty_get_dumps.yml \ No newline at end of file diff --git a/ansible/roles/liberty_get_logs/defaults/main.yml b/ansible/roles/liberty_get_logs/defaults/main.yml index 92bdd70ff..c18a7aab0 100644 --- a/ansible/roles/liberty_get_logs/defaults/main.yml +++ b/ansible/roles/liberty_get_logs/defaults/main.yml @@ -2,3 +2,4 @@ history_days: '-3' env_name: myLibertyEnv +logs_dir: "{{ playbook_dir }}" # location on the ansible controller diff --git a/ansible/roles/liberty_get_logs/tasks/liberty_get_logs.yml b/ansible/roles/liberty_get_logs/tasks/liberty_get_logs.yml index 31b78d3ad..a047e83bb 100644 --- a/ansible/roles/liberty_get_logs/tasks/liberty_get_logs.yml +++ b/ansible/roles/liberty_get_logs/tasks/liberty_get_logs.yml @@ -1,42 +1,143 @@ --- +- name: Any Liberty logs block + when: + - not (more_enabled | default(false)) + block: + - name: Any Liberty logs? + ansible.builtin.stat: + path: "{{ wlp_usr_dir }}/servers/{{ wl_server }}/logs" #Testing if the logs directory is empty. + register: islogs -- name: log directory - delegate_to: localhost - file: - path: "logs/{{ env_name }}" - state: absent - -- name: log directory - delegate_to: localhost - file: - path: "logs/{{ env_name }}" - state: directory - -- name: archive the logs dir to fetch - community.general.archive: - path: - - "{{ wlp_usr_dir }}/servers/{{ wl_server }}/logs" - dest: logs.tar - format: tar - -- name: fetch the twas log archive - ansible.builtin.fetch: - src: logs.tar - dest: "logs/{{ env_name }}" - - # unarchive fails to find handler -- name: Extract the twas log archive - delegate_to: localhost - shell: tar xf logs.tar - args: - chdir: "logs/{{ env_name }}/{{ ansible_fqdn }}" - -- name: remove logs.tar - delegate_to: localhost - file: - path: "logs/{{ env_name }}/{{ ansible_fqdn }}/logs.tar" - state: absent - -- name: log/error directory location - debug: - msg: "{{ playbook_dir }}/logs/{{ env_name }}/{{ ansible_fqdn }}" + - name: Archive the liberty logs dir to fetch + when: islogs.stat.exists + ignore_errors: true # ignore errors, if there are a lot of errors the logs will rollover causing the archive to fail + community.general.archive: + path: + - "{{ wlp_usr_dir }}/servers/{{ wl_server }}/logs/*" # needs * to allow the exclude_path to work + dest: logs.zip + exclude_path: + - "{{ wlp_usr_dir }}/servers/{{ wl_server }}/logs/state" + - "{{ wlp_usr_dir }}/servers/{{ wl_server }}/logs/tracedata" + exclusion_patterns: + - '*.zip' + - '*.tar' + - '*.gz' + - 'trace*.log' + format: zip + mode: '0755' + +- name: Any MoRE Liberty logs block + when: more_enabled | default(false) + block: + - name: Any MoRE logs? + ansible.builtin.stat: + path: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/logs/{{ wl_server }}/logs" + register: islogs + + - name: Archive the liberty MoRE logs dir to fetch + when: islogs.stat.exists + ignore_errors: true # ignore errors, if there are a lot of errors the logs will rollover causing the archive to fail + community.general.archive: + path: + - "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/logs/{{ wl_server }}/logs/*" # needs * to allow the exclude_path to work + dest: logs.zip + exclude_path: + - "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/logs/{{ wl_server }}/logs/state" + - "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/logs/{{ wl_server }}/logs/tracedata" + exclusion_patterns: + - '*.zip' + - '*.tar' + - '*.gz' + - 'trace*.log' + format: zip + mode: '0755' + +- name: Any logs.zip + ansible.builtin.stat: + path: logs.zip + register: islogszip + +- name: Log archive logic + when: islogszip.stat.exists + block: + + - name: Create local logs dir + delegate_to: localhost + ansible.builtin.file: + path: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/servers/{{ wl_server }}/logs/" + state: directory + mode: '0755' + + - name: fetch the liberty log archive + ansible.builtin.fetch: + flat: true + src: logs.zip + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/servers/{{ wl_server }}/" + + - name: Remove temp logs.zip + ansible.builtin.file: + path: logs.zip + state: absent + + - name: Extract the liberty log archive + delegate_to: localhost + ansible.builtin.unarchive: + src: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/servers/{{ wl_server }}/logs.zip" + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/servers/{{ wl_server }}/logs/" + remote_src: false + + - name: Find files with restricted permissions + ansible.builtin.find: + paths: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/servers/{{ wl_server }}/logs/" + file_type: file + recurse: true + register: found_files + no_log: true + + - name: Change permissions from to 0755 + ansible.builtin.file: + path: "{{ item.path }}" + mode: '0755' + loop: "{{ found_files.files }}" + when: item.mode != '0755' + no_log: true + + # - name: List the contents of the logs zip file ( debug ) + # delegate_to: localhost + # ansible.builtin.shell: "unzip -l {{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/servers/{{ wl_server }}/logs.zip" + # register: zipcontents + + # - name: List the contents of the logs zip file output ( debug ) + # debug: + # msg: "{{ zipcontents.stdout_lines }}" + + - name: Remove logs.zip + delegate_to: localhost + ansible.builtin.file: + path: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/servers/{{ wl_server }}/logs.zip" + state: absent + + - name: Log/error directory location + ansible.builtin.debug: + msg: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/servers/{{ wl_server }}/logs/" + + # - name: Is verboseGC set? + # when: verboseGC is defined + # ansible.builtin.debug: + # msg: "{{ verboseGC }}" + + - name: Verbose GC log processing + when: verboseGC|bool + block: + - name: Run the IBM verbosegc logic + ansible.builtin.include_role: + name: ibm_vbgc + vars: + vbgc_dir: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/servers" + + - name: Run the IBM verbosegc report logic + run_once: true + ansible.builtin.include_role: + name: ibm_vbgc_report + vars: + vbgc_report_dir: "{{ logs_dir }}/{{ env_name }}" diff --git a/ansible/roles/liberty_join_collective/files/getJVMpath b/ansible/roles/liberty_join_collective/files/getJVMpath new file mode 100755 index 000000000..51a3095b9 --- /dev/null +++ b/ansible/roles/liberty_join_collective/files/getJVMpath @@ -0,0 +1,298 @@ +#!/bin/sh + +## +## Determine the platform and absolute path of the directory for the current script. +## +case $OSTYPE in + cygwin) + uname=CYGWIN_NT + + # Determine the installation directory without forking if possible. Use + # eval to hide ${var//find/replace}, ${var%suffix}, and ${var:first:length} + # syntaxes from shells that can't parse them. + eval ' + # cd to the install directory. + savePWD=$PWD + script=${0//\\/\/} + unset CDPATH; cd "${script%/*}/../" + + # Convert the install (current working) directory to a Windows path. + case $PWD in + /cygdrive/?/*) + # Use ${var:first:length} to avoid forking for cygpath. + WLP_INSTALL_DIR=${PWD:10:1}:${PWD:11} + ;; + *) + WLP_INSTALL_DIR=`cygpath -ma .` + esac + + cd "$savePWD" + ' + ;; + + *) + uname=`uname` + + case $uname in + CYGWIN_*) + WLP_INSTALL_DIR=`cygpath -ma "${0}"/../../` + ;; + + *) + dirname=`dirname "$0"` + WLP_INSTALL_DIR=`unset CDPATH; cd "$dirname/../" && pwd` + esac +esac + +## +## Platform specific setup +## +newline=' +' +nativeEBCDIC=false + +case ${uname} in + OS/390) + defaultFileEncoding=iso8859-1 + # Auto-convert server.env/jvm.options from ASCII-to-EBCDIC, if necessary. + nativeEBCDIC=true + ;; +esac + +## +## safeEcho: Portable echo that can handle backslashes and leading dashes. +safeEcho() +{ + cat < /dev/null; then + # The shell has support. Define the functions using eval, again to hide the + # syntax from shells that don't support it. + eval " + escapeForEval() + { + escapeForEvalResult=\\'\${1//\\'/\\'\\\"\\'\\\"\\'}\\' + } + + extractValueAndEscapeForEval() + { + escapeForEval \"\${1#*=}\" + } + + substitutePrefixVar() + { + case \$1 in + @\$2@*) substitutePrefixVarResult=\$3\${1#@\$2@};; + *) substitutePrefixVarResult=\$1 + esac + } + " +else + ## + ## escapeForEval: Escape the first parameter to be safe for use in eval, + ## and set escapeForEvalResult with the result. + ## + escapeForEval() + { + escapeForEvalResult=\'`safeEcho "$1" | sed s/\'/\'\"\'\"\'/g`\' + } + + ## + ## extractValueAndEscapeForEval: Extract the value of a var=value string, + ## and set escapeForEvalResult with the result. + ## + extractValueAndEscapeForEval() + { + escapeForEvalResult=\'`safeEcho "$1" | sed -e 's/[^=]*=//' -e s/\'/\'\"\'\"\'/g`\' + } + + ## + ## substitutePrefixVar: If $1 has a prefix @$2@, set substitutePrefixVarResult + ## to $1 with the prefix replaced by $3. Otherwise, set + ## to $1. + substitutePrefixVar() + { + case $1 in + @$2@*) substitutePrefixVarResult=$3`safeEcho "$1" | sed -e "s/^@$2@//"`;; + *) substitutePrefixVarResult=$1 + esac + } +fi + +## +## Quote ${WLP_INSTALL_DIR} for eval. +## +escapeForEval "${WLP_INSTALL_DIR}" +WLP_INSTALL_DIR_QUOTED=${escapeForEvalResult} + +## +## Detects the code page of the file and converts to EBCDIC, +## if necessary, before cat'ing. +## +## Only applicable if running in a native EBCDIC environment (z/OS). +## +## $1 the file name +## $2 pattern denoting the expected first char of file +readNativeFile() { + if ${nativeEBCDIC}; then + # ASCII 'm' overlaps with EBCDIC '_', so strip it out before detecting the codepage. + # Note: cat used here to handle ASCII-tagged files. + filecontents=`cat "$1" | iconv -f ISO8859-1 -t IBM-1047 | tr -d 'm\r\n'` + case $filecontents in + # ASCII file. + $2*) iconv -f ISO8859-1 -t IBM-1047 "$1";; + # EBCDIC file or ASCII-tagged file. + *) cat "$1" + esac + else + cat "$1" + fi +} + +## +## readServerEnv: Read server.env file and export environment variables. +readServerEnv() +{ + # By default, we do not attempt to resolve variables in server.env + variableExpansionEnabled=0 + if [ -f "$1" ]; then + saveIFS=$IFS + IFS=$newline + for line in `readNativeFile "$1" '[#_A-Za-z=]' | tr -d '\r'`; do + case $line in + + \#*) + # The line is a comment. + # A comment line enables variable expansion if it contains the keyword, + # "enable_variable_expansion", and nothing else (ignoring case and white space). + # If found, we use the source command ( . ) which performs all of the server.env + # variable assignments while resolving any variable references. + if [ $variableExpansionEnabled = 0 ]; then + if [ $(echo $line | grep -i "enable_variable_expansion") ] || [ $(echo $line | grep -i "enable_variable_resolution") ]; then + processedLine=$(echo $line | tr -d '[:blank:]' | tr '[:upper:]' '[:lower:]') + if [ "#enable_variable_expansion" = $processedLine ] || [ "#enable_variable_resolution" = $processedLine ]; then + eval ". $1" + variableExpansionEnabled=1 + fi + fi + fi ;; + *=*) + # Only accept alphanumeric variable names to avoid eval complexities. + if var=`safeEcho "$line" | sed -e 's/^\([a-zA-Z0-9_][a-zA-Z0-9_]*\)=.*/\1/'`; then + case $var in + *=*) + SERVER_ENV_SETUP_FAILURE="${var} ${SERVER_ENV_SETUP_FAILURE}" ;; + *) + # if variable expansion is enabled, then we have already "sourced" the entire file. As a result + # all of the variables in server.env have already been defined as shell variables. To make them + # accessible to child processes, they need to be exported. + if [ $variableExpansionEnabled = 1 ] + then + eval "export ${var}" + else + # Variable expansion is not enabled. Just set the variable to whatever is on the right side + # of the assignment and export it. If a later line enables variable expansion, the source + # command will reassign the variable (which is already exported) to the resolved value. + extractValueAndEscapeForEval "${line}" + eval "${var}=${escapeForEvalResult}; export ${var}" + fi + esac + fi ;; + esac + done + IFS=$saveIFS + fi +} + +## + +readServerEnv "${WLP_INSTALL_DIR}/java/java.env" +readServerEnv "${WLP_INSTALL_DIR}/etc/default.env" +readServerEnv "${WLP_INSTALL_DIR}/etc/server.env" + +if [ -z "${WLP_USER_DIR}" ] +then + if [ -z "${WLP_DEFAULT_USER_DIR}" ] + then + WLP_DEFAULT_USER_DIR=${WLP_INSTALL_DIR}/usr + fi + WLP_USER_DIR=${WLP_DEFAULT_USER_DIR} + export WLP_USER_DIR +fi + +if [ -z "${WLP_OUTPUT_DIR}" ] +then + if [ -z "${WLP_DEFAULT_OUTPUT_DIR}" ] + then + WLP_DEFAULT_OUTPUT_DIR=${WLP_USER_DIR}/servers + fi + WLP_OUTPUT_DIR=${WLP_DEFAULT_OUTPUT_DIR} + export WLP_OUTPUT_DIR +fi + +if [ -z "${JAVA_HOME}" ] +then + if [ -z "${JRE_HOME}" ] + then + if [ -z "${WLP_DEFAULT_JAVA_HOME}" ] + then + # Use whatever java is on the path + JAVA_CMD=java + else + substitutePrefixVar "${WLP_DEFAULT_JAVA_HOME}" WLP_INSTALL_DIR "${WLP_INSTALL_DIR}" + JAVA_CMD=${substitutePrefixVarResult}/bin/java + fi + else + JAVA_CMD=${JRE_HOME}/bin/java + fi +else + if [ -f "${JAVA_HOME}/jre/bin/java" ] + then + JAVA_HOME=${JAVA_HOME}/jre + fi + JAVA_CMD=${JAVA_HOME}/bin/java +fi + +# Set a default file encoding if needed +if [ -n "$defaultFileEncoding" ]; then + if ! expr "${JVM_ARGS} ${OPENJ9_JAVA_OPTIONS}" : '.*\(-Dfile\.encoding\=[^[:space:]]\)' > /dev/null; then + JVM_ARGS="${JVM_ARGS} -Dfile.encoding=$defaultFileEncoding" + fi +fi + +if [ -z "${JAVA_HOME}" ]; then + JAVA_PATH_FROM_PATH=$(command -v java) + if [ -n "${JAVA_PATH_FROM_PATH}" ] ; then + JPMS_MODULE_FILE_LOCATION=$(dirname $(dirname $JAVA_PATH_FROM_PATH))/lib/modules + fi +else + JPMS_MODULE_FILE_LOCATION="${JAVA_HOME}/lib/modules" +fi + +# If this is a Java 9 JDK, add some JDK 9 workarounds to the JVM_ARGS +if [ -f "${JPMS_MODULE_FILE_LOCATION}" ]; then + JVM_ARGS="--add-opens java.base/java.lang=ALL-UNNAMED --add-exports java.base/sun.security.action=ALL-UNNAMED ${JVM_ARGS}" +fi + +# Prevent the Java invocation appearing as an application on a mac +# Setting on all platforms to avoid cross platform bugs +JVM_ARGS="-Djava.awt.headless=true ${JVM_ARGS}" + +# Do not create a SCC +if [ -n "${IBM_JAVA_OPTIONS}" ]; then + IBM_JAVA_OPTIONS="${IBM_JAVA_OPTIONS} -Xshareclasses:none" +fi + +if [ -n "${OPENJ9_JAVA_OPTIONS}" ]; then + OPENJ9_JAVA_OPTIONS="${OPENJ9_JAVA_OPTIONS} -Xshareclasses:none" +fi + +echo $(dirname $(dirname $JAVA_CMD)) diff --git a/ansible/roles/liberty_join_collective/tasks/liberty_join_collective.yml b/ansible/roles/liberty_join_collective/tasks/liberty_join_collective.yml index 0c896bd48..cce4790b3 100644 --- a/ansible/roles/liberty_join_collective/tasks/liberty_join_collective.yml +++ b/ansible/roles/liberty_join_collective/tasks/liberty_join_collective.yml @@ -3,56 +3,125 @@ tags: join_collective block: - name: check if liberty is installed - stat: + ansible.builtin.stat: path: "{{ install_base }}/{{ liberty_dir }}/bin/server" register: isliberty failed_when: isliberty.stat.exists == False - name: stop existing server process ignore_errors: true - shell: "{{ wlp_cmd }} {{ install_base }}/{{ liberty_dir }}/bin/server stop {{ wl_server }}" - when: iscc.stat.exists == True + ansible.builtin.shell: "{{ wlp_cmd }} {{ install_base }}/{{ liberty_dir }}/bin/server stop {{ wl_server }}" + when: iscc.stat.exists register: op - - debug: + - ansible.builtin.debug: msg: '{{ op }}' - name: join collective - shell: "{{install_base }}/{{ liberty_dir }}/bin/collective join {{ wl_server }} --host={{ cc_hostname }} --port={{ liberty_admin_ports }} --hostname={{ ansible_fqdn }} --user={{ liberty_admin_user }} --password={{ liberty_admin_pass }} --keystorePassword={{ liberty_admin_pass }} --autoAcceptCertificates --createConfigFile=collectiveMember.xml" + ansible.builtin.shell: "{{ install_base }}/{{ liberty_dir }}/bin/collective join {{ wl_server }} --host={{ cc_hostname }} --port={{ liberty_admin_ports }} --hostname={{ ansible_fqdn }} --user={{ liberty_admin_user }} --password={{ liberty_admin_pass }} --keystorePassword={{ liberty_admin_pass }} --autoAcceptCertificates --createConfigFile=collectiveMember.xml" args: chdir: "{{ wlp_usr_dir }}/servers/{{ wl_server }}" register: joinOutput - - debug: + - ansible.builtin.debug: msg: "{{ joinOutput.stdout_lines }}" + # cheat and create a getJVMpath utility by making a copy of bin/productInfo, stripping off the end commands: + - name: copy getJVMpath utility + ansible.builtin.copy: + src: getJVMpath + dest: "~/getJVMpath" + mode: 0755 + + - name: run the getJVMpath script + ansible.builtin.shell: "~/getJVMpath" + register: getJVMpathOutput + failed_when: ( getJVMpathOutput.rc not in [ 0, 255 ] ) + - name: getJVMpathOutput + ansible.builtin.debug: + msg: "{{ getJVMpathOutput.stdout_lines[0] }}" + + - name: collective updateHost with config access + ansible.builtin.shell: "{{install_base }}/{{ liberty_dir }}/bin/collective updateHost {{ ansible_fqdn }} --host={{ cc_hostname }} --port={{ liberty_admin_ports }} --user={{ liberty_admin_user }} --password={{ liberty_admin_pass }} --useCollectiveSSHKey=true --hostWritePath={{ wlp_usr_dir }} --autoAcceptCertificates --hostJAVAHome={{ getJVMpathOutput.stdout_lines[0] }}" + args: + chdir: "{{ wlp_usr_dir }}/servers/{{ wl_server }}" + register: updateHostOutput + + - ansible.builtin.debug: + msg: "{{ updateHostOutput.stdout_lines }}" + - name: update to tlsv1.2 - lineinfile: + ansible.builtin.lineinfile: path: "{{ wlp_usr_dir }}/servers/{{ wl_server }}/collectiveMember.xml" - regexp: '^sslProtocol="TLSv1.2"' + regexp: 'sslProtocol="TLSv1.2,TLSv1.3"' insertafter: ' + # + - name: Remove existing controllerHost + ansible.builtin.lineinfile: + path: "{{ wlp_usr_dir }}/servers/{{ wl_server }}/collectiveMember.xml" + regexp: 'collectiveMember controllerHost' + state: absent + - name: Remove existing controllerPort + ansible.builtin.lineinfile: + path: "{{ wlp_usr_dir }}/servers/{{ wl_server }}/collectiveMember.xml" + regexp: 'controllerPort="{{ liberty_admin_ports }}" />' + state: absent + # + # + # + # + # ` + - name: Add the primary and the 2 backup controllers + ansible.builtin.blockinfile: + path: "{{ wlp_usr_dir }}/servers/{{ wl_server }}/collectiveMember.xml" + marker: '' + insertafter: '' + block: | + + + + - name: autoAcceptCertificates - lineinfile: + ansible.builtin.lineinfile: path: "{{ wlp_usr_dir }}/servers/{{ wl_server }}/server.env" regexp: 'autoAcceptCertificates' line: 'JVM_ARGS=-Dcom.ibm.websphere.collective.utility.autoAcceptCertificates=true' - name: include collectiveMember.xml in server.xml - lineinfile: + ansible.builtin.lineinfile: path: "{{ wlp_usr_dir }}/servers/{{ wl_server }}/server.xml" regexp: '^controller.xml' insertbefore: '' line: ' ' - name: Conditional role - include_role: + ansible.builtin.include_role: name: liberty_ibmi_grantauth # must use nohup else the server stops after the controlling process exits - name: Start Liberty Server - command: + ansible.builtin.command: cmd: "{{ wlp_nohup }} {{ wlp_cmd }} {{install_base }}/{{ liberty_dir }}/bin/server start {{ wl_server }} --clean" register: cmdOutput failed_when: ( cmdOutput.rc not in [ 0, 1 ] ) diff --git a/ansible/roles/liberty_ltpakeys_get/readme.md b/ansible/roles/liberty_ltpakeys_get/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/liberty_ltpakeys_get/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/liberty_ltpakeys_get/tasks/liberty_ltpakeys_get.yml b/ansible/roles/liberty_ltpakeys_get/tasks/liberty_ltpakeys_get.yml new file mode 100644 index 000000000..bd1fad31a --- /dev/null +++ b/ansible/roles/liberty_ltpakeys_get/tasks/liberty_ltpakeys_get.yml @@ -0,0 +1,14 @@ +--- +- name: check for the existence ltpa.keys + stat: + path: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/resources/security/ltpa.keys" + register: onprem + +- block: + - name: fetch controller ltpa.keys + fetch: + src: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/resources/security/ltpa.keys" + dest: /tmp/ltpa.keys + flat: yes + when: onprem.stat.exists + diff --git a/ansible/roles/liberty_ltpakeys_get/tasks/main.yml b/ansible/roles/liberty_ltpakeys_get/tasks/main.yml new file mode 100644 index 000000000..3798c41e8 --- /dev/null +++ b/ansible/roles/liberty_ltpakeys_get/tasks/main.yml @@ -0,0 +1,2 @@ +--- +- include_tasks: liberty_ltpakeys_get.yml diff --git a/ansible/roles/liberty_ltpakeys_put/readme.md b/ansible/roles/liberty_ltpakeys_put/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/liberty_ltpakeys_put/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/liberty_ltpakeys_put/tasks/liberty_ltpakeys_put.yml b/ansible/roles/liberty_ltpakeys_put/tasks/liberty_ltpakeys_put.yml new file mode 100644 index 000000000..c6efe5792 --- /dev/null +++ b/ansible/roles/liberty_ltpakeys_put/tasks/liberty_ltpakeys_put.yml @@ -0,0 +1,14 @@ +--- +- name: Check for the existence ltpa.keys + stat: + path: /tmp/ltpa.keys + register: onprem + +- block: + - name: Copy the ltpa.keys + copy: + src: /tmp/ltpa.keys + dest: "{{ wlp_usr_dir }}/servers/{{ wl_server }}/resources/security/ltpa.keys" + mode: '0755' + when: onprem.stat.exists + diff --git a/ansible/roles/liberty_ltpakeys_put/tasks/main.yml b/ansible/roles/liberty_ltpakeys_put/tasks/main.yml new file mode 100644 index 000000000..96e7b4901 --- /dev/null +++ b/ansible/roles/liberty_ltpakeys_put/tasks/main.yml @@ -0,0 +1,2 @@ +--- +- include_tasks: liberty_ltpakeys_put.yml diff --git a/ansible/roles/liberty_pentest_collective_cc/defaults/main.yml b/ansible/roles/liberty_pentest_collective_cc/defaults/main.yml new file mode 100644 index 000000000..a779d7a42 --- /dev/null +++ b/ansible/roles/liberty_pentest_collective_cc/defaults/main.yml @@ -0,0 +1,5 @@ +--- +min_heap: '250m' +max_heap: '1024m' +s1_hostname: 'pentest-lib-s1.fyre.ibm.com' + diff --git a/ansible/roles/liberty_pentest_collective_cc/files/createOAuthTables.sql b/ansible/roles/liberty_pentest_collective_cc/files/createOAuthTables.sql new file mode 100644 index 000000000..aa2a0523c --- /dev/null +++ b/ansible/roles/liberty_pentest_collective_cc/files/createOAuthTables.sql @@ -0,0 +1,65 @@ +--- Change oauth2db to the name you want for the database +--- Connect to Derby, choose one connection option by uncomment +--- if connecting to Derby as network server +--- CONNECT 'jdbc:derby://localhost:1527/oauth2db;create=true'; + +--- if connecting to embedded derby, you can change D:\oauth2db to location of database +--- CONNECT 'jdbc:derby:D:\oauth2db;create=true'; + +--- if creating tables in existing Derby database, remove the create=true parameter. + +connect 'jdbc:derby:/home/pent/usr/servers/cc/resources/derby/OAuthTestDB;create=true'; + +----- CREATE TABLES ----- +CREATE TABLE OAuthDBSchema.OAUTH20CACHE +( + LOOKUPKEY VARCHAR(256) NOT NULL, + UNIQUEID VARCHAR(128) NOT NULL, + COMPONENTID VARCHAR(256) NOT NULL, + TYPE VARCHAR(64) NOT NULL, + SUBTYPE VARCHAR(64), + CREATEDAT BIGINT, + LIFETIME INT, + EXPIRES BIGINT, + TOKENSTRING VARCHAR(2048) NOT NULL, + CLIENTID VARCHAR(64) NOT NULL, + USERNAME VARCHAR(64) NOT NULL, + SCOPE VARCHAR(512) NOT NULL, + REDIRECTURI VARCHAR(2048), + STATEID VARCHAR(64) NOT NULL, + EXTENDEDFIELDS CLOB NOT NULL DEFAULT '{}' +); + +CREATE TABLE OAuthDBSchema.OAUTH20CLIENTCONFIG +( + COMPONENTID VARCHAR(256) NOT NULL, + CLIENTID VARCHAR(256) NOT NULL, + CLIENTSECRET VARCHAR(256), + DISPLAYNAME VARCHAR(256) NOT NULL, + REDIRECTURI VARCHAR(2048), + ENABLED INT, + CLIENTMETADATA CLOB NOT NULL DEFAULT '{}' +); + +CREATE TABLE OAuthDBSchema.OAUTH20CONSENTCACHE +( + CLIENTID VARCHAR(256) NOT NULL, + USERID VARCHAR(256), + PROVIDERID VARCHAR(256) NOT NULL, + SCOPE VARCHAR(1024) NOT NULL, + EXPIRES BIGINT, + EXTENDEDFIELDS CLOB NOT NULL DEFAULT '{}' +); + +----- ADD CONSTRAINTS ----- +ALTER TABLE OAuthDBSchema.OAUTH20CACHE + ADD CONSTRAINT PK_LOOKUPKEY PRIMARY KEY (LOOKUPKEY); + +ALTER TABLE OAuthDBSchema.OAUTH20CLIENTCONFIG + ADD CONSTRAINT PK_COMPIDCLIENTID PRIMARY KEY (COMPONENTID,CLIENTID); + +----- CREATE INDEXES ----- +CREATE INDEX OAUTH20CACHE_EXPIRES ON OAUTHDBSCHEMA.OAUTH20CACHE (EXPIRES ASC); + +DISCONNECT CURRENT; +exit; diff --git a/ansible/roles/liberty_pentest_collective_cc/files/fileload.txt b/ansible/roles/liberty_pentest_collective_cc/files/fileload.txt new file mode 100755 index 000000000..7acb3391a --- /dev/null +++ b/ansible/roles/liberty_pentest_collective_cc/files/fileload.txt @@ -0,0 +1,30 @@ +######################################################## +# +#This is to test file download on JMXConnectorREST APIs +# +######################################################## + +WebSphere Application Server Liberty overview +Liberty is a highly composable, fast to start, dynamic application server runtime environment. + +You can install the server as described in Installing Liberty by using downloaded archives. + +Because Liberty does not include a Java? runtime environment (JRE), you must install a compliant Java implementation (JRE or SDK) beforehand. For more information about supported Java environments and where to get them, see Minimum supported Java levels. + +This server supports two models of application deployment: +Deploy an application by dropping it into the dropins directory. +Deploy an application by adding it to the server configuration file. +Liberty supports a subset of the following parts of the full WebSphere� Application Server programming model: +Web applications +OSGi applications +Enterprise JavaBeans (EJB) applications +Associated services such as transactions and security are available to these application types. +Features are the units of functionality by which you control the pieces of the runtime environment that are loaded into a particular server. For a list of the main Liberty features, see Liberty features. You can also create your own features, as described in Extending Liberty. + +You can work with the runtime environment directly, or use the WebSphere Application Server Developer Tools for Eclipse. Further, you can use Admin Center to administer Liberty servers and applications and other resources from a web browser. See Administering Liberty. + +On distributed platforms, Liberty provides both a development and an operational environment. On Mac OS, it provides a development environment. + +On z/OS systems, Liberty provides an operations environment. You can work natively with this environment by using the MVS? console. For application development, consider using the Eclipse-based developer tools on a separate distributed system, or on Mac OS. + +You can organize Liberty servers into collectives to support clustering, administration, and other operations that act on multiple Liberty servers at a time in order to efficiently and accurately deliver application services to your organization. See Collective architecture for more information. diff --git a/ansible/roles/liberty_pentest_collective_cc/files/test1.txt b/ansible/roles/liberty_pentest_collective_cc/files/test1.txt new file mode 100755 index 000000000..db95c699b --- /dev/null +++ b/ansible/roles/liberty_pentest_collective_cc/files/test1.txt @@ -0,0 +1 @@ +This is to test file deletion on JMXConnectorREST APIs. diff --git a/ansible/roles/liberty_pentest_collective_cc/files/test2.txt b/ansible/roles/liberty_pentest_collective_cc/files/test2.txt new file mode 100755 index 000000000..db95c699b --- /dev/null +++ b/ansible/roles/liberty_pentest_collective_cc/files/test2.txt @@ -0,0 +1 @@ +This is to test file deletion on JMXConnectorREST APIs. diff --git a/ansible/roles/liberty_pentest_collective_cc/files/test3.txt b/ansible/roles/liberty_pentest_collective_cc/files/test3.txt new file mode 100755 index 000000000..db95c699b --- /dev/null +++ b/ansible/roles/liberty_pentest_collective_cc/files/test3.txt @@ -0,0 +1 @@ +This is to test file deletion on JMXConnectorREST APIs. diff --git a/ansible/roles/liberty_pentest_collective_cc/files/test4.txt b/ansible/roles/liberty_pentest_collective_cc/files/test4.txt new file mode 100755 index 000000000..db95c699b --- /dev/null +++ b/ansible/roles/liberty_pentest_collective_cc/files/test4.txt @@ -0,0 +1 @@ +This is to test file deletion on JMXConnectorREST APIs. diff --git a/ansible/roles/liberty_pentest_collective_cc/files/test5.txt b/ansible/roles/liberty_pentest_collective_cc/files/test5.txt new file mode 100755 index 000000000..db95c699b --- /dev/null +++ b/ansible/roles/liberty_pentest_collective_cc/files/test5.txt @@ -0,0 +1 @@ +This is to test file deletion on JMXConnectorREST APIs. diff --git a/ansible/roles/liberty_pentest_collective_cc/meta/main.yml b/ansible/roles/liberty_pentest_collective_cc/meta/main.yml new file mode 100644 index 000000000..285b3d3fa --- /dev/null +++ b/ansible/roles/liberty_pentest_collective_cc/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: liberty_defaults diff --git a/ansible/roles/liberty_pentest_collective_cc/tasks/cc_liberty_pentest.yml b/ansible/roles/liberty_pentest_collective_cc/tasks/cc_liberty_pentest.yml new file mode 100644 index 000000000..5f88bf44c --- /dev/null +++ b/ansible/roles/liberty_pentest_collective_cc/tasks/cc_liberty_pentest.yml @@ -0,0 +1,151 @@ +--- +- name: Configure cc PenTest + tags: configure_cc_pentest + block: + - name: check if liberty is installed + stat: + path: "{{ install_base }}/{{ liberty_dir }}/bin/server" + register: isliberty + failed_when: isliberty.stat.exists == False + + - name: liberty server directories + file: + path: '{{ item }}' + state: directory + recurse: yes + with_items: + - "{{ wlp_usr_dir }}/servers/{{ cc_server }}/apps" + - "{{ wlp_usr_dir }}/servers/{{ cc_server }}/resources" + - "{{ wlp_usr_dir }}/servers/{{ cc_server }}/resources/derby" + - "{{ wlp_usr_dir }}/servers/{{ cc_server }}/resources/derby/derby_jars" + - "{{ wlp_usr_dir }}/servers/{{ cc_server }}/dropins" + - "{{ wlp_usr_dir }}/servers/{{ cc_server }}/pentest_delete" + - "{{ wlp_usr_dir }}/servers/{{ cc_server }}/pentest_load" + + - name: copy cc server server.xml template + template: + src: "{{ cc_server }}.xml.j2" + dest: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/server.xml" + + - name: copy basicauth.war + copy: + src: "{{ sec_app }}" # files/basicauth.war + dest: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/apps/basicauth.war" + mode: '0755' + + - name: copy javaee8 batchSecurity.war + copy: + src: "{{ batch_ee8 }}" # files/batch_javaee8_war/batchSecurity.war + dest: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/dropins/batchSecurity.war" + mode: '0755' + + - name: copy derby_jars.zip + copy: + src: "{{ derby_lib }}" # files/derby_jars.zip + dest: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/resources/derby/derby_jars.zip" + mode: '0755' + + - name: unzip derby_jars.zip + command: + cmd: "unzip {{ wlp_usr_dir }}/servers/{{ cc_server }}/resources/derby/derby_jars.zip -d {{ wlp_usr_dir }}/servers/{{ cc_server }}/resources/derby" + register: cmdOutput + failed_when: ( cmdOutput.rc not in [ 0, 1 ] ) + + - debug: + msg: '{{ cmdOutput.stdout_lines }}' + + - name: copy createOAuthTables.sql + copy: + src: files/createOAuthTables.sql + dest: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/resources/derby/createOAuthTables.sql" + mode: '0755' + + - name: copy test*.txt + copy: + src: "files/{{ item }}" + dest: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/pentest_delete/{{ item }}" + mode: '0755' + with_items: + - test1.txt + - test2.txt + - test3.txt + - test4.txt + - test5.txt + + - name: copy fileload.txt + copy: + src: files/fileload.txt + dest: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/pentest_load/fileload.txt" + mode: '0755' + + - name: copy com.ibm.websphere.appserver.openidConnectServer-1.0.zip + # temp solution for https://github.ibm.com/websphere/WS-CD-Open/issues/27465 + copy: + src: files/com.ibm.websphere.appserver.openidConnectServer-1.0.zip + dest: "{{ install_base }}/{{ liberty_dir }}/lib/features/icons/com.ibm.websphere.appserver.openidConnectServer-1.0.zip" + mode: '0755' + + - name: unzip com.ibm.websphere.appserver.openidConnectServer-1.0.zip + command: + cmd: "unzip {{ install_base }}/{{ liberty_dir }}/lib/features/icons/com.ibm.websphere.appserver.openidConnectServer-1.0.zip -d {{ install_base }}/{{ liberty_dir }}/lib/features/icons" + register: cmdOutput + failed_when: ( cmdOutput.rc not in [ 0, 1 ] ) + + - debug: + msg: '{{ cmdOutput.stdout_lines }}' + + - name: add server.env OIDC_CLIENT_REDIRECT + lineinfile: + path: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/server.env" + regexp: 'OIDC_CLIENT_REDIRECT' + line: 'OIDC_CLIENT_REDIRECT=https://{{ s1_hostname }}:9443' + + - name: add server.env HOST_ALIAS + lineinfile: + path: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/server.env" + regexp: 'HOST_ALIAS' + line: 'HOST_ALIAS={{ ansible_fqdn }}' + + + - name: comment out quickStartSecurity configuration in controller.xml + lineinfile: + path: "{{ wlp_usr_dir }}/servers/{{ cc_server }}/controller.xml" + regexp: '' + line: '' + + - name: create derby db tables for oidc toools + command: + cmd: "{{ wlp_cmd }} {{install_base }}/{{ liberty_dir }}/{{ pent_java_dir }}/bin/java -jar {{ wlp_usr_dir }}/servers/{{ cc_server }}/resources/derby/derby_jars/derbyrun.jar ij {{ wlp_usr_dir }}/servers/{{ cc_server }}/resources/derby/createOAuthTables.sql" + register: cmdOutput + failed_when: ( cmdOutput.rc not in [ 0, 1 ] ) + + - debug: + msg: '{{ cmdOutput.stdout_lines }}' + + - name: Stop Liberty Server + command: + cmd: "{{ wlp_cmd }} {{install_base }}/{{ liberty_dir }}/bin/server stop {{ cc_server }}" + register: cmdOutput + failed_when: ( cmdOutput.rc not in [ 0, 1 ] ) + + - debug: + msg: '{{ cmdOutput.stdout_lines }}' + + # must use nohup else the server stops after the controlling process exits + - name: Start Liberty Server + command: + cmd: "{{ wlp_nohup }} {{ wlp_cmd }} {{install_base }}/{{ liberty_dir }}/bin/server start {{ cc_server }} --clean" + register: cmdOutput + failed_when: ( cmdOutput.rc not in [ 0, 1 ] ) + + - debug: + msg: '{{ cmdOutput.stdout_lines }}' + + - name: check server status + command: + cmd: "{{ wlp_cmd }} {{install_base }}/{{ liberty_dir }}/bin/server status {{ cc_server }}" + register: cmdOutput + failed_when: ( cmdOutput.rc not in [ 0, 1 ] ) + + - debug: + msg: '{{ cmdOutput.stdout_lines }}' diff --git a/ansible/roles/liberty_pentest_collective_cc/tasks/main.yml b/ansible/roles/liberty_pentest_collective_cc/tasks/main.yml new file mode 100644 index 000000000..cb40e7e2c --- /dev/null +++ b/ansible/roles/liberty_pentest_collective_cc/tasks/main.yml @@ -0,0 +1 @@ +- include_tasks: "{{ cc_server }}_liberty_pentest.yml" diff --git a/ansible/roles/liberty_pentest_collective_cc/templates/cc.xml.j2 b/ansible/roles/liberty_pentest_collective_cc/templates/cc.xml.j2 new file mode 100644 index 000000000..42167bc5c --- /dev/null +++ b/ansible/roles/liberty_pentest_collective_cc/templates/cc.xml.j2 @@ -0,0 +1,188 @@ + + + + + + jsp-2.3 + apiDiscovery-1.0 + + localConnector-1.0 + batchManagement-1.0 + restConnector-2.0 + adminCenter-1.0 + javaee-8.0 + openidConnectServer-1.0 + openidConnectClient-1.0 + ssl-1.0 + scim-1.0 + dynamicRouting-1.0 + scalingController-1.0 + monitor-1.0 + + + + ${server.config.dir} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + adminUser + + + + readerUser + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${env.HOST_ALIAS}:9080 + ${env.HOST_ALIAS}:9443 + + + + + X-Frame-Options:SAMEORIGIN + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${OIDC_CLIENT_REDIRECT}/oidcclient/redirect/client01 + + + ${OIDC_CLIENT_REDIRECT}/ibm/api/social-login/redirect/client02 + + + client01 + client02 + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ansible/roles/liberty_pentest_collective_ls/defaults/main.yml b/ansible/roles/liberty_pentest_collective_ls/defaults/main.yml new file mode 100644 index 000000000..8371c5821 --- /dev/null +++ b/ansible/roles/liberty_pentest_collective_ls/defaults/main.yml @@ -0,0 +1,7 @@ +--- +install_base: '/home/nest' +liberty_dir: 'wlp' +wl_server: 'server' +min_heap: '1G' +max_heap: '3G' +cc_hostname: 'pentest-lib-cc.fyre.ibm.com' diff --git a/ansible/roles/liberty_pentest_collective_ls/files/fileload.txt b/ansible/roles/liberty_pentest_collective_ls/files/fileload.txt new file mode 100755 index 000000000..7acb3391a --- /dev/null +++ b/ansible/roles/liberty_pentest_collective_ls/files/fileload.txt @@ -0,0 +1,30 @@ +######################################################## +# +#This is to test file download on JMXConnectorREST APIs +# +######################################################## + +WebSphere Application Server Liberty overview +Liberty is a highly composable, fast to start, dynamic application server runtime environment. + +You can install the server as described in Installing Liberty by using downloaded archives. + +Because Liberty does not include a Java? runtime environment (JRE), you must install a compliant Java implementation (JRE or SDK) beforehand. For more information about supported Java environments and where to get them, see Minimum supported Java levels. + +This server supports two models of application deployment: +Deploy an application by dropping it into the dropins directory. +Deploy an application by adding it to the server configuration file. +Liberty supports a subset of the following parts of the full WebSphere� Application Server programming model: +Web applications +OSGi applications +Enterprise JavaBeans (EJB) applications +Associated services such as transactions and security are available to these application types. +Features are the units of functionality by which you control the pieces of the runtime environment that are loaded into a particular server. For a list of the main Liberty features, see Liberty features. You can also create your own features, as described in Extending Liberty. + +You can work with the runtime environment directly, or use the WebSphere Application Server Developer Tools for Eclipse. Further, you can use Admin Center to administer Liberty servers and applications and other resources from a web browser. See Administering Liberty. + +On distributed platforms, Liberty provides both a development and an operational environment. On Mac OS, it provides a development environment. + +On z/OS systems, Liberty provides an operations environment. You can work natively with this environment by using the MVS? console. For application development, consider using the Eclipse-based developer tools on a separate distributed system, or on Mac OS. + +You can organize Liberty servers into collectives to support clustering, administration, and other operations that act on multiple Liberty servers at a time in order to efficiently and accurately deliver application services to your organization. See Collective architecture for more information. diff --git a/ansible/roles/liberty_pentest_collective_ls/files/test1.txt b/ansible/roles/liberty_pentest_collective_ls/files/test1.txt new file mode 100755 index 000000000..db95c699b --- /dev/null +++ b/ansible/roles/liberty_pentest_collective_ls/files/test1.txt @@ -0,0 +1 @@ +This is to test file deletion on JMXConnectorREST APIs. diff --git a/ansible/roles/liberty_pentest_collective_ls/files/test2.txt b/ansible/roles/liberty_pentest_collective_ls/files/test2.txt new file mode 100755 index 000000000..db95c699b --- /dev/null +++ b/ansible/roles/liberty_pentest_collective_ls/files/test2.txt @@ -0,0 +1 @@ +This is to test file deletion on JMXConnectorREST APIs. diff --git a/ansible/roles/liberty_pentest_collective_ls/files/test3.txt b/ansible/roles/liberty_pentest_collective_ls/files/test3.txt new file mode 100755 index 000000000..db95c699b --- /dev/null +++ b/ansible/roles/liberty_pentest_collective_ls/files/test3.txt @@ -0,0 +1 @@ +This is to test file deletion on JMXConnectorREST APIs. diff --git a/ansible/roles/liberty_pentest_collective_ls/files/test4.txt b/ansible/roles/liberty_pentest_collective_ls/files/test4.txt new file mode 100755 index 000000000..db95c699b --- /dev/null +++ b/ansible/roles/liberty_pentest_collective_ls/files/test4.txt @@ -0,0 +1 @@ +This is to test file deletion on JMXConnectorREST APIs. diff --git a/ansible/roles/liberty_pentest_collective_ls/files/test5.txt b/ansible/roles/liberty_pentest_collective_ls/files/test5.txt new file mode 100755 index 000000000..db95c699b --- /dev/null +++ b/ansible/roles/liberty_pentest_collective_ls/files/test5.txt @@ -0,0 +1 @@ +This is to test file deletion on JMXConnectorREST APIs. diff --git a/ansible/roles/liberty_pentest_collective_ls/tasks/main.yml b/ansible/roles/liberty_pentest_collective_ls/tasks/main.yml new file mode 100644 index 000000000..af0cb771e --- /dev/null +++ b/ansible/roles/liberty_pentest_collective_ls/tasks/main.yml @@ -0,0 +1 @@ +- include_tasks: "{{ wl_server }}_liberty_pentest.yml" diff --git a/ansible/roles/liberty_pentest_collective_ls/tasks/s1_liberty_pentest.yml b/ansible/roles/liberty_pentest_collective_ls/tasks/s1_liberty_pentest.yml new file mode 100644 index 000000000..becedd838 --- /dev/null +++ b/ansible/roles/liberty_pentest_collective_ls/tasks/s1_liberty_pentest.yml @@ -0,0 +1,126 @@ +--- +- name: Configure s1 PenTest + tags: configure_s1_pentest + block: + - name: check if liberty is installed + stat: + path: "{{ install_base }}/{{ liberty_dir }}/bin/server" + register: isliberty + failed_when: isliberty.stat.exists == False + + - name: liberty server directories + file: + path: '{{ item }}' + state: directory + recurse: yes + with_items: + - "{{ wlp_usr_dir }}/servers/{{ wl_server }}/apps" + - "{{ wlp_usr_dir }}/servers/{{ wl_server }}/resources" + - "{{ wlp_usr_dir }}/servers/{{ wl_server }}/resources/derby" + - "{{ wlp_usr_dir }}/servers/{{ wl_server }}/resources/derby/derby_jars" + - "{{ wlp_usr_dir }}/servers/{{ wl_server }}/dropins" + - "{{ wlp_usr_dir }}/servers/{{ wl_server }}/pentest_delete" + - "{{ wlp_usr_dir }}/servers/{{ wl_server }}/pentest_load" + + - name: copy server1 server.xml template + template: + src: "{{ wl_server }}.xml.j2" + dest: "{{ wlp_usr_dir }}/servers/{{ wl_server }}/server.xml" + + - name: copy basicauth.war + copy: + src: "{{ sec_app }}" # files/basicauth.war + dest: "{{ wlp_usr_dir }}/servers/{{ wl_server }}/apps/basicauth.war" + mode: '0755' + + - name: copy jakarta batchSecurity.war + copy: + src: "{{ batch_jakarta }}" # files/batch_jakarta_war/batchSecurity.war + dest: "{{ wlp_usr_dir }}/servers/{{ wl_server }}/dropins/batchSecurity.war" + mode: '0755' + + - name: copy derby_jars.zip + copy: + src: "{{ derby_lib }}" # files/derby_jars.zip + dest: "{{ wlp_usr_dir }}/servers/{{ wl_server }}/resources/derby/derby_jars.zip" + mode: '0755' + + - name: unzip derby_jars.zip + command: + cmd: "unzip {{ wlp_usr_dir }}/servers/{{ wl_server }}/resources/derby/derby_jars.zip -d {{ wlp_usr_dir }}/servers/{{ wl_server }}/resources/derby" + + register: cmdOutput + failed_when: ( cmdOutput.rc not in [ 0, 1 ] ) + + - debug: + msg: '{{ cmdOutput.stdout_lines }}' + + - name: copy test*.txt + copy: + src: "files/{{ item }}" + dest: "{{ wlp_usr_dir }}/servers/{{ wl_server }}/pentest_delete/{{ item }}" + mode: '0755' + with_items: + - test1.txt + - test2.txt + - test3.txt + - test4.txt + - test5.txt + + - name: copy fileload.txt + copy: + src: files/fileload.txt + dest: "{{ wlp_usr_dir }}/servers/{{ wl_server }}/pentest_load/fileload.txt" + mode: '0755' + + - name: add server.env OIDC_SERVER_DISCOVERY + lineinfile: + path: "{{ wlp_usr_dir }}/servers/{{ wl_server }}/server.env" + regexp: 'OIDC_SERVER_DISCOVERY' + line: 'OIDC_SERVER_DISCOVERY=https://{{ cc_hostname }}:9443' + + - name: add server.env cert_defaultKeyStore + lineinfile: + path: "{{ wlp_usr_dir }}/servers/{{ wl_server }}/server.env" + regexp: 'cert_defaultKeyStore' + line: 'cert_defaultKeyStore={{ wlp_usr_dir }}/shared/config/server2.der' + + - name: add server.env HOST_ALIAS + lineinfile: + path: "{{ wlp_usr_dir }}/servers/{{ wl_server }}/server.env" + regexp: 'HOST_ALIAS' + line: 'HOST_ALIAS={{ ansible_fqdn }}' + + - name: autoAcceptCertificates + lineinfile: + path: "{{ wlp_usr_dir }}/servers/{{ wl_server }}/server.env" + regexp: 'autoAcceptCertificates' + line: 'JVM_ARGS=-Dcom.ibm.websphere.collective.utility.autoAcceptCertificates=true' + + - name: Stop Liberty Server + command: + cmd: "{{ wlp_cmd }} {{install_base }}/{{ liberty_dir }}/bin/server stop {{ wl_server }}" + register: cmdOutput + failed_when: ( cmdOutput.rc not in [ 0, 1 ] ) + + - debug: + msg: '{{ cmdOutput.stdout_lines }}' + + # must use nohup else the server stops after the controlling process exits + - name: Start Liberty Server + command: + cmd: "{{ wlp_nohup }} {{ wlp_cmd }} {{install_base }}/{{ liberty_dir }}/bin/server start {{ wl_server }} --clean" + register: cmdOutput + failed_when: ( cmdOutput.rc not in [ 0, 1 ] ) + + - debug: + msg: '{{ cmdOutput.stdout_lines }}' + + - name: check server status + command: + cmd: "{{ wlp_cmd }} {{install_base }}/{{ liberty_dir }}/bin/server status {{ wl_server }}" + register: cmdOutput + failed_when: ( cmdOutput.rc not in [ 0, 1 ] ) + + - debug: + msg: '{{ cmdOutput.stdout_lines }}' diff --git a/ansible/roles/liberty_pentest_collective_ls/tasks/s2_liberty_pentest.yml b/ansible/roles/liberty_pentest_collective_ls/tasks/s2_liberty_pentest.yml new file mode 100644 index 000000000..ee7715ba5 --- /dev/null +++ b/ansible/roles/liberty_pentest_collective_ls/tasks/s2_liberty_pentest.yml @@ -0,0 +1,60 @@ +--- +- name: Configure s2 PenTest + tags: configure_s2_pentest + block: + - name: check if liberty is installed + stat: + path: "{{ install_base }}/{{ liberty_dir }}/bin/server" + register: isliberty + failed_when: isliberty.stat.exists == False + + - name: copy server2 server.xml template + template: + src: "{{ wl_server }}.xml.j2" + dest: "{{ wlp_usr_dir }}/servers/{{ wl_server }}/server.xml" + + - name: add server.env cert_defaultKeyStore + lineinfile: + path: "{{ wlp_usr_dir }}/servers/{{ wl_server }}/server.env" + regexp: 'cert_defaultKeyStore' + line: 'cert_defaultKeyStore={{ wlp_usr_dir }}/shared/config/server2.der' + + - name: add server.env HOST_ALIAS + lineinfile: + path: "{{ wlp_usr_dir }}/servers/{{ wl_server }}/server.env" + regexp: 'HOST_ALIAS' + line: 'HOST_ALIAS={{ ansible_fqdn }}' + + - name: autoAcceptCertificates + lineinfile: + path: "{{ wlp_usr_dir }}/servers/{{ wl_server }}/server.env" + regexp: 'autoAcceptCertificates' + line: 'JVM_ARGS=-Dcom.ibm.websphere.collective.utility.autoAcceptCertificates=true' + + - name: Stop Liberty Server + command: + cmd: "{{ wlp_cmd }} {{install_base }}/{{ liberty_dir }}/bin/server stop {{ wl_server }}" + register: cmdOutput + failed_when: ( cmdOutput.rc not in [ 0, 1 ] ) + + - debug: + msg: '{{ cmdOutput.stdout_lines }}' + + - name: Start Liberty Server + command: + cmd: "{{ wlp_nohup }} {{ wlp_cmd }} {{install_base }}/{{ liberty_dir }}/bin/server start {{ wl_server }} --clean" + register: cmdOutput + failed_when: ( cmdOutput.rc not in [ 0, 1 ] ) + + - debug: + msg: '{{ cmdOutput.stdout_lines }}' + + - name: check server status + command: + cmd: "{{ wlp_cmd }} {{install_base }}/{{ liberty_dir }}/bin/server status {{ wl_server }}" + register: cmdOutput + failed_when: ( cmdOutput.rc not in [ 0, 1 ] ) + + - debug: + msg: '{{ cmdOutput.stdout_lines }}' + diff --git a/ansible/roles/liberty_pentest_collective_ls/templates/s1.xml.j2 b/ansible/roles/liberty_pentest_collective_ls/templates/s1.xml.j2 new file mode 100644 index 000000000..41501b962 --- /dev/null +++ b/ansible/roles/liberty_pentest_collective_ls/templates/s1.xml.j2 @@ -0,0 +1,154 @@ + + + + + + jakartaee-10.0 + adminCenter-1.0 + batchManagement-1.0 + openidConnectClient-1.0 + socialLogin-1.0 + mpOpenAPI-3.1 + collectiveMember-1.0 + clusterMember-1.0 + + + + + + + + + ${server.config.dir} + ${server.config.dir} + + + + + + + + + + + + + + + + + + + + adminUser + + + + readerUser + + + + + + + + + + + + + + + + + + + + + + + + + + ${env.HOST_ALIAS}:9080 + ${env.HOST_ALIAS}:9443 + + + + + X-Frame-Options:SAMEORIGIN + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ansible/roles/liberty_pentest_collective_ls/templates/s2.xml.j2 b/ansible/roles/liberty_pentest_collective_ls/templates/s2.xml.j2 new file mode 100644 index 000000000..ec82ecd9c --- /dev/null +++ b/ansible/roles/liberty_pentest_collective_ls/templates/s2.xml.j2 @@ -0,0 +1,92 @@ + + + + + + microProfile-6.1 + ldapRegistry-3.0 + collectiveMember-1.0 + clusterMember-1.0 + + + + + + ${server.config.dir} + ${server.ouput.dir}/delete + + + + + + + + + + + + + + + + + + + + + + + + + + + + adminUser + + + + readerUser + + + + + + + + ${env.HOST_ALIAS}:9080 + ${env.HOST_ALIAS}:9443 + + + + + X-Frame-Options:SAMEORIGIN + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ansible/roles/liberty_server_start/defaults/main.yml b/ansible/roles/liberty_server_start/defaults/main.yml new file mode 100644 index 000000000..7c14f3ae5 --- /dev/null +++ b/ansible/roles/liberty_server_start/defaults/main.yml @@ -0,0 +1,2 @@ +--- +is_scaling: False diff --git a/ansible/roles/liberty_server_start/meta/main.yml b/ansible/roles/liberty_server_start/meta/main.yml new file mode 100644 index 000000000..285b3d3fa --- /dev/null +++ b/ansible/roles/liberty_server_start/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: liberty_defaults diff --git a/ansible/roles/liberty_server_start/readme.md b/ansible/roles/liberty_server_start/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/liberty_server_start/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/liberty_server_start/tasks/liberty_server_start.yml b/ansible/roles/liberty_server_start/tasks/liberty_server_start.yml new file mode 100644 index 000000000..de27ebe81 --- /dev/null +++ b/ansible/roles/liberty_server_start/tasks/liberty_server_start.yml @@ -0,0 +1,41 @@ +--- +- name: Liberty Server Start + tags: StartServers + block: + - name: Check if liberty is installed + ansible.builtin.stat: + path: "{{ install_base }}/{{ liberty_dir }}/bin/server" + register: isliberty + failed_when: isliberty.stat.exists == False + + - name: Status Liberty Server + ansible.builtin.command: + cmd: "{{ wlp_cmd }} {{ install_base }}/{{ liberty_dir }}/bin/server status {{ wl_server }}" + register: cmdOutput + failed_when: ( cmdOutput.rc not in [ 0, 1 ] ) + + - name: Start Liberty Server block + when: + - cmdOutput.rc != 0 + - is_scaling == False + block: + # must use nohup else the server stops after the controlling process exits + - name: Start Liberty server + ansible.builtin.command: + cmd: "{{ wlp_nohup }} {{ wlp_cmd }} {{ install_base }}/{{ liberty_dir }}/bin/server start {{ wl_server }} --clean" + register: cmdOutput1 + failed_when: ( cmdOutput1.rc not in [ 0 ] ) + + - name: Start Liberty server output + ansible.builtin.debug: + msg: '{{ cmdOutput1.stdout_lines }}' + + - name: Check server status + ansible.builtin.command: + cmd: "{{ wlp_cmd }} {{ install_base }}/{{ liberty_dir }}/bin/server status {{ wl_server }}" + register: cmdOutput1 + failed_when: ( cmdOutput1.rc not in [ 0 ] ) + + - name: Server status output + ansible.builtin.debug: + msg: '{{ cmdOutput1.stdout_lines }}' diff --git a/ansible/roles/liberty_server_start/tasks/main.yml b/ansible/roles/liberty_server_start/tasks/main.yml new file mode 100644 index 000000000..fe5949715 --- /dev/null +++ b/ansible/roles/liberty_server_start/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Liberty_server_start + ansible.builtin.include_tasks: liberty_server_start.yml diff --git a/ansible/roles/liberty_server_status/meta/main.yml b/ansible/roles/liberty_server_status/meta/main.yml new file mode 100644 index 000000000..285b3d3fa --- /dev/null +++ b/ansible/roles/liberty_server_status/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: liberty_defaults diff --git a/ansible/roles/liberty_server_status/readme.md b/ansible/roles/liberty_server_status/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/liberty_server_status/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/liberty_server_status/tasks/liberty_server_status.yml b/ansible/roles/liberty_server_status/tasks/liberty_server_status.yml new file mode 100644 index 000000000..8a84b33e2 --- /dev/null +++ b/ansible/roles/liberty_server_status/tasks/liberty_server_status.yml @@ -0,0 +1,76 @@ +--- +- name: Check if liberty is installed + ansible.builtin.stat: + path: "{{ install_base }}/{{ liberty_dir }}/bin/server" + register: islib + failed_when: islib.stat.exists == False + +- name: Set maint status boolean false + ansible.builtin.set_fact: + server_maint_status: false + +- name: MLS Server Status block + when: (more_enabled | default(false)) + block: + + - name: tWAS MoRE Liberty status + ansible.builtin.include_role: + name: twas_status_mls + +- name: Liberty Server Status block + when: not (more_enabled | default(false)) + block: + + - name: Check server status + ansible.builtin.command: + cmd: "{{ wlp_cmd }} {{ install_base }}/{{ liberty_dir }}/bin/server status {{ wl_server }}" + register: cmdOutput1 + failed_when: ( cmdOutput1.rc not in [ 0, 1, 2 ] ) + + - name: Set status facts + ansible.builtin.set_fact: + server_status: '{{ cmdOutput1.stdout | trim }}' + + - name: Is cc_hostname defined? + when: cc_hostname is defined + block: + - name: Check server maintenance status + ansible.builtin.shell: + "{{ install_base }}/{{ liberty_dir }}/bin/collective getMaintenanceMode \ + --host={{ cc_hostname }} \ + --port={{ liberty_admin_ports }} \ + --user={{ liberty_admin_user }} \ + --password={{ liberty_admin_pass }} \ + --hostName={{ ansible_fqdn }} \ + --usrDir={{ cygwin }}{{ wlp_usr_dir }} \ + --server={{ wl_server }} \ + --autoAcceptCertificates" + register: getMaintenanceModeOutput + failed_when: ( getMaintenanceModeOutput.rc not in [ 0, 255 ] ) + + - name: Set maint status boolean true + when: getMaintenanceModeOutput.stdout is search('is in maintenance mode') + ansible.builtin.set_fact: + server_maint_status: true + +- name: Create status dir + delegate_to: localhost + ansible.builtin.file: + path: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/servers/{{ wl_server }}" + state: directory + mode: '0755' + +- name: Create list with server name / status + ansible.builtin.set_fact: + liberty_server_name_status: '{{ liberty_server_name_status | default([]) + [ { "server": wl_server, "status": server_status, "maint_mode": server_maint_status|bool } ] }}' + +- name: New dict server status + ansible.builtin.set_fact: + versions: "{{{ ansible_fqdn : liberty_server_name_status }}}" + +- name: Write server status json file + delegate_to: localhost + ansible.builtin.copy: + content: "{{ versions | to_nice_json( sort_keys=false ) }}" + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/servers/{{ wl_server }}/{{ status_json_file }}" + mode: '0444' diff --git a/ansible/roles/liberty_server_status/tasks/main.yml b/ansible/roles/liberty_server_status/tasks/main.yml new file mode 100644 index 000000000..7a164b07a --- /dev/null +++ b/ansible/roles/liberty_server_status/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Liberty_server_status + ansible.builtin.include_tasks: liberty_server_status.yml diff --git a/ansible/roles/liberty_server_stop/meta/main.yml b/ansible/roles/liberty_server_stop/meta/main.yml new file mode 100644 index 000000000..285b3d3fa --- /dev/null +++ b/ansible/roles/liberty_server_stop/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: liberty_defaults diff --git a/ansible/roles/liberty_server_stop/readme.md b/ansible/roles/liberty_server_stop/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/liberty_server_stop/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/liberty_server_stop/tasks/liberty_server_stop.yml b/ansible/roles/liberty_server_stop/tasks/liberty_server_stop.yml new file mode 100644 index 000000000..147a340b0 --- /dev/null +++ b/ansible/roles/liberty_server_stop/tasks/liberty_server_stop.yml @@ -0,0 +1,29 @@ +--- +- name: Liberty Server Stop + tags: stop + block: + - name: Check if liberty is installed + ansible.builtin.stat: + path: "{{ install_base }}/{{ liberty_dir }}/bin/server" + register: isliberty + failed_when: isliberty.stat.exists == False + + - name: Status Liberty Server + ansible.builtin.command: + cmd: "{{ wlp_cmd }} {{ install_base }}/{{ liberty_dir }}/bin/server status {{ wl_server }}" + register: cmdOutput + failed_when: ( cmdOutput.rc not in [ 0, 1 ] ) + + - name: Stop Liberty Server block + when: cmdOutput.rc == 0 + block: + - name: Stop Liberty Server + ansible.builtin.command: + cmd: "{{ wlp_cmd }} {{ install_base }}/{{ liberty_dir }}/bin/server stop {{ wl_server }}" + register: cmdOutput1 + failed_when: ( cmdOutput1.rc not in [ 0, 1, 21 ] ) # GPF rc=21, which kills the server, mission accomplished + + - name: Stop output + ansible.builtin.debug: + msg: '{{ cmdOutput1.stdout_lines }}' + failed_when: ( cmdOutput1.rc not in [ 0, 1, 21 ] ) diff --git a/ansible/roles/liberty_server_stop/tasks/main.yml b/ansible/roles/liberty_server_stop/tasks/main.yml new file mode 100644 index 000000000..bceb6f910 --- /dev/null +++ b/ansible/roles/liberty_server_stop/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Liberty_server_stop + ansible.builtin.include_tasks: liberty_server_stop.yml diff --git a/ansible/roles/liberty_servers/tasks/liberty_servers.yml b/ansible/roles/liberty_servers/tasks/liberty_servers.yml index d16a3c7b6..9f7085615 100644 --- a/ansible/roles/liberty_servers/tasks/liberty_servers.yml +++ b/ansible/roles/liberty_servers/tasks/liberty_servers.yml @@ -16,7 +16,7 @@ - name: stop existing server process ignore_errors: true shell: "{{ wlp_cmd }} {{install_base }}/{{ liberty_dir }}/bin/server stop {{ wl_server }}" - when: iscc.stat.exists == True + when: iscc.stat.exists register: op - debug: diff --git a/ansible/roles/liberty_version/meta/main.yml b/ansible/roles/liberty_version/meta/main.yml new file mode 100644 index 000000000..285b3d3fa --- /dev/null +++ b/ansible/roles/liberty_version/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: liberty_defaults diff --git a/ansible/roles/liberty_version/readme.md b/ansible/roles/liberty_version/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/liberty_version/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/liberty_version/tasks/liberty_version.yml b/ansible/roles/liberty_version/tasks/liberty_version.yml new file mode 100644 index 000000000..474212862 --- /dev/null +++ b/ansible/roles/liberty_version/tasks/liberty_version.yml @@ -0,0 +1,28 @@ +--- + +- name: Check if Liberty installed + ansible.builtin.stat: + path: "{{ install_base }}/{{ liberty_dir }}/bin/server" + register: islib + +- name: Check if Liberty installed + when: islib.stat.exists + block: + - name: Liberty version + ansible.builtin.shell: "{{ install_base }}/{{ liberty_dir }}/bin/server version" + register: libertyVersionOutput + + # - name: LibertyVersionOutput + # ansible.builtin.debug: + # msg: "{{ libertyVersionOutput.stdout | trim }}" + + - name: Set Liberty version facts + ansible.builtin.set_fact: + libertyVersion: '{{ libertyVersionOutput.stdout | trim }}' + + - name: Write Liberty version to json + delegate_to: localhost + ansible.builtin.template: + src: liberty_version_info.json.j2 + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ versioninfo_json_file }}" + mode: '0444' diff --git a/ansible/roles/liberty_version/tasks/main.yml b/ansible/roles/liberty_version/tasks/main.yml new file mode 100644 index 000000000..300242eab --- /dev/null +++ b/ansible/roles/liberty_version/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Liberty version + ansible.builtin.include_tasks: liberty_version.yml diff --git a/ansible/roles/liberty_version/templates/liberty_version_info.json.j2 b/ansible/roles/liberty_version/templates/liberty_version_info.json.j2 new file mode 100644 index 000000000..a70484cff --- /dev/null +++ b/ansible/roles/liberty_version/templates/liberty_version_info.json.j2 @@ -0,0 +1,5 @@ +{ + "{{ inventory_hostname }}":{ + "libertyVersion": "{{ libertyVersion }}" + } +} diff --git a/ansible/roles/linux_kill_process/tasks/linux_kill_process.yml b/ansible/roles/linux_kill_process/tasks/linux_kill_process.yml deleted file mode 100644 index afd2215af..000000000 --- a/ansible/roles/linux_kill_process/tasks/linux_kill_process.yml +++ /dev/null @@ -1,25 +0,0 @@ ---- - -# logic below to force kill linux process -- name: Get running processes list from remote host - ignore_errors: yes - shell: "ps -few | grep {{ linux_process_to_kill }} | awk '{print $2}'" - register: running_processes - -- name: Kill running processes - ignore_errors: yes - shell: "kill {{ item }}" - with_items: "{{ running_processes.stdout_lines }}" - -- wait_for: - path: "/proc/{{ item }}/status" - state: absent - timeout: 60 - with_items: "{{ running_processes.stdout_lines }}" - ignore_errors: yes - register: WsServer_processes - -- name: Force kill stuck processes - ignore_errors: yes - shell: "kill -9 {{ item }}" - with_items: "{{ WsServer_processes.results | select('failed') | map(attribute='item') | list }}" diff --git a/ansible/roles/linux_kill_process/tasks/main.yml b/ansible/roles/linux_kill_process/tasks/main.yml deleted file mode 100644 index 3667e6345..000000000 --- a/ansible/roles/linux_kill_process/tasks/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- include_tasks: linux_kill_process.yml diff --git a/ansible/roles/nestuser/defaults/main.yml b/ansible/roles/nestuser/defaults/main.yml index 482b6dfa9..437d7ca17 100644 --- a/ansible/roles/nestuser/defaults/main.yml +++ b/ansible/roles/nestuser/defaults/main.yml @@ -1,3 +1,5 @@ --- user_passfile: password.hash user_shell: '/bin/bash' +user_id: 1000 +group_id: 1000 diff --git a/ansible/roles/nestuser/meta/main.yml b/ansible/roles/nestuser/meta/main.yml index 2eb88a330..91c27db2a 100644 --- a/ansible/roles/nestuser/meta/main.yml +++ b/ansible/roles/nestuser/meta/main.yml @@ -2,3 +2,4 @@ dependencies: - role: load_secrets + tags: debug diff --git a/ansible/roles/nestuser/tasks/main.yml b/ansible/roles/nestuser/tasks/main.yml index 19b162e6b..6a4732fc6 100644 --- a/ansible/roles/nestuser/tasks/main.yml +++ b/ansible/roles/nestuser/tasks/main.yml @@ -1,99 +1,95 @@ --- -- name: Generate User Password file - script: scripts/password_hasher.py {{ user_password }} > {{ user_passfile }} - delegate_to: localhost - - # - name: Ensure User is Absent - # user: name={{ user_username }} state=absent - # become: yes - - name: Ensure group exists - become: yes - group: + become: true + ansible.builtin.group: name: "{{ user_username }}" + gid: "{{ group_id }}" state: present # AIX /usr/bin/bash # linux /bin/bash -- name: set /bin/ksh aix shell - set_fact: - user_shell: '/bin/ksh' +- name: Set /bin/ksh aix shell + ansible.builtin.set_fact: + user_shell: '/bin/ksh' when: - - ansible_architecture == 'chrp' + - ansible_architecture == 'chrp' - name: Ensure User is Present - user: name={{ user_username }} group={{ user_username }} password={{ lookup('file', user_passfile) }} generate_ssh_key=yes shell={{ user_shell }} state=present - become: yes - -- name: remove temp pass hash file - file: - path: "{{ user_passfile }}" - state: absent + become: true + ansible.builtin.user: + name: '{{ user_username }}' + uid: '{{ user_id }}' + group: '{{ user_username }}' + password: "{{ user_password | password_hash('sha512') }}" + generate_ssh_key: true + shell: '{{ user_shell }}' + state: present -- name: authorized_key - authorized_key: - user: "{{ user_username }}" - state: present - manage_dir: yes - key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}" +- name: Authorized_key + ansible.builtin.authorized_key: + user: "{{ user_username }}" + state: present + manage_dir: true + key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}" -- name: is sudo installed? - stat: +- name: Is sudo installed? + ansible.builtin.stat: path: "/etc/sudoers" register: issudoers -- name: nest sudoers - lineinfile: - path: /etc/sudoers - state: present - regexp: "^{{ user_username }}" - line: "{{ user_username }} ALL=(ALL) NOPASSWD: ALL" - validate: 'visudo -cf %s' - backup: yes - become: yes - when: issudoers.stat.exists == True - +- name: Nest sudoers + ansible.builtin.lineinfile: + path: /etc/sudoers + state: present + regexp: "^{{ user_username }}" + line: "{{ user_username }} ALL=(ALL) NOPASSWD: ALL" + validate: 'visudo -cf %s' + backup: true + become: true + when: issudoers.stat.exists + - block: - - name: nest hard ulimit nofile - lineinfile: - path: /etc/security/limits.conf - state: present - regexp: "{{ user_username }} hard" - line: "{{ user_username }} hard nofile 20000" - backup: yes - become: yes - - - name: nest soft ulimit nofile - lineinfile: - path: /etc/security/limits.conf - state: present - regexp: "{{ user_username }} soft" - line: "{{ user_username }} soft nofile 20000" - backup: yes - become: yes + - name: Nest hard ulimit nofile + ansible.builtin.lineinfile: + path: /etc/security/limits.conf + state: present + regexp: "{{ user_username }} hard" + line: "{{ user_username }} hard nofile 20000" + backup: true + become: true + + - name: Nest soft ulimit nofile + ansible.builtin.lineinfile: + path: /etc/security/limits.conf + state: present + regexp: "{{ user_username }} soft" + line: "{{ user_username }} soft nofile 20000" + backup: true + become: true when: - - ansible_system == 'Linux' + - ansible_system == 'Linux' -- name: nest ulimit nofile - lineinfile: - path: /etc/security/limits - state: present - regexp: 'nofiles = 2000' - line: 'nofiles = 20000' - backup: yes - become: yes +- name: Nest ulimit nofile + ansible.builtin.lineinfile: + path: /etc/security/limits + state: present + regexp: 'nofiles = 2000' + line: 'nofiles = 20000' + backup: true + become: true when: - - ansible_architecture == 'chrp' - -- name: opt directory owner - file: - path: '{{ item }}' - state: directory - recurse: no - owner: "{{ user_username }}" - group: "{{ user_username }}" + - ansible_architecture == 'chrp' + +- name: Opt directory owner + ansible.builtin.file: + path: '{{ item }}' + state: directory + recurse: false + owner: "{{ user_username }}" + group: "{{ user_username }}" + mode: '0755' with_items: - - '/opt' - become: yes + - '/opt' + become: true diff --git a/ansible/roles/oc_client_install/defaults/main.yml b/ansible/roles/oc_client_install/defaults/main.yml index b5530c948..1236b1108 100644 --- a/ansible/roles/oc_client_install/defaults/main.yml +++ b/ansible/roles/oc_client_install/defaults/main.yml @@ -1,3 +1,3 @@ --- -"ocp_client_version": "4.5.10" +"ocp_client_version": "latest" "client_os": "linux" # linux|mac|windows diff --git a/ansible/roles/oc_client_install/tasks/oc-client-install.yml b/ansible/roles/oc_client_install/tasks/oc-client-install.yml index 5f3a972ae..73ae0182f 100644 --- a/ansible/roles/oc_client_install/tasks/oc-client-install.yml +++ b/ansible/roles/oc_client_install/tasks/oc-client-install.yml @@ -5,14 +5,14 @@ environment: PATH: ".:{{ ansible_env.PATH }}" register: oc_installed - ignore_errors: yes + ignore_errors: true - name: install oc client when: oc_installed.rc != 0 block: - name: Download OCP CLI get_url: - url: "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/{{ ocp_client_version }}/openshift-client-{{ client_os }}-{{ ocp_client_version }}.tar.gz" + url: "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/{{ ocp_client_version }}/openshift-client-{{ client_os }}.tar.gz" dest: "./openshift-client.tar.gz" mode: '0755' validate_certs: false @@ -31,7 +31,7 @@ owner: root group: root mode: '0755' - become: yes + become: true become_user: root - name: Copy kubectl to local bin @@ -41,5 +41,6 @@ owner: root group: root mode: '0755' - become: yes + become: true become_user: root + diff --git a/ansible/roles/ops_svt_jmeter_container/tasks/ops_svt_jmeter_container.yml b/ansible/roles/ops_svt_jmeter_container/tasks/ops_svt_jmeter_container.yml index 8c2f91f73..5a4ebe5ed 100644 --- a/ansible/roles/ops_svt_jmeter_container/tasks/ops_svt_jmeter_container.yml +++ b/ansible/roles/ops_svt_jmeter_container/tasks/ops_svt_jmeter_container.yml @@ -1,18 +1,18 @@ --- - name: check for RedHat distribution - fail: + ansible.builtin.fail: msg: Target OS is not RedHat when: ansible_distribution != "RedHat" - name: create jmeter.log - file: + ansible.builtin.file: path: '{{ item }}' state: touch mode: '0755' with_items: - - jmeter.log - - jmeter.error + - jmeter.log + - jmeter.error - name: kill rm any existing jmeter container containers.podman.podman_container: @@ -25,8 +25,12 @@ state: absent # started created absent stopped present register: svtop -- debug: - msg: '{{ svtop }}' +# - ansible.builtin.debug: +# msg: '{{ svtop }}' + +- name: Get the timezone string + ansible.builtin.shell: "timedatectl show|grep Timezone|awk -F= '{print $2}'" + register: jvmTimeZone # https://docs.ansible.com/ansible/latest/collections/containers/podman/podman_container_module.html#ansible-collections-containers-podman-podman-container-module - name: operate on svt jmeter container @@ -34,15 +38,21 @@ log_level: info name: jmeter hostname: jmeter_container - privileged: no + privileged: false userns: keep-id image: "{{ svt_jmeter_image }}" state: "{{ jmeter_state }}" # started created absent stopped present - restart: yes - timezone: '{{ jmeter_tz }}' + restart: true + # timezone: '{{ jmeter_tz }}' + user: '0:0' + env: + jvmTimeZone: '{{ jvmTimeZone.stdout }}' + letMeExit: true + JSON_TAG: '{{ jmeter_script_id }}' volume: - - '/home/{{ ansible_user }}/jmeter.log:/jmeter/jmeter.log' - - '/home/{{ ansible_user }}/jmeter.error:/jmeter/jmeter.error' + - '/home/{{ ansible_user }}/jmeter.log:/jmeter/jmeter.log' + - '/home/{{ ansible_user }}/jmeter.error:/jmeter/jmeter.error' + - '/etc/localtime:/etc/localtime:ro' command: "-script {{ jmeter_script_id }} \ -host {{ jmeter_ihs_host }} \ -port {{ jmeter_ihs_port }} \ @@ -51,14 +61,15 @@ -rampUpSecs {{ jmeter_rampUpSecs }} \ -threads {{ jmeter_threads }} \ -auth {{ jmeter_auth }} \ + -appUrl {{ jmeter_appUrl }} \ -report {{ jmeter_report }}" register: svtop -- debug: - msg: '{{ svtop }}' +# - ansible.builtin.debug: +# msg: '{{ svtop }}' - name: Gather facts for all containers containers.podman.podman_container_info: register: svtop -- debug: - msg: '{{ svtop }}' +# - ansible.builtin.debug: +# msg: '{{ svtop }}' diff --git a/ansible/roles/osprereqs/defaults/main.yml b/ansible/roles/osprereqs/defaults/main.yml new file mode 100644 index 000000000..194ea0491 --- /dev/null +++ b/ansible/roles/osprereqs/defaults/main.yml @@ -0,0 +1,2 @@ +--- +twas855x: false diff --git a/ansible/roles/osprereqs/tasks/AIX.7.yml b/ansible/roles/osprereqs/tasks/AIX.7.yml index 1e67784aa..90317480c 100644 --- a/ansible/roles/osprereqs/tasks/AIX.7.yml +++ b/ansible/roles/osprereqs/tasks/AIX.7.yml @@ -1,50 +1,59 @@ --- ### https://www.ibm.com/support/pages/understanding-aix-virtual-rpm-package-rpmrte - name: updtvpkg - command: 'updtvpkg' - become: yes + ansible.builtin.command: 'updtvpkg' + become: true + - name: check if aixtoolbox is installed - stat: + ansible.builtin.stat: path: /opt/freeware/bin/dnf register: istoolbox + - block: - name: create aixtoolbox dir - file: + ansible.builtin.file: path: /tmp/aixtoolbox state: directory + - name: get aixtoolbox get_url - get_url: + ansible.builtin.get_url: url: "https://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/ezinstall/ppc/dnf_aixtoolbox.sh" dest: /tmp/aixtoolbox/dnf_aixtoolbox.sh validate_certs: false - become: yes + become: true + - name: chmod +x dnf_aixtoolbox.sh ansible.builtin.file: path: /tmp/aixtoolbox/dnf_aixtoolbox.sh owner: root mode: '1777' - become: yes + become: true + - name: install aixtoolbox - command: '/tmp/aixtoolbox/dnf_aixtoolbox.sh -y' + ansible.builtin.command: '/tmp/aixtoolbox/dnf_aixtoolbox.sh -y' args: chdir: /tmp/aixtoolbox - become: yes + become: true when: istoolbox.stat.exists == False + - name: add /opt/freeware/bin to the path - lineinfile: + ansible.builtin.lineinfile: path: "~/.profile" regexp: '/opt/freeware/bin' line: 'export PATH=/opt/freeware/bin:$PATH' create: true - become: yes + become: true + - name: Install the latest version sudo - ignore_errors: yes - command: '/opt/freeware/bin/dnf -y install sudo zip unzip less' - become: yes + ignore_errors: true + ansible.builtin.command: '/opt/freeware/bin/dnf -y install sudo zip unzip less' + become: true + - name: dnf update all latest - ignore_errors: yes - command: '/opt/freeware/bin/dnf -y update' - become: yes + ignore_errors: true + ansible.builtin.command: '/opt/freeware/bin/dnf -y update' + become: true + - name: enable full core dump from applications - command: 'chdev -l sys0 -a fullcore=true' - become: yes + ansible.builtin.command: 'chdev -l sys0 -a fullcore=true' + become: true diff --git a/ansible/roles/osprereqs/tasks/RedHat.10.yml b/ansible/roles/osprereqs/tasks/RedHat.10.yml new file mode 100644 index 000000000..95a5155ac --- /dev/null +++ b/ansible/roles/osprereqs/tasks/RedHat.10.yml @@ -0,0 +1,46 @@ +--- +# specific OS supports wildcards, if preceded with @ its a group +# if the db is corrupt, this can fix it: rpm --rebuilddb +- name: Remove extraneous packages + become: true + ignore_errors: true + ansible.builtin.dnf: + name: "{{ packages }}" + state: absent + autoremove: yes + vars: + packages: + - "adobe*" + - "java*" + - "samba*" + - "valgrind*" + - "git*" + - "tignervnc" + - '@workstation' + - 'tigervnc-server' + - 'xorg-x11-fonts-Type1' + +- name: Update all packages + become: true + ansible.builtin.dnf: + name: '*' + state: latest + +- name: Install packages + become: true + ansible.builtin.dnf: + name: "{{ packages }}" + state: present + skip_broken: yes + vars: + packages: + - 'xorg-x11-xauth' + - 'gtk3' + - 'libXtst' + - 'xorg-x11-fonts-Type1' + - 'zip' + - 'unzip' + - 'python3' + - 'jq' + - 'libxcrypt-compat' + - 'libnsl' diff --git a/ansible/roles/osprereqs/tasks/RedHat.7.yml b/ansible/roles/osprereqs/tasks/RedHat.7.yml index 92bf3c960..479fb2057 100644 --- a/ansible/roles/osprereqs/tasks/RedHat.7.yml +++ b/ansible/roles/osprereqs/tasks/RedHat.7.yml @@ -2,7 +2,7 @@ # specific OS supports wildcards, if preceded with @ its a group # if the db is corrupt, this can fix it: rpm --rebuilddb - name: remove extraneous packages - become: yes + become: true ignore_errors: yes yum: name: "{{ packages }}" @@ -21,14 +21,14 @@ - 'xorg-x11-fonts-Type1' - name: yum update - become: yes + become: true ignore_errors: yes yum: name: '*' state: latest - name: install packages - become: yes + become: true yum: name: "{{ packages }}" state: present diff --git a/ansible/roles/osprereqs/tasks/RedHat.8.yml b/ansible/roles/osprereqs/tasks/RedHat.8.yml index 0333bb568..e4a9ee446 100644 --- a/ansible/roles/osprereqs/tasks/RedHat.8.yml +++ b/ansible/roles/osprereqs/tasks/RedHat.8.yml @@ -2,12 +2,12 @@ # specific OS supports wildcards, if preceded with @ its a group # if the db is corrupt, this can fix it: rpm --rebuilddb - name: remove extraneous packages - become: yes - ignore_errors: yes + become: true + ignore_errors: true dnf: name: "{{ packages }}" state: absent - autoremove: yes + autoremove: true vars: packages: - "adobe*" @@ -21,17 +21,17 @@ - 'xorg-x11-fonts-Type1' - name: dnf update - become: yes + become: true dnf: name: '*' state: latest - name: install packages - become: yes + become: true dnf: name: "{{ packages }}" state: present - skip_broken: yes + skip_broken: true vars: packages: - 'xorg-x11-xauth' @@ -43,3 +43,20 @@ - 'unzip' - 'python3' - 'jq' + +- name: Install packages tWAS 855x 32 bit packages + when: + - twas855x|bool + - ansible_architecture == 'x86_64' + become: true + dnf: + name: "{{ packages }}" + state: present + skip_broken: yes + vars: + packages: + - 'glibc.i686' + - ' gtk2.i686' + - 'libXtst.i686' + - 'libXft.i686' + - 'libnsl.i686' diff --git a/ansible/roles/osprereqs/tasks/RedHat.9.yml b/ansible/roles/osprereqs/tasks/RedHat.9.yml index 7be04fe1e..a129df584 100644 --- a/ansible/roles/osprereqs/tasks/RedHat.9.yml +++ b/ansible/roles/osprereqs/tasks/RedHat.9.yml @@ -1,9 +1,9 @@ --- # specific OS supports wildcards, if preceded with @ its a group # if the db is corrupt, this can fix it: rpm --rebuilddb -- name: remove extraneous packages - become: yes - ignore_errors: yes +- name: Remove extraneous packages + become: true + ignore_errors: true dnf: name: "{{ packages }}" state: absent @@ -21,13 +21,13 @@ - 'xorg-x11-fonts-Type1' - name: dnf update - become: yes + become: true dnf: name: '*' state: latest -- name: install packages - become: yes +- name: Install packages + become: true dnf: name: "{{ packages }}" state: present @@ -44,3 +44,22 @@ - 'python3' - 'jq' - 'libxcrypt-compat' + +- name: Install packages tWAS 855x 32 bit packages + when: + - twas855x|bool + - ansible_architecture == 'x86_64' + become: true + dnf: + name: "{{ packages }}" + state: present + skip_broken: yes + vars: + packages: + - 'glibc.i686' + - 'gtk2.i686' + - 'libXtst.i686' + - 'libXft.i686' + - 'libnsl.i686' + + diff --git a/ansible/roles/osprereqs/tasks/SLES.12.yml b/ansible/roles/osprereqs/tasks/SLES.12.yml index e8f817ca7..719bd98d8 100644 --- a/ansible/roles/osprereqs/tasks/SLES.12.yml +++ b/ansible/roles/osprereqs/tasks/SLES.12.yml @@ -1,7 +1,7 @@ --- # specific OS supports wildcards - name: remove extraneous packages - become: yes + become: true ignore_errors: yes zypper: name: "{{ packages }}" @@ -15,13 +15,13 @@ - "tignervnc" - name: remove extraneous packages - become: yes + become: true zypper: name: '*' state: latest - name: install packages - become: yes + become: true zypper: name: "{{ packages }}" state: present diff --git a/ansible/roles/osprereqs/tasks/SLES.15.yml b/ansible/roles/osprereqs/tasks/SLES.15.yml index 48cc55653..2c75fdc83 100644 --- a/ansible/roles/osprereqs/tasks/SLES.15.yml +++ b/ansible/roles/osprereqs/tasks/SLES.15.yml @@ -1,7 +1,7 @@ --- # specific OS supports wildcards - name: remove extraneous packages - become: yes + become: true ignore_errors: yes zypper: name: "{{ packages }}" @@ -15,13 +15,13 @@ - "tignervnc" - name: zypper update - become: yes + become: true zypper: name: '*' state: latest - name: install packages - become: yes + become: true zypper: name: "{{ packages }}" state: present diff --git a/ansible/roles/osprereqs/tasks/Ubuntu.18.yml b/ansible/roles/osprereqs/tasks/Ubuntu.18.yml index 13e79452c..5d54040fb 100644 --- a/ansible/roles/osprereqs/tasks/Ubuntu.18.yml +++ b/ansible/roles/osprereqs/tasks/Ubuntu.18.yml @@ -1,7 +1,7 @@ --- # specific OS supports wildcards - name: remove extraneous packages - become: yes + become: true ignore_errors: yes apt: name: "{{ packages }}" @@ -16,13 +16,13 @@ - "tignervnc" - name: apt update - become: yes + become: true apt: name: '*' state: latest - name: install packages - become: yes + become: true apt: name: "{{ packages }}" state: present diff --git a/ansible/roles/osprereqs/tasks/Ubuntu.20.yml b/ansible/roles/osprereqs/tasks/Ubuntu.20.yml index 13e79452c..f2cd7aa9c 100644 --- a/ansible/roles/osprereqs/tasks/Ubuntu.20.yml +++ b/ansible/roles/osprereqs/tasks/Ubuntu.20.yml @@ -1,8 +1,8 @@ --- # specific OS supports wildcards - name: remove extraneous packages - become: yes - ignore_errors: yes + become: true + ignore_errors: true apt: name: "{{ packages }}" state: absent @@ -16,13 +16,13 @@ - "tignervnc" - name: apt update - become: yes + become: true apt: name: '*' state: latest - name: install packages - become: yes + become: true apt: name: "{{ packages }}" state: present @@ -33,3 +33,30 @@ - 'libxft2' - 'zip' - 'unzip' + +- name: Install packages tWAS 855x 32bit packages + when: + - twas855x|bool + - ansible_architecture == 'x86_64' + become: true + command: dpkg --add-architecture i386 + +- name: dpkg --add-architecture i386 tWAS 855x 32bit packages + when: + - twas855x|bool + - ansible_architecture == 'x86_64' + become: true + apt: + name: "{{ packages }}" + state: present + vars: + packages: + - libxtst6 + - libgtk2.0-0 + - libc6:i386 + - libgcc1:i386 + - libgtk2.0-0:i386 + - libstdc++6:i386 + - libxft2 + - libxft2:i386 + - libxtst6:i386 diff --git a/ansible/roles/osprereqs/tasks/Ubuntu.22.yml b/ansible/roles/osprereqs/tasks/Ubuntu.22.yml index 7b5b0a707..adfb65c94 100644 --- a/ansible/roles/osprereqs/tasks/Ubuntu.22.yml +++ b/ansible/roles/osprereqs/tasks/Ubuntu.22.yml @@ -1,8 +1,8 @@ --- # specific OS supports wildcards - name: remove extraneous packages - become: yes - ignore_errors: yes + become: true + ignore_errors: true apt: name: "{{ packages }}" state: absent @@ -16,20 +16,44 @@ - "tignervnc" - name: apt update - become: yes + become: true apt: name: '*' state: latest - name: install packages - become: yes + become: true apt: name: "{{ packages }}" state: present vars: packages: - # - 'libxtst6' - # - 'libgtk2.0-0' - # - 'libxft2' - 'zip' - 'unzip' + +- name: Install packages tWAS 855x 32bit packages + when: + - twas855x|bool + - ansible_architecture == 'x86_64' + become: true + command: dpkg --add-architecture i386 + +- name: dpkg --add-architecture i386 tWAS 855x 32bit packages + when: + - twas855x|bool + - ansible_architecture == 'x86_64' + become: true + apt: + name: "{{ packages }}" + state: present + vars: + packages: + - libxtst6 + - libgtk2.0-0 + - libc6:i386 + - libgcc1:i386 + - libgtk2.0-0:i386 + - libstdc++6:i386 + - libxft2 + - libxft2:i386 + - libxtst6:i386 diff --git a/ansible/roles/osprereqs/tasks/Ubuntu.24.yml b/ansible/roles/osprereqs/tasks/Ubuntu.24.yml new file mode 100644 index 000000000..e2b95057c --- /dev/null +++ b/ansible/roles/osprereqs/tasks/Ubuntu.24.yml @@ -0,0 +1,59 @@ +--- +# specific OS supports wildcards +- name: remove extraneous packages + become: true + ignore_errors: true + apt: + name: "{{ packages }}" + state: absent + autoremove: yes + vars: + packages: + - "java*" + - "samba*" + - "valgrind*" + - "git*" + - "tignervnc" + +- name: apt update + become: true + apt: + name: '*' + state: latest + +- name: install packages + become: true + apt: + name: "{{ packages }}" + state: present + vars: + packages: + - zip + - unzip + +- name: Install packages tWAS 855x 32bit packages + when: + - twas855x|bool + - ansible_architecture == 'x86_64' + become: true + command: dpkg --add-architecture i386 + +- name: dpkg --add-architecture i386 tWAS 855x 32bit packages + when: + - twas855x|bool + - ansible_architecture == 'x86_64' + become: true + apt: + name: "{{ packages }}" + state: present + vars: + packages: + - libxtst6 + - libgtk2.0-0 + - libc6:i386 + - libgcc1:i386 + - libgtk2.0-0:i386 + - libstdc++6:i386 + - libxft2 + - libxft2:i386 + - libxtst6:i386 \ No newline at end of file diff --git a/ansible/roles/osprereqs/tasks/anylinux.yml b/ansible/roles/osprereqs/tasks/anylinux.yml index c33b71a71..3b2166255 100644 --- a/ansible/roles/osprereqs/tasks/anylinux.yml +++ b/ansible/roles/osprereqs/tasks/anylinux.yml @@ -1,21 +1,27 @@ --- -- name: enable /etc/ssh/sshd_config X11Forwarding yes - lineinfile: - path: '/etc/ssh/sshd_config' - state: present - regexp: 'X11Forwarding no' - line: 'X11Forwarding yes' - become: yes +- name: Enable /etc/ssh/sshd_config X11Forwarding yes + ansible.builtin.lineinfile: + path: '/etc/ssh/sshd_config' + state: present + regexp: 'X11Forwarding no' + line: 'X11Forwarding yes' + become: true -- name: enable /etc/ssh/sshd_config X11UseLocalhost no - lineinfile: - path: '/etc/ssh/sshd_config' - state: present - regexp: 'X11UseLocalhost yes' - line: 'X11UseLocalhost no' - become: yes +- name: Enable /etc/ssh/sshd_config X11UseLocalhost no + ansible.builtin.lineinfile: + path: '/etc/ssh/sshd_config' + state: present + regexp: 'X11UseLocalhost yes' + line: 'X11UseLocalhost no' + become: true -- name: restart sshd - command: "systemctl restart sshd" - become: yes +- name: Restart sshd on RedHat + ansible.builtin.command: "systemctl restart sshd" + become: true + when: ansible_facts['distribution'] == "RedHat" + +- name: Restart ssh on Ubuntu + ansible.builtin.command: "systemctl restart ssh" + become: true + when: ansible_facts['distribution'] == "Ubuntu" diff --git a/ansible/roles/osprereqs/tasks/main.yml b/ansible/roles/osprereqs/tasks/main.yml index 8aed4c6bc..8c8454210 100644 --- a/ansible/roles/osprereqs/tasks/main.yml +++ b/ansible/roles/osprereqs/tasks/main.yml @@ -1,5 +1,8 @@ --- -- include_tasks: anylinux.yml - when: - - ansible_system == 'Linux' -- include_tasks: "{{ ansible_distribution }}.{{ ansible_distribution_major_version }}.yml" +- name: Run on all linux targets + ansible.builtin.include_tasks: anylinux.yml + when: + - ansible_system == 'Linux' + +- name: Run on specific OS targets + ansible.builtin.include_tasks: "{{ ansible_distribution }}.{{ ansible_distribution_major_version }}.yml" diff --git a/ansible/roles/pentest_fyrevm/tasks/pentest_fyrevm.yml b/ansible/roles/pentest_fyrevm/tasks/pentest_fyrevm.yml index fe1432ba6..1ac402ddb 100644 --- a/ansible/roles/pentest_fyrevm/tasks/pentest_fyrevm.yml +++ b/ansible/roles/pentest_fyrevm/tasks/pentest_fyrevm.yml @@ -7,7 +7,7 @@ fyre_platform: x fyre_cpu: 2 fyre_memory: 4 - fyre_os: 'RedHat 9.0' + fyre_os: 'RedHat 9.2' fyre_site: "{{ site }}" fyre_comment: 'Pentest Host' clusterName_prefix: pentest diff --git a/ansible/roles/podman/tasks/RedHat.8.yml b/ansible/roles/podman/tasks/RedHat.8.yml index 984af2ee2..538e89e02 100644 --- a/ansible/roles/podman/tasks/RedHat.8.yml +++ b/ansible/roles/podman/tasks/RedHat.8.yml @@ -2,13 +2,13 @@ # specific OS supports wildcards, if preceded with @ its a group # if the db is corrupt, this can fix it: rpm --rebuilddb - name: dnf update - become: yes + become: true dnf: name: '*' state: latest - name: install packages - become: yes + become: true dnf: name: "{{ packages }}" state: present diff --git a/ansible/roles/print_db_info/defaults/main.yml b/ansible/roles/print_db_info/defaults/main.yml new file mode 100644 index 000000000..f1cf59077 --- /dev/null +++ b/ansible/roles/print_db_info/defaults/main.yml @@ -0,0 +1,2 @@ +--- +db_info_json_file: 'db_info.json' diff --git a/ansible/roles/print_db_info/tasks/main.yml b/ansible/roles/print_db_info/tasks/main.yml new file mode 100644 index 000000000..ffd7b5a21 --- /dev/null +++ b/ansible/roles/print_db_info/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Print DB container info + ansible.builtin.include_tasks: print_db_info.yml diff --git a/ansible/roles/print_db_info/tasks/print_db_info.yml b/ansible/roles/print_db_info/tasks/print_db_info.yml new file mode 100644 index 000000000..405098ace --- /dev/null +++ b/ansible/roles/print_db_info/tasks/print_db_info.yml @@ -0,0 +1,59 @@ +--- +- name: Print DB info + when: groups.db is defined + block: + # if the db container is not running this will not work + # our container already exports this to a file on the mounted volume + # dbdir/backup/db2ls.info + # + # - name: Get the DB container version info + # containers.podman.podman_container_exec: + # name: "{{ svt_db_container_name }}" + # command: "su - db2inst1 -c db2ls -c" + # register: dbinfo + + # the db2ls.info file is new, and prob not on all the target dbs yet + - name: Check if svt_db_dir/backup/db2ls.info exists + ansible.builtin.stat: + path: "{{ svt_db_dir }}/backup/db2ls.info" + register: isdb2ls + + - name: Block for db2ls.info + when: (isdb2ls.stat.exists and isdb2ls.stat.size != 0) + block: + # #PATH:VRMF:FIXPACK:SPECIAL:INSTALLTIME:INSTALLERUID + # /opt/ibm/db2/V12.1:12.1.1.0:0 ::Tue Feb 4 22:54:29 2025 UTC :0 + - name: Slurp the db2ls.info file + ansible.builtin.slurp: + src: "~/{{ svt_db_dir }}/backup/db2ls.info" + register: output + + - name: Do some regex + ansible.builtin.set_fact: + content: "{{ output.content | b64decode | regex_search('(?:\\d{1,3}\\.){3}\\d{1,3}\\:\\d+') | split(':') }}" + + - name: Set the DB version / fixpack facts + ansible.builtin.set_fact: + db_Version: "{{ content[0] }}" # ?? some tricky regex + db_Fixpack: "{{ content[1] }}" # ?? some tricky regex + + - name: Default the db version db2ls file not found + delegate_to: localhost + when: (isdb2ls.stat.exists == False or isdb2ls.stat.size == 0) + ansible.builtin.set_fact: + db_Version: "V12.1.1.0" + db_Fixpack: "0" + + - name: Create local logs dir + delegate_to: localhost + ansible.builtin.file: + path: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}" + state: directory + mode: '0755' + + - name: Save db_info to json + delegate_to: localhost + ansible.builtin.template: + src: db_info.json.j2 + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ db_info_json_file }}" + mode: '0444' diff --git a/ansible/roles/print_db_info/templates/db_info.json.j2 b/ansible/roles/print_db_info/templates/db_info.json.j2 new file mode 100644 index 000000000..cb1a7a2ad --- /dev/null +++ b/ansible/roles/print_db_info/templates/db_info.json.j2 @@ -0,0 +1,7 @@ +{ + "{{ inventory_hostname }}":{ + "container_name": "{{ svt_db_container_name }}", + "Version": "{{ db_Version }}", + "Fixpack": "{{ db_Fixpack }}" + } +} diff --git a/ansible/roles/print_env_role_host/print_env_role_host.yml b/ansible/roles/print_env_role_host/print_env_role_host.yml new file mode 100644 index 000000000..4ace4f78f --- /dev/null +++ b/ansible/roles/print_env_role_host/print_env_role_host.yml @@ -0,0 +1,113 @@ +--- +- name: Add tWAS + delegate_to: localhost + when: env_name is search('tWAS') + ansible.builtin.set_fact: + envroles: "{{ envroles | default({}) | combine ({ item.key : item.value }) }}" + with_items: + - { 'key': 'tWAS Dmgr' , 'value': '{{ groups.dmgr }}'} + - { 'key': 'tWAS Server' , 'value': '{{ groups.ts }}'} + +- name: Add Liberty Server + delegate_to: localhost + when: + - env_name is not search('tWAS') + - groups.ls is defined + ansible.builtin.set_fact: + envroles: "{{ envroles | default({}) | combine ({ item.key : item.value }) }}" + with_items: + - { 'key': 'Liberty Server' , 'value': '{{ groups.ls }}'} + +- name: Add Controller + delegate_to: localhost + when: + - env_name is not search('tWAS') + - groups.cc is defined + ansible.builtin.set_fact: + envroles: "{{ envroles | default({}) | combine ({ item.key : item.value }) }}" + with_items: + - { 'key': 'Controller' , 'value': '{{ groups.cc }}'} + +- name: Add ULB + delegate_to: localhost + when: + - groups.ulb is defined + ansible.builtin.set_fact: + envroles: "{{ envroles | default({}) | combine ({ item.key : item.value }) }}" + with_items: + - { 'key': 'ulb' , 'value': '{{ groups.ulb }}'} + +- name: Add ldap + delegate_to: localhost + when: + - groups.ldap is defined + ansible.builtin.set_fact: + envroles: "{{ envroles | default({}) | combine ({ item.key : item.value }) }}" + with_items: + - { 'key': 'ldap' , 'value': '{{ groups.ldap }}'} + +- name: Add WebServer + delegate_to: localhost + when: + - groups.ihs is defined + ansible.builtin.set_fact: + envroles: "{{ envroles | default({}) | combine ({ item.key : item.value }) }}" + with_items: + - { 'key': 'webserver' , 'value': '{{ groups.ihs }}'} + +- name: Add Stress + delegate_to: localhost + when: + - groups.stress is defined + ansible.builtin.set_fact: + envroles: "{{ envroles | default({}) | combine ({ item.key : item.value }) }}" + with_items: + - { 'key': 'stress' , 'value': '{{ groups.stress }}'} + +- name: Add appClient + delegate_to: localhost + when: + - groups.appclient is defined + ansible.builtin.set_fact: + envroles: "{{ envroles | default({}) | combine ({ item.key : item.value }) }}" + with_items: + - { 'key': 'appClient' , 'value': '{{ groups.appclient }}'} + +- name: Add database + delegate_to: localhost + when: + - groups.db is defined + ansible.builtin.set_fact: + envroles: "{{ envroles | default({}) | combine ({ item.key : item.value }) }}" + with_items: + - { 'key': 'database' , 'value': '{{ groups.db }}'} + +- name: Add email + delegate_to: localhost + ansible.builtin.set_fact: + envroles: "{{ envroles | default({}) | combine ({ item.key : item.value }) }}" + with_items: + - { 'key': 'email' , 'value': '{{ env_owner }}'} + +- name: Add mq + when: groups.mq is defined + ansible.builtin.set_fact: + envroles: "{{ envroles | default({}) | combine ({ item.key : item.value }) }}" + with_items: + - { 'key': 'mq' , 'value': '{{ groups.mq }}'} + +# - name: Display the Dictionary +# ansible.builtin.debug: var=envroles + +- name: Create local logs dir + delegate_to: localhost + ansible.builtin.file: + path: "{{ logs_dir }}/{{ env_name }}" + state: directory + +- name: Write the env_role_host.json + ansible.builtin.copy: + content: "{{ envroles | to_nice_json }}" + dest: "{{ logs_dir }}/{{ env_name }}/env_role_host.json" + mode: '0444' + delegate_to: localhost diff --git a/ansible/roles/print_env_role_host/tasks/main.yml b/ansible/roles/print_env_role_host/tasks/main.yml new file mode 100644 index 000000000..90d75c7c9 --- /dev/null +++ b/ansible/roles/print_env_role_host/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: NEST Env role / hosts + ansible.builtin.include_tasks: print_env_role_host.yml diff --git a/ansible/roles/print_mq_info/tasks/main.yml b/ansible/roles/print_mq_info/tasks/main.yml new file mode 100644 index 000000000..88318d0d6 --- /dev/null +++ b/ansible/roles/print_mq_info/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Print MQ container info + ansible.builtin.include_tasks: print_mq_info.yml diff --git a/ansible/roles/print_mq_info/tasks/print_mq_info.yml b/ansible/roles/print_mq_info/tasks/print_mq_info.yml new file mode 100644 index 000000000..154f18429 --- /dev/null +++ b/ansible/roles/print_mq_info/tasks/print_mq_info.yml @@ -0,0 +1,77 @@ +--- +- name: Print MQ info + when: groups.mq is defined + block: + + - name: Gather info for container + containers.podman.podman_container_info: + name: '{{ svt_mq_container_name }}' + register: container_info + + - name: MQ is running in container + when: container_info.containers[0] is defined + block: + + - name: Get the MQ container version info + containers.podman.podman_container_exec: + name: "{{ svt_mq_container_name }}" + command: "dspmqver" + register: mqinfo + # "Name: IBM MQ", + # "Version: 9.4.1.1", + # "Level: p941-001-241129", + # "BuildType: IKAP - (Production)", + # "Platform: IBM MQ for Linux (x86-64 platform)", + # "Mode: 64-bit", + # "O/S: Linux 5.14.0-503.26.1.el9_5.x86_64", + # "O/S Details: Red Hat Enterprise Linux 9.5 (Plow)", + # "InstName: Installation1", + # "InstDesc: IBM MQ V9.4.1.1 (Unzipped)", + # "Primary: N/A", + # "InstPath: /opt/mqm", + # "DataPath: /mnt/mqm/data", + # "MaxCmdLevel: 941", + # "LicenseType: Developer", + # "ReleaseType: Continuous Delivery (CD)" + + # temp hard code info ?? some tricky regex + - name: Do some regex + ansible.builtin.set_fact: + content: "{{ mqinfo.stdout_lines | map('regex_findall','(?<=:)[^\"]+') | flatten }}" + + # - name: Print out content + # ansible.builtin.debug: + # msg: "{{ content }}" + + - name: Set MQ info fact + ansible.builtin.set_fact: + mq_Name: "{{content[0] | trim}}" + mq_Version: "{{content[1] | trim}}" + mq_Level: "{{content[2] | trim}}" + mq_BuildType: "{{content[3] | trim}}" + mq_Platform: "{{content[4] | trim}}" + mq_Mode: "{{content[5] | trim}}" + mq_os: "{{content[6] | trim}}" + mq_osDetails: "{{content[7] | trim}}" + mq_InstName: "{{content[8] | trim}}" + mq_InstDesc: "{{content[9] | trim}}" + mq_Primary: "{{content[10] | trim}}" + mq_InstPath: "{{content[11] | trim}}" + mq_DataPath: "{{content[12] | trim}}" + mq_MaxCmdLevel: "{{content[13] | trim}}" + mq_LicenseType: "{{content[14] | trim}}" + mq_ReleaseType: "{{content[15] | trim}}" + + - name: Create local logs dir + delegate_to: localhost + ansible.builtin.file: + path: "{{ logs_dir }}/{{ env_name }}" + state: directory + mode: '0755' + + - name: Save mqinfo to mq_info.json + delegate_to: localhost + ansible.builtin.template: + src: mq_info.json.j2 + dest: "{{ logs_dir }}/{{ env_name }}/mq_info.json" + mode: '0444' diff --git a/ansible/roles/print_mq_info/templates/mq_info.json.j2 b/ansible/roles/print_mq_info/templates/mq_info.json.j2 new file mode 100644 index 000000000..511cb7985 --- /dev/null +++ b/ansible/roles/print_mq_info/templates/mq_info.json.j2 @@ -0,0 +1,21 @@ +{ + "{{ inventory_hostname }}":{ + "container_name": "{{ svt_mq_container_name }}", + "Name": "{{ mq_Name }}", + "Version": "{{ mq_Version }}", + "Level": "{{ mq_Level }}", + "BuildType": "{{ mq_BuildType }}", + "Platform": "{{ mq_Platform }}", + "Mode": "{{ mq_Mode }}", + "os": "{{ mq_os }}", + "osDetails": "{{ mq_osDetails }}", + "InstName": "{{ mq_InstName }}", + "InstDesc": "{{ mq_InstDesc }}", + "Primary": "{{ mq_Primary }}", + "InstPath": "{{ mq_InstPath }}", + "DataPath": "{{ mq_DataPath }}", + "MaxCmdLevel": "{{ mq_MaxCmdLevel }}", + "LicenseType": "{{ mq_LicenseType }}", + "ReleaseType": "{{ mq_ReleaseType }}" + } +} diff --git a/ansible/roles/quickcheck/tasks/quickcheck.yml b/ansible/roles/quickcheck/tasks/quickcheck.yml index 49969c0c9..73e7ab2f6 100644 --- a/ansible/roles/quickcheck/tasks/quickcheck.yml +++ b/ansible/roles/quickcheck/tasks/quickcheck.yml @@ -1,25 +1,25 @@ --- -- name: install QuickCheck6.jar +- name: Install QuickCheck6.jar copy: src: files/QuickCheck6.jar dest: ~/QuickCheck6.jar -- name: install daytrader.txt +- name: Install daytrader.txt copy: src: files/daytrader.txt dest: ~/daytrader.txt - name: QuickCheck all logs delegate_to: localhost - shell: 'java -jar ~/QuickCheck6.jar ~/daytrader.txt . ' + ansible.builtin.shell: 'java -jar ~/QuickCheck6.jar ~/daytrader.txt . ' args: chdir: "logs/{{ env_name }}/" register: qcoutput -- name: quickcheck output - debug: - msg: "{{ qcoutput.stdout_lines }}" +- name: Quickcheck output + ansible.builtin.debug: + msg: "{{ qcoutput.stdout_lines }}" -- name: quickcheck dir location - debug: - msg: "{{ playbook_dir }}/logs/{{ env_name }}/QuickCheckOutput/" +- name: Quickcheck dir location + ansible.builtin.debug: + msg: "{{ playbook_dir }}/logs/{{ env_name }}/QuickCheckOutput/" diff --git a/ansible/roles/request_ocs_local_storage/tasks/request_ocs_local_storage.yml b/ansible/roles/request_ocs_local_storage/tasks/request_ocs_local_storage.yml index df9d19778..6bf2df28e 100644 --- a/ansible/roles/request_ocs_local_storage/tasks/request_ocs_local_storage.yml +++ b/ansible/roles/request_ocs_local_storage/tasks/request_ocs_local_storage.yml @@ -2,7 +2,7 @@ # tasks ocs install - name: Install jq - become: yes + become: true package: > name=jq state=latest diff --git a/ansible/roles/setup_autowas/tasks/main.yml b/ansible/roles/setup_autowas/tasks/main.yml index 268d705d6..588b42ee1 100644 --- a/ansible/roles/setup_autowas/tasks/main.yml +++ b/ansible/roles/setup_autowas/tasks/main.yml @@ -6,7 +6,7 @@ when: ansible_distribution != "RedHat" - name: Install RHEL pre-reqs - become: yes + become: true dnf: name: "{{ packages }}" state: latest @@ -15,7 +15,7 @@ - python2 - name: Install paramiko python package - become: yes + become: true pip: name: paramiko args: diff --git a/ansible/roles/setup_svt_db2_container/defaults/main.yml b/ansible/roles/setup_svt_db2_container/defaults/main.yml index fed62044f..a8d993966 100644 --- a/ansible/roles/setup_svt_db2_container/defaults/main.yml +++ b/ansible/roles/setup_svt_db2_container/defaults/main.yml @@ -1,3 +1,5 @@ svt_db2_image: someimage -hyc_user: user -hyc_token: token +svt_registry_user: user +svt_registry_password: token +svt_db_container_name: svtdb +svt_db_dir: dbdir diff --git a/ansible/roles/setup_svt_db2_container/tasks/main.yml b/ansible/roles/setup_svt_db2_container/tasks/main.yml index 2fadc984d..ee2d052ee 100644 --- a/ansible/roles/setup_svt_db2_container/tasks/main.yml +++ b/ansible/roles/setup_svt_db2_container/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: setup_svt_db2_container.yml +- name: Setup db2 container + ansible.builtin.include_tasks: setup_svt_db2_container.yml diff --git a/ansible/roles/setup_svt_db2_container/tasks/setup_svt_db2_container.yml b/ansible/roles/setup_svt_db2_container/tasks/setup_svt_db2_container.yml index 4615de0c4..c06c868bc 100644 --- a/ansible/roles/setup_svt_db2_container/tasks/setup_svt_db2_container.yml +++ b/ansible/roles/setup_svt_db2_container/tasks/setup_svt_db2_container.yml @@ -1,27 +1,27 @@ --- -- name: check for RedHat distribution - fail: +- name: Check for RedHat distribution + ansible.builtin.fail: msg: Target OS is not RedHat when: ansible_distribution != "RedHat" - name: Install RHEL pre-reqs - become: yes - dnf: - name: "{{ packages }}" - state: latest + become: true + ansible.builtin.dnf: + name: "{{ packages }}" + state: latest vars: - packages: - - podman + packages: + - podman - name: Check if user is lingering - stat: + ansible.builtin.stat: path: "/var/lib/systemd/linger/{{ ansible_user }}" register: user_lingering when: ansible_user != 'root' - name: Enable lingering is needed - command: "loginctl enable-linger {{ ansible_user }}" + ansible.builtin.command: "loginctl enable-linger {{ ansible_user }}" when: - ansible_user != 'root' - not user_lingering.stat.exists @@ -32,69 +32,98 @@ #- name: get podman runRoot dir # shell: 'podman info | grep runRoot' # register: podman_runRoot -- name: copy the podmand.conf template to /etc/tmpfiles.d/ - become: yes - ansible.builtin.copy: - src: /usr/lib/tmpfiles.d/podman.conf - dest: /etc/tmpfiles.d/podman.conf - remote_src: yes -- name: add podman nonRoot dir to systemd tmp - become: yes - lineinfile: - path: /etc/tmpfiles.d/podman.conf - line: "x /run/user/{{ ansible_user_uid }}" +# is this needed any longer??? +# - name: Copy the podmand.conf template to /etc/tmpfiles.d/ +# become: true +# ansible.builtin.copy: +# src: /usr/lib/tmpfiles.d/podman.conf +# dest: /etc/tmpfiles.d/podman.conf +# remote_src: yes +# - name: Add podman nonRoot dir to systemd tmp +# become: true +# lineinfile: +# path: /etc/tmpfiles.d/podman.conf +# line: "x /run/user/{{ ansible_user_uid }}" + +- name: Create user containers.conf directory + ansible.builtin.file: + path: '.config/containers/' + state: directory + mode: '0755' + +# RHEL10 does not have slirp4netns installation packages, so we cannot override the podman 5.x pasta networking with slirp4netns +# - name: Override podman 5.x pasta networking with slirp4netns +# ansible.builtin.blockinfile: +# path: ".config/containers/containers.conf" +# create: true +# mode: '0755' +# marker: "# {mark} Revert to slirp4netns ANSIBLE MANAGED BLOCK" +# block: | +# [network] +# # default_rootless_network_cmd = "" +# # change to. +# default_rootless_network_cmd = "slirp4netns" - name: Pull the svt db2 image containers.podman.podman_image: name: "{{ svt_db2_image }}" - username: "{{ hyc_user }}" - password: "{{ hyc_token }}" - force: yes + username: "{{ svt_registry_user }}" + password: "{{ svt_registry_password }}" + force: true state: present + validate_certs: false + pull: true register: svtop -- debug: - msg: '{{ svtop }}' +# - ansible.builtin.debug: +# msg: '{{ svtop }}' -- name: create dbdir directory - file: +- name: Create svt_db_dir directory + become: true + ansible.builtin.file: + path: "{{ item }}" + state: absent + with_items: + - "/home/{{ ansible_user }}/{{ svt_db_dir }}" + +- name: Create svt_db_dir directory + ansible.builtin.file: path: "{{ item }}" state: directory with_items: - - "/home/{{ ansible_user }}/dbdir" + - "/home/{{ ansible_user }}/{{ svt_db_dir }}" - name: kill rm any existing db2 container containers.podman.podman_container: log_level: info - name: svtdb - privileged: yes + name: '{{ svt_db_container_name }}' + privileged: true image: "{{ svt_db2_image }}" state: absent # started created absent stopped present register: svtop -- debug: - msg: '{{ svtop }}' +# - ansible.builtin.debug: +# msg: '{{ svtop }}' # https://docs.ansible.com/ansible/latest/collections/containers/podman/podman_container_module.html#ansible-collections-containers-podman-podman-container-module - name: Run svtdb container containers.podman.podman_container: log_level: info - name: svtdb - privileged: yes + name: '{{ svt_db_container_name }}' + privileged: true image: "{{ svt_db2_image }}" state: started - restart: yes + restart: true ports: - - "50000:50000" + - "50000:50000" volume: - - "/home/{{ ansible_user }}/dbdir:/database" + - "/home/{{ ansible_user }}/{{ svt_db_dir }}:/database" cmd_args: - - "-e LICENSE=accept" - - "-e DB2INST1_PASSWORD={{ db_pass }}" - - "-e DBNAME={{ db_name }}" - - "-e APP={{ svt_db_app }}" + - "-e LICENSE=accept" + - "-e DB2INST1_PASSWORD={{ db_pass }}" + - "-e DBNAME={{ db_name }}" + - "-e APP={{ svt_db_app }}" register: svtop -- debug: - msg: '{{ svtop }}' - +# - ansible.builtin.debug: +# msg: '{{ svtop }}' diff --git a/ansible/roles/setup_svt_jmeter_container/defaults/main.yml b/ansible/roles/setup_svt_jmeter_container/defaults/main.yml index f97cda147..ac1ce1a8a 100644 --- a/ansible/roles/setup_svt_jmeter_container/defaults/main.yml +++ b/ansible/roles/setup_svt_jmeter_container/defaults/main.yml @@ -1,3 +1,3 @@ svt_jmeter_image: someimage -hyc_user: user -hyc_token: token +svt_registry_user: user +svt_registry_password: pass diff --git a/ansible/roles/setup_svt_jmeter_container/tasks/setup_svt_jmeter_container.yml b/ansible/roles/setup_svt_jmeter_container/tasks/setup_svt_jmeter_container.yml index 1998889c9..97af860f2 100644 --- a/ansible/roles/setup_svt_jmeter_container/tasks/setup_svt_jmeter_container.yml +++ b/ansible/roles/setup_svt_jmeter_container/tasks/setup_svt_jmeter_container.yml @@ -1,12 +1,12 @@ --- - name: check for RedHat distribution - fail: + ansible.builtin.fail: msg: Target OS is not RedHat when: ansible_distribution != "RedHat" - name: Install RHEL pre-reqs - become: yes + become: true dnf: name: "{{ packages }}" state: latest @@ -15,13 +15,13 @@ - podman - name: Check if user is lingering - stat: + ansible.builtin.stat: path: "/var/lib/systemd/linger/{{ ansible_user }}" register: user_lingering when: ansible_user != 'root' - name: Enable lingering is needed - command: "loginctl enable-linger {{ ansible_user }}" + ansible.builtin.command: "loginctl enable-linger {{ ansible_user }}" when: - ansible_user != 'root' - not user_lingering.stat.exists @@ -29,12 +29,14 @@ - name: Pull the svt jmeter image containers.podman.podman_image: name: "{{ svt_jmeter_image }}" - username: "{{ hyc_user }}" - password: "{{ hyc_token }}" + username: "{{ svt_registry_user }}" + password: "{{ svt_registry_password }}" force: yes state: present + validate_certs: false + pull: true register: svtop -- debug: - msg: '{{ svtop }}' +# - ansible.builtin.debug: +# msg: '{{ svtop }}' diff --git a/ansible/roles/setup_svt_mq_container/defaults/main.yml b/ansible/roles/setup_svt_mq_container/defaults/main.yml new file mode 100644 index 000000000..c806b4578 --- /dev/null +++ b/ansible/roles/setup_svt_mq_container/defaults/main.yml @@ -0,0 +1,4 @@ +svt_mq_image: someimage +svt_registry_user: user +svt_registry_password: pass +svt_mq_container_name: svtmq diff --git a/ansible/roles/setup_svt_mq_container/meta/main.yml b/ansible/roles/setup_svt_mq_container/meta/main.yml new file mode 100644 index 000000000..2eb88a330 --- /dev/null +++ b/ansible/roles/setup_svt_mq_container/meta/main.yml @@ -0,0 +1,4 @@ +--- + +dependencies: +- role: load_secrets diff --git a/ansible/roles/setup_svt_mq_container/readme.md b/ansible/roles/setup_svt_mq_container/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/setup_svt_mq_container/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/setup_svt_mq_container/tasks/main.yml b/ansible/roles/setup_svt_mq_container/tasks/main.yml new file mode 100644 index 000000000..14f9f83f1 --- /dev/null +++ b/ansible/roles/setup_svt_mq_container/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Setup the MQ container + include_tasks: setup_svt_mq_container.yml diff --git a/ansible/roles/setup_svt_mq_container/tasks/setup_svt_mq_container.yml b/ansible/roles/setup_svt_mq_container/tasks/setup_svt_mq_container.yml new file mode 100644 index 000000000..b8e3f8cbb --- /dev/null +++ b/ansible/roles/setup_svt_mq_container/tasks/setup_svt_mq_container.yml @@ -0,0 +1,109 @@ +--- + +- name: Check for RedHat distribution + ansible.builtin.fail: + msg: Target OS is not RedHat + when: ansible_distribution != "RedHat" + +- name: Install RHEL pre-reqs + become: true + ansible.builtin.dnf: + name: "{{ packages }}" + state: latest + vars: + packages: + - podman + +- name: Check if user is lingering + ansible.builtin.stat: + path: "/var/lib/systemd/linger/{{ ansible_user }}" + register: user_lingering + when: ansible_user != 'root' + +- name: Enable lingering is needed + ansible.builtin.command: "loginctl enable-linger {{ ansible_user }}" + when: + - ansible_user != 'root' + - not user_lingering.stat.exists + + # https://stackoverflow.com/questions/66324225/podman-pod-disappears-after-a-few-days-but-process-is-still-running-and-listeni + # + # runRoot: /run/user/1000/containers + #- name: get podman runRoot dir + # shell: 'podman info | grep runRoot' + # register: podman_runRoot +- name: Copy the podmand.conf template to /etc/tmpfiles.d/ + become: true + ansible.builtin.copy: + src: /usr/lib/tmpfiles.d/podman.conf + dest: /etc/tmpfiles.d/podman.conf + remote_src: true +- name: add podman nonRoot dir to systemd tmp + become: true + ansible.builtin.lineinfile: + path: /etc/tmpfiles.d/podman.conf + line: "x /run/user/{{ ansible_user_uid }}" + +- name: Pull the svt mq image + containers.podman.podman_image: + name: "{{ svt_mq_image }}" + username: "{{ svt_registry_user }}" + password: "{{ svt_registry_password }}" + force: true + state: present + validate_certs: false + pull: true + register: svtop + +# - name: Output svtop +# ansible.builtin.debug: +# msg: '{{ svtop }}' + +- name: Kill rm any existing mq container + containers.podman.podman_container: + log_level: info + name: '{{ svt_mq_container_name }}' + privileged: true + image: "{{ svt_mq_image }}" + state: absent # started created absent stopped present + register: svtop + +# - name: Output svtop +# ansible.builtin.debug: +# msg: '{{ svtop }}' + +- name: Purge existing mqdata volume + containers.podman.podman_volume: + state: absent + name: mqdata + +- name: Create mqdata volume + containers.podman.podman_volume: + state: present + name: mqdata + + +# https://docs.ansible.com/ansible/latest/collections/containers/podman/podman_container_module.html#ansible-collections-containers-podman-podman-container-module +- name: Run mq container + containers.podman.podman_container: + log_level: info + name: '{{ svt_mq_container_name }}' + privileged: false + image: "{{ svt_mq_image }}" + state: started + restart: true + ports: + - "{{ mq_port }}:1414" + - "{{ mq_admin_port }}:9443" + volume: + - "mqdata:/mnt/mqm" + cmd_args: + - "-e LICENSE=accept" + - "-e MQ_QMGR_NAME=QM1" + - "-e MQ_APP_PASSWORD={{ mq_pass }}" + - "-e MQ_ADMIN_PASSWORD={{ mq_admin_pass }}" + register: svtop + +# - name: Output svtop +# ansible.builtin.debug: +# msg: '{{ svtop }}' diff --git a/ansible/roles/timezone/tasks/main.yml b/ansible/roles/timezone/tasks/main.yml index 9c5c775a5..818d1b3e8 100644 --- a/ansible/roles/timezone/tasks/main.yml +++ b/ansible/roles/timezone/tasks/main.yml @@ -3,5 +3,3 @@ - name: "Set timezone to {{ regionTimeZone }}" timezone: name: "{{ regionTimeZone }}" - - diff --git a/ansible/roles/twas855x_ospreqs/tasks/AIX.7.chrp.yml b/ansible/roles/twas855x_ospreqs/tasks/AIX.7.chrp.yml index 75f8b4de1..e1979d966 100644 --- a/ansible/roles/twas855x_ospreqs/tasks/AIX.7.chrp.yml +++ b/ansible/roles/twas855x_ospreqs/tasks/AIX.7.chrp.yml @@ -1,5 +1,5 @@ --- ### https://www.ibm.com/support/pages/understanding-aix-virtual-rpm-package-rpmrte -- name: updtvpkg +- name: Updtvpkg command: 'updtvpkg' - become: yes + become: true diff --git a/ansible/roles/twas855x_ospreqs/tasks/RedHat.10.ppc64le.yml b/ansible/roles/twas855x_ospreqs/tasks/RedHat.10.ppc64le.yml new file mode 100644 index 000000000..aa7f7d9df --- /dev/null +++ b/ansible/roles/twas855x_ospreqs/tasks/RedHat.10.ppc64le.yml @@ -0,0 +1,5 @@ +--- +- name: No 32bit support on ppc64le + delegate_to: localhost + ansible.builtin.debug: + msg: No 32bit support on ppc64le diff --git a/ansible/roles/twas855x_ospreqs/tasks/RedHat.10.s390x.yml b/ansible/roles/twas855x_ospreqs/tasks/RedHat.10.s390x.yml new file mode 100644 index 000000000..aa7f7d9df --- /dev/null +++ b/ansible/roles/twas855x_ospreqs/tasks/RedHat.10.s390x.yml @@ -0,0 +1,5 @@ +--- +- name: No 32bit support on ppc64le + delegate_to: localhost + ansible.builtin.debug: + msg: No 32bit support on ppc64le diff --git a/ansible/roles/twas855x_ospreqs/tasks/RedHat.10.x86_64.yml b/ansible/roles/twas855x_ospreqs/tasks/RedHat.10.x86_64.yml new file mode 100644 index 000000000..aa7f7d9df --- /dev/null +++ b/ansible/roles/twas855x_ospreqs/tasks/RedHat.10.x86_64.yml @@ -0,0 +1,5 @@ +--- +- name: No 32bit support on ppc64le + delegate_to: localhost + ansible.builtin.debug: + msg: No 32bit support on ppc64le diff --git a/ansible/roles/twas855x_ospreqs/tasks/RedHat.7.x86_64.yml b/ansible/roles/twas855x_ospreqs/tasks/RedHat.7.x86_64.yml index cd6b43f91..bf7e26579 100644 --- a/ansible/roles/twas855x_ospreqs/tasks/RedHat.7.x86_64.yml +++ b/ansible/roles/twas855x_ospreqs/tasks/RedHat.7.x86_64.yml @@ -1,7 +1,7 @@ --- - name: install packages - become: yes + become: true dnf: name: "{{ packages }}" state: present diff --git a/ansible/roles/twas855x_ospreqs/tasks/RedHat.8.x86_64.yml b/ansible/roles/twas855x_ospreqs/tasks/RedHat.8.x86_64.yml index cd6b43f91..bf7e26579 100644 --- a/ansible/roles/twas855x_ospreqs/tasks/RedHat.8.x86_64.yml +++ b/ansible/roles/twas855x_ospreqs/tasks/RedHat.8.x86_64.yml @@ -1,7 +1,7 @@ --- - name: install packages - become: yes + become: true dnf: name: "{{ packages }}" state: present diff --git a/ansible/roles/twas855x_ospreqs/tasks/RedHat.9.ppc64le.yml b/ansible/roles/twas855x_ospreqs/tasks/RedHat.9.ppc64le.yml index 78d28b3b7..da8e4034d 100644 --- a/ansible/roles/twas855x_ospreqs/tasks/RedHat.9.ppc64le.yml +++ b/ansible/roles/twas855x_ospreqs/tasks/RedHat.9.ppc64le.yml @@ -1,7 +1,7 @@ --- - name: install packages - become: yes + become: true dnf: name: "{{ packages }}" state: present diff --git a/ansible/roles/twas855x_ospreqs/tasks/RedHat.9.s390x.yml b/ansible/roles/twas855x_ospreqs/tasks/RedHat.9.s390x.yml index 78d28b3b7..da8e4034d 100644 --- a/ansible/roles/twas855x_ospreqs/tasks/RedHat.9.s390x.yml +++ b/ansible/roles/twas855x_ospreqs/tasks/RedHat.9.s390x.yml @@ -1,7 +1,7 @@ --- - name: install packages - become: yes + become: true dnf: name: "{{ packages }}" state: present diff --git a/ansible/roles/twas855x_ospreqs/tasks/RedHat.9.x86_64.yml b/ansible/roles/twas855x_ospreqs/tasks/RedHat.9.x86_64.yml index cd6b43f91..bf7e26579 100644 --- a/ansible/roles/twas855x_ospreqs/tasks/RedHat.9.x86_64.yml +++ b/ansible/roles/twas855x_ospreqs/tasks/RedHat.9.x86_64.yml @@ -1,7 +1,7 @@ --- - name: install packages - become: yes + become: true dnf: name: "{{ packages }}" state: present diff --git a/ansible/roles/twas855x_ospreqs/tasks/SLES.12.x86_64.yml b/ansible/roles/twas855x_ospreqs/tasks/SLES.12.x86_64.yml index 7d50515f9..ae49c8220 100644 --- a/ansible/roles/twas855x_ospreqs/tasks/SLES.12.x86_64.yml +++ b/ansible/roles/twas855x_ospreqs/tasks/SLES.12.x86_64.yml @@ -1,7 +1,7 @@ --- - name: install packages - become: yes + become: true zypper: name: "{{ packages }}" state: present diff --git a/ansible/roles/twas855x_ospreqs/tasks/SLES.15.ppc64le.yml b/ansible/roles/twas855x_ospreqs/tasks/SLES.15.ppc64le.yml new file mode 100644 index 000000000..958ba30e8 --- /dev/null +++ b/ansible/roles/twas855x_ospreqs/tasks/SLES.15.ppc64le.yml @@ -0,0 +1,17 @@ +--- +- name: No 32bit support on ppc64le + delegate_to: localhost + ansible.builtin.debug: + msg: No 32bit support on ppc64le + +# - name: Install packages +# become: true +# zypper: +# name: "{{ packages }}" +# state: present +# vars: +# packages: +# # - 'libgtk-3-0-32bit' +# # - 'libgthread-2_0-0-32bit' +# - 'libXtst6-32bit' +# - 'libstdc++6-32bit' diff --git a/ansible/roles/twas855x_ospreqs/tasks/SLES.15.x86_64.yml b/ansible/roles/twas855x_ospreqs/tasks/SLES.15.x86_64.yml index 7d50515f9..ff10b6807 100644 --- a/ansible/roles/twas855x_ospreqs/tasks/SLES.15.x86_64.yml +++ b/ansible/roles/twas855x_ospreqs/tasks/SLES.15.x86_64.yml @@ -1,13 +1,13 @@ --- -- name: install packages - become: yes +- name: Install packages + become: true zypper: name: "{{ packages }}" state: present vars: packages: - - 'libgtk-3-0-32bit' - - 'libgthread-2_0-0-32bit' + # - 'libgtk-3-0-32bit' + # - 'libgthread-2_0-0-32bit' - 'libXtst6-32bit' - + - 'libstdc++6-32bit' diff --git a/ansible/roles/twas855x_ospreqs/tasks/Ubuntu.18.x86_64.yml b/ansible/roles/twas855x_ospreqs/tasks/Ubuntu.18.x86_64.yml index 9144f7c5d..2bdc5fbdb 100644 --- a/ansible/roles/twas855x_ospreqs/tasks/Ubuntu.18.x86_64.yml +++ b/ansible/roles/twas855x_ospreqs/tasks/Ubuntu.18.x86_64.yml @@ -1,8 +1,8 @@ --- # specific OS supports wildcards - name: remove extraneous packages - become: yes - ignore_errors: yes + become: true + ignore_errors: true apt: name: "{{ packages }}" state: absent @@ -15,13 +15,13 @@ - "tignervnc" - name: apt update - become: yes + become: true apt: name: '*' state: latest - name: install packages - become: yes + become: true apt: name: "{{ packages }}" state: present diff --git a/ansible/roles/twas855x_ospreqs/tasks/Ubuntu.20.x86_64.yml b/ansible/roles/twas855x_ospreqs/tasks/Ubuntu.20.x86_64.yml index a30ded408..baac3ee88 100644 --- a/ansible/roles/twas855x_ospreqs/tasks/Ubuntu.20.x86_64.yml +++ b/ansible/roles/twas855x_ospreqs/tasks/Ubuntu.20.x86_64.yml @@ -1,7 +1,7 @@ --- -- name: install packages - become: yes +- name: Install packages + become: true apt: name: "{{ packages }}" state: present diff --git a/ansible/roles/twas855x_ospreqs/tasks/Ubuntu.22.x86_64.yml b/ansible/roles/twas855x_ospreqs/tasks/Ubuntu.22.x86_64.yml index a30ded408..baac3ee88 100644 --- a/ansible/roles/twas855x_ospreqs/tasks/Ubuntu.22.x86_64.yml +++ b/ansible/roles/twas855x_ospreqs/tasks/Ubuntu.22.x86_64.yml @@ -1,7 +1,7 @@ --- -- name: install packages - become: yes +- name: Install packages + become: true apt: name: "{{ packages }}" state: present diff --git a/ansible/roles/twas855x_ospreqs/tasks/Ubuntu.24.ppc64le.yml b/ansible/roles/twas855x_ospreqs/tasks/Ubuntu.24.ppc64le.yml new file mode 100644 index 000000000..7efba6544 --- /dev/null +++ b/ansible/roles/twas855x_ospreqs/tasks/Ubuntu.24.ppc64le.yml @@ -0,0 +1,13 @@ +--- + +- name: Install packages + become: true + apt: + name: "{{ packages }}" + state: present + vars: + packages: + - 'libxtst6' + - 'libgtk2.0-0' + - 'libxft2' + \ No newline at end of file diff --git a/ansible/roles/twas855x_ospreqs/tasks/Ubuntu.24.s390x.yml b/ansible/roles/twas855x_ospreqs/tasks/Ubuntu.24.s390x.yml new file mode 100644 index 000000000..389b6f31a --- /dev/null +++ b/ansible/roles/twas855x_ospreqs/tasks/Ubuntu.24.s390x.yml @@ -0,0 +1,12 @@ +--- + +- name: Install packages + become: true + apt: + name: "{{ packages }}" + state: present + vars: + packages: + - 'libxtst6' + - 'libgtk2.0-0' + - 'libxft2' \ No newline at end of file diff --git a/ansible/roles/twas855x_ospreqs/tasks/Ubuntu.24.x86_64.yml b/ansible/roles/twas855x_ospreqs/tasks/Ubuntu.24.x86_64.yml new file mode 100644 index 000000000..7efba6544 --- /dev/null +++ b/ansible/roles/twas855x_ospreqs/tasks/Ubuntu.24.x86_64.yml @@ -0,0 +1,13 @@ +--- + +- name: Install packages + become: true + apt: + name: "{{ packages }}" + state: present + vars: + packages: + - 'libxtst6' + - 'libgtk2.0-0' + - 'libxft2' + \ No newline at end of file diff --git a/ansible/roles/twas855x_ospreqs/tasks/main.yml b/ansible/roles/twas855x_ospreqs/tasks/main.yml index 515cf4323..adbbfde54 100644 --- a/ansible/roles/twas855x_ospreqs/tasks/main.yml +++ b/ansible/roles/twas855x_ospreqs/tasks/main.yml @@ -1,2 +1,4 @@ --- -- include_tasks: "{{ ansible_distribution }}.{{ ansible_distribution_major_version }}.{{ ansible_architecture }}.yml" +- name: Which arch OS? + when: ansible_system is not search('CYG') + ansible.builtin.include_tasks: "{{ ansible_distribution }}.{{ ansible_distribution_major_version }}.{{ ansible_architecture }}.yml" diff --git a/ansible/roles/twas_cell_clear_dumps/meta/main.yml b/ansible/roles/twas_cell_clear_dumps/meta/main.yml new file mode 100644 index 000000000..1397bfd39 --- /dev/null +++ b/ansible/roles/twas_cell_clear_dumps/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: twas_cell_defaults diff --git a/ansible/roles/twas_cell_clear_dumps/readme.md b/ansible/roles/twas_cell_clear_dumps/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/twas_cell_clear_dumps/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/twas_cell_clear_dumps/tasks/main.yml b/ansible/roles/twas_cell_clear_dumps/tasks/main.yml new file mode 100644 index 000000000..20ed09269 --- /dev/null +++ b/ansible/roles/twas_cell_clear_dumps/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Clear tWAS heapdumps / javacores + ansible.builtin.include_tasks: twas_cell_clear_dumps.yml diff --git a/ansible/roles/twas_cell_clear_dumps/tasks/twas_cell_clear_dumps.yml b/ansible/roles/twas_cell_clear_dumps/tasks/twas_cell_clear_dumps.yml new file mode 100644 index 000000000..942b83e4a --- /dev/null +++ b/ansible/roles/twas_cell_clear_dumps/tasks/twas_cell_clear_dumps.yml @@ -0,0 +1,30 @@ +--- +- name: Does the profile exist? + ansible.builtin.stat: + path: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}" + register: isdir + +- name: Clear dumps + when: isdir.stat.exists + block: + - name: Any heapdumps? + ansible.builtin.shell: "find {{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }} -name 'heapdump*'" + register: isheap + changed_when: false + + - name: Remove tWAS heapdumps + ansible.builtin.file: + path: "{{ item }}" + state: absent + with_items: '{{ isheap.stdout_lines }}' + + - name: Any javacores? + ansible.builtin.shell: "find {{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }} -name 'javacore*'" + register: isjavacore + changed_when: false + + - name: Remove tWAS javacores + ansible.builtin.file: + path: "{{ item }}" + state: absent + with_items: '{{ isjavacore.stdout_lines }}' diff --git a/ansible/roles/twas_cell_clear_logs/tasks/twas_cell_clear_logs.yml b/ansible/roles/twas_cell_clear_logs/tasks/twas_cell_clear_logs.yml index 067806742..20fe36237 100644 --- a/ansible/roles/twas_cell_clear_logs/tasks/twas_cell_clear_logs.yml +++ b/ansible/roles/twas_cell_clear_logs/tasks/twas_cell_clear_logs.yml @@ -1,6 +1,78 @@ --- +- name: Remove tWAS logs directory + when: + - twas_dir is defined + - profile_name is defined + block: + - name: Does the log dir exist? + ansible.builtin.stat: + path: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/logs" + register: islog + - name: Remove tWAS logs directory + ansible.builtin.file: + path: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/logs" + state: absent + when: islog.stat.exists -- name: remove logs directory - file: - path: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/logs" - state: absent +- name: Remove IHS logs directory + when: + - install_ihs_base is defined + - http_dir is defined + block: + - name: Does the log dir exist? + ansible.builtin.stat: + path: "{{ install_ihs_base }}/{{ http_dir }}/logs" + register: islog + - name: Remove IHS logs directory + ansible.builtin.file: + path: "{{ install_ihs_base }}/{{ http_dir }}/logs" + state: absent + when: islog.stat.exists + - name: ReCreate IHS logs directory + ansible.builtin.file: + path: "{{ install_ihs_base }}/{{ http_dir }}/logs" + state: directory + mode: 0755 + when: islog.stat.exists + +- name: Remove Plugin logs directory + when: + - install_ihs_base is defined + - plugin_dir is defined + - webServerName is defined + block: + - name: Does the log dir exist? + ansible.builtin.stat: + path: "{{ install_ihs_base }}/{{ plugin_dir }}/logs/{{ webServerName }}" + register: islog + - name: Remove Plugin logs directory + ansible.builtin.file: + path: "{{ install_ihs_base }}/{{ plugin_dir }}/logs/{{ webServerName }}" + state: absent + when: islog.stat.exists + - name: ReCreate Plugin logs directory + ansible.builtin.file: + path: "{{ install_ihs_base }}/{{ plugin_dir }}/logs/{{ webServerName }}" + state: directory + mode: 0755 + when: islog.stat.exists + +- name: Any extra logs? + when: extra_logs is defined + block: + + - name: Remove Liberty extra_logs dir + ansible.builtin.file: + path: "{{ item }}" + state: absent + with_items: + - "{{ extra_logs }}" + + - name: Create Liberty extra_logs dir + become: true + ansible.builtin.file: + path: "{{ item }}" + state: directory + mode: '0777' + with_items: + - "{{ extra_logs }}" diff --git a/ansible/roles/twas_cell_cluster_servers/tasks/twas_cell_cluster_servers.yml b/ansible/roles/twas_cell_cluster_servers/tasks/twas_cell_cluster_servers.yml index ae2b1568a..bea98a50f 100644 --- a/ansible/roles/twas_cell_cluster_servers/tasks/twas_cell_cluster_servers.yml +++ b/ansible/roles/twas_cell_cluster_servers/tasks/twas_cell_cluster_servers.yml @@ -6,7 +6,7 @@ dest: "twas_cell_cluster_servers.py" - name: run the twas_cell_cluster_servers.py jython script - shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin.sh -lang jython -username {{ twas_username }} -password {{ twas_password }} -f twas_cell_cluster_servers.py" + shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin{{ ext }} -lang jython -username {{ twas_username }} -password {{ twas_password }} -f twas_cell_cluster_servers.py" register: createServerOutput failed_when: ( createServerOutput.rc not in [ 0, 255 ] ) - name: createServerOutput diff --git a/ansible/roles/twas_cell_common_daytrader/default/main.yml b/ansible/roles/twas_cell_common_daytrader/default/main.yml new file mode 100644 index 000000000..d5abf25ac --- /dev/null +++ b/ansible/roles/twas_cell_common_daytrader/default/main.yml @@ -0,0 +1,4 @@ +mq_user: mq_user +mq_pass: mq_pass +mq_host: mq_host +mq_port: mq_port diff --git a/ansible/roles/twas_cell_common_daytrader/templates/daytrader7.py.j2 b/ansible/roles/twas_cell_common_daytrader/templates/daytrader7.py.j2 index eb43811da..5d55a27c8 100644 --- a/ansible/roles/twas_cell_common_daytrader/templates/daytrader7.py.j2 +++ b/ansible/roles/twas_cell_common_daytrader/templates/daytrader7.py.j2 @@ -142,7 +142,7 @@ if (operation == "all" or operation == "install"): print (" Installing DayTrader") print ("------------------------------------------------") deleteApplicationByNameIfExists(DefaultTradeAppName) - AdminApp.install(DefaultEarFile, '[ -nopreCompileJSPs -distributeApp -nouseMetaDataFromBinary -appname '+DefaultTradeAppName+' -createMBeansForResources -noreloadEnabled -nodeployws -validateinstall warn -noprocessEmbeddedConfig -filepermission .*\.dll=755#.*\.so=755#.*\.a=755#.*\.sl=755 -noallowDispatchRemoteInclude -noallowServiceRemoteInclude -asyncRequestDispatchType DISABLED -nouseAutoLink -noenableClientModule -clientMode isolated -novalidateSchema -MapModulesToServers [[ "DayTrader Enterprise Bean Definitions" daytrader-ee7-ejb.jar,META-INF/ejb-jar.xml WebSphere:cell=ndcell,cluster={{ clusterName }}+WebSphere:cell=ndcell,node={{ webNode }},server={{ webServerName }} ][ "DayTrader Web" daytrader-ee7-web.war,WEB-INF/web.xml WebSphere:cell=ndcell,cluster={{ clusterName }}+WebSphere:cell=ndcell,node={{ webNode }},server={{ webServerName }} ]] -MapMessageDestinationRefToEJB [[ "DayTrader Enterprise Bean Definitions" TradeSLSBBean daytrader-ee7-ejb.jar,META-INF/ejb-jar.xml com.ibm.websphere.samples.daytrader.ejb3.TradeSLSBBean/tradeBrokerQueue "jms/TradeBrokerQueue" ][ "DayTrader Enterprise Bean Definitions" TradeSLSBBean daytrader-ee7-ejb.jar,META-INF/ejb-jar.xml com.ibm.websphere.samples.daytrader.ejb3.TradeSLSBBean/tradeStreamerTopic "jms/TradeStreamerTopic" ][ "DayTrader Web" "" daytrader-ee7-web.war,WEB-INF/web.xml jms/StreamerTopic "jms/TradeStreamerTopic" ][ "DayTrader Web" "" daytrader-ee7-web.war,WEB-INF/web.xml jms/BrokerQueue "jms/TradeBrokerQueue" ]] -MapResEnvRefToRes [[ "DayTrader Web" "" daytrader-ee7-web.war,WEB-INF/web.xml com.ibm.websphere.samples.daytrader.web.prims.PingManagedExecutor/mes javax.enterprise.concurrent.ManagedExecutorService wm/default ][ "DayTrader Web" "" daytrader-ee7-web.war,WEB-INF/web.xml com.ibm.websphere.samples.daytrader.web.prims.PingManagedThread/managedThreadFactory javax.enterprise.concurrent.ManagedThreadFactory "wm/default" ][ "DayTrader Enterprise Bean Definitions" TradeSLSBBean daytrader-ee7-ejb.jar,META-INF/ejb-jar.xml com.ibm.websphere.samples.daytrader.ejb3.TradeSLSBBean/managedThreadFactory javax.enterprise.concurrent.ManagedThreadFactory "wm/default" ]]]' ) + AdminApp.install(DefaultEarFile, '[ -nopreCompileJSPs -distributeApp -nouseMetaDataFromBinary -appname '+DefaultTradeAppName+' -createMBeansForResources -noreloadEnabled -nodeployws -validateinstall warn -noprocessEmbeddedConfig -filepermission .*\.dll=755#.*\.so=755#.*\.a=755#.*\.sl=755 -noallowDispatchRemoteInclude -noallowServiceRemoteInclude -asyncRequestDispatchType DISABLED -nouseAutoLink -noenableClientModule -clientMode isolated -novalidateSchema -MapModulesToServers [[ "DayTrader Enterprise Bean Definitions" daytrader-ee7-ejb.jar,META-INF/ejb-jar.xml WebSphere:cell=ndcell,{{ targetServerMapping }}+WebSphere:cell=ndcell,node={{ webNode }},server={{ webServerName }} ][ "DayTrader Web" daytrader-ee7-web.war,WEB-INF/web.xml WebSphere:cell=ndcell,{{ targetServerMapping }}+WebSphere:cell=ndcell,node={{ webNode }},server={{ webServerName }} ]] -MapMessageDestinationRefToEJB [[ "DayTrader Enterprise Bean Definitions" TradeSLSBBean daytrader-ee7-ejb.jar,META-INF/ejb-jar.xml com.ibm.websphere.samples.daytrader.ejb3.TradeSLSBBean/tradeBrokerQueue "jms/TradeBrokerQueue" ][ "DayTrader Enterprise Bean Definitions" TradeSLSBBean daytrader-ee7-ejb.jar,META-INF/ejb-jar.xml com.ibm.websphere.samples.daytrader.ejb3.TradeSLSBBean/tradeStreamerTopic "jms/TradeStreamerTopic" ][ "DayTrader Web" "" daytrader-ee7-web.war,WEB-INF/web.xml jms/StreamerTopic "jms/TradeStreamerTopic" ][ "DayTrader Web" "" daytrader-ee7-web.war,WEB-INF/web.xml jms/BrokerQueue "jms/TradeBrokerQueue" ]] -MapResEnvRefToRes [[ "DayTrader Web" "" daytrader-ee7-web.war,WEB-INF/web.xml com.ibm.websphere.samples.daytrader.web.prims.PingManagedExecutor/mes javax.enterprise.concurrent.ManagedExecutorService wm/default ][ "DayTrader Web" "" daytrader-ee7-web.war,WEB-INF/web.xml com.ibm.websphere.samples.daytrader.web.prims.PingManagedThread/managedThreadFactory javax.enterprise.concurrent.ManagedThreadFactory "wm/default" ][ "DayTrader Enterprise Bean Definitions" TradeSLSBBean daytrader-ee7-ejb.jar,META-INF/ejb-jar.xml com.ibm.websphere.samples.daytrader.ejb3.TradeSLSBBean/managedThreadFactory javax.enterprise.concurrent.ManagedThreadFactory "wm/default" ]]]' ) #endif print ("") print ("------------------------------------------------") diff --git a/ansible/roles/twas_cell_common_daytrader/templates/daytrader_config.py.j2 b/ansible/roles/twas_cell_common_daytrader/templates/daytrader_config.py.j2 index ede084553..8a840417e 100644 --- a/ansible/roles/twas_cell_common_daytrader/templates/daytrader_config.py.j2 +++ b/ansible/roles/twas_cell_common_daytrader/templates/daytrader_config.py.j2 @@ -1,5 +1,4 @@ import sys -import os #----------------------------------------------------------------- # WARNING: Jython/Python is extremely sensitive to indentation @@ -8,7 +7,7 @@ import os #----------------------------------------------------------------- #----------------------------------------------------------------- -# daytrader3.py - DayTrader Cluster Install Script +# daytrader_config.py - DayTrader Cluster Install Script #----------------------------------------------------------------- # #----------------------------------------------------------------- @@ -20,12 +19,10 @@ import os # "silent install" option the only option # # To invoke the script type: -# wsadmin -f daytrader3.py [all|configure|cleanup|install|uninstall] +# wsadmin -f daytrader3.py [all|configure|cleanup] # where: all - configures JDBC and JMS resources and installs the app # configure - only configures the JDBC and JMS resource # cleanup - removes the JDBC and JMS resources -# install - installs the DayTrader ear -# uninstall - uninstalls the DayTrader ear # # If no parameters are specified, "all" is assumed! # @@ -67,8 +64,8 @@ DefaultClusterName = "Cluster" # configurations, LDAP, Windows Active Directory or some other form of # centralized authentication mechanism must be used to validate the userid. SecurityEnabled = "true" -DefaultAdminUser = "user1" -DefaultAdminPasswd = "security" +DefaultAdminUser = "persona1" +DefaultAdminPasswd = "ppersona1" # JDBC provider options # JDBC provider types include: @@ -101,13 +98,9 @@ DefaultMEDatabaseName = "TRADEDB" # Misc options #--------------------------------------------------------------------- -CmdOptions = ["all", "configure", "cleanup", "install", "uninstall"] +CmdOptions = ["all", "configure", "cleanup"] DefaultOptions = ["yes", "no"] BooleanOptions = ["true", "false"] -ProviderOptions = ["DB2 Universal","DB2 iSeries (Toolbox)","DB2 iSeries (Native)","Derby"] -DeployOptions = ["DB2UDB_V82","DB2UDBOS390_V8","DB2UDBISERIES_V54","DERBY_V10"] - - #--------------------------------------------------------------------- # Application specific config information @@ -171,10 +164,9 @@ WebstreamerMDB = "StreamerMDB" # Common JDBC Driver Paths #--------------------------------------------------------------------- # Note: wsadmin parses the command line based on ";" regardless of platform type -DB2WinJccPath = "c:/opt/WAS70/db2jars/db2jcc.jar;c:/opt/WAS70/db2jars/db2jcc_license_cu.jar;" +DB2WinJccPath = "c:/opt/WAS70/db2jars/db2jcc.jar" DB2zSeriesNativePath = "/usr/lpp/db2/db2810/jcc/lib" DB2CliPath = "c:/sqllib/java/db2java.zip" -DerbyPath = "$\{WAS_INSTALL_ROOT\}/derby/lib/derby.jar" DB2iSeriesNativePath = "/QIBM/ProdData/Java400/ext/db2_classes.jar" DB2iSeriesToolboxPath = "/QIBM/ProdData/HTTP/Public/jt400/lib/jt400.jar" @@ -185,8 +177,8 @@ dtvars = "daytrader_vars.py" execfile(dtvars) # Deploy types include: -DefaultPathName = "${WAS_INSTALL_ROOT}/db2jars/db2jcc4.jar;${WAS_INSTALL_ROOT}/db2jars/db2jcc_license_cu.jar" -DefaultEJBDeployType = "DB2UDB_V82" +DefaultPathName = "${WAS_INSTALL_ROOT}/db2jars/db2jcc4.jar" +DefaultEJBDeployType = "DB2UDB_V95" #--------------------------------------------------------------------- # Basic App Administration Procedures @@ -209,8 +201,8 @@ def printUsageAndExit ( ): def createJDBC_DataSource( scope ): provider = createJdbcProvider( scope, DefaultProviderType, DefaultPathName, DefaultNativePathName, implementationClassName, '', DefaultProviderType ) - datasource = createDataSource_ext ( 'cell', '', '', '', provider, DefaultDatasourceName, '', "jdbc/"+DefaultDatasourceName, DefaultStmtCacheSize, DefaultDatasourceAuthAliasName, datasourceHelperClassname, 'DB2', nonTransDS='', cmpDatasource='true', xaRecoveryAuthAlias=None, databaseName=DefaultDatabaseName, serverName=DefaultHostname, portNumber=DefaultPort, driverType=DefaultDB2DriverType, URL=None, informixLockModeWait=None, ifxIFXHOST=None ) - noTxDatasource = createDataSource_ext ( 'cell', '', '', '', provider, DefaultNoTxDatasourceName, '', "jdbc/"+DefaultNoTxDatasourceName, DefaultStmtCacheSize, DefaultDatasourceAuthAliasName, datasourceHelperClassname, 'DB2', nonTransDS='', cmpDatasource='true', xaRecoveryAuthAlias=None, databaseName=DefaultDatabaseName, serverName=DefaultHostname, portNumber=DefaultPort, driverType=DefaultDB2DriverType, URL=None, informixLockModeWait=None, ifxIFXHOST=None ) + datasource = createDataSource_ext( 'cell', '', '', '', provider, DefaultDatasourceName, '', "jdbc/"+DefaultDatasourceName, DefaultStmtCacheSize, DefaultDatasourceAuthAliasName, datasourceHelperClassname, 'DB2', nonTransDS='', cmpDatasource='true', xaRecoveryAuthAlias=None, databaseName=DefaultDatabaseName, serverName=DefaultHostname, portNumber=DefaultPort, driverType=DefaultDB2DriverType, URL=None, informixLockModeWait=None, ifxIFXHOST=None ) + noTxDatasource = createDataSource_ext( 'cell', '', '', '', provider, DefaultNoTxDatasourceName, '', "jdbc/"+DefaultNoTxDatasourceName, DefaultStmtCacheSize, DefaultDatasourceAuthAliasName, datasourceHelperClassname, 'DB2', nonTransDS='', cmpDatasource='true', xaRecoveryAuthAlias=None, databaseName=DefaultDatabaseName, serverName=DefaultHostname, portNumber=DefaultPort, driverType=DefaultDB2DriverType, URL=None, informixLockModeWait=None, ifxIFXHOST=None ) AdminTask.setResourceProperty(noTxDatasource, ["-propertyName", "nonTransactionalDataSource", "-propertyValue", "true"]) # Create the JMS config objects @@ -220,7 +212,7 @@ def createJDBC_DataSource( scope ): print (" Scope: "+scope) print ("------------------------------------------------") #creates ME datasource - datasource = createDataSource_ext ( 'cell', '', '', '', provider, DefaultClusterMEDatasourceName, '', "jdbc/"+DefaultClusterMEDatasourceName, DefaultStmtCacheSize, DefaultDatasourceAuthAliasName, datasourceHelperClassname, 'DB2', nonTransDS='', cmpDatasource='true', xaRecoveryAuthAlias=None, databaseName=DefaultDatabaseName, serverName=DefaultHostname, portNumber=DefaultPort, driverType=DefaultDB2DriverType, URL=None, informixLockModeWait=None, ifxIFXHOST=None ) + datasource = createDataSource_ext( 'cell', '', '', '', provider, DefaultClusterMEDatasourceName, '', "jdbc/"+DefaultClusterMEDatasourceName, DefaultStmtCacheSize, DefaultDatasourceAuthAliasName, datasourceHelperClassname, 'DB2', nonTransDS='', cmpDatasource='true', xaRecoveryAuthAlias=None, databaseName=DefaultDatabaseName, serverName=DefaultHostname, portNumber=DefaultPort, driverType=DefaultDB2DriverType, URL=None, informixLockModeWait=None, ifxIFXHOST=None ) #endDef #--------------------------------------------------------------------- @@ -258,7 +250,7 @@ if (operation == "all" or operation == "configure"): # Create the JDBC/Datasource config objects cell = getCellId() - productVersion=AdminTask.getNodeBaseProductVersion(['-nodeName', 'dmgr']) + #productVersion=AdminTask.getNodeBaseProductVersion(['-nodeName', 'dmgr']) TargetCellName = getNameFromId(cell) scope = cell @@ -302,86 +294,96 @@ if (operation == "all" or operation == "configure"): print ("------------------------------------------------") - createJAAS(DefaultAdminAuthAliasName, DefaultAdminUser, DefaultAdminPasswd ) - - target = [DefaultClusterName] - print("---createSIBusDT---") - sibus = createSIBusDT(DefaultClusterName,DefaultAdminAuthAliasName) - dsParms = ["false","jdbc/"+DefaultClusterMEDatasourceName] - print("---addSIBusMemberDT---") - addSIBusMemberDT(sibus, "false", target, dsParms) - - # Create additional MEs - parms = ["-bus",DefaultClusterName,"-cluster",DefaultClusterName] - meList = AdminTask.listSIBEngines(parms) - idx=len(meList.split("\n")) - meIndex=1 - while (idx < len(ClusterMemberNames)): - target=[DefaultClusterName] - print("---createMessageEngine---") - createMessageEngine(sibus, "false",("jdbc/"+DefaultClusterMEDatasourceName),target) - idx=idx+1 - meIndex=meIndex+1 - #endFor + if ( enableWMQ == 'true' or enableWMQ == 'True' ): + execfile('mq_config.py') + else: + print ("") + print ("------------------------------------------------") + print (" JMS Resource Configuration started!!!") + print (" Scope: " + scope) + print ("------------------------------------------------") + + createJAAS(DefaultAdminAuthAliasName, DefaultAdminUser, DefaultAdminPasswd ) + + target = [DefaultClusterName] + print("---createSIBusDT---") + sibus = createSIBusDT(DefaultClusterName,DefaultAdminAuthAliasName) + dsParms = ["false","jdbc/"+DefaultClusterMEDatasourceName] + print("---addSIBusMemberDT---") + addSIBusMemberDT(sibus, "false", target, dsParms) + + # Create additional MEs + parms = ["-bus",DefaultClusterName,"-cluster",DefaultClusterName] + meList = AdminTask.listSIBEngines(parms) + idx=len(meList.split("\n")) + meIndex=1 + while (idx < len(ClusterMemberNames)): + target=[DefaultClusterName] + print("---createMessageEngine---") + createMessageEngine(sibus, "false",("jdbc/"+DefaultClusterMEDatasourceName),target) + idx=idx+1 + meIndex=meIndex+1 + #endFor - baseName = "Policy for ME" - baseSchema = "IBMME" + baseName = "Policy for ME" + baseSchema = "IBMME" - idx=0 - meList = AdminTask.listSIBEngines(parms) - for engine in meList.split("\n") : - engine = engine.rstrip() - name = baseName + str(idx) - schema = baseSchema + str(idx) - serverName = ClusterMemberNames[idx] - idx = idx + 1 + idx=0 + meList = AdminTask.listSIBEngines(parms) + for engine in meList.split("\n") : + engine = engine.rstrip() + name = baseName + str(idx) + schema = baseSchema + str(idx) + serverName = ClusterMemberNames[idx] + idx = idx + 1 - # Modify the MEs to use the same datastore - print("---modifyMEDataStore---") - modifyMEDataStore(engine,DefaultDatasourceAuthAliasName,schema) - #end for + # Modify the MEs to use the same datastore + print("---modifyMEDataStore---") + modifyMEDataStore(engine,DefaultDatasourceAuthAliasName,schema) + #end for - # [10/1/14 10:43:43:164 EDT] Buses > DTEJBCluster > Bus members > Messaging engines for DTEJBCluster - print("---modifySIBusMemberPolicy---") - AdminTask.modifySIBusMemberPolicy(['-bus', DefaultClusterName, '-cluster', DefaultClusterName, '-enableAssistance', 'true', '-policyName', 'SCALABILITY_HA' ]) - # RTC 185101 schader@us.ibm.com 2015-08-25 - print("---modifySIBus---") - AdminTask.modifySIBus(['-bus', DefaultClusterName, '-configurationReloadEnabled', 'true', '-discardOnDelete', 'false', '-bootstrapPolicy', 'MEMBERS_ONLY', '-highMessageThreshold', '50000', '-protocol', '-description', DefaultClusterName ]) + # [10/1/14 10:43:43:164 EDT] Buses > DTEJBCluster > Bus members > Messaging engines for DTEJBCluster + print("---modifySIBusMemberPolicy---") + AdminTask.modifySIBusMemberPolicy(['-bus', DefaultClusterName, '-cluster', DefaultClusterName, '-enableAssistance', 'true', '-policyName', 'SCALABILITY_HA' ]) + # RTC 185101 schader@us.ibm.com 2015-08-25 + print("---modifySIBus---") + AdminTask.modifySIBus(['-bus', DefaultClusterName, '-configurationReloadEnabled', 'true', '-discardOnDelete', 'false', '-bootstrapPolicy', 'MEMBERS_ONLY', '-highMessageThreshold', '50000', '-protocol', '-description', DefaultClusterName ]) - target =[DefaultClusterName] - if (SecurityEnabled == "true"): - print("---createSIBusSecurityRole---") - createSIBusSecurityRole(sibus, DefaultAdminUser ) - #endIf + target =[DefaultClusterName] + if (SecurityEnabled == "true"): + print("---createSIBusSecurityRole---") + createSIBusSecurityRole(sibus, DefaultAdminUser ) + #endIf - # Create the Trade Broker Queue and Trade TopicSpace Destinations + # Create the Trade Broker Queue and Trade TopicSpace Destinations - createSIBDestination(sibus, brokerSIBDest, "Queue", reliability, target ) - createSIBDestination(sibus, topicSpace, "TopicSpace", reliability, [] ) + createSIBDestination(sibus, brokerSIBDest, "Queue", reliability, target ) + createSIBDestination(sibus, topicSpace, "TopicSpace", reliability, [] ) - createJMSConnectionFactory(sibus, brokerJMSQCF, "Queue", "jms/"+brokerJMSQCF, DefaultAdminAuthAliasName, scope ) - createJMSConnectionFactory(sibus, streamerJMSTCF, "Topic", "jms/"+streamerJMSTCF, DefaultAdminAuthAliasName, scope ) + createJMSConnectionFactory(sibus, brokerJMSQCF, "Queue", "jms/"+brokerJMSQCF, DefaultAdminAuthAliasName, scope ) + createJMSConnectionFactory(sibus, streamerJMSTCF, "Topic", "jms/"+streamerJMSTCF, DefaultAdminAuthAliasName, scope ) - createJMSConnectionFactory(sibus, WebbrokerJMSQCF, "Queue", "web/jms/"+WebbrokerJMSQCF, DefaultAdminAuthAliasName, scope ) - createJMSConnectionFactory(sibus, WebstreamerJMSTCF, "Topic", "web/jms/"+WebstreamerJMSTCF, DefaultAdminAuthAliasName, scope ) + createJMSConnectionFactory(sibus, WebbrokerJMSQCF, "Queue", "web/jms/"+WebbrokerJMSQCF, DefaultAdminAuthAliasName, scope ) + createJMSConnectionFactory(sibus, WebstreamerJMSTCF, "Topic", "web/jms/"+WebstreamerJMSTCF, DefaultAdminAuthAliasName, scope ) - createJMSQueue(brokerQueue, "jms/"+brokerQueue, brokerSIBDest, deliveryMode, scope ) - createJMSTopic(streamerTopic, "jms/"+streamerTopic, topicSpace, deliveryMode, scope ) + createJMSQueue(brokerQueue, "jms/"+brokerQueue, brokerSIBDest, deliveryMode, scope ) + createJMSTopic(streamerTopic, "jms/"+streamerTopic, topicSpace, deliveryMode, scope ) - createJMSQueue(WebbrokerQueue, "web/jms/"+WebbrokerQueue, brokerSIBDest, deliveryMode, scope ) - createJMSTopic(WebstreamerTopic, "web/jms/"+WebstreamerTopic, topicSpace, deliveryMode, scope ) + createJMSQueue(WebbrokerQueue, "web/jms/"+WebbrokerQueue, brokerSIBDest, deliveryMode, scope ) + createJMSTopic(WebstreamerTopic, "web/jms/"+WebstreamerTopic, topicSpace, deliveryMode, scope ) - createMDBActivationSpec(brokerMDB, "eis/"+brokerMDB, sibus, "jms/"+brokerQueue, "javax.jms.Queue", DefaultAdminAuthAliasName, scope, durability ) - createMDBActivationSpec(streamerMDB, "eis/"+streamerMDB, sibus, "jms/"+streamerTopic, "javax.jms.Topic", DefaultAdminAuthAliasName, scope, durability ) + createMDBActivationSpec(brokerMDB, "eis/"+brokerMDB, sibus, "jms/"+brokerQueue, "javax.jms.Queue", DefaultAdminAuthAliasName, scope, durability ) + createMDBActivationSpec(streamerMDB, "eis/"+streamerMDB, sibus, "jms/"+streamerTopic, "javax.jms.Topic", DefaultAdminAuthAliasName, scope, durability ) - createMDBActivationSpec(WebbrokerMDB, "eis/"+WebbrokerMDB, sibus, "web/jms/"+WebbrokerQueue, "javax.jms.Queue", DefaultAdminAuthAliasName, scope, durability ) - createMDBActivationSpec(WebstreamerMDB, "eis/"+WebstreamerMDB, sibus, "web/jms/"+WebstreamerTopic, "javax.jms.Topic", DefaultAdminAuthAliasName, scope, durability ) + createMDBActivationSpec(WebbrokerMDB, "eis/"+WebbrokerMDB, sibus, "web/jms/"+WebbrokerQueue, "javax.jms.Queue", DefaultAdminAuthAliasName, scope, durability ) + createMDBActivationSpec(WebstreamerMDB, "eis/"+WebstreamerMDB, sibus, "web/jms/"+WebstreamerTopic, "javax.jms.Topic", DefaultAdminAuthAliasName, scope, durability ) - print ("") - print ("------------------------------------------------") - print (" JMS Resource Configuration Completed!!!") - print ("------------------------------------------------") + print ("") + print ("------------------------------------------------") + print (" JMS Resource Configuration Completed!!!") + print ("------------------------------------------------") + #endIf print ("") print ("Saving...") diff --git a/ansible/roles/twas_cell_common_daytrader/templates/daytrader_config_base.py.j2 b/ansible/roles/twas_cell_common_daytrader/templates/daytrader_config_base.py.j2 new file mode 100644 index 000000000..8ed041003 --- /dev/null +++ b/ansible/roles/twas_cell_common_daytrader/templates/daytrader_config_base.py.j2 @@ -0,0 +1,395 @@ +import sys + +#----------------------------------------------------------------- +# WARNING: Jython/Python is extremely sensitive to indentation +# errors. Please ensure that tabs are configured appropriately +# for your editor of choice. +#----------------------------------------------------------------- + +#----------------------------------------------------------------- +# daytrader_config_base.py - DayTrader Single Server Install Script +#----------------------------------------------------------------- +# +# This script is designed to configure the JDBC and JMS resource required by +# the DayTrader application. Both single server and clustered environments are +# supported. A "silent install" option is also supported after manually setting +# the default config options in this file. +# +# To invoke the script type: +# wsadmin -f daytrader_config_base.py [all|configure|cleanup|install|uninstall] nodename servername +# where: all - configures JDBC and JMS resources and installs the app +# configure - only configures the JDBC and JMS resource +# cleanup - removes the JDBC and JMS resources +# install - installs the DayTrader ear +# uninstall - uninstalls the DayTrader ear +# +# If no parameters are specified, "all" is assumed! +# + +print ("daytrader_config_base.py") + +# Process the resource file containing all of the admin task definitions +resources = "resource_scripts.py" +wsadminlib = "wsadminlib.py" +execfile(wsadminlib) +execfile(resources) + +# Edit this parameter to switch between Interactive and Silent installs +SilentInstall = "true" + +#--------------------------------------------------------------------- +# Default Properties for Silent Install +# +# Edit the variables in this section to perform a silent install. +#--------------------------------------------------------------------- + +# Silent install properties for Managed Node +# - Modify these properties to specify the target node and server + +TargetNodeName = "server1" +TargetServerName = "server1" + +# Security options +# Note: If global security is enabled or will be enabled at some point and +# time, the AdminAuthAlias should be updated with a valid administrative +# userid and password. In single-server configurations, this can be provided +# by role-based auth (default), local OS auth, LDAP, etc. For cluster +# configurations, LDAP, Windows Active Directory or some other form of +# centralized authentication mechanism must be used to validate the userid. +SecurityEnabled = "true" +DefaultAdminUser = "persona1" +DefaultAdminPasswd = "ppersona1" + +# JDBC provider options +# JDBC provider types include: +DefaultProviderType = "DB2 Using IBM JCC Driver" +DefaultNativePathName = "" +implementationClassName="com.ibm.db2.jcc.DB2ConnectionPoolDataSource" + +# Datasource options +# Note: For Oracle, default port is 1521. For DB2, 50000. +DefaultDatabaseName = "TRADEDB" +DefaultHostname = "yourdb.rtp.raleigh.ibm.com" +DefaultPort = "50000" +DefaultUser = "db2inst1" +DefaultPasswd = "yourpass" + +# Additional defaults for vendor specific Datasources +DefaultDB2DriverType = "4" + +# Deploy options +# Deploy types include: +# "DB2UDB_V82","DB2UDBOS390_V8","DB2UDBISERIES_V54","DERBY_V10","MSSQLSERVER_2005","ORACLE_V10G","INFORMIX_V100" +DefaultEJBDeployType = "DB2UDB_V95" + +# JMS Messaging Engine Datastore options +# Note: true - file store will be used +# false - database data store will be used +DefaultMEFileStore = "true" +DefaultMEFileStoreLocation = "default" + + +#--------------------------------------------------------------------- +# Misc options +#--------------------------------------------------------------------- + +CmdOptions = ["all", "configure", "cleanup", "install", "uninstall"] +DefaultOptions = ["yes", "no"] +BooleanOptions = ["true", "false"] + +#--------------------------------------------------------------------- +# Application specific config information +# +# NOTE: This should NOT be modified!!! +#--------------------------------------------------------------------- +DefaultTradeAppName = "{{ DefaultAppName }}" +DefaultEarFile = "{{ DefaultEarFile }}" + +# Deployment options +# Deployment options +DefaultRunEJBDeploy = "false" +DefaultRunWSDeploy = "false" +DefaultBindings = "true" +DefaultUseMetadata = "true" + +# JDBC Driver and DataSource Config Parameters +# Datasource properties +DefaultDatasourceName = "TradeDataSource" +DefaultDatasourceAuthAliasName = "TradeDataSourceAuthData" +DefaultNoTxDatasourceName = "NoTxTradeDataSource" + +DefaultStmtCacheSize = 100 +DefaultXA = "false" +DefaultClusterMEDatasourceName = "MEDataSource" + +# JMS (Messaging) Config Parameters +# Global Security properties for JMS +DefaultAdminAuthAliasName = "TradeAdminAuthData" +datasourceHelperClassname="com.ibm.websphere.rsadapter.DB2UniversalDataStoreHelper" + +#reliability = "ASSURED_PERSISTENT" +reliability = "EXPRESS_NONPERSISTENT" + +#deliveryMode = "Persistent" +deliveryMode = "NonPersistent" + +#durability = "Durable" +durability = "NonDurable" + +# Queue/Topic Names +brokerSIBDest = "TradeBrokerJSD" +topicSpace = "Trade.Topic.Space" +brokerJMSQCF = "TradeBrokerQCF" +streamerJMSTCF = "TradeStreamerTCF" +brokerQueue = "TradeBrokerQueue" +streamerTopic = "TradeStreamerTopic" +brokerMDB = "TradeBrokerMDB" +streamerMDB = "TradeStreamerMDB" + +WebbrokerJMSQCF = "QueueConnectionFactory" +WebstreamerJMSTCF = "TopicConnectionFactory" +WebbrokerQueue = "BrokerQueue" +WebstreamerTopic = "StreamerTopic" +WebbrokerMDB = "BrokerMDB" +WebstreamerMDB = "StreamerMDB" + +#--------------------------------------------------------------------- +# Common JDBC Driver Paths +#--------------------------------------------------------------------- +# Note: wsadmin parses the command line based on ";" regardless of platform type +DB2WinJccPath = "c:/sqllib/java/db2jcc.jar" +DB2zSeriesNativePath = "/usr/lpp/db2/db2810/jcc/lib" +DB2CliPath = "c:/sqllib/java/db2java.zip" +DB2iSeriesNativePath = "/QIBM/ProdData/Java400/ext/db2_classes.jar" +DB2iSeriesToolboxPath = "/QIBM/ProdData/HTTP/Public/jt400/lib/jt400.jar" + + +# NOTE: edit daytrader_vars.py for custom settings +# if any of the defaults in this script need changing, move to the daytrader_vars.py +dtvars = "daytrader_vars.py" +execfile(dtvars) + +# Deploy types include: +DefaultPathName = "${WAS_INSTALL_ROOT}/db2jars/db2jcc4.jar" +DefaultEJBDeployType = "DB2UDB_V82" +#--------------------------------------------------------------------- +# Basic App Administration Procedures +#--------------------------------------------------------------------- + +def printUsageAndExit (): + print ("") + print ("Usage: wsadmin -f daytrader_config.py [all|configure|cleanup] ") + print ("") + print (" where: all - configures JDBC and JMS resources and installs the app") + print (" configure - only configures the JDBC and JMS resource") + print (" cleanup - removes the JDBC and JMS resources") + print ("") + print (" If no parameters are specified, \"all\" is assumed!") + print ("") + sys.exit() + sys.exit() +#endDef + +def createJDBC_DataSource( scope ): + provider = createJdbcProvider( scope, DefaultProviderType, DefaultPathName, DefaultNativePathName, implementationClassName, '', DefaultProviderType ) + + datasource = createDataSource_ext ( 'cell', '', '', '', provider, DefaultDatasourceName, '', "jdbc/"+DefaultDatasourceName, DefaultStmtCacheSize, DefaultDatasourceAuthAliasName, datasourceHelperClassname, 'DB2', nonTransDS='', cmpDatasource='true', xaRecoveryAuthAlias=None, databaseName=DefaultDatabaseName, serverName=DefaultHostname, portNumber=DefaultPort, driverType=DefaultDB2DriverType, URL=None, informixLockModeWait=None, ifxIFXHOST=None ) + noTxDatasource = createDataSource_ext ( 'cell', '', '', '', provider, DefaultNoTxDatasourceName, '', "jdbc/"+DefaultNoTxDatasourceName, DefaultStmtCacheSize, DefaultDatasourceAuthAliasName, datasourceHelperClassname, 'DB2', nonTransDS='', cmpDatasource='true', xaRecoveryAuthAlias=None, databaseName=DefaultDatabaseName, serverName=DefaultHostname, portNumber=DefaultPort, driverType=DefaultDB2DriverType, URL=None, informixLockModeWait=None, ifxIFXHOST=None ) + AdminTask.setResourceProperty(noTxDatasource, ["-propertyName", "nonTransactionalDataSource", "-propertyValue", "true"]) + + # Create the JMS config objects + print ("") + print ("------------------------------------------------") + print (" Configuring JMS Resources") + print (" Scope: "+scope) + print ("------------------------------------------------") + #creates ME datasource + datasource = createDataSource_ext ( 'cell', '', '', '', provider, DefaultClusterMEDatasourceName, '', "jdbc/"+DefaultClusterMEDatasourceName, DefaultStmtCacheSize, DefaultDatasourceAuthAliasName, datasourceHelperClassname, 'DB2', nonTransDS='', cmpDatasource='true', xaRecoveryAuthAlias=None, databaseName=DefaultDatabaseName, serverName=DefaultHostname, portNumber=DefaultPort, driverType=DefaultDB2DriverType, URL=None, informixLockModeWait=None, ifxIFXHOST=None ) +#endDef + +#--------------------------------------------------------------------- +# Parse Command Line +#--------------------------------------------------------------------- + +if (len(sys.argv) == 0): + operation = "all" +elif (sys.argv[0] in CmdOptions): + operation = sys.argv[0] +else: + printUsageAndExit( ) +#endElse + +#--------------------------------------------------------------------- +# Daytrader configuration procedures +#--------------------------------------------------------------------- + +scope = "" + +if (operation == "all" or operation == "configure"): + # Create the JDBC/Datasource config objects + + cell = getCellId() + #productVersion=AdminTask.getNodeBaseProductVersion(['-nodeName', 'dmgr']) + TargetCellName = getNameFromId(cell) + scope = cell + + print ("") + print ("------------------------------------------------") + print (" Configuring JDBC/Datasource Resources") + print (" Scope: " + scope) + print ("------------------------------------------------") + + createJAAS(DefaultDatasourceAuthAliasName, DefaultUser, DefaultPasswd ) + + # add webserver port + ensureHostAlias('default_host', '*', defaultWebServerHostPort ) + ensureHostAlias('default_host', '*', defaultWebServerHostPortS ) + #endIf + print ("") + print ("------------------------------------------------") + print (" Configuring JDBC/Datasource Resources") + print (" Scope: " + scope) + print ("------------------------------------------------") + + createJAAS(DefaultDatasourceAuthAliasName, DefaultUser, DefaultPasswd ) + # create a cell level datasource for timers + createJDBC_DataSource( scope ) + + print ("") + print ("------------------------------------------------") + print (" JDBC Resource Configuration Completed!!!") + print ("------------------------------------------------") + + # Create the JMS config objects + if ( enableWMQ == 'true' or enableWMQ == 'True' ): + print ("") + print ("------------------------------------------------") + print (" IBM WMQ Resource Configuration started!!!") + print (" Scope: " + scope) + print ("------------------------------------------------") + + # many of the hard coded values below are hard coded into the application, and the variables above cannot be changed. + # I have not used those variables here as it make no sense, and makes the command harder to understand + # + createJAAS(DefaultAdminAuthAliasName, '{{ mq_user }}', '{{ mq_pass }}' ) + AdminTask.createWMQConnectionFactory('"WebSphere MQ JMS Provider(cells/ndcell|resources.xml#builtin_mqprovider)"', '[-type QCF -name TradeBrokerQCF -jndiName jms/TradeBrokerQCF -description -qmgrName QM1 -wmqTransportType CLIENT -qmgrSvrconnChannel DEV.APP.SVRCONN -qmgrHostname {{ mq_host }} -qmgrPortNumber {{ mq_port }} -componentAuthAlias TradeAdminAuthData]') + + AdminTask.createWMQQueue('ndcell(cells/ndcell|cell.xml)', '[-name TradeBrokerQueue -jndiName jms/TradeBrokerQueue -queueName TradeBrokerQueue -qmgr -description ]') + + AdminTask.createWMQConnectionFactory('"WebSphere MQ JMS Provider(cells/ndcell|resources.xml#builtin_mqprovider)"', '[-type TCF -name TradeStreamerTCF -jndiName jms/TradeStreamerTCF -description -qmgrName QM1 -wmqTransportType CLIENT -qmgrSvrconnChannel DEV.APP.SVRCONN -qmgrHostname {{ mq_host }} -qmgrPortNumber {{ mq_port }} -componentAuthAlias TradeAdminAuthData]') + + AdminTask.createWMQTopic('ndcell(cells/ndcell|cell.xml)', '[-name TradeStreamerTopic -jndiName jms/TradeStreamerTopic -topicName TradeStreamerTopic -description -brokerDurSubQueue -brokerCCDurSubQueue -brokerPubQmgr -brokerPubQueue ]') + + AdminTask.createWMQActivationSpec('"WebSphere MQ JMS Provider(cells/ndcell|resources.xml#builtin_mqprovider)"', '[-name TradeBrokerMDB -jndiName eis/TradeBrokerMDB -description -destinationJndiName TradeBrokerQueue -destinationType javax.jms.Queue -messageSelector -qmgrName QM1 -wmqTransportType CLIENT -qmgrSvrconnChannel DEV.APP.SVRCONN -qmgrHostname {{ mq_host }} -qmgrPortNumber {{ mq_port }} -authAlias TradeAdminAuthData]') + + AdminTask.createWMQActivationSpec('"WebSphere MQ JMS Provider(cells/ndcell|resources.xml#builtin_mqprovider)"', '[-name TradeStreamerMDB -jndiName eis/TradeStreamerMDB -description -destinationJndiName TradeStreamerTopic -destinationType javax.jms.Topic -messageSelector -subscriptionDurability Nondurable -qmgrName QM1 -wmqTransportType CLIENT -qmgrSvrconnChannel DEV.APP.SVRCONN -qmgrHostname {{ mq_host }} -qmgrPortNumber {{ mq_port }} -authAlias TradeAdminAuthData]') + + print ("") + print ("------------------------------------------------") + print (" IBM WMQ Resource Configuration Completed!!!") + print ("------------------------------------------------") + else: + print ("") + print ("------------------------------------------------") + print (" JMS Resource Configuration started!!!") + print (" Scope: " + scope) + print ("------------------------------------------------") + + createJAAS(DefaultAdminAuthAliasName, DefaultAdminUser, DefaultAdminPasswd ) + + sibus = createSIBusDT(DefaultClusterName,DefaultAdminAuthAliasName) + fileStore = [DefaultMEFileStore, DefaultMEFileStoreLocation] + target = [TargetNodeName, TargetServerName] + dsParms = ["true", "dummy"] + addSIBusMemberDT(sibus, fileStore, target, dsParms) + + if (SecurityEnabled == "true"): + createSIBusSecurityRole(sibus, DefaultAdminUser ) + #endIf + + # Create the Trade Broker Queue and Trade TopicSpace Destinations + + createSIBDestination(sibus, brokerSIBDest, "Queue", reliability, target ) + createSIBDestination(sibus, topicSpace, "TopicSpace", reliability, [] ) + + createJMSConnectionFactory(sibus, brokerJMSQCF, "Queue", "jms/"+brokerJMSQCF, DefaultAdminAuthAliasName, scope ) + createJMSConnectionFactory(sibus, streamerJMSTCF, "Topic", "jms/"+streamerJMSTCF, DefaultAdminAuthAliasName, scope ) + + createJMSConnectionFactory(sibus, WebbrokerJMSQCF, "Queue", "web/jms/"+WebbrokerJMSQCF, DefaultAdminAuthAliasName, scope ) + createJMSConnectionFactory(sibus, WebstreamerJMSTCF, "Topic", "web/jms/"+WebstreamerJMSTCF, DefaultAdminAuthAliasName, scope ) + + createJMSQueue(brokerQueue, "jms/"+brokerQueue, brokerSIBDest, deliveryMode, scope ) + createJMSTopic(streamerTopic, "jms/"+streamerTopic, topicSpace, deliveryMode, scope ) + + createJMSQueue(WebbrokerQueue, "web/jms/"+WebbrokerQueue, brokerSIBDest, deliveryMode, scope ) + createJMSTopic(WebstreamerTopic, "web/jms/"+WebstreamerTopic, topicSpace, deliveryMode, scope ) + + createMDBActivationSpec(brokerMDB, "eis/"+brokerMDB, sibus, "jms/"+brokerQueue, "javax.jms.Queue", DefaultAdminAuthAliasName, scope, durability ) + createMDBActivationSpec(streamerMDB, "eis/"+streamerMDB, sibus, "jms/"+streamerTopic, "javax.jms.Topic", DefaultAdminAuthAliasName, scope, durability ) + + createMDBActivationSpec(WebbrokerMDB, "eis/"+WebbrokerMDB, sibus, "web/jms/"+WebbrokerQueue, "javax.jms.Queue", DefaultAdminAuthAliasName, scope, durability ) + createMDBActivationSpec(WebstreamerMDB, "eis/"+WebstreamerMDB, sibus, "web/jms/"+WebstreamerTopic, "javax.jms.Topic", DefaultAdminAuthAliasName, scope, durability ) + + print ("") + print ("------------------------------------------------") + print (" JMS Resource Configuration Completed!!!") + print ("------------------------------------------------") + #endIf + + print ("") + print ("Saving...") + AdminConfig.save( ) +#endIf + + + +if (operation == "cleanup"): + print (" ") + print ("------------------------------------------------") + print (" Uninstalling JMS Resources") + print ("------------------------------------------------") + + deleteMDBActicationSpec(brokerMDB) + deleteMDBActicationSpec(streamerMDB) + + deleteJMSQueue(brokerQueue) + deleteJMSTopic(streamerTopic) + + deleteJMSQueue(WebbrokerQueue) + deleteJMSTopic(WebstreamerTopic) + + deleteJMSConnectionFactory(brokerJMSQCF) + deleteJMSConnectionFactory(streamerJMSTCF) + deleteJMSConnectionFactory(WebbrokerJMSQCF) + deleteJMSConnectionFactory(WebstreamerJMSTCF) + + deleteSIBDestination(brokerSIBDest) + deleteSIBDestination(topicSpace) + + deleteSIBus(getName(getNodeIdDT(""))) + + removeJAASAuthData(DefaultAdminAuthAliasName) + + print (" ") + print ("------------------------------------------------") + print (" Uninstalling JDBC Resources") + print ("------------------------------------------------") + + removeDatasource(DefaultDatasourceName) + removeDatasource(DefaultNoTxDatasourceName) + removeJAASAuthData(DefaultDatasourceAuthAliasName) + + print ("") + print ("------------------------------------------------") + print (" DayTrader Resource Cleanup Completed!!!") + print ("------------------------------------------------") + + print ("") + print ("Saving...") + AdminConfig.save( ) +#endIf +print ("") +print ("Saving config...") +AdminConfig.save( ) + + diff --git a/ansible/roles/twas_cell_common_daytrader/templates/daytrader_vars.py.j2 b/ansible/roles/twas_cell_common_daytrader/templates/daytrader_vars.py.j2 index fe863b31d..738549352 100644 --- a/ansible/roles/twas_cell_common_daytrader/templates/daytrader_vars.py.j2 +++ b/ansible/roles/twas_cell_common_daytrader/templates/daytrader_vars.py.j2 @@ -39,7 +39,11 @@ defaultWebServerHostPort="{{ ihs_http_port }}" defaultWebServerHostPortS="{{ ihs_https_port }}" DefaultClusterName="{{ clusterName }}" +TargetNodeName = "{{ profile_name }}" +TargetServerName = "{{ appServerName }}" DefaultEarFile = "{{ DefaultEarFile }}" DefaultTradeAppName = "{{ DefaultAppName }}" + +enableWMQ = "{{ enable_wmq }}" # END diff --git a/ansible/roles/twas_cell_common_daytrader/templates/mq_config.py.j2 b/ansible/roles/twas_cell_common_daytrader/templates/mq_config.py.j2 new file mode 100644 index 000000000..8807a4f6f --- /dev/null +++ b/ansible/roles/twas_cell_common_daytrader/templates/mq_config.py.j2 @@ -0,0 +1,27 @@ +print ("") +print ("------------------------------------------------") +print (" IBM WMQ Resource Configuration started!!!") +print (" Scope: " + scope) +print ("------------------------------------------------") + +# many of the hard coded values below are hard coded into the application, and the variables above cannot be changed. +# I have not used those variables here as it make no sense, and makes the command harder to understand +# +createJAAS(DefaultAdminAuthAliasName, '{{ mq_user }}', '{{ mq_pass }}' ) +AdminTask.createWMQConnectionFactory('"WebSphere MQ JMS Provider(cells/ndcell|resources.xml#builtin_mqprovider)"', '[-type QCF -name TradeBrokerQCF -jndiName jms/TradeBrokerQCF -description -qmgrName QM1 -wmqTransportType CLIENT -qmgrSvrconnChannel DEV.APP.SVRCONN -qmgrHostname {{ mq_host }} -qmgrPortNumber {{ mq_port }} -componentAuthAlias TradeAdminAuthData]') + +AdminTask.createWMQQueue('ndcell(cells/ndcell|cell.xml)', '[-name TradeBrokerQueue -jndiName jms/TradeBrokerQueue -queueName TradeBrokerQueue -qmgr -description ]') + + +AdminTask.createWMQConnectionFactory('"WebSphere MQ JMS Provider(cells/ndcell|resources.xml#builtin_mqprovider)"', '[-type TCF -name TradeStreamerTCF -jndiName jms/TradeStreamerTCF -description -qmgrName QM1 -wmqTransportType CLIENT -qmgrSvrconnChannel DEV.APP.SVRCONN -qmgrHostname {{ mq_host }} -qmgrPortNumber {{ mq_port }} -componentAuthAlias TradeAdminAuthData]') + +AdminTask.createWMQTopic('ndcell(cells/ndcell|cell.xml)', '[-name TradeStreamerTopic -jndiName jms/TradeStreamerTopic -topicName TradeStreamerTopic -description -brokerDurSubQueue -brokerCCDurSubQueue -brokerPubQmgr -brokerPubQueue ]') + +AdminTask.createWMQActivationSpec('"WebSphere MQ JMS Provider(cells/ndcell|resources.xml#builtin_mqprovider)"', '[-name TradeBrokerMDB -jndiName eis/TradeBrokerMDB -description -destinationJndiName TradeBrokerQueue -destinationType javax.jms.Queue -messageSelector -qmgrName QM1 -wmqTransportType CLIENT -qmgrSvrconnChannel DEV.APP.SVRCONN -qmgrHostname {{ mq_host }} -qmgrPortNumber {{ mq_port }} -authAlias TradeAdminAuthData]') + +AdminTask.createWMQActivationSpec('"WebSphere MQ JMS Provider(cells/ndcell|resources.xml#builtin_mqprovider)"', '[-name TradeStreamerMDB -jndiName eis/TradeStreamerMDB -description -destinationJndiName TradeStreamerTopic -destinationType javax.jms.Topic -messageSelector -subscriptionDurability Nondurable -qmgrName QM1 -wmqTransportType CLIENT -qmgrSvrconnChannel DEV.APP.SVRCONN -qmgrHostname {{ mq_host }} -qmgrPortNumber {{ mq_port }} -authAlias TradeAdminAuthData]') + +print ("") +print ("------------------------------------------------") +print (" IBM WMQ Resource Configuration Completed!!!") +print ("------------------------------------------------") \ No newline at end of file diff --git a/ansible/roles/twas_cell_daytrader3/defaults/main.yml b/ansible/roles/twas_cell_daytrader3/defaults/main.yml index 206c7904f..7998c7744 100644 --- a/ansible/roles/twas_cell_daytrader3/defaults/main.yml +++ b/ansible/roles/twas_cell_daytrader3/defaults/main.yml @@ -3,3 +3,8 @@ DefaultAppName: 'DayTrader3.0.9-ee6-src' DefaultEarFile: '{{ DefaultAppName }}.ear' +# dummy value when configuring on base servers +DefaultClusterName: 'dummyCluster' +# dummy values to help when configuring a cluster +TargetNodeName: '{{ profile_name }}' +TargetServerName: '{{ appServerName }}' diff --git a/ansible/roles/twas_cell_daytrader3/files/DayTrader3.0.9-ee6-src.ear b/ansible/roles/twas_cell_daytrader3/files/DayTrader3.0.9-ee6-src.ear deleted file mode 100755 index 94e46b912..000000000 Binary files a/ansible/roles/twas_cell_daytrader3/files/DayTrader3.0.9-ee6-src.ear and /dev/null differ diff --git a/ansible/roles/twas_cell_daytrader3/meta/main.yml b/ansible/roles/twas_cell_daytrader3/meta/main.yml index 43ee3189f..de740f747 100644 --- a/ansible/roles/twas_cell_daytrader3/meta/main.yml +++ b/ansible/roles/twas_cell_daytrader3/meta/main.yml @@ -3,3 +3,4 @@ dependencies: - role: twas_cell_defaults - role: http_defaults - role: twas_cell_common_daytrader + - role: load_secrets diff --git a/ansible/roles/twas_cell_daytrader3/tasks/twas_cell_daytrader3.yml b/ansible/roles/twas_cell_daytrader3/tasks/twas_cell_daytrader3.yml index 39d80734b..a6d6fce3f 100644 --- a/ansible/roles/twas_cell_daytrader3/tasks/twas_cell_daytrader3.yml +++ b/ansible/roles/twas_cell_daytrader3/tasks/twas_cell_daytrader3.yml @@ -22,7 +22,7 @@ dest: "~/{{ DefaultEarFile }}" - name: run the daytrader config jython script - shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin.sh -lang jython -username {{ twas_username }} -password {{ twas_password }} -f daytrader_config.py" + shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin{{ ext }} -lang jython -username {{ twas_username }} -password {{ twas_password }} -f daytrader_config.py" register: daytraderConfigOutput failed_when: ( daytraderConfigOutput.rc not in [ 0, 255 ] ) - name: daytraderConfigOutput @@ -30,7 +30,7 @@ msg: "{{ daytraderConfigOutput.stdout_lines }}" - name: run the daytrader3 application install jython script - shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin.sh -lang jython -username {{ twas_username }} -password {{ twas_password }} -f daytrader3.py" + shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin{{ ext }} -lang jython -username {{ twas_username }} -password {{ twas_password }} -f daytrader3.py" register: daytrader3Output failed_when: ( daytrader3Output.rc not in [ 0, 255 ] ) - name: daytrader3Output diff --git a/ansible/roles/twas_cell_daytrader7/defaults/main.yml b/ansible/roles/twas_cell_daytrader7/defaults/main.yml index 2d2423ad6..4d9b6ed3f 100644 --- a/ansible/roles/twas_cell_daytrader7/defaults/main.yml +++ b/ansible/roles/twas_cell_daytrader7/defaults/main.yml @@ -3,3 +3,8 @@ DefaultAppName: 'DayTrader-ee7.0.11' DefaultEarFile: '{{ DefaultAppName }}.ear' +# dummy value when configuring on base servers +DefaultClusterName: 'dummyCluster' +# dummy values to help when configuring a cluster +TargetNodeName: '{{ profile_name }}' +TargetServerName: '{{ appServerName }}' diff --git a/ansible/roles/twas_cell_daytrader7/files/DayTrader-ee7.0.11.ear b/ansible/roles/twas_cell_daytrader7/files/DayTrader-ee7.0.11.ear deleted file mode 100644 index c8b543b2a..000000000 Binary files a/ansible/roles/twas_cell_daytrader7/files/DayTrader-ee7.0.11.ear and /dev/null differ diff --git a/ansible/roles/twas_cell_daytrader7/meta/main.yml b/ansible/roles/twas_cell_daytrader7/meta/main.yml index 43ee3189f..de740f747 100644 --- a/ansible/roles/twas_cell_daytrader7/meta/main.yml +++ b/ansible/roles/twas_cell_daytrader7/meta/main.yml @@ -3,3 +3,4 @@ dependencies: - role: twas_cell_defaults - role: http_defaults - role: twas_cell_common_daytrader + - role: load_secrets diff --git a/ansible/roles/twas_cell_daytrader7/tasks/main.yml b/ansible/roles/twas_cell_daytrader7/tasks/main.yml index 8aec58956..06a544bc9 100644 --- a/ansible/roles/twas_cell_daytrader7/tasks/main.yml +++ b/ansible/roles/twas_cell_daytrader7/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: twas_cell_daytrader7.yml +- name: tWAS Cell DayTrader7 + include_tasks: twas_cell_daytrader7.yml diff --git a/ansible/roles/twas_cell_daytrader7/tasks/twas_cell_daytrader7.yml b/ansible/roles/twas_cell_daytrader7/tasks/twas_cell_daytrader7.yml index 4053b89cb..6d3a2785a 100644 --- a/ansible/roles/twas_cell_daytrader7/tasks/twas_cell_daytrader7.yml +++ b/ansible/roles/twas_cell_daytrader7/tasks/twas_cell_daytrader7.yml @@ -1,39 +1,59 @@ --- +- block: + - set_fact: + targetServerMapping: "cluster={{ clusterName }}" + - name: Copy daytrader_config.py.j2 template + ansible.builtin.template: + src: "../twas_cell_common_daytrader/templates/daytrader_config.py.j2" + dest: "daytrader_config.py" + - name: Copy mq_config.py.j2 template + ansible.builtin.template: + src: "../twas_cell_common_daytrader/templates/mq_config.py.j2" + dest: "mq_config.py" + when: + - profile_type == 'dmgr' + - enable_wmq + when: profile_type == 'dmgr' -- name: copy daytrader7.py.j2 template - template: - src: "../twas_cell_common_daytrader/templates/daytrader7.py.j2" - dest: "daytrader7.py" -- name: copy daytrader_config.py.j2 template - template: - src: "../twas_cell_common_daytrader/templates/daytrader_config.py.j2" - dest: "daytrader_config.py" -- name: copy daytrader_vars.py.j2 template - template: - src: "../twas_cell_common_daytrader/templates/daytrader_vars.py.j2" - dest: "daytrader_vars.py" -- name: copy resource_scripts.py.j2 template - template: - src: "../twas_cell_common_daytrader/templates/resource_scripts.py.j2" - dest: "resource_scripts.py" -- name: copy daytrader app - copy: +- block: + - set_fact: + targetServerMapping: "node={{ profile_name }},server={{ appServerName }}" + - name: Copy daytrader_config_base.py.j2 template + ansible.builtin.template: + src: "../twas_cell_common_daytrader/templates/daytrader_config_base.py.j2" + dest: "daytrader_config.py" + when: profile_type == 'default' + +- name: Copy daytrader7.py.j2 template + ansible.builtin.template: + src: "../twas_cell_common_daytrader/templates/daytrader7.py.j2" + dest: "daytrader7.py" + +- name: Copy daytrader_vars.py.j2 template + ansible.builtin.template: + src: "../twas_cell_common_daytrader/templates/daytrader_vars.py.j2" + dest: "daytrader_vars.py" +- name: Copy resource_scripts.py.j2 template + ansible.builtin.template: + src: "../twas_cell_common_daytrader/templates/resource_scripts.py.j2" + dest: "resource_scripts.py" +- name: Copy daytrader app + ansible.builtin.copy: src: "{{ DefaultEarFile }}" dest: "~/{{ DefaultEarFile }}" -- name: run the daytrader config jython script - shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin.sh -lang jython -username {{ twas_username }} -password {{ twas_password }} -f daytrader_config.py" +- name: Run the daytrader config jython script + ansible.builtin.shell: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin{{ ext }} -lang jython -username {{ twas_username }} -password {{ twas_password }} -f daytrader_config.py" register: daytraderConfigOutput failed_when: ( daytraderConfigOutput.rc not in [ 0, 255 ] ) - name: daytraderConfigOutput - debug: - msg: "{{ daytraderConfigOutput.stdout_lines }}" + ansible.builtin.debug: + msg: "{{ daytraderConfigOutput.stdout_lines }}" -- name: run the daytrader7 application install jython script - shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin.sh -lang jython -username {{ twas_username }} -password {{ twas_password }} -f daytrader7.py" +- name: Run the daytrader7 application install jython script + ansible.builtin.shell: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin{{ ext }} -lang jython -username {{ twas_username }} -password {{ twas_password }} -f daytrader7.py" register: daytrader7Output failed_when: ( daytrader7Output.rc not in [ 0, 255 ] ) - name: daytrader7Output - debug: - msg: "{{ daytrader7Output.stdout_lines }}" - + ansible.builtin.debug: + msg: "{{ daytrader7Output.stdout_lines }}" diff --git a/ansible/roles/twas_cell_defaults/defaults/main.yml b/ansible/roles/twas_cell_defaults/defaults/main.yml index 0998664b5..bb16674ab 100644 --- a/ansible/roles/twas_cell_defaults/defaults/main.yml +++ b/ansible/roles/twas_cell_defaults/defaults/main.yml @@ -1,7 +1,9 @@ --- -twas_im_driver: 'cf212205.01' +twas_im_driver: 'f5202422.01' twas_daily_or_test: 'test' install_base: '/home/nest' +cygwin: '' +ext: '.sh' # default to *nix shell extension twas_dir: 'was' app_dir: 'AppClient' shared_dir: 'IM-shared' @@ -11,11 +13,18 @@ ibm_user: 'external_ibmuser' ibm_pass: 'external_ibmpass' #twas_release: 'WAS855' twas_release: 'WAS90' +twas_more_release: 'v10' +cell_trust: 'CellDefaultTrustStore' +verbosegc_file_template: 'verbosegc*' +env_name: mytWASEnv +logs_dir: "{{ playbook_dir }}" # location on the ansible controller + +enable_wmq: false # if set to true, use real MQ versus internal SIB/JMS profile_templatePath: - managed: '{{ install_base }}/{{ twas_dir }}/profileTemplates/managed' - dmgr: '{{ install_base }}/{{ twas_dir }}/profileTemplates/management' - default: '{{ install_base }}/{{ twas_dir }}/profileTemplates/default' + managed: managed + dmgr: management + default: default cellName: 'ndcell' clusterName: 'Cluster' @@ -33,4 +42,10 @@ im_twas_package: im_appclient_package: WAS90: 'com.ibm.websphere.APPCLIENT.v90' WAS855: 'com.ibm.websphere.APPCLIENT{{le_package_extension[ansible_architecture]}}.v85' -im_twas_java_package: 'com.ibm.sdk.v8' +im_twas_java_package: 'com.ibm.java.jdk.v8' +im_twas_more_package: + v10: com.ibm.websphere.MORE.v10 + v20: com.ibm.websphere.MORE.v20 + +verboseGC: true +linux_process_to_kill: 'java' \ No newline at end of file diff --git a/ansible/roles/twas_cell_defaults/tasks/main.yml b/ansible/roles/twas_cell_defaults/tasks/main.yml new file mode 100644 index 000000000..967aee750 --- /dev/null +++ b/ansible/roles/twas_cell_defaults/tasks/main.yml @@ -0,0 +1,7 @@ +--- +- name: Check windoze + ansible.builtin.set_fact: + cygwin: 'c:/cygwin64' + ext: '.bat' + when: + - ansible_system == 'Windows' or 'CYG' in ansible_system diff --git a/ansible/roles/twas_cell_dmgr_backupConfig/meta/main.yml b/ansible/roles/twas_cell_dmgr_backupConfig/meta/main.yml new file mode 100644 index 000000000..1397bfd39 --- /dev/null +++ b/ansible/roles/twas_cell_dmgr_backupConfig/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: twas_cell_defaults diff --git a/ansible/roles/twas_cell_dmgr_backupConfig/readme.md b/ansible/roles/twas_cell_dmgr_backupConfig/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/twas_cell_dmgr_backupConfig/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/twas_cell_dmgr_backupConfig/tasks/main.yml b/ansible/roles/twas_cell_dmgr_backupConfig/tasks/main.yml new file mode 100644 index 000000000..ec934000c --- /dev/null +++ b/ansible/roles/twas_cell_dmgr_backupConfig/tasks/main.yml @@ -0,0 +1,2 @@ +--- +- include_tasks: twas_cell_dmgr_backupConfig.yml diff --git a/ansible/roles/twas_cell_dmgr_backupConfig/tasks/twas_cell_dmgr_backupConfig.yml b/ansible/roles/twas_cell_dmgr_backupConfig/tasks/twas_cell_dmgr_backupConfig.yml new file mode 100644 index 000000000..88b3857e5 --- /dev/null +++ b/ansible/roles/twas_cell_dmgr_backupConfig/tasks/twas_cell_dmgr_backupConfig.yml @@ -0,0 +1,12 @@ +--- + +- name: BackupConfig on dmgr + when: profile_type == 'dmgr' + block: + - name: Backup the dmgr config + ansible.builtin.shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/backupConfig{{ ext }} -nostop" + register: backupConfigOutput + failed_when: ( backupConfigOutput.rc not in [ 0, 255 ] ) + - name: BackupConfigOutput + ansible.builtin.debug: + msg: "{{ backupConfigOutput.stdout_lines }}" diff --git a/ansible/roles/twas_cell_enable_ldap_security/tasks/twas_cell_enable_ldap_security.yml b/ansible/roles/twas_cell_enable_ldap_security/tasks/twas_cell_enable_ldap_security.yml index d00f2149b..4395c0f2e 100644 --- a/ansible/roles/twas_cell_enable_ldap_security/tasks/twas_cell_enable_ldap_security.yml +++ b/ansible/roles/twas_cell_enable_ldap_security/tasks/twas_cell_enable_ldap_security.yml @@ -6,7 +6,7 @@ dest: "99_twas_enable_ldap_security.py" - name: run the enable ldap jython script - shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin.sh -lang jython -username {{ twas_username }} -password {{ twas_password }} -f 99_twas_enable_ldap_security.py" + shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin{{ ext }} -lang jython -username {{ twas_username }} -password {{ twas_password }} -f 99_twas_enable_ldap_security.py" register: enableLdapOutput failed_when: ( enableLdapOutput.rc not in [ 0, 255 ] ) - name: enableLdapOutput diff --git a/ansible/roles/twas_cell_enable_ldap_security/templates/99_twas_enable_ldap_security.py.j2 b/ansible/roles/twas_cell_enable_ldap_security/templates/99_twas_enable_ldap_security.py.j2 index e400f61b1..cc3ca2aa5 100644 --- a/ansible/roles/twas_cell_enable_ldap_security/templates/99_twas_enable_ldap_security.py.j2 +++ b/ansible/roles/twas_cell_enable_ldap_security/templates/99_twas_enable_ldap_security.py.j2 @@ -7,7 +7,7 @@ import os # for your editor of choice. #----------------------------------------------------------------- # -# bin/wsadmin.sh -lang jython -username user -password pass -f 99_twas_enable_ldap_security.py.j2 +# bin/wsadmin{{ ext }} -lang jython -username user -password pass -f 99_twas_enable_ldap_security.py.j2 # execfile('wsadminlib.py') diff --git a/ansible/roles/twas_cell_federate/tasks/twas_cell_federate.yml b/ansible/roles/twas_cell_federate/tasks/twas_cell_federate.yml index eb331ba25..1f4f8fc27 100644 --- a/ansible/roles/twas_cell_federate/tasks/twas_cell_federate.yml +++ b/ansible/roles/twas_cell_federate/tasks/twas_cell_federate.yml @@ -4,7 +4,7 @@ when: profile_type == 'managed' block: - name: addNode - shell: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/addNode.sh {{ groups.dmgr[0] }} -conntype SOAP -username {{ twas_username }} -password {{ twas_password }} -profileName {{ profile_name }}" + shell: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/addNode{{ ext }} {{ groups.dmgr[0] }} -conntype SOAP -username {{ twas_username }} -password {{ twas_password }} -profileName {{ profile_name }}" register: addNodeOutput failed_when: ( addNodeOutput.rc not in [ 0, 1, 2 ] ) - name: addNodeOutput diff --git a/ansible/roles/twas_cell_get_dumps/defaults/main.yml b/ansible/roles/twas_cell_get_dumps/defaults/main.yml new file mode 100644 index 000000000..ed97d539c --- /dev/null +++ b/ansible/roles/twas_cell_get_dumps/defaults/main.yml @@ -0,0 +1 @@ +--- diff --git a/ansible/roles/twas_cell_get_dumps/meta/main.yml b/ansible/roles/twas_cell_get_dumps/meta/main.yml new file mode 100644 index 000000000..1397bfd39 --- /dev/null +++ b/ansible/roles/twas_cell_get_dumps/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: twas_cell_defaults diff --git a/ansible/roles/twas_cell_get_dumps/readme.md b/ansible/roles/twas_cell_get_dumps/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/twas_cell_get_dumps/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/twas_cell_get_dumps/tasks/main.yml b/ansible/roles/twas_cell_get_dumps/tasks/main.yml new file mode 100644 index 000000000..d61bf6db1 --- /dev/null +++ b/ansible/roles/twas_cell_get_dumps/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Get tWAS javacore and heapdumps + include_tasks: twas_cell_get_dumps.yml \ No newline at end of file diff --git a/ansible/roles/twas_cell_get_dumps/tasks/twas_cell_get_dumps.yml b/ansible/roles/twas_cell_get_dumps/tasks/twas_cell_get_dumps.yml new file mode 100644 index 000000000..94ecd0b39 --- /dev/null +++ b/ansible/roles/twas_cell_get_dumps/tasks/twas_cell_get_dumps.yml @@ -0,0 +1,56 @@ +--- + +- name: Any Cores? + ansible.builtin.shell: "ls {{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/javacore*" + register: iscore + failed_when: iscore.rc not in [0,2] + +- name: Any Heapdumps? + ansible.builtin.shell: "ls {{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/heapdump*" + register: isheap + failed_when: isheap.rc not in [0,2] + +- name: Dump archive logic + when: iscore.rc == 0 or isheap.rc == 0 + block: + - name: Archive the tWAS dump zip to fetch + ignore_errors: True + community.general.archive: + path: + - "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/javacore*" + - "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/heapdump*" + dest: dumps.zip + format: zip + exclusion_patterns: + - '*.zip' + - '*.tar' + - '*.gz' + mode: '0755' + + - name: Fetch the tWAS dump archive + ansible.builtin.fetch: + src: dumps.zip + dest: "{{ dumps_dir }}/{{ env_name }}" + + - name: Remove temp dumps.zip + ansible.builtin.file: + path: dumps.zip + state: absent + + # unarchive fails to find handler + - name: Extract the tWAS dump archive + delegate_to: localhost + ansible.builtin.unarchive: + src: "{{ dumps_dir }}/{{ env_name }}/{{ ansible_fqdn }}/dumps.zip" + dest: "{{ dumps_dir }}/{{ env_name }}/{{ ansible_fqdn }}" + remote_src: false + + - name: Remove dumps.zip + delegate_to: localhost + ansible.builtin.file: + path: "{{ dumps_dir }}/{{ env_name }}/{{ ansible_fqdn }}/dumps.zip" + state: absent + + - name: Dumps directory location + ansible.builtin.debug: + msg: "{{ dumps_dir }}/{{ env_name }}/{{ ansible_fqdn }}" diff --git a/ansible/roles/twas_cell_get_logs/defaults/main.yml b/ansible/roles/twas_cell_get_logs/defaults/main.yml index 35f869189..7fd75fa34 100644 --- a/ansible/roles/twas_cell_get_logs/defaults/main.yml +++ b/ansible/roles/twas_cell_get_logs/defaults/main.yml @@ -2,3 +2,4 @@ history_days: '-3' env_name: mytWASEnv +logs_dir: "{{ playbook_dir }}" # location on the ansible controller diff --git a/ansible/roles/twas_cell_get_logs/tasks/twas_cell_get_logs.yml b/ansible/roles/twas_cell_get_logs/tasks/twas_cell_get_logs.yml index ce1773fd3..1482d391e 100644 --- a/ansible/roles/twas_cell_get_logs/tasks/twas_cell_get_logs.yml +++ b/ansible/roles/twas_cell_get_logs/tasks/twas_cell_get_logs.yml @@ -1,42 +1,74 @@ --- -- name: clear log directory - delegate_to: localhost - file: - path: "logs/{{ env_name }}/{{ ansible_fqdn }}" - state: absent - -- name: create log directory - delegate_to: localhost - file: - path: "logs/{{ env_name }}/{{ ansible_fqdn }}" - state: directory - -- name: archive the logs dir to fetch - community.general.archive: - path: - - "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/logs" - dest: logs.tar - format: tar - -- name: fetch the twas log archive - ansible.builtin.fetch: - src: logs.tar - dest: "logs/{{ env_name }}" - - # unarchive fails to find handler -- name: Extract the twas log archive - delegate_to: localhost - shell: tar xf logs.tar - args: - chdir: "logs/{{ env_name }}/{{ ansible_fqdn }}" - -- name: remove logs.tar - delegate_to: localhost - file: - path: "logs/{{ env_name }}/{{ ansible_fqdn }}/logs.tar" - state: absent - -- name: log/error directory location - debug: - msg: "{{ playbook_dir }}/logs/{{ env_name }}/{{ ansible_fqdn }}" +- name: Any logs? + ansible.builtin.stat: + path: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/logs" + register: islogs + +- name: Log archive logic + when: islogs.stat.exists + block: + - name: Archive the logs dir to fetch + ignore_errors: true # ignore errors, if there are a lot of errors the logs will rollover causing the archive to fail + community.general.archive: + path: + - "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/logs/*" # needs * to allow the exclude_path to work + exclude_path: + - "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/logs/service" + exclusion_patterns: + - '*.zip' + - '*.tar' + - '*.gz' + - '*.lck' + - 'SystemErr*.log' + - 'btrace*' + - 'objects*' + dest: logs.zip + format: zip + mode: '0755' + + - name: Create local logs dir + delegate_to: localhost + ansible.builtin.file: + path: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ profile_name }}/logs/" + state: directory + mode: '0755' + + - name: Fetch the twas log archive + ansible.builtin.fetch: + flat: true + src: logs.zip + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ profile_name }}/" + + - name: Unarchive the twas logs + delegate_to: localhost + ansible.builtin.unarchive: + src: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ profile_name }}/logs.zip" + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ profile_name }}/logs/" + remote_src: false + + - name: Remove logs.zip + delegate_to: localhost + ansible.builtin.file: + path: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ profile_name }}/logs.zip" + state: absent + + - name: Print local log/error directory location + ansible.builtin.debug: + msg: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ profile_name }}/logs" + + - name: Verbose GC log processing + when: verboseGC|bool + block: + - name: Run the IBM verbosegc logic + ansible.builtin.include_role: + name: ibm_vbgc + vars: + vbgc_dir: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ profile_name }}/logs" + + - name: Run the IBM verbosegc report logic + run_once: true + ansible.builtin.include_role: + name: ibm_vbgc_report + vars: + vbgc_report_dir: "{{ logs_dir }}/{{ env_name }}" diff --git a/ansible/roles/twas_cell_get_verbosegc/defaults/main.yml b/ansible/roles/twas_cell_get_verbosegc/defaults/main.yml new file mode 100644 index 000000000..a891759ca --- /dev/null +++ b/ansible/roles/twas_cell_get_verbosegc/defaults/main.yml @@ -0,0 +1,2 @@ +--- +log_time_window: -3 \ No newline at end of file diff --git a/ansible/roles/twas_cell_get_verbosegc/meta/main.yml b/ansible/roles/twas_cell_get_verbosegc/meta/main.yml new file mode 100644 index 000000000..1397bfd39 --- /dev/null +++ b/ansible/roles/twas_cell_get_verbosegc/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: twas_cell_defaults diff --git a/ansible/roles/twas_cell_get_verbosegc/readme.md b/ansible/roles/twas_cell_get_verbosegc/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/twas_cell_get_verbosegc/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/twas_cell_get_verbosegc/tasks/main.yml b/ansible/roles/twas_cell_get_verbosegc/tasks/main.yml new file mode 100644 index 000000000..c00b26983 --- /dev/null +++ b/ansible/roles/twas_cell_get_verbosegc/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Get tWAS verbosegc + include_tasks: twas_cell_get_verbosegc.yml \ No newline at end of file diff --git a/ansible/roles/twas_cell_get_verbosegc/tasks/twas_cell_get_verbosegc.yml b/ansible/roles/twas_cell_get_verbosegc/tasks/twas_cell_get_verbosegc.yml new file mode 100644 index 000000000..c975e26eb --- /dev/null +++ b/ansible/roles/twas_cell_get_verbosegc/tasks/twas_cell_get_verbosegc.yml @@ -0,0 +1,45 @@ +--- +- name: Any verbosegc files? + ansible.builtin.shell: "find {{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/logs/ -name {{ verbosegc_file_template }} -mtime {{ log_time_window }}" + register: isverbosegc + +- name: Verbosegc archive logic + when: isverbosegc.stdout != "" + block: + - name: Archive the tWAS verbosegc files to fetch + ignore_errors: True + community.general.archive: + path: + - "{{ item }}" + dest: verbosegc.zip + format: zip + mode: '0755' + with_items: '{{ isverbosegc.stdout_lines }}' + + - name: Fetch the tWAS verbosegc archive + ansible.builtin.fetch: + src: verbosegc.zip + dest: "{{ logs_dir }}/{{ env_name }}" + + - name: Remove temp verbosegc.zip + ansible.builtin.file: + path: verbosegc.zip + state: absent + + # unarchive fails to find handler + - name: Extract the tWAS verbosegc archive + delegate_to: localhost + ansible.builtin.unarchive: + src: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/verbosegc.zip" + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}" + remote_src: false + + - name: Remove verbosegc.zip + delegate_to: localhost + ansible.builtin.file: + path: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/verbosegc.zip" + state: absent + + - name: Verbosegc directory location + ansible.builtin.debug: + msg: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}" diff --git a/ansible/roles/twas_cell_ihsplugin_gen_propagate/tasks/twas_cell_ihsplugin_gen_propagate.yml b/ansible/roles/twas_cell_ihsplugin_gen_propagate/tasks/twas_cell_ihsplugin_gen_propagate.yml index c865ecbba..02fbfea9c 100644 --- a/ansible/roles/twas_cell_ihsplugin_gen_propagate/tasks/twas_cell_ihsplugin_gen_propagate.yml +++ b/ansible/roles/twas_cell_ihsplugin_gen_propagate/tasks/twas_cell_ihsplugin_gen_propagate.yml @@ -1,15 +1,34 @@ --- -- name: copy ihsplugin_gen_propagate.py.j2 template - template: - src: "ihsplugin_gen_propagate.py.j2" - dest: "ihsplugin_gen_propagate.py" +- name: Set targetappServerName for default + ansible.builtin.set_fact: + targetappServerName: "{{ appServerName }}" + when: profile_type == 'default' -- name: run the ihsplugin_gen_propagate jython script - shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin.sh -lang jython -username {{ twas_username }} -password {{ twas_password }} -f ihsplugin_gen_propagate.py" +- name: Set targetappServerName for dmgr + ansible.builtin.set_fact: + targetappServerName: dmgr + when: profile_type == 'dmgr' + +- name: Unset windoze comment cuz its not + ansible.builtin.set_fact: + comment_out_for_windoze: '' + when: ansible_system is not search('CYG') +- name: Set windoze comment + ansible.builtin.set_fact: + comment_out_for_windoze: '#' + when: ansible_system == 'Windows' or 'CYG' in ansible_system + +- name: Copy ihsplugin_gen_propagate.py.j2 template + ansible.builtin.template: + src: "ihsplugin_gen_propagate.py.j2" + dest: "ihsplugin_gen_propagate.py" + + +- name: Run the ihsplugin_gen_propagate jython script + ansible.builtin.shell: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin{{ ext }} -lang jython -username {{ twas_username }} -password {{ twas_password }} -f ihsplugin_gen_propagate.py" register: ihsplugin_gen_propagateOutput failed_when: ( ihsplugin_gen_propagateOutput.rc not in [ 0, 255 ] ) -- name: ihsplugin_gen_propagateOutput - debug: - msg: "{{ ihsplugin_gen_propagateOutput.stdout_lines }}" - \ No newline at end of file +- name: Plugin ihsplugin_gen_propagateOutput + ansible.builtin.debug: + msg: "{{ ihsplugin_gen_propagateOutput.stdout_lines }}" diff --git a/ansible/roles/twas_cell_ihsplugin_gen_propagate/templates/ihsplugin_gen_propagate.py.j2 b/ansible/roles/twas_cell_ihsplugin_gen_propagate/templates/ihsplugin_gen_propagate.py.j2 index 3fa69a81d..37367e083 100644 --- a/ansible/roles/twas_cell_ihsplugin_gen_propagate/templates/ihsplugin_gen_propagate.py.j2 +++ b/ansible/roles/twas_cell_ihsplugin_gen_propagate/templates/ihsplugin_gen_propagate.py.j2 @@ -1,6 +1,3 @@ -import sys -import os - #----------------------------------------------------------------- # WARNING: Jython/Python is extremely sensitive to indentation # errors. Please ensure that tabs are configured appropriately @@ -29,10 +26,13 @@ enableDebugMessages() # generate and prop the webserver plugin print ("generatePluginCfg:start") -generatePluginCfg('{{ webServerName }}', '{{ webNode }}') +wVersion = AdminTask.getNodeBaseProductVersion('[-nodeName {{ profile_name }} ]') +AdminControl.invoke('WebSphere:name=PluginCfgGenerator,process={{ targetappServerName }},platform=common,node={{ profile_name }},version='+wVersion+',type=PluginCfgGenerator,mbeanIdentifier=PluginCfgGenerator,cell=ndcell,spec=1.0', 'generate', '[{{ cygwin }}{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/config ndcell {{ webNode }} {{ webServerName }} false]') + print ("generatePluginCfg:completed") -wVersion = AdminTask.getNodeBaseProductVersion('[-nodeName dmgr ]') + # [1/31/22 12:21:36:608 EST] Web servers > webserver1 > Plug-in properties -print ("generatePluginCfg:propagateKeyring:start") -AdminControl.invoke('WebSphere:name=PluginCfgGenerator,process=dmgr,platform=common,node=dmgr,version='+wVersion+',type=PluginCfgGenerator,mbeanIdentifier=PluginCfgGenerator,cell=ndcell,spec=1.0', 'propagateKeyring', '[{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/config ndcell {{ webNode }} {{ webServerName }}]') -print ("generatePluginCfg:propagateKeyring:completed") +{{ comment_out_for_windoze }}print ("generatePluginCfg:propagateKeyring:start") + +{{ comment_out_for_windoze }}AdminControl.invoke('WebSphere:name=PluginCfgGenerator,process={{ targetappServerName }},platform=common,node={{ profile_name }},version='+wVersion+',type=PluginCfgGenerator,mbeanIdentifier=PluginCfgGenerator,cell=ndcell,spec=1.0', 'propagateKeyring', '[{{ cygwin }}{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/config ndcell {{ webNode }} {{ webServerName }}]') +{{ comment_out_for_windoze }}print ("generatePluginCfg:propagateKeyring:completed") diff --git a/ansible/roles/twas_cell_ihsplugin_gen_propagate_windoze_copy_hack/meta/main.yml b/ansible/roles/twas_cell_ihsplugin_gen_propagate_windoze_copy_hack/meta/main.yml new file mode 100644 index 000000000..83555b652 --- /dev/null +++ b/ansible/roles/twas_cell_ihsplugin_gen_propagate_windoze_copy_hack/meta/main.yml @@ -0,0 +1,4 @@ +--- +dependencies: + - role: twas_cell_defaults + - role: http_defaults diff --git a/ansible/roles/twas_cell_ihsplugin_gen_propagate_windoze_copy_hack/readme.md b/ansible/roles/twas_cell_ihsplugin_gen_propagate_windoze_copy_hack/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/twas_cell_ihsplugin_gen_propagate_windoze_copy_hack/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/twas_cell_ihsplugin_gen_propagate_windoze_copy_hack/tasks/main.yml b/ansible/roles/twas_cell_ihsplugin_gen_propagate_windoze_copy_hack/tasks/main.yml new file mode 100644 index 000000000..588fa5eca --- /dev/null +++ b/ansible/roles/twas_cell_ihsplugin_gen_propagate_windoze_copy_hack/tasks/main.yml @@ -0,0 +1,9 @@ +--- +- name: Windoze copy hack + ansible.builtin.include_tasks: twas_cell_ihsplugin_gen_propagate_windoze_copy_hack.yml +- name: Stop httpd + ansible.builtin.include_role: + name: apachectl_stop +- name: Start httpd + ansible.builtin.include_role: + name: apachectl_start diff --git a/ansible/roles/twas_cell_ihsplugin_gen_propagate_windoze_copy_hack/tasks/twas_cell_ihsplugin_gen_propagate_windoze_copy_hack.yml b/ansible/roles/twas_cell_ihsplugin_gen_propagate_windoze_copy_hack/tasks/twas_cell_ihsplugin_gen_propagate_windoze_copy_hack.yml new file mode 100644 index 000000000..deffc8d7b --- /dev/null +++ b/ansible/roles/twas_cell_ihsplugin_gen_propagate_windoze_copy_hack/tasks/twas_cell_ihsplugin_gen_propagate_windoze_copy_hack.yml @@ -0,0 +1,23 @@ +--- + +- name: Windoze hack due to some path issues for propogate - copy + when: ansible_system == 'Windows' or 'CYG' in ansible_system + block: + - name: Remove any previous plugin-key* files + ansible.builtin.file: + path: "{{ install_ihs_base }}/{{ plugin_dir }}/config/{{ webServerName }}/{{ item }}" + state: absent + with_items: + - plugin-key.sth + - plugin-key.kdb + - plugin-cfg.xml + + - name: Copy generated files + ansible.builtin.copy: + src: "/tmp/{{ item }}" + dest: "{{ install_ihs_base }}/{{ plugin_dir }}/config/{{ webServerName }}/{{ item }}" + mode: '0755' + with_items: + - plugin-cfg.xml + - plugin-key.sth + - plugin-key.kdb diff --git a/ansible/roles/twas_cell_ihsplugin_gen_propagate_windoze_fetch_hack/meta/main.yml b/ansible/roles/twas_cell_ihsplugin_gen_propagate_windoze_fetch_hack/meta/main.yml new file mode 100644 index 000000000..83555b652 --- /dev/null +++ b/ansible/roles/twas_cell_ihsplugin_gen_propagate_windoze_fetch_hack/meta/main.yml @@ -0,0 +1,4 @@ +--- +dependencies: + - role: twas_cell_defaults + - role: http_defaults diff --git a/ansible/roles/twas_cell_ihsplugin_gen_propagate_windoze_fetch_hack/readme.md b/ansible/roles/twas_cell_ihsplugin_gen_propagate_windoze_fetch_hack/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/twas_cell_ihsplugin_gen_propagate_windoze_fetch_hack/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/twas_cell_ihsplugin_gen_propagate_windoze_fetch_hack/tasks/main.yml b/ansible/roles/twas_cell_ihsplugin_gen_propagate_windoze_fetch_hack/tasks/main.yml new file mode 100644 index 000000000..29a89ce76 --- /dev/null +++ b/ansible/roles/twas_cell_ihsplugin_gen_propagate_windoze_fetch_hack/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Windoze fetch hack + ansible.builtin.include_tasks: twas_cell_ihsplugin_gen_propagate_windoze_fetch_hack.yml diff --git a/ansible/roles/twas_cell_ihsplugin_gen_propagate_windoze_fetch_hack/tasks/twas_cell_ihsplugin_gen_propagate_windoze_fetch_hack.yml b/ansible/roles/twas_cell_ihsplugin_gen_propagate_windoze_fetch_hack/tasks/twas_cell_ihsplugin_gen_propagate_windoze_fetch_hack.yml new file mode 100644 index 000000000..9c98be9bf --- /dev/null +++ b/ansible/roles/twas_cell_ihsplugin_gen_propagate_windoze_fetch_hack/tasks/twas_cell_ihsplugin_gen_propagate_windoze_fetch_hack.yml @@ -0,0 +1,20 @@ +--- + +- name: Windoze hack due to some path issues for propogate - fetch + when: ansible_system == 'Windows' or 'CYG' in ansible_system + block: + - name: Fetch plugin-cfg.xml + ansible.builtin.fetch: + src: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/config/cells/{{ cellName }}/nodes/{{ webNode }}/servers/{{ webServerName }}/plugin-cfg.xml" + dest: /tmp/plugin-cfg.xml + flat: yes + - name: Fetch plugin-key.sth + ansible.builtin.fetch: + src: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/config/cells/{{ cellName }}/nodes/{{ webNode }}/servers/{{ webServerName }}/plugin-key.sth" + dest: /tmp/plugin-key.sth + flat: yes + - name: Fetch plugin-key.kdb + ansible.builtin.fetch: + src: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/config/cells/{{ cellName }}/nodes/{{ webNode }}/servers/{{ webServerName }}/plugin-key.kdb" + dest: /tmp/plugin-key.kdb + flat: yes diff --git a/ansible/roles/twas_cell_ihsplugin_mod_was_hack/meta/main.yml b/ansible/roles/twas_cell_ihsplugin_mod_was_hack/meta/main.yml new file mode 100644 index 000000000..83555b652 --- /dev/null +++ b/ansible/roles/twas_cell_ihsplugin_mod_was_hack/meta/main.yml @@ -0,0 +1,4 @@ +--- +dependencies: + - role: twas_cell_defaults + - role: http_defaults diff --git a/ansible/roles/twas_cell_ihsplugin_mod_was_hack/readme.md b/ansible/roles/twas_cell_ihsplugin_mod_was_hack/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/twas_cell_ihsplugin_mod_was_hack/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/twas_cell_ihsplugin_mod_was_hack/tasks/main.yml b/ansible/roles/twas_cell_ihsplugin_mod_was_hack/tasks/main.yml new file mode 100644 index 000000000..cf2f26222 --- /dev/null +++ b/ansible/roles/twas_cell_ihsplugin_mod_was_hack/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Windoze copy hack + ansible.builtin.include_tasks: twas_cell_ihsplugin_mod_was_hack.yml diff --git a/ansible/roles/twas_cell_ihsplugin_mod_was_hack/tasks/twas_cell_ihsplugin_mod_was_hack.yml b/ansible/roles/twas_cell_ihsplugin_mod_was_hack/tasks/twas_cell_ihsplugin_mod_was_hack.yml new file mode 100644 index 000000000..e6969d0d4 --- /dev/null +++ b/ansible/roles/twas_cell_ihsplugin_mod_was_hack/tasks/twas_cell_ihsplugin_mod_was_hack.yml @@ -0,0 +1,14 @@ +--- + +- name: Windoze hack due to some path issues for propogate - copy + when: ansible_system == 'Windows' or 'CYG' in ansible_system + block: + # the wct configure plugin on windoze pretends to work , but actually fails, most likely due to path issues + # manually configure the httpd.conf with: + - name: Insert/Update windoze WebSpherePluginConfig hack + ansible.builtin.blockinfile: + path: "{{ install_ihs_base }}/{{ http_dir }}/conf/httpd.conf" + marker: "# {mark} WebSpherePluginConfig ANSIBLE MANAGED BLOCK" + block: | + LoadModule was_{{ mod_was }}_module {{ cygwin }}{{ install_ihs_base }}/{{ plugin_dir }}/bin/{{ dll_bits }}/mod_was_{{ mod_was }}_http.dll + WebSpherePluginConfig {{ cygwin }}{{ install_ihs_base }}/{{ plugin_dir }}/config/{{ webServerName }}/plugin-cfg.xml diff --git a/ansible/roles/twas_cell_kill/tasks/twas_cell_kill.yml b/ansible/roles/twas_cell_kill/tasks/twas_cell_kill.yml index e40ded00b..15078ad9c 100644 --- a/ansible/roles/twas_cell_kill/tasks/twas_cell_kill.yml +++ b/ansible/roles/twas_cell_kill/tasks/twas_cell_kill.yml @@ -1,22 +1,32 @@ --- +- name: Unix kill operations + when: ansible_system is not search('CYG') + block: + - name: Get running processes + ansible.builtin.shell: "ps -ef | grep -v grep | grep -w '{{install_base }}/{{ twas_dir }}' | awk '{print $2}'" + register: running_processes -- name: Get running processes - shell: "ps -ef | grep -v grep | grep -w '{{install_base }}/{{ twas_dir }}' | awk '{print $2}'" - register: running_processes + - name: Kill running processes + ansible.builtin.shell: "kill {{ item }}" + with_items: "{{ running_processes.stdout_lines }}" -- name: Kill running processes - shell: "kill {{ item }}" - with_items: "{{ running_processes.stdout_lines }}" - -- wait_for: - path: "/proc/{{ item }}/status" - state: absent - with_items: "{{ running_processes.stdout_lines }}" - ignore_errors: yes - register: killed_processes - -- name: Force kill stuck processes - shell: "kill -9 {{ item }}" - with_items: "{{ killed_processes.results | select('failed') | map(attribute='item') | list }}" + - wait_for: + path: "/proc/{{ item }}/status" + state: absent + with_items: "{{ running_processes.stdout_lines }}" + ignore_errors: true + register: killed_processes + - name: Force kill stuck processes + ansible.builtin.shell: "kill -9 {{ item }}" + with_items: "{{ killed_processes.results | select('failed') | map(attribute='item') | list }}" +- name: Windoze kill operations + when: ansible_system == 'Windows' or 'CYG' in ansible_system + block: + - name: Blindly try kill ( windoze ) + ignore_errors: true + ansible.builtin.shell: "ps -W|grep java|awk '{print $1}'|xargs kill -f" + register: killOutput + failed_when: ( killOutput.rc not in [ 0, 123 ] ) + changed_when: false diff --git a/ansible/roles/twas_cell_local_logs_remove/defaults/main.yml b/ansible/roles/twas_cell_local_logs_remove/defaults/main.yml new file mode 100644 index 000000000..5e2bcec04 --- /dev/null +++ b/ansible/roles/twas_cell_local_logs_remove/defaults/main.yml @@ -0,0 +1,2 @@ +--- +logs_dir: "{{ playbook_dir }}" # location on the ansible controller diff --git a/ansible/roles/twas_cell_local_logs_remove/meta/main.yml b/ansible/roles/twas_cell_local_logs_remove/meta/main.yml new file mode 100644 index 000000000..1397bfd39 --- /dev/null +++ b/ansible/roles/twas_cell_local_logs_remove/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: twas_cell_defaults diff --git a/ansible/roles/twas_cell_local_logs_remove/readme.md b/ansible/roles/twas_cell_local_logs_remove/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/twas_cell_local_logs_remove/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/twas_cell_local_logs_remove/tasks/main.yml b/ansible/roles/twas_cell_local_logs_remove/tasks/main.yml new file mode 100644 index 000000000..145cb52b5 --- /dev/null +++ b/ansible/roles/twas_cell_local_logs_remove/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Remove the local logs dir + include_tasks: twas_cell_local_logs_remove.yml \ No newline at end of file diff --git a/ansible/roles/twas_cell_local_logs_remove/tasks/twas_cell_local_logs_remove.yml b/ansible/roles/twas_cell_local_logs_remove/tasks/twas_cell_local_logs_remove.yml new file mode 100644 index 000000000..e5830560f --- /dev/null +++ b/ansible/roles/twas_cell_local_logs_remove/tasks/twas_cell_local_logs_remove.yml @@ -0,0 +1,14 @@ +--- + +- name: Clear local logs directory + delegate_to: localhost + ansible.builtin.file: + path: "{{ logs_dir }}/{{ env_name }}" + state: absent + +- name: Create local logs directory + delegate_to: localhost + ansible.builtin.file: + path: "{{ logs_dir }}/{{ env_name }}" + state: directory + mode: '0755' diff --git a/ansible/roles/twas_cell_more_gasnet/defaults/main.yml b/ansible/roles/twas_cell_more_gasnet/defaults/main.yml new file mode 100644 index 000000000..5d0aea9bf --- /dev/null +++ b/ansible/roles/twas_cell_more_gasnet/defaults/main.yml @@ -0,0 +1,10 @@ +--- +# Default variables for WebSphere administration + +DefaultAppName: 'GasNet_ATM_Module' +DefaultAppFile: '{{ DefaultAppName }}.war' + +# DB2 connection settings +db2_jdbc_path: "${WAS_INSTALL_ROOT}/db2jars/" + +MLSClusterName: 'MLSCluster1' \ No newline at end of file diff --git a/ansible/roles/twas_cell_more_gasnet/meta/main.yml b/ansible/roles/twas_cell_more_gasnet/meta/main.yml new file mode 100644 index 000000000..de740f747 --- /dev/null +++ b/ansible/roles/twas_cell_more_gasnet/meta/main.yml @@ -0,0 +1,6 @@ +--- +dependencies: + - role: twas_cell_defaults + - role: http_defaults + - role: twas_cell_common_daytrader + - role: load_secrets diff --git a/ansible/roles/twas_cell_more_gasnet/tasks/main.yml b/ansible/roles/twas_cell_more_gasnet/tasks/main.yml new file mode 100644 index 000000000..7a9d4dc3b --- /dev/null +++ b/ansible/roles/twas_cell_more_gasnet/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Install tWAS MoRE GasNet application + ansible.builtin.include_tasks: twas_cell_more_gasnet.yml diff --git a/ansible/roles/twas_cell_more_gasnet/tasks/twas_cell_more_gasnet.yml b/ansible/roles/twas_cell_more_gasnet/tasks/twas_cell_more_gasnet.yml new file mode 100644 index 000000000..613802170 --- /dev/null +++ b/ansible/roles/twas_cell_more_gasnet/tasks/twas_cell_more_gasnet.yml @@ -0,0 +1,62 @@ +--- +# Tasks for WebSphere administration + +- name: Generate DB2 datasource script from template + ansible.builtin.template: + src: gasnet_datasource.py.j2 + dest: "gasnet_datasource.py" + mode: '0755' + +- name: Run wsadmin script to create DB2 datasource + ansible.builtin.command: + cmd: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin{{ ext }} -lang jython -f gasnet_datasource.py -username {{ twas_username }} -password {{ twas_password }}" + register: wsadmin_result + changed_when: "'WASX7209I: Connected to process' in wsadmin_result.stderr" + failed_when: wsadmin_result.rc != 0 + +- name: Display wsadmin output + ansible.builtin.debug: + var: wsadmin_result.stdout_lines + +# MLS Cluster creation tasks +- name: Generate MLS cluster script from template + ansible.builtin.template: + src: create_mls_cluster.py.j2 + dest: "create_mls_cluster.py" + mode: '0755' + +- name: Run wsadmin script to create MLS cluster + ansible.builtin.command: + cmd: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin{{ ext }} -lang jython -f create_mls_cluster.py -username {{ twas_username }} -password {{ twas_password }}" + register: mls_cluster_result + changed_when: "'WASX7209I: Connected to process' in mls_cluster_result.stderr" + failed_when: mls_cluster_result.rc != 0 + +- name: Display MLS cluster creation output + ansible.builtin.debug: + var: mls_cluster_result.stdout_lines + +# Made with Bob + +# GasNet_ATM_Module deployment tasks +- name: Generate GasNet_ATM_Module installation script from template + ansible.builtin.template: + src: install_gnatm.py.j2 + dest: "install_gnatm.py" + mode: '0755' + +- name: Copy GasNet app + ansible.builtin.copy: + src: "{{ DefaultAppFile }}" + dest: "{{ DefaultAppFile }}" + +- name: Run wsadmin script to deploy GasNet_ATM_Module + ansible.builtin.command: + cmd: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin{{ ext }} -lang jython -f install_gnatm.py -username {{ twas_username }} -password {{ twas_password }}" + register: gnatm_result + changed_when: "'WASX7209I: Connected to process' in gnatm_result.stderr" + failed_when: gnatm_result.rc != 0 + +- name: Display GasNet_ATM_Module deployment output + ansible.builtin.debug: + var: gnatm_result.stdout_lines diff --git a/ansible/roles/twas_cell_more_gasnet/templates/create_mls_cluster.py.j2 b/ansible/roles/twas_cell_more_gasnet/templates/create_mls_cluster.py.j2 new file mode 100644 index 000000000..07c47bd4d --- /dev/null +++ b/ansible/roles/twas_cell_more_gasnet/templates/create_mls_cluster.py.j2 @@ -0,0 +1,13 @@ +# +# Create MLS cluster +# +import time + +print ("Creating cluster {{ MLSClusterName }}") +AdminTask.createCluster(['-clusterConfig', ['-clusterName', '{{ MLSClusterName }}', '-clusterType', 'MANAGED_LIBERTY_SERVER']]) +print ("finished createCluster") +AdminTask.createClusterMember(['-clusterName', '{{ MLSClusterName }}', '-memberConfig', ['-memberNode', 'node1', '-memberName', 'libertyServer']]) +print ("finished createClusterMember for node1") +AdminTask.createClusterMember(['-clusterName', '{{ MLSClusterName }}', '-memberConfig', ['-memberNode', 'node2', '-memberName', 'libertyServer']]) +print ("finished createClusterMember for node2") +AdminConfig.save() diff --git a/ansible/roles/twas_cell_more_gasnet/templates/gasnet_datasource.py.j2 b/ansible/roles/twas_cell_more_gasnet/templates/gasnet_datasource.py.j2 new file mode 100644 index 000000000..20c627554 --- /dev/null +++ b/ansible/roles/twas_cell_more_gasnet/templates/gasnet_datasource.py.j2 @@ -0,0 +1,10 @@ +myDB2Alias=AdminTask.createAuthDataEntry('[-alias db2Alias -user {{ db_user }} -password {{ db_pass }} -description db2Alias]') +print (myDB2Alias) +myJDBC=AdminTask.createJDBCProvider('[-scope Cell={{ cellName }} -databaseType DB2 -providerType "DB2 Universal JDBC Driver Provider" -implementationType "XA data source" -name DB2_Universal_JDBC_Driver_Provider_XA -description DB2_Universal_JDBC_Driver_Provider_XA -classpath [{{ db2_jdbc_path }}/db2jcc4.jar] -nativePath [${DB2UNIVERSAL_JDBC_DRIVER_NATIVEPATH}] ]') +print (myJDBC) +myDS=AdminTask.createDatasource(myJDBC, '[-name StationSecureDS -jndiName jdbc/StationSecureDS -dataStoreHelperClassName com.ibm.websphere.rsadapter.DB2UniversalDataStoreHelper -containerManagedPersistence false -componentManagedAuthenticationAlias dmgr/db2Alias -xaRecoveryAuthAlias dmgr/db2Alias -configureResourceProperties [[databaseName java.lang.String STSECDB] [driverType java.lang.Integer 4] [serverName java.lang.String {{ gn_db_host }}] [portNumber java.lang.Integer {{ gn_db_port }}]]]') +print (myDS) +myMappingModule=AdminConfig.create('MappingModule', myDS, '[[authDataAlias dmgr/db2Alias] [mappingConfigAlias DefaultPrincipalMapping]]') +print (myMappingModule) + +AdminConfig.save() \ No newline at end of file diff --git a/ansible/roles/twas_cell_more_gasnet/templates/install_gnatm.py.j2 b/ansible/roles/twas_cell_more_gasnet/templates/install_gnatm.py.j2 new file mode 100644 index 000000000..9d9bafb0f --- /dev/null +++ b/ansible/roles/twas_cell_more_gasnet/templates/install_gnatm.py.j2 @@ -0,0 +1,9 @@ +# +# Deploy GasNet_ATM_Module ee10 on MLSCluster1 +# +# Usage: wsadmin.sh -f install_gnatm.py +import time + +print ("Installing app: GasNet_ATM_Module") +AdminApp.install('{{ DefaultAppFile}}', '[ -distributeApp -useMetaDataFromBinary -appname GasNet_ATM_Module_war -validateinstall warn -nouseAutoLink -novalidateSchema -contextroot GasNet_ATM_Module -MapResRefToEJB [[ GasNet_ATM_Module "" GasNet_ATM_Module.war,WEB-INF/web.xml jdbc/StationSecureDS javax.sql.DataSource "jdbc/StationSecureDS " "" "" "" ]] -MapModulesToServers [[ GasNet_ATM_Module GasNet_ATM_Module.war,WEB-INF/web.xml WebSphere:cell={{ cellName }},cluster={{ MLSClusterName }}+WebSphere:cell={{ cellName }},node={{ webNode }},server={{ webServerName }} ]] -MapWebModToVH [[ GasNet_ATM_Module GasNet_ATM_Module.war,WEB-INF/web.xml default_host ]]]' ) +AdminConfig.save() diff --git a/ansible/roles/twas_cell_product_version_level/meta/main.yml b/ansible/roles/twas_cell_product_version_level/meta/main.yml new file mode 100644 index 000000000..83555b652 --- /dev/null +++ b/ansible/roles/twas_cell_product_version_level/meta/main.yml @@ -0,0 +1,4 @@ +--- +dependencies: + - role: twas_cell_defaults + - role: http_defaults diff --git a/ansible/roles/twas_cell_product_version_level/readme.md b/ansible/roles/twas_cell_product_version_level/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/twas_cell_product_version_level/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/twas_cell_product_version_level/tasks/main.yml b/ansible/roles/twas_cell_product_version_level/tasks/main.yml new file mode 100644 index 000000000..3f11fb3a7 --- /dev/null +++ b/ansible/roles/twas_cell_product_version_level/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Parse the tWAS xx.product + ansible.builtin.include_tasks: twas_cell_product_version_level.yml diff --git a/ansible/roles/twas_cell_product_version_level/tasks/twas_cell_product_version_level.yml b/ansible/roles/twas_cell_product_version_level/tasks/twas_cell_product_version_level.yml new file mode 100644 index 000000000..3a98c3460 --- /dev/null +++ b/ansible/roles/twas_cell_product_version_level/tasks/twas_cell_product_version_level.yml @@ -0,0 +1,77 @@ +--- +- name: Check if tWAS properties/version/XXX.product + ansible.builtin.stat: + path: "{{ install_base }}/{{ target_dir }}/properties/version/{{ twas_product }}.product" + register: isproduct + +- name: Is tWAS properties/version/XXX.product + when: isproduct.stat.exists + block: + + - name: Create target output dir + delegate_to: localhost + ansible.builtin.file: + path: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}" + state: directory + mode: '0755' + + - name: Fetch properties/version/XXX.product + ansible.builtin.fetch: + src: "{{ install_base }}/{{ target_dir }}/properties/version/{{ twas_product }}.product" + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ twas_product }}.product" + flat: true + + - name: Read the product name from properties/version/XXX.product + delegate_to: localhost + community.general.xml: + path: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ twas_product }}.product" + xpath: /product + content: attribute + register: product + + - name: Set twas_Product fact + ansible.builtin.set_fact: + twas_Product: "{{ product.matches[0]['product']['name'] }}" + + - name: Print twas_Product debug + ansible.builtin.debug: + var: "{{ twas_Product }}" + + - name: Read the product version from properties/version/XXX.product + delegate_to: localhost + community.general.xml: + path: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ twas_product }}.product" + xpath: /product/version + content: text + register: version + + - name: Set twas_Version fact + ansible.builtin.set_fact: + twas_Version: '{{ version.matches[0]["version"] }}' + + - name: Print twas_Version debug + ansible.builtin.debug: + var: "{{ twas_Version }}" + + - name: Read the level from properties/version/XXX.product + delegate_to: localhost + community.general.xml: + path: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ twas_product }}.product" + xpath: /product/build-info + content: attribute + register: product_level + + - name: Set twas_Build_Level fact + ansible.builtin.set_fact: + twas_Build_Level: '{{ product_level.matches[0]["build-info"]["level"] }}' + + - name: Print twas_Build_Level debug + ansible.builtin.debug: + var: "{{ twas_Build_Level }}" + + - name: Write tWAS prooduct version_level to staging json file + delegate_to: localhost + ansible.builtin.template: + src: version_level.json.j2 + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ staging_json_file }}" + mode: '0444' diff --git a/ansible/roles/twas_cell_product_version_level/templates/version_level.json.j2 b/ansible/roles/twas_cell_product_version_level/templates/version_level.json.j2 new file mode 100644 index 000000000..91ccf61c9 --- /dev/null +++ b/ansible/roles/twas_cell_product_version_level/templates/version_level.json.j2 @@ -0,0 +1,10 @@ +{ + "{{ ansible_fqdn }}": + [ + { + "Product": "{{ twas_Product }}", + "Version": "{{ twas_Version }}", + "Build_Level": "{{ twas_Build_Level }}" + } + ] +} diff --git a/ansible/roles/twas_cell_profiles/tasks/twas_cell_profiles.yml b/ansible/roles/twas_cell_profiles/tasks/twas_cell_profiles.yml index dabdeac9f..b015e3f38 100644 --- a/ansible/roles/twas_cell_profiles/tasks/twas_cell_profiles.yml +++ b/ansible/roles/twas_cell_profiles/tasks/twas_cell_profiles.yml @@ -1,58 +1,39 @@ --- - -# blindly try fuser ( linux ) -- name: blindly try fuser ( linux ) +- name: Blindly try fuser ( linux ) ignore_errors: true - shell: "fuser -k {{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}" + ansible.builtin.shell: "fuser -k {{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}" register: killOutput failed_when: ( killOutput.rc not in [ 0, 1, 2, 127 ] ) -#[nest@oscert-twas855-dmgr ~]$ was/bin/manageprofiles.sh -listProfiles -#[dmgr] -#[nest@oscert-twas855-dmgr ~]$ was/bin/manageprofiles.sh -getName -profilePath /home/nest/was/profiles/dmgr -#dmgr -#if no profile -#[nest@oscert-twas855-dmgr ~]$ was/bin/manageprofiles.sh -getName -profilePath /home/nest/was/profiles/dmgr1 -#Cannot retrieve the profile name: The profile registry might be corrupt or the profile might not exist. For more information, consult /home/nest/was/logs/manageprofiles/getName.log. -#[nest@oscert-twas855-dmgr ~]$ echo $? -#1 - -- name: list current profile +- name: List current profile ignore_errors: true - shell: "{{install_base }}/{{ twas_dir }}/bin/manageprofiles.sh -getName -profilePath {{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}" + ansible.builtin.shell: "{{install_base }}/{{ twas_dir }}/bin/manageprofiles{{ ext }} -getName -profilePath {{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}" register: listProfile failed_when: ( listProfile.rc not in [ 0, 1, 2 ] ) -- name: listProfileOutput - debug: - msg: "{{ listProfile.stdout_lines }}" - -#[nest@oscert-twas855-dmgr ~]$ was/bin/manageprofiles.sh -delete -profileName dmgr -#INSTCONFPARTIALSUCCESS: The profile no longer exists, but errors occurred. For more information, consult /home/nest/was/logs/manageprofiles/dmgr_delete.log. -#[nest@oscert-twas855-dmgr ~]$ echo $? -#2 +- name: ListProfileOutput + ansible.builtin.debug: + msg: "{{ listProfile.stdout_lines }}" -- name: delete current profile +- name: Delete current profile when: ( listProfile.rc in [ 0 ] ) ignore_errors: true - shell: "{{install_base }}/{{ twas_dir }}/bin/manageprofiles.sh -delete -profileName {{ profile_name }}" + ansible.builtin.shell: "{{install_base }}/{{ twas_dir }}/bin/manageprofiles{{ ext }} -delete -profileName {{ profile_name }}" register: deleteProfile failed_when: ( deleteProfile.rc not in [ 0, 1, 2 ] ) - name: Remove previous twas profile dir - file: + ansible.builtin.file: path: "{{ item }}" state: absent with_items: - - "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}" + - "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}" - name: create profile - shell: "{{ install_base }}/{{ twas_dir }}/bin/manageprofiles.sh -create -profileName {{ profile_name }} -profilePath {{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }} -templatePath {{ profile_templatePath[profile_type] }} -cellName {{ cellName }} -nodeName {{ profile_name }} -omitAction" + ansible.builtin.shell: "{{ install_base }}/{{ twas_dir }}/bin/manageprofiles{{ ext }} -create -profileName {{ profile_name }} -templatePath {{ profile_type }} -cellName {{ cellName }} -nodeName {{ profile_name }} -omitAction" register: createProfile failed_when: ( createProfile.rc not in [ 0, 1, 2 ] ) - name: createProfile - debug: - msg: "{{ createProfile.stdout_lines }}" - - + ansible.builtin.debug: + msg: "{{ createProfile.stdout_lines }}" diff --git a/ansible/roles/twas_cell_put_db2jars/tasks/twas_cell_put_db2jars.yml b/ansible/roles/twas_cell_put_db2jars/tasks/twas_cell_put_db2jars.yml index d476a70a7..968fb81c6 100644 --- a/ansible/roles/twas_cell_put_db2jars/tasks/twas_cell_put_db2jars.yml +++ b/ansible/roles/twas_cell_put_db2jars/tasks/twas_cell_put_db2jars.yml @@ -13,8 +13,3 @@ src: /tmp/db2jcc4.jar dest: "{{install_base }}/{{ twas_dir }}/db2jars/db2jcc4.jar" mode: '0755' -- name: copy db2jcc_license_cu.jar ${WAS_INSTALL_ROOT}/db2jars - copy: - src: /tmp/db2jcc_license_cu.jar - dest: "{{install_base }}/{{ twas_dir }}/db2jars/db2jcc_license_cu.jar" - mode: '0755' diff --git a/ansible/roles/twas_cell_start_cluster/files/twas_cell_start_cluster.py b/ansible/roles/twas_cell_start_cluster/files/twas_cell_start_cluster.py index 08c625b52..b86d4261f 100644 --- a/ansible/roles/twas_cell_start_cluster/files/twas_cell_start_cluster.py +++ b/ansible/roles/twas_cell_start_cluster/files/twas_cell_start_cluster.py @@ -28,7 +28,7 @@ def printUsageAndExit ( ): print ("Scope: "+scope) if (scope == "cluster"): clusterNamesList.append(sys.argv[1]) - print ("Cluster: "+clusterNamesList[0]) + print ("Cluster: "+clusterNamesList[0]) if ( len(sys.argv) == 3 ): clusterNamesList.append(sys.argv[2]) print ("Cluster: "+clusterNamesList[1]) diff --git a/ansible/roles/twas_cell_start_cluster/tasks/twas_cell_start_cluster.yml b/ansible/roles/twas_cell_start_cluster/tasks/twas_cell_start_cluster.yml index 5bd20cf36..02e6d7444 100644 --- a/ansible/roles/twas_cell_start_cluster/tasks/twas_cell_start_cluster.yml +++ b/ansible/roles/twas_cell_start_cluster/tasks/twas_cell_start_cluster.yml @@ -6,10 +6,12 @@ dest: "~/twas_cell_start_cluster.py" - name: run the twas_cell_start_cluster.py script - shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin.sh -lang jython -username {{ twas_username }} -password {{ twas_password }} -f twas_cell_start_cluster.py cluster {{ clusterName }}" + shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin{{ ext }} -lang jython -username {{ twas_username }} -password {{ twas_password }} -f twas_cell_start_cluster.py cluster {{ clusterName }}" register: startClusterOutput failed_when: ( startClusterOutput.rc not in [ 0, 255 ] ) -- name: startClusterOutput - debug: - msg: "{{ startClusterOutput.stdout_lines }}" +- name: startClusterOutput check for errors + ansible.builtin.debug: + msg: "{{ startClusterOutput.stdout_lines }}" + failed_when: + - '"ADMN0022E" in startClusterOutput.stdout' diff --git a/ansible/roles/twas_cell_start_dmgr/tasks/twas_cell_start_dmgr.yml b/ansible/roles/twas_cell_start_dmgr/tasks/twas_cell_start_dmgr.yml index 0ff21b3d5..050ef4f4e 100644 --- a/ansible/roles/twas_cell_start_dmgr/tasks/twas_cell_start_dmgr.yml +++ b/ansible/roles/twas_cell_start_dmgr/tasks/twas_cell_start_dmgr.yml @@ -1,12 +1,23 @@ --- -- name: dmgr +- name: Start the stopped dmgr when: profile_type == 'dmgr' block: - - name: start the dmgr - shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/startManager.sh" - register: startManagerOutput - failed_when: ( startManagerOutput.rc not in [ 0, 255 ] ) - - name: startManagerOutput - debug: - msg: "{{ startManagerOutput.stdout_lines }}" + - name: Check the dmgr status + ansible.builtin.shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/serverStatus{{ ext }} dmgr -username {{ twas_username }} -password {{ twas_password }}" + register: statusDmgroutput + failed_when: ( statusDmgroutput.rc not in [ 0, 246, 255 ] ) + + - name: Start the stopped dmgr + when: '"STARTED" not in statusDmgroutput.stdout' + block: + - name: Start the dmgr + shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/startManager{{ ext }}" + register: startManagerOutput + failed_when: ( startManagerOutput.rc not in [ 0, 255 ] ) + - name: StartManagerOutput check for errors + ansible.builtin.debug: + msg: "{{ startManagerOutput.stdout_lines }}" + failed_when: + - '" Error " in startManagerOutput.stdout' + diff --git a/ansible/roles/twas_cell_start_node/tasks/twas_cell_start_node.yml b/ansible/roles/twas_cell_start_node/tasks/twas_cell_start_node.yml index b2c7999bf..dd13482c9 100644 --- a/ansible/roles/twas_cell_start_node/tasks/twas_cell_start_node.yml +++ b/ansible/roles/twas_cell_start_node/tasks/twas_cell_start_node.yml @@ -1,12 +1,22 @@ --- -- name: start node +- name: Start the stopped nodeagent when: profile_type == 'managed' block: - - name: start the node - shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/startNode.sh" - register: startNodeOutput - failed_when: ( startNodeOutput.rc not in [ 0, 255 ] ) - - name: startNodeOutput - debug: - msg: "{{ startNodeOutput.stdout_lines }}" + - name: Check the nodeagent status + ansible.builtin.shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/serverStatus{{ ext }} nodeagent -username {{ twas_username }} -password {{ twas_password }}" + register: statusNodeOutput + failed_when: ( statusNodeOutput.rc not in [ 0, 246, 255 ] ) + + - name: Start the stopped nodeagent + when: '"STARTED" not in statusNodeOutput.stdout' + block: + - name: start the node + shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/startNode{{ ext }}" + register: startNodeOutput + failed_when: ( startNodeOutput.rc not in [ 0, 255 ] ) + - name: startNodeOutput + debug: + msg: "{{ startNodeOutput.stdout_lines }}" + failed_when: + - '" Error " in startNodeOutput.stdout' diff --git a/ansible/roles/twas_cell_status/tasks/twas_cell_status.yml b/ansible/roles/twas_cell_status/tasks/twas_cell_status.yml index 7e2314ac0..533607e4a 100644 --- a/ansible/roles/twas_cell_status/tasks/twas_cell_status.yml +++ b/ansible/roles/twas_cell_status/tasks/twas_cell_status.yml @@ -2,12 +2,12 @@ - name: twas version and status shell: | - [ -f {{ install_base }}/{{ twas_dir }}/bin/versionInfo.sh ] && {{ install_base }}/{{ twas_dir }}/bin/versionInfo.sh || true - [ -f {{ install_base }}/{{ http_dir }}/bin/versionInfo.sh ] && {{ install_base }}/{{ http_dir }}/bin/versionInfo.sh || true - [ -f {{ install_base }}/{{ plugin_dir }}/bin/versionInfo.sh ] && {{ install_base }}/{{ plugin_dir }}/bin/versionInfo.sh || true - [ -f {{ install_base }}/{{ wct_dir }}/bin/versionInfo.sh ] && {{ install_base }}/{{ wct_dir }}/bin/versionInfo.sh || true - [ -f {{ install_base }}/{{ app_dir }}/bin/versionInfo.sh ] && {{ install_base }}/{{ app_dir }}/bin/versionInfo.sh || true - [ -f {{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/serverStatus.sh ] && {{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/serverStatus.sh -all -username {{ twas_username }} -password {{ twas_password }} || true + [ -f {{ install_base }}/{{ twas_dir }}/bin/versionInfo{{ ext }} ] && {{ install_base }}/{{ twas_dir }}/bin/versionInfo{{ ext }} -ifixDetail || true + [ -f {{ install_base }}/{{ http_dir }}/bin/versionInfo{{ ext }} ] && {{ install_base }}/{{ http_dir }}/bin/versionInfo{{ ext }} -ifixDetail || true + [ -f {{ install_base }}/{{ plugin_dir }}/bin/versionInfo{{ ext }} ] && {{ install_base }}/{{ plugin_dir }}/bin/versionInfo{{ ext }} -ifixDetail || true + [ -f {{ install_base }}/{{ wct_dir }}/bin/versionInfo{{ ext }} ] && {{ install_base }}/{{ wct_dir }}/bin/versionInfo{{ ext }} -ifixDetail || true + [ -f {{ install_base }}/{{ app_dir }}/bin/versionInfo{{ ext }} ] && {{ install_base }}/{{ app_dir }}/bin/versionInfo{{ ext }} -ifixDetail || true + [ -f {{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/serverStatus{{ ext }} ] && {{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/serverStatus{{ ext }} -all -username {{ twas_username }} -password {{ twas_password }} || true register: twasstatus - name: twasstatus diff --git a/ansible/roles/twas_cell_stop_cluster/tasks/twas_cell_stop_cluster.yml b/ansible/roles/twas_cell_stop_cluster/tasks/twas_cell_stop_cluster.yml index 219c1eae3..483f82d2f 100644 --- a/ansible/roles/twas_cell_stop_cluster/tasks/twas_cell_stop_cluster.yml +++ b/ansible/roles/twas_cell_stop_cluster/tasks/twas_cell_stop_cluster.yml @@ -6,7 +6,7 @@ dest: "~/twas_cell_stop_cluster.py" - name: run the twas_cell_stop_cluster.py script - shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin.sh -lang jython -username {{ twas_username }} -password {{ twas_password }} -f twas_cell_stop_cluster.py cluster {{ clusterName }}" + shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin{{ ext }} -lang jython -username {{ twas_username }} -password {{ twas_password }} -f twas_cell_stop_cluster.py cluster {{ clusterName }}" register: stopClusterOutput failed_when: ( stopClusterOutput.rc not in [ 0, 255 ] ) - name: stopClusterOutput diff --git a/ansible/roles/twas_cell_stop_dmgr/tasks/twas_cell_stop_dmgr.yml b/ansible/roles/twas_cell_stop_dmgr/tasks/twas_cell_stop_dmgr.yml index 0b43a9e68..faeb52283 100644 --- a/ansible/roles/twas_cell_stop_dmgr/tasks/twas_cell_stop_dmgr.yml +++ b/ansible/roles/twas_cell_stop_dmgr/tasks/twas_cell_stop_dmgr.yml @@ -1,12 +1,32 @@ --- -- name: dmgr +- name: Stop the running dmgr when: profile_type == 'dmgr' block: - - name: stop the dmgr - shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/stopManager.sh -username {{ twas_username }} -password {{ twas_password }}" - register: stopManagerOutput - failed_when: ( stopManagerOutput.rc not in [ 0, 255 ] ) - - name: stopManagerOutput - debug: - msg: "{{ stopManagerOutput.stdout_lines }}" + - name: Retrieve signers + shell: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/retrieveSigners{{ ext }} {{ cell_trust }} ClientDefaultTrustStore -autoAcceptBootstrapSigner -username {{ twas_username }} -password {{ twas_password }}" + register: retrieveSignersOutput + failed_when: ( retrieveSignersOutput.rc not in [ 0, 3 ] ) + - name: RetrieveSignersOutput + debug: + msg: "{{ retrieveSignersOutput.stdout_lines }}" + + - name: Check the dmgr status + ansible.builtin.shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/serverStatus{{ ext }} dmgr -username {{ twas_username }} -password {{ twas_password }}" + register: statusDmgroutput + failed_when: ( statusDmgroutput.rc not in [ 0, 246, 255 ] ) + + - name: Stop the started dmgr + when: '"STARTED" in statusDmgroutput.stdout' + block: + - name: Stop the dmgr + shell: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/stopManager{{ ext }} -username {{ twas_username }} -password {{ twas_password }}" + register: stopManagerOutput + failed_when: ( stopManagerOutput.rc not in [ 0, 246, 255 ] ) + timeout: 300 + + - name: stopManagerOutput + debug: + msg: "{{ stopManagerOutput.stdout_lines }}" + failed_when: + - '" Error " in stopManagerOutput.stdout' diff --git a/ansible/roles/twas_cell_stop_node/tasks/twas_cell_stop_node.yml b/ansible/roles/twas_cell_stop_node/tasks/twas_cell_stop_node.yml index 6585919b5..735ff9968 100644 --- a/ansible/roles/twas_cell_stop_node/tasks/twas_cell_stop_node.yml +++ b/ansible/roles/twas_cell_stop_node/tasks/twas_cell_stop_node.yml @@ -1,12 +1,32 @@ --- -- name: stop node - when: profile_type == 'managed' +- name: Stop node + when: profile_type == 'managed' or profile_type == 'default' block: - - name: stop the node - shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/stopNode.sh -username {{ twas_username }} -password {{ twas_password }}" - register: stopNodeOutput - failed_when: ( stopNodeOutput.rc not in [ 0, 255 ] ) - - name: stopNodeOutput - debug: - msg: "{{ stopNodeOutput.stdout_lines }}" + - name: retrieve signers + shell: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/retrieveSigners{{ ext }} {{ cell_trust }} ClientDefaultTrustStore -autoAcceptBootstrapSigner -username {{ twas_username }} -password {{ twas_password }}" + register: retrieveSignersOutput + failed_when: ( retrieveSignersOutput.rc not in [ 0, 3 ] ) + + - name: retrieveSignersOutput + debug: + msg: "{{ retrieveSignersOutput.stdout_lines }}" + + - name: Check the nodeagent status + ansible.builtin.shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/serverStatus{{ ext }} nodeagent -username {{ twas_username }} -password {{ twas_password }}" + register: statusNodeOutput + failed_when: ( statusNodeOutput.rc not in [ 0, 246, 255 ] ) + + - name: Stop the running nodeagent + when: '"STARTED" in statusNodeOutput.stdout' + block: + - name: stop the node + ansible.builtin.shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/stopNode{{ ext }} -username {{ twas_username }} -password {{ twas_password }}" + register: stopNodeOutput + failed_when: ( stopNodeOutput.rc not in [ 0, 246, 255 ] ) + - name: stopNodeOutput + ansible.builtin.debug: + msg: "{{ stopNodeOutput.stdout_lines }}" + failed_when: + - '" Error " in stopNodeOutput.stdout' + diff --git a/ansible/roles/twas_cell_test_ldap/tasks/twas_cell_test_ldap.yml b/ansible/roles/twas_cell_test_ldap/tasks/twas_cell_test_ldap.yml index e41bcde86..9266b47cb 100644 --- a/ansible/roles/twas_cell_test_ldap/tasks/twas_cell_test_ldap.yml +++ b/ansible/roles/twas_cell_test_ldap/tasks/twas_cell_test_ldap.yml @@ -1,11 +1,20 @@ --- +- name: Does command timeout exist? set it not aix + when: ansible_architecture != 'chrp' + ansible.builtin.set_fact: + timeout_cmd: 'timeout 2' + +- name: Does command timeout exist? dont set it aix + when: ansible_architecture == 'chrp' + ansible.builtin.set_fact: + timeout_cmd: '' - name: test ldap connectivity - shell: 'timeout 2 openssl s_client -connect {{ ldapServer }}:{{ ldapPort }} -tls1_2' + ansible.builtin.shell: '{{ timeout_cmd }} openssl s_client -connect {{ ldapServer }}:{{ ldapPort }} -tls1_2' register: ldapOutput failed_when: ( ldapOutput.rc not in [ 1 ] ) - name: ping ldapOutput - debug: + ansible.builtin.debug: msg: "{{ ldapOutput.stdout_lines }}" failed_when: '"CONNECTED" not in ldapOutput.stdout' diff --git a/ansible/roles/twas_cell_tuning/tasks/twas_cell_tuning.yml b/ansible/roles/twas_cell_tuning/tasks/twas_cell_tuning.yml index d0331563a..c8723482e 100644 --- a/ansible/roles/twas_cell_tuning/tasks/twas_cell_tuning.yml +++ b/ansible/roles/twas_cell_tuning/tasks/twas_cell_tuning.yml @@ -6,7 +6,7 @@ dest: "tuneDayTrader.py" - name: run the daytrader tuning jython script - shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin.sh -lang jython -username {{ twas_username }} -password {{ twas_password }} -f tuneDayTrader.py cluster {{ clusterName }}" + shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin{{ ext }} -lang jython -username {{ twas_username }} -password {{ twas_password }} -f tuneDayTrader.py cluster {{ clusterName }}" register: tuningOutput failed_when: ( tuningOutput.rc not in [ 0, 255 ] ) - name: tuningOutput diff --git a/ansible/roles/twas_cell_unamaged_web_node/defaults/main.yml b/ansible/roles/twas_cell_unamaged_web_node/defaults/main.yml new file mode 100644 index 000000000..f1f9fe796 --- /dev/null +++ b/ansible/roles/twas_cell_unamaged_web_node/defaults/main.yml @@ -0,0 +1,9 @@ +--- +un_managed_node_os: + AIX: 'aix' + Linux: 'linux' + Windows: 'windows' + CYGWIN_NT-10.0-20348: 'windows' # hard coded to a specific cygwin version + CYGWIN_NT-10.0-26100: 'windows' # hard coded to a specific cygwin version + ZOS: 'os390' + OS400: 'os400' diff --git a/ansible/roles/twas_cell_unamaged_web_node/meta/main.yml b/ansible/roles/twas_cell_unamaged_web_node/meta/main.yml index 599eef66a..83555b652 100644 --- a/ansible/roles/twas_cell_unamaged_web_node/meta/main.yml +++ b/ansible/roles/twas_cell_unamaged_web_node/meta/main.yml @@ -2,4 +2,3 @@ dependencies: - role: twas_cell_defaults - role: http_defaults - - role: ibm_installation_manager_cic_selector diff --git a/ansible/roles/twas_cell_unamaged_web_node/tasks/twas_cell_unamaged_web_node.yml b/ansible/roles/twas_cell_unamaged_web_node/tasks/twas_cell_unamaged_web_node.yml index 21b6e9a5e..4194f2ae2 100644 --- a/ansible/roles/twas_cell_unamaged_web_node/tasks/twas_cell_unamaged_web_node.yml +++ b/ansible/roles/twas_cell_unamaged_web_node/tasks/twas_cell_unamaged_web_node.yml @@ -1,15 +1,15 @@ --- -- name: copy twas_cell_unamaged_web_node.py.j2 template - template: +- name: Copy twas_cell_unamaged_web_node.py.j2 template + ansible.builtin.template: src: "twas_cell_unamaged_web_node.py.j2" dest: "twas_cell_unamaged_web_node.py" -- name: run the twas_cell_unamaged_web_node.py jython script - shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin.sh -lang jython -username {{ twas_username }} -password {{ twas_password }} -f twas_cell_unamaged_web_node.py" +- name: Run the twas_cell_unamaged_web_node.py jython script + ansible.builtin.shell: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin{{ ext }} -lang jython -username {{ twas_username }} -password {{ twas_password }} -f twas_cell_unamaged_web_node.py" register: createWebServerOutput failed_when: ( createWebServerOutput.rc not in [ 0, 255 ] ) - name: createWebServerOutput - debug: - msg: "{{ createWebServerOutput.stdout_lines }}" + ansible.builtin.debug: + msg: "{{ createWebServerOutput.stdout_lines }}" diff --git a/ansible/roles/twas_cell_unamaged_web_node/templates/twas_cell_unamaged_web_node.py.j2 b/ansible/roles/twas_cell_unamaged_web_node/templates/twas_cell_unamaged_web_node.py.j2 index 3cb719cb2..c73db2ccf 100644 --- a/ansible/roles/twas_cell_unamaged_web_node/templates/twas_cell_unamaged_web_node.py.j2 +++ b/ansible/roles/twas_cell_unamaged_web_node/templates/twas_cell_unamaged_web_node.py.j2 @@ -21,10 +21,10 @@ cellname="{{ cellName }}" webnode="{{ webNode }}" webservername="{{ webServerName }}" ihs_hostname="{{ groups.ihs[0] }}" -os_type="{{ cic_selector_os[ansible_system] }}" +os_type="{{ un_managed_node_os[ansible_system] }}" webPort="{{ ihs_http_port }}" -webInstallRoot="{{ install_base }}/{{ http_dir }}" -pluginInstallRoot="{{ install_base }}/{{ plugin_dir }}" +webInstallRoot="{{ cygwin }}{{ install_base }}/{{ http_dir }}" +pluginInstallRoot="{{ cygwin }}{{ install_base }}/{{ plugin_dir }}" configurationFile="" webAppMapping="ALL" adminPort="{{ ihs_admin_port }}" @@ -43,8 +43,9 @@ if nodelist != '': for nodename in nodelist: print "--- checking nodename: %s ---" % nodename if nodeIsUnmanaged( nodename ): - print "--- Delete the unmanaged node ---" - AdminTask.removeUnmanagedNode('[-nodeName '+ webnode +']') + if webnode == nodename: + print "--- Delete the unmanaged node ---" + AdminTask.removeUnmanagedNode('[-nodeName '+ webnode +']') # [1/21/22 15:49:25:578 EST] Nodes > New... print "--- create the unmanaged node ---" diff --git a/ansible/roles/twas_cell_versionInfo/meta/main.yml b/ansible/roles/twas_cell_versionInfo/meta/main.yml new file mode 100644 index 000000000..83555b652 --- /dev/null +++ b/ansible/roles/twas_cell_versionInfo/meta/main.yml @@ -0,0 +1,4 @@ +--- +dependencies: + - role: twas_cell_defaults + - role: http_defaults diff --git a/ansible/roles/twas_cell_versionInfo/readme.md b/ansible/roles/twas_cell_versionInfo/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/twas_cell_versionInfo/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/twas_cell_versionInfo/tasks/main.yml b/ansible/roles/twas_cell_versionInfo/tasks/main.yml new file mode 100644 index 000000000..d0de4750d --- /dev/null +++ b/ansible/roles/twas_cell_versionInfo/tasks/main.yml @@ -0,0 +1,2 @@ +--- +- include_tasks: twas_cell_versionInfo.yml diff --git a/ansible/roles/twas_cell_versionInfo/tasks/twas_cell_versionInfo.yml b/ansible/roles/twas_cell_versionInfo/tasks/twas_cell_versionInfo.yml new file mode 100644 index 000000000..c35777733 --- /dev/null +++ b/ansible/roles/twas_cell_versionInfo/tasks/twas_cell_versionInfo.yml @@ -0,0 +1,150 @@ +--- + +- name: Create version dir + delegate_to: localhost + ansible.builtin.file: + path: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}" + state: directory + mode: '0755' + +- name: Check if tWAS installed + ansible.builtin.stat: + path: "{{ install_base }}/{{ twas_dir }}/properties/version/WAS.product" + register: istwas + +- name: tWAS versions + when: istwas.stat.exists + block: + + - name: Read the WAS.product xml file + ansible.builtin.include_role: + name: twas_cell_product_version_level + vars: + twas_product: WAS + target_dir: "{{ twas_dir }}" + staging_json_file: "{{ version_level_json_file }}" + + - name: WebSphere VersionInfo + ansible.builtin.shell: "{{ install_base }}/{{ twas_dir }}/bin/versionInfo{{ ext }} -ifixDetail" + register: tversions + + - name: Size of versionInfo stdout_lines + delegate_to: localhost + ansible.builtin.set_fact: + max_counter: "{{ tversions.stdout_lines | length }}" + + - name: Create dict with tWAS version(s) + ansible.builtin.set_fact: + twas_version: "{{ twas_version | default({}) | combine( { item: tversions.stdout_lines[item | int] }, recursive=True, list_merge='append' ) }}" + with_sequence: 'start=0 end={{ max_counter | int - 1 }}' + no_log: true + + - name: New dict twas_version + ansible.builtin.set_fact: + versions: "{{{ ansible_fqdn : twas_version }}}" + + - name: Write tWAS versionInfo to json file + delegate_to: localhost + ansible.builtin.copy: + content: "{{ versions | to_nice_json( sort_keys=false ) }}" + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ versioninfo_json_file }}" + mode: '0444' + + - name: Check if MoRE installed + ansible.builtin.stat: + path: "{{ install_base }}/{{ twas_dir }}/properties/version/MORE.product" + register: ismore + + - name: MORE versions + when: ismore.stat.exists + block: + + - name: Read the MORE.product xml file + ansible.builtin.include_role: + name: twas_cell_product_version_level + vars: + twas_product: MORE + target_dir: "{{ twas_dir }}" + staging_json_file: "more_{{ version_level_json_file }}" + + - name: Merge the Server / MoRE json ( combined ) + delegate_to: localhost + when: istwas.stat.exists + ansible.builtin.copy: + content: "{{ lookup('ansible.builtin.file', '{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ version_level_json_file }}') | from_json | ansible.builtin.combine(lookup('ansible.builtin.file', '{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/more_{{ version_level_json_file }}') | from_json, recursive=True, list_merge='append' )}}" + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ version_level_json_file }}" + mode: '0444' + + - name: Remove the more_{{ version_level_json_file }} + delegate_to: localhost + ansible.builtin.file: + path: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/more_{{ version_level_json_file }}" + state: absent + +- name: Check if AppClient installed + ansible.builtin.stat: + path: "{{ install_base }}/{{ app_dir }}/properties/version/APPCLIENT.product" + register: isapp + +- name: AppClient versions + when: isapp.stat.exists + block: + + - name: Read the APPCLIENT.product xml file + ansible.builtin.include_role: + name: twas_cell_product_version_level + vars: + twas_product: APPCLIENT + target_dir: "{{ app_dir }}" + staging_json_file: "app_{{ version_level_json_file }}" + + - name: Rename the app_{{ version_level_json_file }} + when: istwas.stat.exists == False + block: + - name: No tWAS rename the app_{{ version_level_json_file }} + delegate_to: localhost + ansible.builtin.copy: + remote_src: false + src: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/app_{{ version_level_json_file }}" + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ version_level_json_file }}" + mode: "0644" + + - name: Remove the app_{{ version_level_json_file }} + delegate_to: localhost + ansible.builtin.file: + path: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/app_{{ version_level_json_file }}" + state: absent + + - name: Merge the Server / Appclient json ( combined ) + delegate_to: localhost + when: istwas.stat.exists + ansible.builtin.copy: + content: "{{ lookup('ansible.builtin.file', '{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ version_level_json_file }}') | from_json | ansible.builtin.combine(lookup('ansible.builtin.file', '{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/app_{{ version_level_json_file }}') | from_json, recursive=True, list_merge='append' )}}" + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ version_level_json_file }}" + mode: '0444' + + - name: AppClient version details + ansible.builtin.shell: "{{ install_base }}/{{ app_dir }}/bin/versionInfo{{ ext }} -ifixDetail" + register: appVersionOutput + + - name: Size of stdout_lines + delegate_to: localhost + ansible.builtin.set_fact: + max_counter: "{{ appVersionOutput.stdout_lines | length }}" + + - name: Create dict with tWAS version(s) + ansible.builtin.set_fact: + app_version: "{{ app_version | default({}) | combine( { item: appVersionOutput.stdout_lines[item | int] }, recursive=True, list_merge='append' ) }}" + with_sequence: 'start=0 end={{ max_counter | int - 1 }}' + no_log: true + + - name: New dict app_version + ansible.builtin.set_fact: + versions: "{{ { ansible_fqdn : app_version } }}" + + - name: Write AppClient versionInfo to json file + delegate_to: localhost + ansible.builtin.copy: + content: "{{ versions | to_nice_json( sort_keys=false ) }}" + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ app_versioninfo_json_file }}" + mode: '0444' diff --git a/ansible/roles/twas_config/tasks/twas_config.yml b/ansible/roles/twas_config/tasks/twas_config.yml index d98a3c67c..debc24f4a 100644 --- a/ansible/roles/twas_config/tasks/twas_config.yml +++ b/ansible/roles/twas_config/tasks/twas_config.yml @@ -7,7 +7,7 @@ mode: '0600' - name: run the config jython script - shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin.sh -lang jython -username {{ twas_username }} -password {{ twas_password }} -f ~/{{ twas_script }}" + shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin{{ ext }} -lang jython -username {{ twas_username }} -password {{ twas_password }} -f ~/{{ twas_script }}" register: twasConfigOutput failed_when: ( twasConfigOutput.rc not in [ 0, 255 ] ) - name: twasConfigOutput diff --git a/ansible/roles/twas_create_mls/meta/main.yml b/ansible/roles/twas_create_mls/meta/main.yml new file mode 100644 index 000000000..1397bfd39 --- /dev/null +++ b/ansible/roles/twas_create_mls/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: twas_cell_defaults diff --git a/ansible/roles/twas_create_mls/readme.md b/ansible/roles/twas_create_mls/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/twas_create_mls/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/twas_create_mls/tasks/main.yml b/ansible/roles/twas_create_mls/tasks/main.yml new file mode 100644 index 000000000..28095a42b --- /dev/null +++ b/ansible/roles/twas_create_mls/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Create tWAS Managed Liberty Server + ansible.builtin.include_tasks: twas_create_mls.yml diff --git a/ansible/roles/twas_create_mls/tasks/twas_create_mls.yml b/ansible/roles/twas_create_mls/tasks/twas_create_mls.yml new file mode 100644 index 000000000..0c543d8ea --- /dev/null +++ b/ansible/roles/twas_create_mls/tasks/twas_create_mls.yml @@ -0,0 +1,23 @@ +--- +- name: Start tWAS Managed Liberty servers + when: profile_type == 'managed' or profile_type == 'default' + block: + - name: Retrieve signers + ansible.builtin.shell: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/retrieveSigners{{ ext }} {{ cell_trust }} ClientDefaultTrustStore -autoAcceptBootstrapSigner -username {{ twas_username }} -password {{ twas_password }}" + register: retrieveSignersOutput + failed_when: ( retrieveSignersOutput.rc not in [ 0, 3 ] ) + - name: retrieveSignersOutput + ansible.builtin.debug: + msg: "{{ retrieveSignersOutput.stdout_lines }}" + + - name: Copy create_mls.jy + ansible.builtin.template: + src: create_mls.jy.j2 + dest: create_mls.jy + mode: '0755' + + - name: Create the ManagedLibertyServer + ansible.builtin.shell: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin{{ ext }} -username {{ twas_username }} -password {{ twas_password }} -lang jython -f create_mls.jy {{ item }}" + register: serverCreateOutput + with_items: '{{ mls_servers }}' + failed_when: serverCreateOutput.rc not in [0,105] diff --git a/ansible/roles/twas_create_mls/templates/create_mls.jy.j2 b/ansible/roles/twas_create_mls/templates/create_mls.jy.j2 new file mode 100644 index 000000000..b2eb8dcbd --- /dev/null +++ b/ansible/roles/twas_create_mls/templates/create_mls.jy.j2 @@ -0,0 +1,5 @@ +if len(sys.argv) == 1: + mls_create=AdminTask.createManagedLibertyServer('{{ profile_name }}', '[-name %s -templateName default -genUniquePorts true ]' % (str(sys.argv[0]))) + print(mls_create) + AdminConfig.save() + AdminNodeManagement.syncNode('{{ profile_name }}') \ No newline at end of file diff --git a/ansible/roles/twas_default_swaggerui/tasks/twas_default_swaggerui.yml b/ansible/roles/twas_default_swaggerui/tasks/twas_default_swaggerui.yml index 88f77caa1..c69cd0f40 100644 --- a/ansible/roles/twas_default_swaggerui/tasks/twas_default_swaggerui.yml +++ b/ansible/roles/twas_default_swaggerui/tasks/twas_default_swaggerui.yml @@ -1,7 +1,7 @@ --- - name: deploySwaggerUI.py - shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin.sh -lang jython -conntype NONE -username {{ twas_username }} -password {{ twas_password }} -f {{install_base }}/{{ twas_dir }}/bin/deploySwaggerUI.py install 'WebSphere:cell={{ cellName }},node={{ profile_name }},server=server1'" + shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin{{ ext }} -lang jython -conntype NONE -username {{ twas_username }} -password {{ twas_password }} -f {{install_base }}/{{ twas_dir }}/bin/deploySwaggerUI.py install 'WebSphere:cell={{ cellName }},node={{ profile_name }},server={{ appServerName }}'" register: twasConfigOutput failed_when: ( twasConfigOutput.rc not in [ 0, 105, 130, 255 ] ) - name: twasConfigOutput diff --git a/ansible/roles/twas_delete_mls/meta/main.yml b/ansible/roles/twas_delete_mls/meta/main.yml new file mode 100644 index 000000000..1397bfd39 --- /dev/null +++ b/ansible/roles/twas_delete_mls/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: twas_cell_defaults diff --git a/ansible/roles/twas_delete_mls/readme.md b/ansible/roles/twas_delete_mls/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/twas_delete_mls/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/twas_delete_mls/tasks/main.yml b/ansible/roles/twas_delete_mls/tasks/main.yml new file mode 100644 index 000000000..74e3fba7e --- /dev/null +++ b/ansible/roles/twas_delete_mls/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Delete tWAS Managed Liberty Server + ansible.builtin.include_tasks: twas_delete_mls.yml diff --git a/ansible/roles/twas_delete_mls/tasks/twas_delete_mls.yml b/ansible/roles/twas_delete_mls/tasks/twas_delete_mls.yml new file mode 100644 index 000000000..36d2488cb --- /dev/null +++ b/ansible/roles/twas_delete_mls/tasks/twas_delete_mls.yml @@ -0,0 +1,23 @@ +--- +- name: Start tWAS Managed Liberty servers + when: profile_type == 'managed' or profile_type == 'default' + block: + - name: Retrieve signers + ansible.builtin.shell: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/retrieveSigners{{ ext }} {{ cell_trust }} ClientDefaultTrustStore -autoAcceptBootstrapSigner -username {{ twas_username }} -password {{ twas_password }}" + register: retrieveSignersOutput + failed_when: ( retrieveSignersOutput.rc not in [ 0, 3 ] ) + - name: retrieveSignersOutput + debug: + msg: "{{ retrieveSignersOutput.stdout_lines }}" + + - name: Copy delete_mls.jy + ansible.builtin.template: + src: delete_mls.jy.j2 + dest: delete_mls.jy + mode: '0755' + + - name: Delete the ManagedLibertyServer + ansible.builtin.shell: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin{{ ext }} -username {{ twas_username }} -password {{ twas_password }} -lang jython -f delete_mls.jy {{ item }}" + register: serverDeleteOutput + with_items: '{{ mls_servers }}' + failed_when: serverDeleteOutput.rc not in [0,105] diff --git a/ansible/roles/twas_delete_mls/templates/delete_mls.jy.j2 b/ansible/roles/twas_delete_mls/templates/delete_mls.jy.j2 new file mode 100644 index 000000000..b7ee405e6 --- /dev/null +++ b/ansible/roles/twas_delete_mls/templates/delete_mls.jy.j2 @@ -0,0 +1,5 @@ +if len(sys.argv) == 1: + mls_delete=AdminTask.deleteServer('[-serverName %s -nodeName {{ profile_name }}]' % (str(sys.argv[0]))) + AdminConfig.save() + AdminNodeManagement.syncNode('{{ profile_name }}') + print(mls_delete) \ No newline at end of file diff --git a/ansible/roles/twas_enable_wim_registry/tasks/twas_enable_wim_registry.yml b/ansible/roles/twas_enable_wim_registry/tasks/twas_enable_wim_registry.yml index 6a7e6a25b..43c78553c 100644 --- a/ansible/roles/twas_enable_wim_registry/tasks/twas_enable_wim_registry.yml +++ b/ansible/roles/twas_enable_wim_registry/tasks/twas_enable_wim_registry.yml @@ -6,7 +6,7 @@ dest: "wim_wizard.py" - name: run the enable wim jython script - shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin.sh -lang jython -conntype NONE -username {{ twas_username }} -password {{ twas_password }} -f wim_wizard.py" + shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin{{ ext }} -lang jython -conntype NONE -username {{ twas_username }} -password {{ twas_password }} -f wim_wizard.py" register: enablewimOutput failed_when: ( enablewimOutput.rc not in [ 0, 255 ] ) - name: enablewimOutput diff --git a/ansible/roles/twas_maintmode_ops/meta/main.yml b/ansible/roles/twas_maintmode_ops/meta/main.yml new file mode 100644 index 000000000..99e2c3ce2 --- /dev/null +++ b/ansible/roles/twas_maintmode_ops/meta/main.yml @@ -0,0 +1,4 @@ +--- +dependencies: + - role: twas_cell_defaults + - role: twas_cell_wsadminlib diff --git a/ansible/roles/twas_maintmode_ops/readme.md b/ansible/roles/twas_maintmode_ops/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/twas_maintmode_ops/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/twas_maintmode_ops/scripts/maintModeOps.py b/ansible/roles/twas_maintmode_ops/scripts/maintModeOps.py new file mode 100644 index 000000000..0052b1534 --- /dev/null +++ b/ansible/roles/twas_maintmode_ops/scripts/maintModeOps.py @@ -0,0 +1,55 @@ +#-------------------------------------------------------------------- +# WebSphere Maint Mode enablement +#-------------------------------------------------------------------- +# +# +# To invoke the script, type: +# wsadmin -f enableMaintMode.py < nodename > < mode > +# 2017-03-10 schader@us.ibm.com initial version +#-------------------------------------------------------------------- +# +# false: This value disables the maintenance mode. +# break: This value stops any traffic from being routed to the server. +# affinity: Default value. This value routes only traffic with affinity to the server. +# stop: This value stops the server, and persistently sets it in break mode. +# + +def printUsageAndExit ( ): + print ("") + print ("Usage: wsadmin -f enableMaintMode.py [nodeName] [ mode ] ") + print ("") + sys.exit() +#endDef +#--------------------------------------------------------------------- +# Parse Command Line +#--------------------------------------------------------------------- + +if (len(sys.argv) == 2): + arg_nodeName = sys.argv[0] + arg_mode = sys.argv[1] +else: + printUsageAndExit( ) +#endElse + +execfile('wsadminlib.py') + +print ("Starting script maint mode...") + +#-------------------------------------------------------------------- +#cellName = AdminControl.getCell() +#productVersion=AdminTask.getNodeBaseProductVersion(['-nodeName', 'dmgr']) +#print "modifying WAS version: " + productVersion + +# get the list of servers and loop on every one minus webservers +for (nodename,servername) in listServersOfType(None): + if arg_nodeName == nodename: + stype = getServerType(nodename,servername) + # sometimes, dmgr has no type... who knows why + if stype == 'APPLICATION_SERVER' or stype == 'PROXY_SERVER' or stype == 'ONDEMAND_ROUTER': + print ("-- maint mode op" + arg_mode +" for node: " + nodename + " server:" + servername) + AdminTask.setMaintenanceMode (nodename,['-name',servername,'-mode',arg_mode]) + #endif + #endif +#endfor +AdminConfig.save() +print ("--completed...") diff --git a/ansible/roles/twas_maintmode_ops/tasks/main.yml b/ansible/roles/twas_maintmode_ops/tasks/main.yml new file mode 100644 index 000000000..df8135180 --- /dev/null +++ b/ansible/roles/twas_maintmode_ops/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Maintenence mode ops + ansible.builtin.include_tasks: maintModeOps.yml diff --git a/ansible/roles/twas_maintmode_ops/tasks/maintModeOps.yml b/ansible/roles/twas_maintmode_ops/tasks/maintModeOps.yml new file mode 100644 index 000000000..27807a032 --- /dev/null +++ b/ansible/roles/twas_maintmode_ops/tasks/maintModeOps.yml @@ -0,0 +1,15 @@ +--- + +- name: Copy twas config scripts to target host + ansible.builtin.copy: + src: "scripts/enableMaintMode.py" + dest: ~/ + mode: '0600' + +- name: Set the nodes servers into maint mode + ansible.builtin.shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin{{ ext }} -lang jython -username {{ twas_username }} -password {{ twas_password }} -f ~/enableMaintMode.py {{ profile_name }} {{ maint_mode_op }}" + register: twasOpsOutput + failed_when: ( twasOpsOutput.rc not in [ 0, 255 ] ) +- name: twasOpsOutput + ansible.builtin.debug: + msg: "{{ twasOpsOutput.stdout_lines }}" diff --git a/ansible/roles/twas_ssl_client_props/tasks/twas_ssl_client_props.yml b/ansible/roles/twas_ssl_client_props/tasks/twas_ssl_client_props.yml index d3621f9a3..e5b8ab13b 100644 --- a/ansible/roles/twas_ssl_client_props/tasks/twas_ssl_client_props.yml +++ b/ansible/roles/twas_ssl_client_props/tasks/twas_ssl_client_props.yml @@ -5,3 +5,12 @@ path: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/properties/ssl.client.props" regexp: 'SSL_TLSv2' replace: '{{ sslProtocol }}' + +# https://www.ibm.com/support/pages/hostname-verification-websphere-application-server-traditional +- name: Optionally disable / enable HNV ssl.client.props + when: + - enable_hnv is defined + lineinfile: + path: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/properties/ssl.client.props" + regexp: 'com.ibm.ssl.verifyHostname' + line: 'com.ibm.ssl.verifyHostname=false diff --git a/ansible/roles/twas_start_default/tasks/twas_start_default.yml b/ansible/roles/twas_start_default/tasks/twas_start_default.yml index 2c9f2e896..3dd73168c 100644 --- a/ansible/roles/twas_start_default/tasks/twas_start_default.yml +++ b/ansible/roles/twas_start_default/tasks/twas_start_default.yml @@ -1,18 +1,38 @@ --- - -- name: default - when: profile_type == 'default' +- name: Start tWAS Server + when: + - profile_type == 'managed' or profile_type == 'default' + - dynamic_cluster_only is not defined block: - - name: start the default - shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/startServer.sh server1" - register: startDefaultOutput - failed_when: ( startDefaultOutput.rc not in [ 0, 255 ] ) - - name: startDefaultOutput - debug: - msg: "{{ startDefaultOutput.stdout_lines }}" - - name: cat AboutThisProfile.txt - shell: "cat {{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/logs/AboutThisProfile.txt" - register: AboutThisProfile - - name: AboutThisProfile - debug: - msg: "{{ AboutThisProfile.stdout_lines }}" + - name: retrieve signers + shell: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/retrieveSigners{{ ext }} {{ cell_trust }} ClientDefaultTrustStore -autoAcceptBootstrapSigner -username {{ twas_username }} -password {{ twas_password }}" + register: retrieveSignersOutput + failed_when: ( retrieveSignersOutput.rc not in [ 0, 3 ] ) + - name: retrieveSignersOutput + debug: + msg: "{{ retrieveSignersOutput.stdout_lines }}" + + # If the target servers are part of a dynamic cluster which starts automtcally, pause xx mins + - name: Pause for dynamic cluster startup + pause: + minutes: "{{ dynamic_cluster_pause }}" + when: dynamic_cluster_pause is defined + + - name: List the stopped servers minus the nodeagent + ansible.builtin.shell: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/serverStatus{{ ext }} -all -username {{ twas_username }} -password {{ twas_password }} |grep -i ADMU0509I|grep -v nodeagent|awk -F'\"' '{print $2}'" + register: serverListOutput + + - name: Start the default tWAS Server + ansible.builtin.shell: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/startServer{{ ext }} {{ item }}" + register: startDefaultOutput + failed_when: ( startDefaultOutput.rc not in [ 0, 255 ] ) + with_items: '{{ serverListOutput.stdout_lines }}' + + - name: startDefaultOutput + ansible.builtin.debug: + msg: "rc={{ item.rc }}" + with_items: "{{ startDefaultOutput.results }}" + loop_control: + label: "{{ item.stdout }}" + failed_when: + - '" Error " in item.stdout' diff --git a/ansible/roles/twas_start_mls/meta/main.yml b/ansible/roles/twas_start_mls/meta/main.yml new file mode 100644 index 000000000..1397bfd39 --- /dev/null +++ b/ansible/roles/twas_start_mls/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: twas_cell_defaults diff --git a/ansible/roles/twas_start_mls/readme.md b/ansible/roles/twas_start_mls/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/twas_start_mls/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/twas_start_mls/tasks/main.yml b/ansible/roles/twas_start_mls/tasks/main.yml new file mode 100644 index 000000000..276f5763c --- /dev/null +++ b/ansible/roles/twas_start_mls/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Start tWAS Managed Liberty Server + ansible.builtin.include_tasks: twas_start_mls.yml diff --git a/ansible/roles/twas_start_mls/tasks/twas_start_mls.yml b/ansible/roles/twas_start_mls/tasks/twas_start_mls.yml new file mode 100644 index 000000000..48773dcc0 --- /dev/null +++ b/ansible/roles/twas_start_mls/tasks/twas_start_mls.yml @@ -0,0 +1,62 @@ +--- +- name: Start tWAS Managed Liberty servers + when: profile_type == 'managed' or profile_type == 'default' + block: + - name: Retrieve signers + ansible.builtin.shell: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/retrieveSigners{{ ext }} {{ cell_trust }} ClientDefaultTrustStore -autoAcceptBootstrapSigner -username {{ twas_username }} -password {{ twas_password }}" + register: retrieveSignersOutput + failed_when: ( retrieveSignersOutput.rc not in [ 0, 3 ] ) + - name: retrieveSignersOutput + debug: + msg: "{{ retrieveSignersOutput.stdout_lines }}" + + # bin/wsadmin.sh -username persona1 -password ppersona1 -c "AdminTask.listServers('[-serverType MANAGED_LIBERTY_SERVER -nodeName node1]')" + # WASX7209I: Connected to process "dmgr" on node dmgr using SOAP connector; The type of process is: DeploymentManager + # u'lib11(cells/ndcell/nodes/node1/servers/lib11|server.xml)\nlib1(cells/ndcell/nodes/node1/servers/lib1|server.xml)' + + - name: Copy list_mls.jy + ansible.builtin.template: + src: list_mls.jy.j2 + dest: list_mls.jy + mode: '0755' + + - name: List the ManagedLibertyServer + ansible.builtin.shell: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin{{ ext }} -username {{ twas_username }} -password {{ twas_password }} -lang jython -f list_mls.jy" + register: serverListOutput + + # - name: Debug serverListOutput + # ansible.builtin.debug: + # var: serverListOutput.stdout_lines + + - name: Find ManagedLibertyServers + ansible.builtin.set_fact: + mls: >- + {{ + serverListOutput.stdout + | regex_findall('servers/([^|]+)\|server\.xml') + }} + + # - name: Debug found these ManagedLibertyServers + # ansible.builtin.debug: + # var: mls + + - name: Copy start_mls.jy + ansible.builtin.template: + src: start_mls.jy.j2 + dest: start_mls.jy + mode: '0755' + + - name: Start ManagedLibertyServer + ansible.builtin.shell: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin{{ ext }} -username {{ twas_username }} -password {{ twas_password }} -lang jython -f start_mls.jy {{ item }}" + register: startMlsOutput + failed_when: ( startMlsOutput.rc not in [ 0,105 ] ) + with_items: '{{ mls }}' + + - name: ManagedLibertyServer start output + ansible.builtin.debug: + msg: "rc={{ item.rc }}" + with_items: "{{ startMlsOutput.results }}" + loop_control: + label: "{{ item.stdout }}" + failed_when: + - '" Error " in item.stdout' diff --git a/ansible/roles/twas_start_mls/templates/list_mls.jy.j2 b/ansible/roles/twas_start_mls/templates/list_mls.jy.j2 new file mode 100644 index 000000000..d2ad04902 --- /dev/null +++ b/ansible/roles/twas_start_mls/templates/list_mls.jy.j2 @@ -0,0 +1,2 @@ +mls_list=AdminTask.listServers('[-serverType MANAGED_LIBERTY_SERVER -nodeName {{ profile_name }}]') +print(mls_list) \ No newline at end of file diff --git a/ansible/roles/twas_start_mls/templates/start_mls.jy.j2 b/ansible/roles/twas_start_mls/templates/start_mls.jy.j2 new file mode 100644 index 000000000..bbced1f3e --- /dev/null +++ b/ansible/roles/twas_start_mls/templates/start_mls.jy.j2 @@ -0,0 +1,3 @@ +if len(sys.argv) == 1: + mls_start=AdminControl.startServer(str(sys.argv[0]),'{{ profile_name }}') + print(mls_start) \ No newline at end of file diff --git a/ansible/roles/twas_status_mls/meta/main.yml b/ansible/roles/twas_status_mls/meta/main.yml new file mode 100644 index 000000000..1397bfd39 --- /dev/null +++ b/ansible/roles/twas_status_mls/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: twas_cell_defaults diff --git a/ansible/roles/twas_status_mls/readme.md b/ansible/roles/twas_status_mls/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/twas_status_mls/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/twas_status_mls/tasks/main.yml b/ansible/roles/twas_status_mls/tasks/main.yml new file mode 100644 index 000000000..b64bd7316 --- /dev/null +++ b/ansible/roles/twas_status_mls/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Get status tWAS Managed Liberty Server + ansible.builtin.include_tasks: twas_status_mls.yml diff --git a/ansible/roles/twas_status_mls/tasks/twas_status_mls.yml b/ansible/roles/twas_status_mls/tasks/twas_status_mls.yml new file mode 100644 index 000000000..e09e7e4b7 --- /dev/null +++ b/ansible/roles/twas_status_mls/tasks/twas_status_mls.yml @@ -0,0 +1,67 @@ +--- +- name: Get status tWAS Managed Liberty servers + when: profile_type == 'managed' or profile_type == 'default' + block: + - name: Retrieve signers + ansible.builtin.shell: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/retrieveSigners{{ ext }} {{ cell_trust }} ClientDefaultTrustStore -autoAcceptBootstrapSigner -username {{ twas_username }} -password {{ twas_password }}" + register: retrieveSignersOutput + failed_when: ( retrieveSignersOutput.rc not in [ 0, 3 ] ) + - name: retrieveSignersOutput + ansible.builtin.debug: + msg: "{{ retrieveSignersOutput.stdout_lines }}" + + # bin/wsadmin.sh -username persona1 -password ppersona1 -c "AdminTask.listServers('[-serverType MANAGED_LIBERTY_SERVER -nodeName node1]')" + # WASX7209I: Connected to process "dmgr" on node dmgr using SOAP connector; The type of process is: DeploymentManager + # u'lib11(cells/ndcell/nodes/node1/servers/lib11|server.xml)\nlib1(cells/ndcell/nodes/node1/servers/lib1|server.xml)' + + - name: Copy list_mls.jy + ansible.builtin.template: + src: list_mls.jy.j2 + dest: list_mls.jy + mode: '0755' + + - name: List the running ManagedLibertyServer + ansible.builtin.shell: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin{{ ext }} -username {{ twas_username }} -password {{ twas_password }} -lang jython -f list_mls.jy" + register: serverListOutput + + # - name: Debug serverListOutput + # ansible.builtin.debug: + # var: serverListOutput.stdout_lines + + - name: Find ManagedLibertyServers + ansible.builtin.set_fact: + mls: >- + {{ + serverListOutput.stdout + | regex_findall('servers/([^|]+)\|server\.xml') + }} + + # - name: Debug found these ManagedLibertyServers + # ansible.builtin.debug: + # var: mls + + - name: Copy status_mls.jy + ansible.builtin.template: + src: status_mls.jy.j2 + dest: status_mls.jy + mode: '0755' + + - name: Get status ManagedLibertyServer + ansible.builtin.shell: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin{{ ext }} -username {{ twas_username }} -password {{ twas_password }} -lang jython -f status_mls.jy {{ item }}" + register: statusMlsOutput + failed_when: ( statusMlsOutput.rc not in [ 0,105 ] ) + with_items: '{{ mls }}' + timeout: 300 + + - name: Extract server status + ansible.builtin.set_fact: + server_status: "{{ item.stdout | regex_search('(RUNNING|STOPPED)') | default('UNKNOWN') }}" + with_items: "{{ statusMlsOutput.results }}" + register: extracted_status + + - name: ManagedLibertyServer status output + ansible.builtin.debug: + msg: "Status: {{ item.ansible_facts.server_status }}" + with_items: "{{ extracted_status.results }}" + loop_control: + label: "{{ item.item.stdout | regex_search('[^\\s]+$') | default('unknown') }}" diff --git a/ansible/roles/twas_status_mls/templates/list_mls.jy.j2 b/ansible/roles/twas_status_mls/templates/list_mls.jy.j2 new file mode 100644 index 000000000..d2ad04902 --- /dev/null +++ b/ansible/roles/twas_status_mls/templates/list_mls.jy.j2 @@ -0,0 +1,2 @@ +mls_list=AdminTask.listServers('[-serverType MANAGED_LIBERTY_SERVER -nodeName {{ profile_name }}]') +print(mls_list) \ No newline at end of file diff --git a/ansible/roles/twas_status_mls/templates/status_mls.jy.j2 b/ansible/roles/twas_status_mls/templates/status_mls.jy.j2 new file mode 100644 index 000000000..23427ba87 --- /dev/null +++ b/ansible/roles/twas_status_mls/templates/status_mls.jy.j2 @@ -0,0 +1,4 @@ +if len(sys.argv) == 1: + nodeagent = AdminControl.queryNames('type=NodeAgent,process=nodeagent,node={{ profile_name }},*') + mls_status=AdminControl.invoke(nodeagent, 'getProcessStatus', str(sys.argv[0])) + print(mls_status) \ No newline at end of file diff --git a/ansible/roles/twas_status_summary_servers/meta/main.yml b/ansible/roles/twas_status_summary_servers/meta/main.yml new file mode 100644 index 000000000..83555b652 --- /dev/null +++ b/ansible/roles/twas_status_summary_servers/meta/main.yml @@ -0,0 +1,4 @@ +--- +dependencies: + - role: twas_cell_defaults + - role: http_defaults diff --git a/ansible/roles/twas_status_summary_servers/readme.md b/ansible/roles/twas_status_summary_servers/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/twas_status_summary_servers/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/twas_status_summary_servers/tasks/main.yml b/ansible/roles/twas_status_summary_servers/tasks/main.yml new file mode 100644 index 000000000..df2de10fd --- /dev/null +++ b/ansible/roles/twas_status_summary_servers/tasks/main.yml @@ -0,0 +1,2 @@ +--- +- include_tasks: twas_status_summary_servers.yml diff --git a/ansible/roles/twas_status_summary_servers/tasks/twas_status_summary_servers.yml b/ansible/roles/twas_status_summary_servers/tasks/twas_status_summary_servers.yml new file mode 100644 index 000000000..cb026b24f --- /dev/null +++ b/ansible/roles/twas_status_summary_servers/tasks/twas_status_summary_servers.yml @@ -0,0 +1,50 @@ +--- +- name: Check if tWAS serverStatus + ansible.builtin.stat: + path: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/serverStatus{{ ext }}" + register: isServerStatus + +- name: tWAS versions + when: isServerStatus.stat.exists + block: + + - name: Summary of tWAS server status + ansible.builtin.shell: + cmd: | + set -o pipefail + {{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/serverStatus{{ ext }} -all -username {{ twas_username }} -password {{ twas_password }}|egrep 'ADMU0508I:|ADMU0509I:' || true + executable: /bin/bash + register: twasstatus + + - name: Create status dir + delegate_to: localhost + ansible.builtin.file: + path: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}" + state: directory + mode: '0755' + + - name: Size of stdout_lines + ansible.builtin.set_fact: + max_counter: "{{ twasstatus.stdout_lines | length }}" + + - name: Create list with server name / status + ansible.builtin.set_fact: + # NOTE: the get_twas_server_status -> plugins/filter/get_twas_server_status + twas_server_name_status: '{{ twas_server_name_status | default([]) + [ { "server": twasstatus.stdout_lines[item | int] | ibm_community_automation.ibm_community_automation.get_twas_server_name, "status": twasstatus.stdout_lines[item | int] } ] }}' + with_sequence: 'start=0 end={{ max_counter | int - 1 }}' + no_log: true + + - name: Debug twas_server_name_status list + ansible.builtin.debug: + msg: "{{ twas_server_name_status }}" + + - name: New dict server status + ansible.builtin.set_fact: + versions: "{{{ ansible_fqdn : twas_server_name_status }}}" + + - name: Write server status json file + delegate_to: localhost + ansible.builtin.copy: + content: "{{ versions | to_nice_json( sort_keys=false ) }}" + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ status_json_file }}" + mode: '0444' diff --git a/ansible/roles/twas_stop_default/tasks/twas_stop_default.yml b/ansible/roles/twas_stop_default/tasks/twas_stop_default.yml index a20af8a0f..48e09b220 100644 --- a/ansible/roles/twas_stop_default/tasks/twas_stop_default.yml +++ b/ansible/roles/twas_stop_default/tasks/twas_stop_default.yml @@ -1,13 +1,35 @@ --- - -- name: default - when: profile_type == 'default' +- name: Stop node servers + when: profile_type == 'managed' or profile_type == 'default' block: - - name: stop the default server - ignore_errors: true - shell: "{{install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/stopServer.sh server1 -username {{ twas_username }} -password {{ twas_password }}" - register: stopDefaultOutput - failed_when: ( stopDefaultOutput.rc not in [ 0,246,255 ] ) - - name: stopDefaultOutput - debug: - msg: "{{ stopDefaultOutput.stdout_lines }}" + - name: Retrieve signers + ansible.builtin.shell: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/retrieveSigners{{ ext }} {{ cell_trust }} ClientDefaultTrustStore -autoAcceptBootstrapSigner -username {{ twas_username }} -password {{ twas_password }}" + register: retrieveSignersOutput + failed_when: ( retrieveSignersOutput.rc not in [ 0, 3 ] ) + - name: retrieveSignersOutput + debug: + msg: "{{ retrieveSignersOutput.stdout_lines }}" + + - name: List the running servers minus the nodeagent + ansible.builtin.shell: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/serverStatus{{ ext }} -all -username {{ twas_username }} -password {{ twas_password }} |grep -i started|grep -v nodeagent|awk -F'\"' '{print $2}'" + register: serverListOutput + + - name: Stop the application servers + ansible.builtin.shell: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/stopServer{{ ext }} {{ item }} -username {{ twas_username }} -password {{ twas_password }}" + register: stopDefaultOutput + failed_when: ( stopDefaultOutput.rc not in [ 0,246 ] ) + with_items: '{{ serverListOutput.stdout_lines }}' + timeout: 300 + + - name: stopDefaultOutput + ansible.builtin.debug: + msg: "rc={{ item.rc }}" + with_items: "{{ stopDefaultOutput.results }}" + loop_control: + label: "{{ item.stdout }}" + failed_when: + - '" Error " in item.stdout' + rescue: + - ansible.builtin.include_role: + name: was_kill_process + \ No newline at end of file diff --git a/ansible/roles/twas_stop_mls/meta/main.yml b/ansible/roles/twas_stop_mls/meta/main.yml new file mode 100644 index 000000000..1397bfd39 --- /dev/null +++ b/ansible/roles/twas_stop_mls/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: twas_cell_defaults diff --git a/ansible/roles/twas_stop_mls/readme.md b/ansible/roles/twas_stop_mls/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/twas_stop_mls/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/twas_stop_mls/tasks/main.yml b/ansible/roles/twas_stop_mls/tasks/main.yml new file mode 100644 index 000000000..39f1fa3f5 --- /dev/null +++ b/ansible/roles/twas_stop_mls/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Stop tWAS Managed Liberty Server + ansible.builtin.include_tasks: twas_stop_mls.yml diff --git a/ansible/roles/twas_stop_mls/tasks/twas_stop_mls.yml b/ansible/roles/twas_stop_mls/tasks/twas_stop_mls.yml new file mode 100644 index 000000000..9d1ad7967 --- /dev/null +++ b/ansible/roles/twas_stop_mls/tasks/twas_stop_mls.yml @@ -0,0 +1,67 @@ +--- +- name: Stop tWAS Managed Liberty servers + when: profile_type == 'managed' or profile_type == 'default' + block: + - name: Retrieve signers + ansible.builtin.shell: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/retrieveSigners{{ ext }} {{ cell_trust }} ClientDefaultTrustStore -autoAcceptBootstrapSigner -username {{ twas_username }} -password {{ twas_password }}" + register: retrieveSignersOutput + failed_when: ( retrieveSignersOutput.rc not in [ 0, 3 ] ) + - name: retrieveSignersOutput + debug: + msg: "{{ retrieveSignersOutput.stdout_lines }}" + + # bin/wsadmin.sh -username persona1 -password ppersona1 -c "AdminTask.listServers('[-serverType MANAGED_LIBERTY_SERVER -nodeName node1]')" + # WASX7209I: Connected to process "dmgr" on node dmgr using SOAP connector; The type of process is: DeploymentManager + # u'lib11(cells/ndcell/nodes/node1/servers/lib11|server.xml)\nlib1(cells/ndcell/nodes/node1/servers/lib1|server.xml)' + + - name: Copy list_mls.jy + ansible.builtin.template: + src: list_mls.jy.j2 + dest: list_mls.jy + mode: '0755' + + - name: List the running ManagedLibertyServer + ansible.builtin.shell: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin{{ ext }} -username {{ twas_username }} -password {{ twas_password }} -lang jython -f list_mls.jy" + register: serverListOutput + + # - name: Debug serverListOutput + # ansible.builtin.debug: + # var: serverListOutput.stdout_lines + + - name: Find ManagedLibertyServers + ansible.builtin.set_fact: + mls: >- + {{ + serverListOutput.stdout + | regex_findall('servers/([^|]+)\|server\.xml') + }} + + # - name: Debug found these ManagedLibertyServers + # ansible.builtin.debug: + # var: mls + + - name: Copy stop_mls.jy + ansible.builtin.template: + src: stop_mls.jy.j2 + dest: stop_mls.jy + mode: '0755' + + - name: Stop ManagedLibertyServer + ansible.builtin.shell: "{{ install_base }}/{{ twas_dir }}/profiles/{{ profile_name }}/bin/wsadmin{{ ext }} -username {{ twas_username }} -password {{ twas_password }} -lang jython -f stop_mls.jy {{ item }}" + register: stopMlsOutput + failed_when: ( stopMlsOutput.rc not in [ 0,105 ] ) + with_items: '{{ mls }}' + timeout: 300 + + - name: ManagedLibertyServer stop output + ansible.builtin.debug: + msg: "rc={{ item.rc }}" + with_items: "{{ stopMlsOutput.results }}" + loop_control: + label: "{{ item.stdout }}" + failed_when: + - '" Error " in item.stdout' + rescue: + - ansible.builtin.include_role: + name: was_kill_process + diff --git a/ansible/roles/twas_stop_mls/templates/list_mls.jy.j2 b/ansible/roles/twas_stop_mls/templates/list_mls.jy.j2 new file mode 100644 index 000000000..d2ad04902 --- /dev/null +++ b/ansible/roles/twas_stop_mls/templates/list_mls.jy.j2 @@ -0,0 +1,2 @@ +mls_list=AdminTask.listServers('[-serverType MANAGED_LIBERTY_SERVER -nodeName {{ profile_name }}]') +print(mls_list) \ No newline at end of file diff --git a/ansible/roles/twas_stop_mls/templates/stop_mls.jy.j2 b/ansible/roles/twas_stop_mls/templates/stop_mls.jy.j2 new file mode 100644 index 000000000..360b68cd9 --- /dev/null +++ b/ansible/roles/twas_stop_mls/templates/stop_mls.jy.j2 @@ -0,0 +1,3 @@ +if len(sys.argv) == 1: + mls_stop=AdminControl.stopServer(str(sys.argv[0]),'{{ profile_name }}') + print(mls_stop) \ No newline at end of file diff --git a/ansible/roles/twas_ulb_versions/meta/main.yml b/ansible/roles/twas_ulb_versions/meta/main.yml new file mode 100644 index 000000000..1397bfd39 --- /dev/null +++ b/ansible/roles/twas_ulb_versions/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: twas_cell_defaults diff --git a/ansible/roles/twas_ulb_versions/readme.md b/ansible/roles/twas_ulb_versions/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/twas_ulb_versions/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/twas_ulb_versions/tasks/main.yml b/ansible/roles/twas_ulb_versions/tasks/main.yml new file mode 100644 index 000000000..41da77cc7 --- /dev/null +++ b/ansible/roles/twas_ulb_versions/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: IM versions ULB + ansible.builtin.include_tasks: twas_ulb_versions.yml diff --git a/ansible/roles/twas_ulb_versions/tasks/twas_ulb_versions.yml b/ansible/roles/twas_ulb_versions/tasks/twas_ulb_versions.yml new file mode 100644 index 000000000..01744f5cd --- /dev/null +++ b/ansible/roles/twas_ulb_versions/tasks/twas_ulb_versions.yml @@ -0,0 +1,102 @@ +--- +- name: Check if install_base exists + ansible.builtin.stat: + path: "{{ install_base }}/IM/eclipse/tools/imcl" + register: isimcl + +- name: Check if install_base is a directory + when: isimcl.stat.exists + block: + + - name: ULB imcl listInstalledPackages + ansible.builtin.shell: "{{ install_base }}/IM/eclipse/tools/imcl listInstalledPackages -long" + register: imOutput + +# /opt/IM/eclipse : com.ibm.cic.agent_1.9.2003.20220917_1018 : IBM® Installation Manager : 1.9.2.3 +# /opt/IBM/WebSphere/Edge/ULB : com.ibm.java.jdk.v8_8.0.8040.20250328_0802 : IBM SDK, Java Technology Edition, Version 8 : 8.0.8.40 +# /opt/IBM/WebSphere/Edge/ULB : com.ibm.websphere.EDGELBIPV4IPV6.v90_9.0.5024.20250326_1821 : IBM WebSphere Edge Components: Load Balancer for IPV4 and IPV6 : 9.0.5.24 + + - name: Size of stdout_lines + delegate_to: localhost + ansible.builtin.set_fact: + max_counter: "{{ imOutput.stdout_lines | length }}" + + - name: Extract parts from the string + set_fact: + parts: "{{ my_string | regex_search('^([^:]+):([^:]+):([^:]+):([^:]+)$', '\\1,\\2,\\3,\\4') | split(',') }}" + vars: + my_string: "alpha:beta:gamma:delta" + + - name: Extract values from colon-separated string + set_fact: + values: "{{ (colon_separated_string|regex_replace('^.*:', ''))|split(':') }}" + vars: + colon_separated_string: "value1:value2:value3:value4" + + - name: Debug values + debug: + var: values + + - name: Create dict with plugin version(s) + ansible.builtin.set_fact: + plugin_version: "{{ plugin_version | default({}) | combine( { item: PluginVersionOutput.stdout_lines[item | int] }, recursive=True, list_merge='append' ) }}" + with_sequence: 'start=0 end={{ max_counter | int - 1 }}' + no_log: true + + - name: New dict plugin_version + ansible.builtin.set_fact: + versions: "{{{ ansible_fqdn : plugin_version }}}" + + # - name: New dict append_this + # delegate_to: localhost + # ansible.builtin.debug: + # msg: "{{ versions }}" + + - name: Write plugin versionInfo to json file + delegate_to: localhost + ansible.builtin.copy: + content: "{{ versions | to_nice_json( sort_keys=false ) }}" + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ plugin_versioninfo_json_file }}" + mode: '0444' + + - name: Check if version_level exists + ansible.builtin.stat: + path: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ version_level_json_file }}" + register: isjson + + - name: Block to init the seed version_level.json + when: isjson.stat.exists == False + block: + + - name: Inialize combined dict ( twas_ulb ) + delegate_to: localhost + ansible.builtin.set_fact: + combined_dict: {} + + - name: Save ( seed combined )( twas_ulb ) + delegate_to: localhost + ansible.builtin.copy: + content: "{{ combined_dict }}" + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ version_level_json_file }}" + mode: '0444' + + - name: Save IHS/PLG/WCT to version_level json ( combined ) + delegate_to: localhost + ansible.builtin.copy: + content: "{{ lookup('ansible.builtin.file', '{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ version_level_json_file }}') | from_json | ansible.builtin.combine(lookup('ansible.builtin.file', '{{ item }}') | from_json, recursive=True, list_merge='append' )}}" + dest: "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/{{ version_level_json_file }}" + mode: '0444' + with_items: + - "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/ihs_{{ version_level_json_file }}" + - "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/plg_{{ version_level_json_file }}" + - "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/wct_{{ version_level_json_file }}" + + - name: Remove local source json after combine + with_items: + - "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/ihs_{{ version_level_json_file }}" + - "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/plg_{{ version_level_json_file }}" + - "{{ logs_dir }}/{{ env_name }}/{{ ansible_fqdn }}/wct_{{ version_level_json_file }}" + delegate_to: localhost + ansible.builtin.file: + state: absent + path: "{{ item }}" \ No newline at end of file diff --git a/ansible/roles/vnc/tasks/vnc.RedHat.yml b/ansible/roles/vnc/tasks/vnc.RedHat.yml index d3596d81a..1adca1572 100644 --- a/ansible/roles/vnc/tasks/vnc.RedHat.yml +++ b/ansible/roles/vnc/tasks/vnc.RedHat.yml @@ -7,29 +7,13 @@ key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}" - block: - - name: remove extraneous packages - become: yes - ignore_errors: yes - dnf: - name: "{{ packages }}" - state: absent - autoremove: yes - vars: - packages: - - "adobe*" - - "containers*" - - "java*" - - "samba*" - - "valgrind*" - - "tignervnc" - - name: install the workstation group - command: "dnf -y groupinstall 'Server with GUI'" + command: "dnf -y groupinstall 'Server with GUI' --allowerasing" register: manualdnf - become: yes + become: true - name: install rhel packages - become: yes + become: true dnf: name: "{{ packages }}" state: present @@ -60,7 +44,7 @@ state: present regexp: ':1=' line: ":1={{ ansible_user }}" - become: yes + become: true - name: add vnc geometry lineinfile: @@ -68,7 +52,7 @@ state: present regexp: 'geometry=' line: "geometry=1852x1100" - become: yes + become: true - name: add vnc session lineinfile: @@ -76,7 +60,7 @@ state: present regexp: 'session=' line: "session=gnome" - become: yes + become: true - name: vnc pass shell: "echo 'vncPassw0rd' | vncpasswd -f > ~/.vnc/passwd" @@ -94,7 +78,7 @@ - name: user vnc enable command: "systemctl enable vncserver@:1 --now" register: uservncenable - become: yes + become: true - name: purge directories file: diff --git a/ansible/roles/was_automation_register/tasks/liberty.yml b/ansible/roles/was_automation_register/tasks/liberty.yml index 8df814160..fcbcf1fa3 100644 --- a/ansible/roles/was_automation_register/tasks/liberty.yml +++ b/ansible/roles/was_automation_register/tasks/liberty.yml @@ -110,8 +110,8 @@ - name: stop liberty servers ( if server not running an error will be produced - ignore and no_log ) command: "{{ wa_target_path }}/bin/server stop {{ item }}" register: stop_server_servers - ignore_errors: yes - no_log: yes + ignore_errors: true + no_log: true with_items: - "{{ liberty_servers }}" diff --git a/ansible/roles/was_automation_register/tasks/twas.yml b/ansible/roles/was_automation_register/tasks/twas.yml index e4162e2d5..ded8af813 100644 --- a/ansible/roles/was_automation_register/tasks/twas.yml +++ b/ansible/roles/was_automation_register/tasks/twas.yml @@ -5,9 +5,9 @@ dest: ~/ mode: '0755' -- name: find owner of wsadmin.sh +- name: find owner of wsadmin{{ ext }} ansible.builtin.stat: - path: "{{ wa_target_path }}/bin/wsadmin.sh" + path: "{{ wa_target_path }}/bin/wsadmin{{ ext }}" register: wasowner - name: set become of file owners are non-root @@ -29,7 +29,7 @@ replace: 'com.ibm.ws.scripting.echoparams=false' # check the status of the dmgr - # [nest@nest-wa-twas855 ~]$ /opt/WAS/profiles/dmgr/bin/serverStatus.sh dmgr + # [nest@nest-wa-twas855 ~]$ /opt/WAS/profiles/dmgr/bin/serverStatus{{ ext }} dmgr #ADMU0116I: Tool information is being logged in file # /opt/WAS/profiles/dmgr/logs/dmgr/serverStatus.log #ADMU0128I: Starting tool with the dmgr profile @@ -40,7 +40,7 @@ - name: check the dmgr status become: '{{ was_become }}' no_log: true - shell: "bin/serverStatus.sh dmgr -username {{ wsadmin_username }} -password {{ wsadmin_password }}" + shell: "bin/serverStatus{{ ext }} dmgr -username {{ wsadmin_username }} -password {{ wsadmin_password }}" args: chdir: "{{ wa_target_path }}" register: dmgr_status @@ -77,9 +77,9 @@ - trustStorePassword is defined - trustStorePassword | length > 1 -- name: run wsadmin.sh +- name: run wsadmin{{ ext }} become: '{{ was_become }}' - shell: "bin/wsadmin.sh -lang jython -username {{ wsadmin_username }} -password {{ wsadmin_password }} -f ~/configuretWasUsageMetering.py url={{ wa_url }} apikey={{ api_key }} {{ key1 }}={{ value1 }} startServers={{ startServers }}" + shell: "bin/wsadmin{{ ext }} -lang jython -username {{ wsadmin_username }} -password {{ wsadmin_password }} -f ~/configuretWasUsageMetering.py url={{ wa_url }} apikey={{ api_key }} {{ key1 }}={{ value1 }} startServers={{ startServers }}" args: chdir: "{{ wa_target_path }}" register: wsadmin diff --git a/ansible/roles/was_automation_register/templates/was-usage-metering.xml.j2 b/ansible/roles/was_automation_register/templates/was-usage-metering.xml.j2 index 0557aa040..f56ebdfa1 100644 --- a/ansible/roles/was_automation_register/templates/was-usage-metering.xml.j2 +++ b/ansible/roles/was_automation_register/templates/was-usage-metering.xml.j2 @@ -10,7 +10,7 @@ + sslProtocol="TLSv1.2,TLSv1.3"/> diff --git a/ansible/roles/was_kill_process/readme.md b/ansible/roles/was_kill_process/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/was_kill_process/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/was_kill_process/tasks/main.yml b/ansible/roles/was_kill_process/tasks/main.yml new file mode 100644 index 000000000..07c6a5e54 --- /dev/null +++ b/ansible/roles/was_kill_process/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: WAS Kill Process + include_tasks: was_kill_process.yml diff --git a/ansible/roles/was_kill_process/tasks/was_kill_process.yml b/ansible/roles/was_kill_process/tasks/was_kill_process.yml new file mode 100644 index 000000000..48d6f8d87 --- /dev/null +++ b/ansible/roles/was_kill_process/tasks/was_kill_process.yml @@ -0,0 +1,42 @@ +--- +- name: Unix kill a process + when: ansible_system is not search('CYG') + block: + # logic below to force kill linux process + - name: Get running processes list from remote host + ignore_errors: true + ansible.builtin.shell: "ps -few | grep {{ linux_process_to_kill }} | awk '{print $2}'" + register: running_processes + + - name: Kill running processes + ignore_errors: true + ansible.builtin.shell: "kill {{ item }}" + with_items: "{{ running_processes.stdout_lines }}" + + - name: Kill wait_for + ansible.builtin.wait_for: + path: "/proc/{{ item }}/status" + state: absent + timeout: 60 + with_items: "{{ running_processes.stdout_lines }}" + ignore_errors: true + register: WsServer_processes + + - name: Force kill stuck processes + ignore_errors: true + ansible.builtin.shell: "kill -9 {{ item }}" + with_items: "{{ WsServer_processes.results | select('failed') | map(attribute='item') | list }}" + +- name: Windoze reboot system + when: ansible_system is search('CYG') + block: + - name: Reboot Windows manually + ansible.builtin.shell: shutdown /r /t 0 + async: 0 + poll: 0 + ignore_errors: true + + - name: Wait for system to come back online + ansible.builtin.wait_for_connection: + timeout: 600 + delay: 30 diff --git a/ansible/roles/was_local_logs_remove/defaults/main.yml b/ansible/roles/was_local_logs_remove/defaults/main.yml new file mode 100644 index 000000000..3cb55960a --- /dev/null +++ b/ansible/roles/was_local_logs_remove/defaults/main.yml @@ -0,0 +1,4 @@ +--- + +env_name: myLibertyEnv +logs_dir: "{{ playbook_dir }}" # location on the ansible controller diff --git a/ansible/roles/was_local_logs_remove/readme.md b/ansible/roles/was_local_logs_remove/readme.md new file mode 100644 index 000000000..d13f2feb6 --- /dev/null +++ b/ansible/roles/was_local_logs_remove/readme.md @@ -0,0 +1,46 @@ +Role Name +========= + +A brief description of the role goes here. + +------------ + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +| Variable | Required | Default | Choices | Comments | +|-------------------------|----------|---------|---------------------------|------------------------------------------| +| foo | no | false | true, false | example variable | +| bar | yes | | eggs, spam | example variable | + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +```yaml + - hosts: all + roles: + - ansible-role-template +``` + +License +------- + +See [LICENSE](https://github.com/IBM/community-automation/blob/master/LICENSE) + +Author Information +------------------ + +Add author diff --git a/ansible/roles/was_local_logs_remove/tasks/main.yml b/ansible/roles/was_local_logs_remove/tasks/main.yml new file mode 100644 index 000000000..7b7134bcf --- /dev/null +++ b/ansible/roles/was_local_logs_remove/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Remove the local logs + ansible.builtin.include_tasks: was_local_logs_remove.yml diff --git a/ansible/roles/was_local_logs_remove/tasks/was_local_logs_remove.yml b/ansible/roles/was_local_logs_remove/tasks/was_local_logs_remove.yml new file mode 100644 index 000000000..661c0c64e --- /dev/null +++ b/ansible/roles/was_local_logs_remove/tasks/was_local_logs_remove.yml @@ -0,0 +1,14 @@ +--- + +- name: Remove local logs directory + delegate_to: localhost + ansible.builtin.file: + path: "{{ logs_dir }}/{{ env_name }}" + state: absent + +# - name: Create local logs directory +# delegate_to: localhost +# ansible.builtin.file: +# path: "{{ logs_dir }}/{{ env_name }}" +# state: directory +# mode: '0755' diff --git a/ansible/setup-new-fyre-host-play/Jenkinsfile b/ansible/setup-new-fyre-host-play/Jenkinsfile deleted file mode 100644 index 1690b807d..000000000 --- a/ansible/setup-new-fyre-host-play/Jenkinsfile +++ /dev/null @@ -1,37 +0,0 @@ -#! groovy - -// Standard job properties -def jobProps = [ - buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '50')), - disableResume(), - durabilityHint("PERFORMANCE_OPTIMIZED"), - [$class: 'RebuildSettings', autoRebuild: false, rebuildDisabled: false] -] - -def paramsList = [ - string(name: 'osnames', defaultValue: 'changeMyhostname', description: 'comma delimitted list of IPs or hostnames'), - string(name: 'regionTimeZone', defaultValue: 'America/New_York', description: 'set the timezone->https://en.wikipedia.org/wiki/List_of_tz_database_time_zones'), - string(name: 'authorized_keys_url', defaultValue: '"{{ lookup(\'file\', \'/mnt/data/.load_secrets_dir/nest_infrastructure.keys\') }}"', description: 'URL location of a file containg id_rsa.pub keys'), - string(name: 'load_secrets_dir', defaultValue: '/mnt/data/.load_secrets_dir', description: 'location secrets'), - string(name: 'passwordfile', defaultValue: '/mnt/data/.load_secrets_dir/.password', description: 'location secrets'), - ] -jobProps.push(parameters(paramsList)) - -properties(jobProps) - -timestamps { - ansiColor('xterm') { - node ( 'kube_pod_slave' ) { - - //def scmVars = checkout scm - checkout scm - stage('Stage 1') { - sh """ - set +x # hide sensitive info being echo'd to log - export ANSIBLE_FORCE_COLOR=true - cp ./ansible/setup-new-fyre-host-play/examples/inventory ./ansible/setup-new-fyre-host-play/; ansible-playbook -i ${params.osnames}, ./ansible/setup-new-fyre-host-play/setup-new-fyre-host-play.yml -e regionTimeZone=${params.regionTimeZone} -e authorized_keys_url=${params.authorized_keys_url} -e load_secrets_dir=${params.load_secrets_dir} --vault-password-file=${params.passwordfile} - """.stripIndent() - } - } - } -} diff --git a/ansible/setup-new-fyre-host-play/Jenkinsfile.setup_nest_defaults b/ansible/setup-new-fyre-host-play/Jenkinsfile.setup_nest_defaults new file mode 100644 index 000000000..474054a5b --- /dev/null +++ b/ansible/setup-new-fyre-host-play/Jenkinsfile.setup_nest_defaults @@ -0,0 +1,37 @@ +#! groovy +pipeline { + agent { label 'rtp' } + + parameters { + string(name: 'osnames', defaultValue: 'changeMyhostname', description: 'comma delimitted list of IPs or hostnames') + booleanParam(name: 'twas855x', defaultValue: false, description: 'set true if installing tWAS855x WCT on x64 - requires 32bit libs') + string(name: 'regionTimeZone', defaultValue: 'America/New_York', description: 'set the timezone->https://en.wikipedia.org/wiki/List_of_tz_database_time_zones') + string(name: 'authorized_keys_url', defaultValue: '"{{ lookup(\'file\', \'/mnt/data/.load_secrets_dir/nest_infrastructure.keys\') }}"', description: 'URL location of a file containg id_rsa.pub keys') + string(name: 'load_secrets_dir', defaultValue: '/mnt/data/.load_secrets_dir', description: 'location secrets') + string(name: 'passwordfile', defaultValue: '/mnt/data/.load_secrets_dir/.password', description: 'location secrets') + } + environment { + ANSIBLE_FORCE_COLOR=true + } + + stages { + stage('setNestDefaults') { + agent { label 'rtp' } + when { + allOf { + //branch 'main' + triggeredBy cause: "UserIdCause" + } + } + steps { + ansiColor('xterm') { + sh """ + set +x # hide sensitive info being echo'd to log + ANSIBLE_FORCE_COLOR=true + cp ./ansible/setup-new-fyre-host-play/examples/inventory ./ansible/setup-new-fyre-host-play/; ansible-playbook -i $osnames, ./ansible/setup-new-fyre-host-play/setup-new-fyre-host-play.yml -e twas855x=$twas855x -e regionTimeZone=$regionTimeZone -e authorized_keys_url=$authorized_keys_url -e load_secrets_dir=$load_secrets_dir --vault-password-file=$passwordfile + """ + } + } + } + } +} diff --git a/ansible/setup-new-fyre-host-play/setup-new-fyre-host-play.yml b/ansible/setup-new-fyre-host-play/setup-new-fyre-host-play.yml index 8e8e7a791..1175271b4 100644 --- a/ansible/setup-new-fyre-host-play/setup-new-fyre-host-play.yml +++ b/ansible/setup-new-fyre-host-play/setup-new-fyre-host-play.yml @@ -6,8 +6,9 @@ - ansible_ssh_common_args: -o StrictHostKeyChecking=no - ansible_user: root roles: - - role: osprereqs - role: nestuser - role: fix_fyre_hosts_file + - role: osprereqs - role: timezone - role: authorized_keys + - role: issue_net diff --git a/ansible/was-automation-register/Jenkinsfile.Liberty b/ansible/was-automation-register/Jenkinsfile.Liberty index c6d8570c7..8981a023f 100644 --- a/ansible/was-automation-register/Jenkinsfile.Liberty +++ b/ansible/was-automation-register/Jenkinsfile.Liberty @@ -24,7 +24,7 @@ properties(jobProps) timestamps { ansiColor('xterm') { - node ( 'kube_pod_slave' ) { + node { //def scmVars = checkout scm checkout scm diff --git a/ansible/was-automation-register/Jenkinsfile.tWAS b/ansible/was-automation-register/Jenkinsfile.tWAS index 2694f59ef..12ab3a7ab 100644 --- a/ansible/was-automation-register/Jenkinsfile.tWAS +++ b/ansible/was-automation-register/Jenkinsfile.tWAS @@ -26,7 +26,7 @@ properties(jobProps) timestamps { ansiColor('xterm') { - node ( 'kube_pod_slave' ) { + node { //def scmVars = checkout scm checkout scm diff --git a/ansible/was-automation-register/Jenkinsfile.tWAS.remove b/ansible/was-automation-register/Jenkinsfile.tWAS.remove index b27819ef5..49ee358f9 100644 --- a/ansible/was-automation-register/Jenkinsfile.tWAS.remove +++ b/ansible/was-automation-register/Jenkinsfile.tWAS.remove @@ -19,7 +19,7 @@ properties(jobProps) timestamps { ansiColor('xterm') { - node ( 'kube_pod_slave' ) { + node { //def scmVars = checkout scm checkout scm diff --git a/ansible/was-automation-register/Jenkinsfile.test b/ansible/was-automation-register/Jenkinsfile.test index 5a5c91907..0a85390c9 100644 --- a/ansible/was-automation-register/Jenkinsfile.test +++ b/ansible/was-automation-register/Jenkinsfile.test @@ -24,7 +24,7 @@ properties(jobProps) timestamps { ansiColor('xterm') { - node ( 'kube_pod_slave' ) { + node { //def scmVars = checkout scm checkout scm diff --git a/.travis.yml b/disable.travis.yml similarity index 100% rename from .travis.yml rename to disable.travis.yml diff --git a/docs/jenkinsfile.md b/docs/jenkinsfile.md index 03ccc3452..f1786f77b 100644 --- a/docs/jenkinsfile.md +++ b/docs/jenkinsfile.md @@ -31,7 +31,7 @@ properties(jobProps) timestamps { ansiColor('xterm') { - node ( 'kube_pod_slave' ) { + node { checkout scm