File ardana-db-8.0+git.1583944923.03cca6c.obscpio of Package ardana-db

07070100000000000081A40000000000000000000000015E6914DB0000007E000000000000000000000000000000000000003000000000ardana-db-8.0+git.1583944923.03cca6c/.gitreview[gerrit]
host=gerrit.suse.provo.cloud
port=29418
project=ardana/db-ansible.git
defaultremote=ardana
defaultbranch=stable/pike
07070100000001000081A40000000000000000000000015E6914DB0000000C000000000000000000000000000000000000003300000000ardana-db-8.0+git.1583944923.03cca6c/.rsync-filter- ardana-ci
07070100000002000081A40000000000000000000000015E6914DB0000279F000000000000000000000000000000000000002D00000000ardana-db-8.0+git.1583944923.03cca6c/LICENSE
                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

07070100000003000081A40000000000000000000000015E6914DB0000049E000000000000000000000000000000000000002F00000000ardana-db-8.0+git.1583944923.03cca6c/README.md
(c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
(c) Copyright 2017 SUSE LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.


README
======
percona-deploy.yml - deploys percona cluster.
percona-start.yml  - starts percona services, if all services down on all nodes percona-bootstrap
                     will need to be run.
percona-stop.yml   - stops percona .  If run on ALL nodes a manual bootstrap will need to be run.
percona-bootstrap.yml - Starts percona when all cluster nodes are down
percona-reconfigure.yml - Reconfigures Percona when a config change is made
percona-upgrade.yml - Upgrades Percona to a new version
percona-status.yml - Reports on the status of Percona Services
07070100000004000041ED0000000000000000000000045E6914DB00000000000000000000000000000000000000000000002F00000000ardana-db-8.0+git.1583944923.03cca6c/ardana-ci07070100000005000041ED0000000000000000000000035E6914DB00000000000000000000000000000000000000000000003700000000ardana-db-8.0+git.1583944923.03cca6c/ardana-ci/project07070100000006000041ED0000000000000000000000035E6914DB00000000000000000000000000000000000000000000004300000000ardana-db-8.0+git.1583944923.03cca6c/ardana-ci/project/input-model07070100000007000041ED0000000000000000000000025E6914DB00000000000000000000000000000000000000000000004800000000ardana-db-8.0+git.1583944923.03cca6c/ardana-ci/project/input-model/data07070100000008000081A40000000000000000000000015E6914DB00000927000000000000000000000000000000000000005A00000000ardana-db-8.0+git.1583944923.03cca6c/ardana-ci/project/input-model/data/control_plane.yml#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
  product:
    version: 2

  control-planes:
    - name: cp1
      control-plane-prefix: cp1
      failure-zones:
        - AZ1

      common-service-components:
        - lifecycle-manager-target
      load-balancers:
        - provider: ip-cluster
          name: lb
          components:
            - default
          roles:
            - internal
            - admin
        - provider: ip-cluster
          name: extlb
          external-name: myardana-cp1.test
          components:
            - default
          roles:
            - public
      clusters:
        - name: cluster0
          cluster-prefix: c0
          server-role:
            - SERVER1-ROLE
          member-count: 1
          allocation-policy: strict
          service-components:
            - lifecycle-manager-target
            - lifecycle-manager
            - rabbitmq
            - keystone-api
            - mysql
            - ip-cluster
    - name: cp2
      uses:
        - from: cp1
          service-components:
            - all
      control-plane-prefix: cp2
      failure-zones:
        - AZ1
        - AZ2
        - AZ3
      common-service-components:
        - lifecycle-manager-target
      load-balancers:
        - provider: ip-cluster
          name: lb
          components:
            - default
          roles:
            - internal
            - admin
      clusters:
        - name: cluster1
          cluster-prefix: c1
          server-role:
            - SERVER2-ROLE
            - SERVER3-ROLE
            - SERVER4-ROLE
          member-count: 3
          allocation-policy: strict
          service-components:
            - ntp-server
            - mysql
            - ip-cluster
07070100000009000081A40000000000000000000000015E6914DB0000051E000000000000000000000000000000000000005B00000000ardana-db-8.0+git.1583944923.03cca6c/ardana-ci/project/input-model/data/network_groups.yml#
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
  product:
    version: 2

  network-groups:
    - name: ARDANA
      hostname-suffix: ardana
      component-endpoints:
        - lifecycle-manager
        - lifecycle-manager-target


    - name: MANAGEMENT
      hostname-suffix: mgmt
      hostname: true

      tags:
        - neutron.networks.vxlan
        - neutron.networks.vlan:
            provider-physical-network: physnet1

#      tls-component-endpoints:
#        - barbican-api
      component-endpoints:
        - default

#      routes:
#        - default

      load-balancers:
        - lb
        - extlb

    - name: EXTERNAL-VM
      tags:
        - neutron.l3_agent.external_network_bridge
0707010000000A000081A40000000000000000000000015E6914DB00000378000000000000000000000000000000000000005400000000ardana-db-8.0+git.1583944923.03cca6c/ardana-ci/project/input-model/data/regions.yml#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
  product:
    version: 2

  regions:
    - name: region1
      includes:
        - control-plane: cp1
          services:
            - all

    - name: region2
      includes:
        - control-plane: cp2
          services:
            - all
0707010000000B000081A40000000000000000000000015E6914DB000006C4000000000000000000000000000000000000005400000000ardana-db-8.0+git.1583944923.03cca6c/ardana-ci/project/input-model/data/servers.yml#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
  product:
    version: 2

  baremetal:
    netmask: 255.255.255.0
    subnet: 192.168.110.0
    server-interface: eth2

  servers:

    - id: server1
      ip-addr: 192.168.110.3
      role: SERVER1-ROLE
      server-group: RACK1
      mac-addr: a4:93:0c:4f:7c:73
      nic-mapping: VAGRANT
      ilo-ip: 192.168.109.3
      ilo-password: password
      ilo-user: admin

    - id: server2
      ip-addr: 192.168.110.4
      role: SERVER2-ROLE
      server-group: RACK1
      mac-addr: b2:72:8d:ac:7c:6f
      nic-mapping: VAGRANT
      ilo-ip: 192.168.109.4
      ilo-password: password
      ilo-user: admin

    - id: server3
      ip-addr: 192.168.110.5
      role: SERVER3-ROLE
      server-group: RACK2
      mac-addr: 8a:8e:64:55:43:76
      nic-mapping: VAGRANT
      ilo-ip: 192.168.109.5
      ilo-password: password
      ilo-user: admin

    - id: server4
      ip-addr: 192.168.110.6
      role: SERVER4-ROLE
      server-group: RACK3
      mac-addr: 9a:9e:64:55:43:67
      nic-mapping: VAGRANT
      ilo-ip: 192.168.109.5
      ilo-password: password
      ilo-user: admin

0707010000000C000041ED0000000000000000000000025E6914DB00000000000000000000000000000000000000000000003500000000ardana-db-8.0+git.1583944923.03cca6c/ardana-ci/tests0707010000000D000081ED0000000000000000000000015E6914DB0000070C000000000000000000000000000000000000004800000000ardana-db-8.0+git.1583944923.03cca6c/ardana-ci/tests/add-node-test.bash#!/bin/bash
#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#

serverid=$1
ipaddr=$2
role=$3
servergroup=$4
macaddr=$5
iloip=$6
clustername=$7
# adds a server entry into servers.yml based on provided args
cat <<EOF >> ~/openstack/my_cloud/definition/data/servers.yml
    - id: $serverid
      ip-addr: $ipaddr
      role: $role
      server-group: $servergroup
      mac-addr: $macaddr
      nic-mapping: VAGRANT
      ilo-ip: $iloip
      ilo-password: password
      ilo-user: admin
EOF

controlplane=~/openstack/my_cloud/definition/data/control_plane.yml
# get the member-count in cluster $7
membercount=$(grep -nA 10 "$clustername" $controlplane | awk '/member-count:/{print}' | cut -d ':' -f2 | xargs)
# get the linenumber of member count
linenum=$(grep -nA 10 "$clustername" $controlplane | awk '/member-count:/{print}' | cut -f1 -d"-")
# increase member-count by 1 in cluster $7
sed -i ''$linenum's/member-count: '$membercount'/member-count: '$((membercount + 1))'/' $controlplane
# add server role to control plane - get linenum of server role
serverrole=$(grep -nA 10 "$clustername" $controlplane | awk '/server-role:/{print}' | cut -f1 -d"-")
sed -i ''$serverrole' a\
            - '$role'' $controlplane
0707010000000E000081ED0000000000000000000000015E6914DB00000320000000000000000000000000000000000000004900000000ardana-db-8.0+git.1583944923.03cca6c/ardana-ci/tests/bootstrap-test.bash#!/bin/bash
#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# This simulates the bootstrap in the percona play
if [ `hostname` == "$1" ]
then
  sudo service mysql bootstrap-pxc
  sudo service mysql restart
fi
0707010000000F000081A40000000000000000000000015E6914DB0000048F000000000000000000000000000000000000004500000000ardana-db-8.0+git.1583944923.03cca6c/ardana-ci/tests/change-repo.yml#
# (c) Copyright 2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- hosts: FND-MDB
  tasks:
  - name: create 192_168_10_3_79_ardana_sources.list
    become: yes
    file:
      path: /etc/apt/sources.list.d/192_168_10_3_79_ardana_sources.list
      state: touch

  - name: change apt-repo
    become: yes
    lineinfile:
      dest: /etc/apt/sources.list.d/192_168_10_3_79_ardana_sources.list
      line: "deb [arch=amd64] http://apt.suse.provo.cloud/apt/hlinux-deejay.us.rdlabs.hpecorp.net/hLinuxArchive/2016/{{ repo }} cattleprod main contrib non-free"

  - name: install aptitude
    become: yes
    apt:
      name: aptitude
      update_cache: yes
07070100000010000081A40000000000000000000000015E6914DB0000041E000000000000000000000000000000000000004C00000000ardana-db-8.0+git.1583944923.03cca6c/ardana-ci/tests/check-cluster-size.yml#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- hosts: FND-MDB
  tasks:
  - name: project-stack | remove-node | Check cluster size on every host
    become: yes
    shell: mysql -sNe "SHOW GLOBAL STATUS LIKE 'wsrep_cluster_size'"| awk '{print $2}'
    register: mysql_cluster_size

  - name: project-stack | remove-node | Validate correct cluster size
    fail:
      msg: "the cluster size is incorrect"
    when: cluster_size != mysql_cluster_size.stdout
07070100000011000081A40000000000000000000000015E6914DB00000566000000000000000000000000000000000000004600000000ardana-db-8.0+git.1583944923.03cca6c/ardana-ci/tests/check-tables.yml#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- hosts: FND-MDB
  tasks:
  - name: FND_MDB | project-stack | check table exists
    become: yes
    shell: mysql --execute="USE test; SHOW TABLES LIKE 'test';"
    register: table_state
    ignore_errors: True

  - name: FND_MDB | project-stack | fail if table doesn't exist
    fail:
      msg: "Can't access the test database"
    when: table_state | failed

  - name: FND_MDB | project-stack | check if row exists
    become: yes
    shell: mysql --execute="USE test; SELECT * FROM test;"
    register: table_contents

  - name: FND_MDB | project-stack | fail if row doesn't exist
    fail:
      msg: >
        "The table test appears to not exist,
        data is being lost please report this"
    when: table_contents.stdout == ""
07070100000012000081ED0000000000000000000000015E6914DB00000456000000000000000000000000000000000000003F00000000ardana-db-8.0+git.1583944923.03cca6c/ardana-ci/tests/copy.bash#!/bin/bash
#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#

# $1 playbook name
# $2 can be limit or extra var
# $3 will be extra var when $2 is set
cp ~/ardana-ci-tests/$1 ~/scratch/ansible/next/ardana/ansible
if [ -n "$3" ]
then
  ansible-playbook -i hosts/verb_hosts $1 $2 -e $3
  status=$?
else
  if [ -n "$2" ];
  then
    ansible-playbook -i hosts/verb_hosts $1 -e $2
    status=$?
  else
    ansible-playbook -i hosts/verb_hosts $1
    status=$?
  fi
fi
rm ~/scratch/ansible/next/ardana/ansible/$1
exit $status

07070100000013000081A40000000000000000000000015E6914DB000005B8000000000000000000000000000000000000004A00000000ardana-db-8.0+git.1583944923.03cca6c/ardana-ci/tests/create-test-data.yml#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- hosts: FND-MDB
  tasks:
  - include_vars: roles/FND-MDB/defaults/main.yml
  - name: FND_MDB | project-stack | Create DB
    become: yes
    mysql_db:
      login_user: "{{ mysql_root_user }}"
      login_password: "{{ mysql_root_pwd }}"
      name: "test"
    run_once_per: verb_hosts.FND_MDB

  - name: FND_MDB | project-stack | create table
    become: yes
    shell: >
      mysql --execute="USE test; CREATE TABLE test LIKE mysql.user;"
    run_once_per: verb_hosts.FND_MDB

  - name: FND_MDB | project-stack | check if row exists
    become: yes
    shell: mysql --execute="USE test; SELECT * FROM test;"
    register: table_contents

  - name: FND_MDB | project-stack | create row
    become: yes
    shell: >
      mysql --execute="USE test; INSERT INTO test () VALUES();;"
    when: table_contents.stdout == ""
07070100000014000081A40000000000000000000000015E6914DB0000031A000000000000000000000000000000000000004800000000ardana-db-8.0+git.1583944923.03cca6c/ardana-ci/tests/pwd_change_cp1.yml#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
mysql_root_pwd:
  value: "mynewpassword"
  metadata:
  - clusters:
    - cluster0
    component: mysql
    consuming-cp: cp1
    cp: cp1
  version: '2.0'

07070100000015000081A40000000000000000000000015E6914DB0000031A000000000000000000000000000000000000004800000000ardana-db-8.0+git.1583944923.03cca6c/ardana-ci/tests/pwd_change_cp2.yml#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
mysql_root_pwd:
  value: "mynewpassword"
  metadata:
  - clusters:
    - cluster1
    component: mysql
    consuming-cp: cp2
    cp: cp2
  version: '2.0'

07070100000016000081ED0000000000000000000000015E6914DB0000055E000000000000000000000000000000000000004B00000000ardana-db-8.0+git.1583944923.03cca6c/ardana-ci/tests/remove-node-test.bash#!/bin/bash
#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
server_name=$1
serverrole=$2
clustername=$3
controlplane=~/openstack/my_cloud/definition/data/control_plane.yml
# remove server $1 from servers.yml
sed -i '/id: '$server_name'/,+9d' ~/openstack/my_cloud/definition/data/servers.yml
# remove server role from control plane
sed -i '/'$serverrole'/d' $controlplane
# get member count from control plane
membercount=$(grep -nA 10 "$clustername" $controlplane | awk '/member-count:/{print}' | cut -d ':' -f2 | xargs)
# get line number of member-count
linenum=$(grep -nA 10 "$clustername" $controlplane | awk '/member-count:/{print}' | cut -f1 -d"-")
# reduce member-count by 1
sed -i ''$linenum's/member-count: '$membercount'/member-count: '$((membercount - 1))'/' $controlplane
07070100000017000081A40000000000000000000000015E6914DB00000077000000000000000000000000000000000000004D00000000ardana-db-8.0+git.1583944923.03cca6c/ardana-ci/tests/remove-sources.list.yml---
- hosts: FND-MDB
  tasks:
  - name: delete sources.list
    become: yes
    shell: rm -f /etc/apt/sources.list.d/*
07070100000018000081A40000000000000000000000015E6914DB00000337000000000000000000000000000000000000004A00000000ardana-db-8.0+git.1583944923.03cca6c/ardana-ci/tests/remove-test-data.yml#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- hosts: FND-MDB
  tasks:
    - name: FND_MDB | project-stack | drop db
      become: yes
      shell: mysql --execute="DROP DATABASE test;"
      run_once_per: verb_hosts.FND_MDB
07070100000019000081ED0000000000000000000000015E6914DB000003B1000000000000000000000000000000000000004100000000ardana-db-8.0+git.1583944923.03cca6c/ardana-ci/tests/run-cp.bash#!/bin/bash
#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
cd ~/openstack/ardana/ansible
git add -A
git commit -m "My config or other commit message"
ansible-playbook -i hosts/localhost config-processor-run.yml -e remove_deleted_servers="y" -e free_unused_addresses="y" -e encrypt="" -e rekey=""
ansible-playbook -i hosts/localhost ready-deployment.yml
0707010000001A000081ED0000000000000000000000015E6914DB00000417000000000000000000000000000000000000004400000000ardana-db-8.0+git.1583944923.03cca6c/ardana-ci/tests/test-conf.bash#!/bin/bash
#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
#  test-conf cp1 value my.cnf
#  tests to see if value is in my.cnf on cp1 and not in my.cnf
#  on any other control plane
set -vx
echo " $1 $2 $3"
cnfstatus=0
if [[ $(hostname) == *"$1"* ]]
then
  sudo grep  "$2" "$3"
  if [[ $? == 1 ]]
  then
    cnfstatus=1
  fi
fi
if [[ $(hostname) != *"$1"* ]]
then
  sudo grep  "$2" "$3"
  if [[ $? == 0 ]]
  then
    cnfstatus=1
  fi
fi
exit $cnfstatus


0707010000001B000081ED0000000000000000000000015E6914DB0000048D000000000000000000000000000000000000004A00000000ardana-db-8.0+git.1583944923.03cca6c/ardana-ci/tests/test-mysql-conf.bash#!/bin/bash
#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# e.g
#    test-mysql-conf cp1 slow_query_log ON
# tests if slow_query_log is set ON on cp1 and
# NOT set ON elsewhere if this is run elsewhere
#  Currently only run on the deployer
set -vx
echo " $1 $2 $3"
cnfstatus=0
if [[ $(hostname) == *"$1"* ]]
then
  sudo mysql -e "show variables like '$2'" | grep $3
  if [[ $? == 1 ]]
  then
    cnfstatus=1
  fi
fi
if [[ $(hostname) != *"$1"* ]]
then
  sudo mysql -e "show variables like '$2'" | grep  $3
  if [[ $? == 0 ]]
  then
    cnfstatus=1
  fi
fi
exit $cnfstatus
0707010000001C000081A40000000000000000000000015E6914DB00002BF1000000000000000000000000000000000000004400000000ardana-db-8.0+git.1583944923.03cca6c/ardana-ci/tests/test-plan.yaml#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---

# note: aptitude is not installed at this point and is installed as part of these tests
- name: remove-mysql
  logfile: testsuite-remove.log
  prefix: remove
  playbooks:
    - percona-remove.yml -e automate=true

- name: remove apt repos
  logfile: testsuite-remove.log
  prefix: remove
  exec:
    - copy.bash remove-sources.list.yml

- name: update apt repo
  logfile: testsuite-upgrade.log
  prefix: remove
  exec:
    - copy.bash change-repo.yml repo=hos2.1.6_ga-0

- name: deploy percona 5.5
  logfile: testsuite-upgrade.log
  prefix: deploy-5.5
  playbooks:
    - percona-deploy.yml

- name: create-test-data
  logfile: testsuite-remove.log
  prefix: remove
  exec:
    - copy.bash create-test-data.yml
##
- name: change apt-repo
  logfile: testsuite-upgrade.log
  prefix: change-apt-repo
  exec:
    - copy.bash change-repo.yml repo=hos3.0_beta-2

- name: test major pre upgrade
  logfile: testsuite-upgrade.log
  prefix: upgrade
  playbooks:
    - percona-pre-upgrade.yml

- name: test major upgrade
  logfile: testsuite-upgrade.log
  prefix: upgrade
  playbooks:
    - percona-upgrade.yml --limit *cp1*

- name: test mysql version
  logfile: testsuite-upgrade.log
  prefix: upgrade
  exec:
    - validate-upgrade.bash 5.6.27-25.13-1.jessie

- name: test major upgrade
  logfile: testsuite-upgrade.log
  prefix: upgrade
  playbooks:
    - percona-upgrade.yml

- name: test major post upgrade
  logfile: testsuite-upgrade.log
  prefix: upgrade
  playbooks:
    - percona-post-upgrade.yml

- name: check-tables
  logfile: testsuite-remove.log
  prefix: remove
  exec:
    - copy.bash check-tables.yml

- name: change apt-repo
  logfile: testsuite-upgrade.log
  prefix: change-apt-repo
  exec:
    - copy.bash change-repo.yml repo=hos4.0_beta1

- name: test major pre upgrade
  logfile: testsuite-upgrade.log
  prefix: upgrade
  playbooks:
    - percona-pre-upgrade.yml

- name: test minor upgrade
  logfile: testsuite-upgrade.log
  prefix: upgrade
  playbooks:
    - percona-upgrade.yml --limit *cp1*

- name: test mysql version
  logfile: testsuite-upgrade.log
  prefix: upgrade
  exec:
    - validate-upgrade.bash 5.6.28-25.14-1+hpelinux2

- name: test minor upgrade
  logfile: testsuite-upgrade.log
  prefix: upgrade
  playbooks:
    - percona-upgrade.yml

- name: Test no op upgrade
  logfile: testsuite-upgrade.log
  prefix: upgrade
  playbooks:
    - percona-upgrade.yml

- name: test minor post upgrade
  logfile: testsuite-upgrade.log
  prefix: upgrade
  playbooks:
    - percona-post-upgrade.yml

- name: check-tables
  logfile: testsuite-remove.log
  prefix: remove
  exec:
    - copy.bash check-tables.yml

# Singleton Tests

# Test Normal Stop  (one node)
- name: Test stop one percona on singleton Cluster
  logfile: testsuite-stop.log
  prefix: stop-percona
  playbooks:
    - percona-stop.yml --limit=project-cp1-c0-m1-mgmt

# Test Normal Start  (one node) - commented out until https://review.hpcloud.net/#/c/117842 (TBD)
#- name: Test start one node
#  logfile: testsuite-start.log
#  prefix: start
#  playbooks:
#    - percona-start.yml --limit=project-cp1-c0-m1-mgmt
#  exit_status:2

# Test Percona Still down as bootstrap required until autombootstrap in (TBD)
- name: Validate percona Down
  logfile: testsuite-stop.log
  prefix: validate-percona-down
  exec:
    - validate-percona-down.bash

# Test Bootstrap  (one node) - commented out until auto-bootstrap has force flag as currently interactive (TBD)
#- name: Test start one node
#  logfile: testsuite-start.log
#  prefix: start
#  playbooks:
#    - percona-bootstrap.yml --limit=project-cp1-c0-m1-mgmt

# Remove when we have a forceflag (TBD)
- name: Bootstrap (workaround for no forceflag on percona-bootstrap)
  prefix: percona-bootstrap-in-test
  logfile: testsuite-stop.log
  exec:
    - bootstrap-test.bash project-cp1-c0-m1-mgmt

- name: Validate percona Up
  logfile: testsuite-stop.log
  prefix: validate-percona-up
  exec:
    - validate-percona-up.bash

- name: Test stop one percona on Multi-Node Cluster
  logfile: testsuite-stop.log
  prefix: stop-percona-one
  playbooks:
    - percona-stop.yml --limit=project-cp2-c1-m1-mgmt

- name: Test start one percona on Multi-Node Cluster
  logfile: testsuite-stop.log
  prefix: start-percona-one
  playbooks:
    - percona-start.yml --limit=project-cp2-c1-m1-mgmt

- name: Validate percona Up
  logfile: testsuite-stop.log
  prefix: validate-percona-up
  exec:
    - validate-percona-up.bash

# Test Noop Reconfigure
- name: Test Noop reconfigure
  logfile: testsuite-reconfigure-noop.log
  prefix: testsuite-reconfigure-noop
  playbooks:
    - percona-reconfigure.yml

# Test percona is up - This should test that percona has not restarted (TBD)
- name: Validate percona
  logfile: testsuite-reconfigure-noop.log
  prefix: validate-percona
  exec:
    - validate-percona-up.bash

- name: Update conf file change
  logfile: testsuite-reconfigure-conf-change.log
  prefix: update-conf-all
  exec:
    - update-conf.bash 's/slow_query_log          = 0/slow_query_log          = 1/g' ./percona/my.cfg.j2

- name: Test reconfigure conf file change
  logfile: testsuite-reconfigure-conf-change.log
  prefix: reconfigure-conf-all
  playbooks:
    - percona-reconfigure.yml

- name: Test Conf File change
  logfile: testsuite-reconfigure-conf-change.log
  prefix: test-mysql-conf
  exec:
    - test-mysql-conf.bash  cp1 slow_query_log ON

- name: Update conf file change for limit test
  logfile: testsuite-reconfigure-conf-change-limit.log
  prefix: update-conf-limited
  exec:
    - update-conf.bash 's/slow_query_log          = 1/slow_query_log          = 0/g' ./percona/my.cfg.j2

- name: Test reconfigure conf Limit to Single Control Plane
  logfile: testsuite-reconfigure-conf-change-limit.log
  prefix: reconfigure-conf-limited
  playbooks:
    - percona-reconfigure.yml  --limit=*cp1*

# Currently exec only runs on the deployer so the second exec cannot
# actually check the state of cp2 here . TBD checking how we fix this.
- name: Test Conf File change
  logfile: testsuite-reconfigure-conf-change-limit.log
  prefix: test-conf-limited
  exec:
    -  test-mysql-conf.bash cp1 slow_query_log OFF
    -  test-mysql-conf.bash cp2 slow_query_log ON

- name: Test - Reset to original of slow_query_log=0
  logfile: testsuite-reconfigure-conf-change-limit.log
  prefix: reconfigure-conf-limited
  playbooks:
    - percona-reconfigure.yml

- name: Update password  for single control plane
  logfile: testsuite-reconfigure-pwd-change.log
  prefix: update-pwd
  exec:
    - update-pwd.bash ~/ardana-ci-tests/pwd_change_cp1.yml

- name: Test reconfigure password change
  logfile: testsuite-reconfigure-pwd-change.log
  prefix: reconfigure-password-change
  playbooks:
    - percona-reconfigure.yml

- name: Test Password Change Result - Access to mysql
  logfile: testsuite-reconfigure-pwd-change.log
  prefix: test-conf-limited
  exec:
    - validate-percona-up.bash

- name: Test Pasword change Result - Password on control planes
  logfile: testsuite-reconfigure-conf-change.log
  prefix: test-conf-limited
  exec:
    -  test-conf.bash cp1 mynewpassword ~root/.my.cnf

- name: Update password  for all control planes
  logfile: testsuite-reconfigure-pwd-change.log
  prefix: update-pwd
  exec:
    - update-pwd.bash ~/ardana-ci-tests/pwd_change_cp1.yml
    - update-pwd.bash ~/ardana-ci-tests/pwd_change_cp2.yml

- name: Test reconfigure password change
  logfile: testsuite-reconfigure-pwd-change.log
  prefix: reconfigure-password-change-all
  playbooks:
    - percona-reconfigure.yml

- name: Test Password change Result - Access to mysql
  logfile: testsuite-reconfigure-pwd-change.log
  prefix: test-conf-limited
  exec:
    - validate-percona-up.bash

# Currently exec only runs this on the deplouyer so this does not really
# check cp2
- name: Test Password change Result - Password on control planes
  logfile: testsuite-reconfigure-conf-change.log
  prefix: test-conf-limited
  exec:
    - test-conf.bash cp  mynewpassword ~root/.my.cnf

# Reboot Tests - Single Host reboots  TBD check if test harness has
# long enough sleep as next test failing occassionally without sleep
- name: Test reboot server2
  logfile: reboot.log
  prefix: reboot-server2
  vms:
    - reboot: server2

- name: Test reboot server2
  logfile: reboot.log
  prefix: sleep-for-1
  exec:
    - sleep 60

- name: Test we are up
  logfile: reboot.log
  prefix: validate-percona-up
  exec:
    - validate-percona-up.bash

- name: Test reboot server3
  logfile: reboot.log
  prefix: reboot-server3
  vms:
    - reboot: server3

- name: Test reboot server3
  logfile: reboot.log
  prefix: sleep-for-1
  exec:
    - sleep 60

- name: Test we are up
  logfile: reboot.log
  prefix: validate-percona-up
  exec:
    - validate-percona-up.bash

- name: Test reboot  - Singleton, required reboot
  logfile: reboot.log
  prefix: reboot-singleton
  vms:
    - reboot: server1

- name: Test reboot server1
  logfile: reboot.log
  prefix: sleep-for-1
  exec:
    - sleep 60

- name: Test we are up
  logfile: reboot.log
  prefix: validate-percona-down
  exec:
    - validate-percona-down.bash

- name: Bootstrap (workaround for no forceflag on percona-bootstrap)
  logfile: reboot.log
  prefix: bootstrap-singleton
  exec:
    - bootstrap-test.bash project-cp1-c0-m1-mgmt

- name: Test
  logfile: reboot.log
  prefix: validate-singleton
  exec:
    - validate-percona-up.bash
# Test node replacement procedure
- name: percona-deploy
  logfile: remove-nodes.log
  prefix: deploy-percona
  playbooks:
    - percona-remove.yml --limit=project-cp2-c1-m3-mgmt -e automate=true

- name: remove-nodes
  logfile: remove.log
  prefix: remove-nodes
  exec:
    - remove-node-test.bash server4 SERVER4-ROLE cluster1

- name: run-cp
  logfile: remove.log
  prefix: run-cp
  exec:
    - run-cp.bash

- name: add-nodes
  logfile: add.log
  prefix: add-nodes
  exec:
    - add-node-test.bash server4 192.168.110.6 SERVER4-ROLE RACK3 9a:9e:64:55:43:67 192.168.109.5 cluster1

- name: run-cp
  logfile: remove.log
  prefix: run-cp
  exec:
    - run-cp.bash

- name: percona-deploy
  logfile: remove-nodes.log
  prefix: deploy-percona
  playbooks:
    - percona-deploy.yml --limit=project-cp2-c1-m3-mgmt

- name: check remove node
  logfile: remove.log
  prefix: remove-nodes
  exec:
    - copy.bash check-cluster-size.yml --limit=project-cp2-c1-m1-mgmt cluster_size=3

- name: delete-test-data
  logfile: testsuite-remove.log
  prefix: clear-test-data
  exec:
    - copy.bash remove-test-data.yml
# TBD - lots more tests to be done, would be useful
# to be able to add upgrade in here e.g.
# Test configure Monasca
0707010000001D000081ED0000000000000000000000015E6914DB00000402000000000000000000000000000000000000004600000000ardana-db-8.0+git.1583944923.03cca6c/ardana-ci/tests/update-conf.bash#!/bin/bash
#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
set -vxe
echo "Changing $1 in $2"
pushd ~/openstack/my_cloud/config
sed -e "$1" -i "$2" --follow-symlinks
git add -A
git commit --allow-empty -m "My Config Change"
pushd ~/openstack/ardana/ansible/
ansible-playbook -i hosts/localhost config-processor-run.yml -e encrypt="" \
                     -e rekey=""
ansible-playbook -i hosts/localhost ready-deployment.yml
popd
popd
0707010000001E000081ED0000000000000000000000015E6914DB00000401000000000000000000000000000000000000004500000000ardana-db-8.0+git.1583944923.03cca6c/ardana-ci/tests/update-pwd.bash#!/bin/bash
#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
set -evx
cp $1 ~/ardana/change_credentials/
pushd ~/openstack/ardana/ansible/

# Next two lines should not be necessary but are, checking why
git add -A
git commit  --allow-empty -m "My Config Change"

ansible-playbook -i hosts/localhost config-processor-run.yml -e encrypt="" \
                     -e rekey=""
ansible-playbook -i hosts/localhost ready-deployment.yml
popd
0707010000001F000081ED0000000000000000000000015E6914DB00000378000000000000000000000000000000000000005000000000ardana-db-8.0+git.1583944923.03cca6c/ardana-ci/tests/validate-percona-down.bash#!/bin/bash
#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#

ansible-playbook -i hosts/verb_hosts percona-status.yml
percona_test_status=$?
echo "Percona Test Status is $percona_test_status"
if [ $percona_test_status -eq 0 ]
then
  echo "Fail, Expected Percona Down!"
  exit 1
else
  echo "OK"
fi
07070100000020000081ED0000000000000000000000015E6914DB00000360000000000000000000000000000000000000004E00000000ardana-db-8.0+git.1583944923.03cca6c/ardana-ci/tests/validate-percona-up.bash#!/bin/bash
#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#

ansible-playbook -i hosts/verb_hosts percona-status.yml
percona_test_status=$?
echo "Percona Test Status is $percona_test_status"
if [ $percona_test_status -eq 0 ]
then
  echo "Ok"
else
  echo "Fail"
  exit 1
fi
07070100000021000081ED0000000000000000000000015E6914DB000000BC000000000000000000000000000000000000004B00000000ardana-db-8.0+git.1583944923.03cca6c/ardana-ci/tests/validate-upgrade.bash#!/bin/bash
set -vx
version=`dpkg -l | grep percona-xtradb-cluster-common | awk '{print $3}'`

if [[ $version == $1 ]]
then
  upgradestatus=0
else
  upgradestatus=1
fi
exit $upgradestatus
07070100000022000041ED0000000000000000000000025E6914DB00000000000000000000000000000000000000000000002C00000000ardana-db-8.0+git.1583944923.03cca6c/config07070100000023000081A40000000000000000000000015E6914DB00000325000000000000000000000000000000000000004100000000ardana-db-8.0+git.1583944923.03cca6c/config/mariadb-symlinks.yml#
# (c) Copyright 2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#

# The following relative symlinks are created under the
# my_cloud/config directory.
---
symlinks:
  "mariadb/my.cfg.j2": "roles/FND-MDB/templates/etc/mysql/my.cnf.j2"
  "mariadb/defaults.yml": "roles/FND-MDB/defaults/main.yml"
07070100000024000081A40000000000000000000000015E6914DB00000369000000000000000000000000000000000000004100000000ardana-db-8.0+git.1583944923.03cca6c/config/percona-symlinks.yml#
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#

# The following relative symlinks are created under the
# my_cloud/config directory.
---
symlinks:
  "percona/my.cfg.j2": "roles/FND-MDB/templates/etc/mysql/my.cnf.j2"
  "percona/defaults.yml": "roles/FND-MDB/defaults/main.yml"
07070100000025000041ED0000000000000000000000025E6914DB00000000000000000000000000000000000000000000003400000000ardana-db-8.0+git.1583944923.03cca6c/filter_plugins07070100000026000081A40000000000000000000000015E6914DB000003FC000000000000000000000000000000000000004300000000ardana-db-8.0+git.1583944923.03cca6c/filter_plugins/hash_filter.py#
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#

import zlib

# Given a string returns an integer hash < 2^32
# crc32 would be good but it returns a signed
# value which cannot be used for a server id
#
#   https://bugs.python.org/issue1202

def adler32_unsigned(value ):
    return zlib.adler32(value) & 0xffffffffL

class FilterModule(object):

    def filters(self):
        return {'adler32_unsigned': adler32_unsigned}
07070100000027000081A40000000000000000000000015E6914DB00000396000000000000000000000000000000000000003A00000000ardana-db-8.0+git.1583944923.03cca6c/galera-bootstrap.yml#
# (c) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Warning: If this is used to stop on all nodes the whole cluster is down
# and can only be started by bootstrapping the cluster manually
#
---
- hosts: FND-MDB
  max_fail_percentage: 0
  roles:
    - FND-MDB
  tasks:
    - include: roles/FND-MDB/tasks/galera_bootstrap.yml
07070100000028000041ED0000000000000000000000025E6914DB00000000000000000000000000000000000000000000002D00000000ardana-db-8.0+git.1583944923.03cca6c/library07070100000029000081A40000000000000000000000015E6914DB00002A70000000000000000000000000000000000000005300000000ardana-db-8.0+git.1583944923.03cca6c/library/find_galera_mariadb_bootstrap_host.py#!/usr/bin/python
#
# (c) Copyright 2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#

ANSIBLE_METADATA = {
    'metadata_version': '1.0',
    'status': ['preview'],
    'supported_by': 'SuSE'
}

DOCUMENTATION = '''
---
module: find_galera_mariadb_bootstrap_host

short_description: Figure out the best way to restart the cluster.

version_added: "1.9"

description:
    - This action module will analyse the result of service status,
      safe_to_bootstrap status, seqno, and possibly recovered position to
      determine the best way to restart the cluster. If all the nodes are
      down, it will figure out the node in which to bootstrap the cluster.
      If some of the nodes are down and others are still alive, it will
      simply return the list of nodes to restart and rejoin the cluster.
      If all the nodes are down and we are unable to determine the boostrap
      node from safe_to_bootstrap and seqno, we'll attempt to use the
      recovered position to figure out the latest UUID and seqno.

      This module does not work by itself. Rather, it is relying on the
      other tasks to find the server status, safe_to_boostrap attribute,
      seqno attribute, and possibly recovered position from each of
      the cluster nodes. The result of the above are expected to be conveyed
      via the host vars. This module merely going over those results and
      determine the best way to restart the cluster.

options:
    hostvars:
        description:
            - Ansible hostvars dict
        required: true
    mdb_hosts:
        description:
            - List of hosts which make up the MariaDB cluster.
        required: true

extends_documentation_fragment:
    -

author:
    - Guang Yee (guang.yee@suse.com)
'''

EXAMPLES = '''
- name: FND-MDB | _suse_galera_bootstrap | Look for safe_to_bootstrap
  shell: >
    cat /var/lib/mysql/grastate.dat | grep safe_to_bootstrap |
    awk '{print $2}'
  register: safe_to_bootstrap_result

- name: FND-MDB | _suse_galera_bootstrap | Lookup seqno
  shell: >
    cat /var/lib/mysql/grastate.dat | grep seqno |
    awk '{print $2}'
  register: seqno_result

- name: FND-MDB | _suse_galera_bootstrap | Check if service is active (exited)
  become: yes
  shell: "systemctl status {{ mysql_service }}"
  register: mysql_service_result
  failed_when: false
  changed_when: '"active (exited)" in mysql_service_result.stdout'

- name: FND-MDB | _suse_galera_bootstrap | Find Galera MariaDB bootstrap host
  find_galera_mariadb_bootstrap_host:
    hostvars: "{{ hostvars }}"
  register: find_bootstrap_host_result

- name: FND-MDB | _suse_galera_bootstrap | Bootstrap host
  debug:
    msg: "Bootstrap HOst: {{ find_bootstrap_host_result.bootstrap_host }}"
  when: find_bootstrap_host_result.bootstrap_host is defined
'''

RETURN = '''
bootstrap_host:
    description: The inventory host where we should be bootstrapping the
                 cluster. This attribute is set only if all the nodes are down
                 and the bootstrap node is found. If one or more nodes in the
                 cluster are still alive, there's no need to perform the
                 bootstrap sequence. Therefore, this attribute will not be set.
    type: str
hosts_to_start:
    description: The list of inventory hosts to perform normal restart. This
                 attribute will always set. However, it may contain an empty
                 list if all the hosts in the cluster are still alive and well.
    type: list
need_recovery:
    description: Indicate whether we are in a situation when we must overwrite
                 the grastate.dat file with the recovered uuid and seqno.
                 User likely got into this situation if the cluster was not
                 properly bootstrapped after all the nodes are down. If
                 need_recovery is set to True. The recovered uuid and seqno
                 are conveyed via recovered_uuid and recovered_seqno
                 parameter respectively.
    type: boolean
recovered_uuid:
    description: The recovered UUID.
    type: str
recovered_seqno:
    description: The recovered seqno (last transaction ID)
    type: str
'''

from ansible.module_utils.basic import *

def find_host_with_safe_to_bootstrap(hostvars, hosts):
    for host in hosts:
        if hostvars[host]['safe_to_bootstrap_result']['stdout'] == '1':
            return host


def find_host_with_highest_seqno(hostvars, hosts):
    highest_seqno = 0
    host_with_highest_seqno = None
    for host in hosts:
        seqno = int(hostvars[host]['seqno_result']['stdout'])
        if seqno > highest_seqno:
            highest_seqno = seqno
            host_with_highest_seqno = host
    return host_with_highest_seqno


def find_hosts_where_mysql_still_running(hostvars, hosts):
    alive_hosts = []
    for host in hosts:
        if int(hostvars[host]['mysql_service_status_result']['rc']) == 0:
            if int(hostvars[host]['mysql_process_status_result']['rc']) == 0:
                seqno = int(hostvars[host]['seqno_result']['stdout'])
                # If the mysql is running, the seqno should be -1.
                if seqno != -1:
                    raise Exception('Mysql appeared to be running on host %s, '
                                    'but the sequence number is not -1 as '
                                    'expected.', host)
                alive_hosts.append(host)
            else:
                # We have a FUBAR situation here. Systemd is reporting that
                # mysql service is alive, but the mysqld process is not found.
                # Human intervention is required.
                raise Exception('Systemd on host %s indicating mysql service '
                                'still alive. But the process mysqld is not '
                                'found.', host)
    return alive_hosts


def find_latest_recovered_position(hostvars, hosts):
    host_with_highest_seqno = None
    highest_seqno = -1
    highest_uuid = None
    for host in hosts:
        if ('recovered_position_result' in hostvars[host] and
            hostvars[host]['recovered_position_result']['stdout'] != ''):
            # per http://galeracluster.com/documentation-webpages/
            # restartingcluster.html#identifying-the-most-advanced-node
            # recovered postion is of the format: <uuid>:<seqno>
            result = hostvars[host]['recovered_position_result']
            (uuid, seqno) = result['stdout'].split(':', 1)
            seqno = int(seqno)
            if seqno > highest_seqno:
                highest_seqno = seqno
                highest_uuid = uuid
                host_with_highest_seqno = host
        else:
            # If one or more nodes does not produce a recovered postion after
            # the crash, that means we have a FUBAR situation which required
            # menual recovery.
            raise Exception('Unable to find the recovered positon on host %s. '
                            'Manual recovery is required.', host)
    return (host_with_highest_seqno, highest_uuid, highest_seqno)


def run_module():
    # define the available arguments/parameters that a user can pass to
    # the module
    module_args = dict(
        hostvars=dict(type='dict', required=True),
        mdb_hosts=dict(type='list', required=True)
    )

    # seed the result dict in the object
    # we primarily care about changed and state
    # change is if this module effectively modified the target
    # state will include any data that you want your module to pass back
    # for consumption, for example, in a subsequent task
    result = dict(
        changed=False,
        original_message='',
        message='',
        bootstrap_host=None,
        need_recovery=False,
        recovered_uuid=None,
        recovered_seqno=None,
        hosts_to_start=[]
    )

    # the AnsibleModule object will be our abstraction working with Ansible
    # this includes instantiation, a couple of common attr would be the
    # args/params passed to the execution, as well as if the module
    # supports check mode
    module = AnsibleModule(
        argument_spec=module_args,
        supports_check_mode=True
    )

    # if the user is working with this module in only check mode we do not
    # want to make any changes to the environment, just return the current
    # state with no modifications
    if module.check_mode:
        return result

    # manipulate or modify the state as needed (this is going to be the
    # part where your module will do what it needs to do)
    hostvars = module.params.get("hostvars")
    hosts = module.params.get("mdb_hosts")

    try:
        alive_hosts = find_hosts_where_mysql_still_running(hostvars, hosts)
        if alive_hosts:
            dead_hosts = list(set(hosts) - set(alive_hosts))
            if dead_hosts:
                result['hosts_to_start'] = dead_hosts
        else:
            safe_to_bootstrap_host = find_host_with_safe_to_bootstrap(
                hostvars, hosts)
            if safe_to_bootstrap_host:
                result['bootstrap_host'] = safe_to_bootstrap_host
            else:
                highest_seqno_host = find_host_with_highest_seqno(
                    hostvars, hosts)
                if highest_seqno_host:
                    result['bootstrap_host'] = highest_seqno_host
                else:
                    # at this point, we have to rely on the recovered position
                    # as we can't determine the boostrap host. We'll first
                    # find the host with the highest seqno, then override its
                    # grastate.dat file with the recovered uuid and seqno.
                    # This host will be bootstrapped first as the master node.
                    (host, uuid, seqno) = find_latest_recovered_position(
                        hostvars, hosts)
                    result['bootstrap_host'] = host
                    result['need_recovery'] = True
                    result['recovered_uuid'] = uuid
                    result['recovered_seqno'] = seqno
            result['hosts_to_start'] = list(
                set(hosts) - set([result['bootstrap_host']]))
    except Exception, e:
        module.fail_json(msg=e.message)
    else:
        module.exit_json(**result)


def main():
    run_module()

if __name__ == '__main__':
    main()
0707010000002A000081A40000000000000000000000015E6914DB000004DE000000000000000000000000000000000000003B00000000ardana-db-8.0+git.1583944923.03cca6c/percona-bootstrap.yml#
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#

---

- hosts: FND-MDB
  max_fail_percentage: 0
  roles:
    - guard-cluster
    - FND-MDB
  tasks:
    - include: roles/FND-MDB/tasks/check.yml
    - include: roles/FND-MDB/tasks/stop.yml
    - include: roles/FND-MDB/tasks/initialise.yml
    - include: roles/FND-MDB/tasks/bootstrap.yml
    - name: FND-MDB | bootstrap | Notify I am bootstrapping
      set_fact:
        mysql_bootstrapping: true


- hosts: FND-MDB
  serial: 1
  roles:
    - FND-MDB
  tasks:
    - include: roles/FND-MDB/tasks/start.yml

- hosts: FND-MDB
  roles:
    - FND-MDB
  tasks:
    - include: roles/FND-MDB/tasks/status.yml
0707010000002B000081A40000000000000000000000015E6914DB00000423000000000000000000000000000000000000004300000000ardana-db-8.0+git.1583944923.03cca6c/percona-configure-monasca.yml#
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- hosts: FND-MDB:&MON-AGN
  max_fail_percentage: 0
  roles:
    - FND-MDB-monasca
  tasks:
    - include: roles/FND-MDB-monasca/tasks/configure.yml

- hosts: FND-MDB:&MON-AGN
  max_fail_percentage: 0
  roles:
    - FND-MDB
    - FND-MDB-monasca
  tasks:
    - name: percona-configure-monasca | include configure_tls
      include: roles/FND-MDB-monasca/tasks/configure_tls.yml
      when: mysql_bind_tls | bool
0707010000002C000081A40000000000000000000000015E6914DB0000056B000000000000000000000000000000000000003800000000ardana-db-8.0+git.1583944923.03cca6c/percona-deploy.yml#
# (c) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#

- hosts: FND-MDB
  max_fail_percentage: 0
  roles:
    - FND-MDB-lifecycle
    - FND-MDB
  tasks:
    - include: roles/FND-MDB/tasks/install.yml
    - include: roles/FND-MDB/tasks/configure.yml
    - include: roles/FND-MDB/tasks/create_service_users_dbs.yml

- hosts: FND-MDB
  max_fail_percentage: 0
  serial: 1
  roles:
    - FND-MDB-lifecycle
    - FND-MDB
  tasks:
    - include: roles/FND-MDB/tasks/start.yml

- hosts: FND-MDB
  max_fail_percentage: 0
  serial: 1
  roles:
    - FND-MDB-lifecycle
    - FND-MDB
  tasks:
    - include: roles/FND-MDB/tasks/restart_master.yml

- hosts: FND-MDB
  max_fail_percentage: 0
  roles:
    - FND-MDB
  tasks:
    - include: roles/FND-MDB/tasks/status.yml

- include: percona-configure-monasca.yml
0707010000002D000081A40000000000000000000000015E6914DB00000306000000000000000000000000000000000000003E00000000ardana-db-8.0+git.1583944923.03cca6c/percona-post-upgrade.yml#
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- hosts: FND-MDB
  max_fail_percentage: 0
  roles:
    - FND-MDB
  tasks:
    - include: roles/FND-MDB/tasks/post-upgrade.yml
0707010000002E000081A40000000000000000000000015E6914DB00000305000000000000000000000000000000000000003D00000000ardana-db-8.0+git.1583944923.03cca6c/percona-pre-upgrade.yml#
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- hosts: FND-MDB
  max_fail_percentage: 0
  roles:
    - FND-MDB
  tasks:
    - include: roles/FND-MDB/tasks/pre-upgrade.yml
0707010000002F000081A40000000000000000000000015E6914DB00000620000000000000000000000000000000000000003D00000000ardana-db-8.0+git.1583944923.03cca6c/percona-reconfigure.yml#
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---

#Fail here if any of the nodes are down as
#password changes wont be replicated
- hosts: FND-MDB
  max_fail_percentage: 0
  roles:
    - FND-MDB
  tasks:
    - include: roles/FND-MDB/tasks/status.yml

- hosts: FND-MDB
  gather_facts: no
  max_fail_percentage: 0
  roles:
    - FND-MDB

  tasks:
    - include: roles/FND-MDB/tasks/percona-change-pwd.yml
    - include: roles/FND-MDB/tasks/create_service_users_dbs.yml
#Running this every time wont make a difference as if
#there is no change nothing will occur and if there is
#a change to the passwords it will update it.
    - include: roles/FND-MDB/tasks/configure.yml

# Split tasks so that notification sent in time for start

- hosts: FND-MDB
  gather_facts: no
  max_fail_percentage: 0
  serial: 1
  roles:
    - FND-MDB
  tasks:
    - include: roles/FND-MDB/tasks/start.yml
    - include: roles/FND-MDB/tasks/status.yml

- include: percona-configure-monasca.yml
07070100000030000081A40000000000000000000000015E6914DB0000057C000000000000000000000000000000000000003800000000ardana-db-8.0+git.1583944923.03cca6c/percona-remove.yml#
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- hosts: FND-MDB
  roles:
    - FND-MDB
  tasks:
  - name: you will permently wipe mysql and its databases
      from your system if you continue.
      This will remove all mysql data from all the nodes.
    pause:
      prompt: |
        Wipe mysql from the system?.
        Press enter to continue or control+c then a to abort
    delegate_to: localhost
    when: automate is not defined

  - name: 5 minutes to reconsider. press ctrl+c then c if you are sure.
      If not press ctrl+c then a to abort.
    delegate_to: localhost
    pause:
      minutes: 5
    when: automate is not defined

  - include: roles/FND-MDB/tasks/check_install.yml
  - include: roles/FND-MDB/tasks/remove_packages.yml
  - include: roles/FND-MDB/tasks/remove_mysql_dirs.yml
07070100000031000081A40000000000000000000000015E6914DB00000480000000000000000000000000000000000000003700000000ardana-db-8.0+git.1583944923.03cca6c/percona-start.yml#
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---

- hosts: FND-MDB
  max_fail_percentage: 0
  vars:
    - num_hosts: "{{ vars['play_hosts'] | length }}"
  roles:
    - FND-MDB
  tasks:
    # if play hosts is 1, we assume playbooks is invoked with the --limit
    # option
    - include: roles/FND-MDB/tasks/start.yml
      when: num_hosts | int == 1

    # if we have multiple play hosts, we are always in a bootstrap situation
    - include: roles/FND-MDB/tasks/galera_bootstrap.yml
      when: ansible_os_family == 'Suse' and num_hosts | int > 1
07070100000032000081A40000000000000000000000015E6914DB0000038C000000000000000000000000000000000000003800000000ardana-db-8.0+git.1583944923.03cca6c/percona-status.yml#
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Warning: If this is used to stop on all nodes the whole cluster is down
# and can only be started by bootstrapping the cluster manually
#
---
- hosts: FND-MDB
  max_fail_percentage: 0
  roles:
    - FND-MDB
  tasks:
    - include: roles/FND-MDB/tasks/status.yml
07070100000033000081A40000000000000000000000015E6914DB0000038B000000000000000000000000000000000000003600000000ardana-db-8.0+git.1583944923.03cca6c/percona-stop.yml#
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Warning: If this is used to  stop on all nodes the whole cluster is down
# and can only be started by bootstrapping the cluster manually
#
---
- hosts: FND-MDB
  max_fail_percentage: 0
  roles:
    - FND-MDB
  tasks:
    - include: roles/FND-MDB/tasks/stop.yml
07070100000034000081A40000000000000000000000015E6914DB000006DC000000000000000000000000000000000000003900000000ardana-db-8.0+git.1583944923.03cca6c/percona-upgrade.yml#
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---

- hosts: FND-MDB
  max_fail_percentage: 0
  roles:
    - FND-MDB
  tasks:
    - include: roles/FND-MDB/tasks/status.yml
    - include: roles/FND-MDB/tasks/check_upgraded_pkgs.yml
    - include: roles/FND-MDB/tasks/configure.yml
    - include: roles/FND-MDB/tasks/create_service_users_dbs.yml
    - include: roles/FND-MDB/tasks/_pre_upgrade.yml

- hosts: FND-MDB
  max_fail_percentage: 0
  serial: 1
  roles:
    - FND-MDB
  tasks:
    - include: roles/FND-MDB/tasks/check_install.yml

    - include: roles/FND-MDB/tasks/_debian_install.yml
      when: ansible_os_family == 'Debian'

    - include: roles/FND-MDB/tasks/_suse_install.yml
      when: ansible_os_family == 'Suse'

- hosts: FND-MDB
  max_fail_percentage: 0
  roles:
    - FND-MDB
  tasks:
    - include: roles/FND-MDB/tasks/_post_upgrade.yml

# Split tasks so that notification sent in time for start

- hosts: FND-MDB
  gather_facts: no
  max_fail_percentage: 0
  serial: 1
  roles:
    - FND-MDB
  tasks:
    - include: roles/FND-MDB/tasks/start.yml
    - include: roles/FND-MDB/tasks/status.yml

- include: percona-configure-monasca.yml
07070100000035000041ED0000000000000000000000055E6914DB00000000000000000000000000000000000000000000002B00000000ardana-db-8.0+git.1583944923.03cca6c/roles07070100000036000041ED0000000000000000000000095E6914DB00000000000000000000000000000000000000000000003300000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB07070100000037000041ED0000000000000000000000035E6914DB00000000000000000000000000000000000000000000003D00000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB-lifecycle07070100000038000041ED0000000000000000000000025E6914DB00000000000000000000000000000000000000000000004200000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB-lifecycle/vars07070100000039000081A40000000000000000000000015E6914DB00000288000000000000000000000000000000000000004B00000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB-lifecycle/vars/main.yml#
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
0707010000003A000041ED0000000000000000000000045E6914DB00000000000000000000000000000000000000000000003B00000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB-monasca0707010000003B000041ED0000000000000000000000025E6914DB00000000000000000000000000000000000000000000004000000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB-monasca/meta0707010000003C000081A40000000000000000000000015E6914DB000002C0000000000000000000000000000000000000004900000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB-monasca/meta/main.yml#
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---

dependencies:
  - {role: monasca-agent, run_mode: Use}
0707010000003D000041ED0000000000000000000000025E6914DB00000000000000000000000000000000000000000000004100000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB-monasca/tasks0707010000003E000081A40000000000000000000000015E6914DB0000038A000000000000000000000000000000000000004F00000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB-monasca/tasks/configure.yml#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Start mysql on these nodes. Note if the whole cluster is down
# this will not start as a boostrap will need to run on one node

---
- name: FND-MDB-monasca | configure | Run Monasca detection plugin for mysql
  become: yes
  monasca_agent_plugin:
    name: "mysql"
0707010000003F000081A40000000000000000000000015E6914DB0000082C000000000000000000000000000000000000005300000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB-monasca/tasks/configure_tls.yml#
# (c) Copyright 2020 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Start mysql on these nodes. Note if the whole cluster is down
# this will not start as a boostrap will need to run on one node

---
- name: FND-MDB-monasca | configure | Check sever TLS cert
  become: yes
  stat:
    path: "{{ mysql_server_cert }}"
  register: mysql_server_cert_check_result

# NOTE(gyee): Since the provisioned TLS server certificate is consisted of
# both certificate and private key, we need to separate out the certificate
# protion for monitoring without having to compromise the private key.
# This is done by copying the certificate to a different file and make it
# readable by the world. Making certificate readable by the world is NOT a
# problem as it is TLS certificate is public information.
- name: FND-MDB-monasca | configure_tls | Separate out mysql TLS cert
  become: yes
  shell: >
    openssl x509 -in {{ mysql_server_cert }}
    -out {{ mysql_server_cert_monitoring }} -outform PEM
  when: mysql_server_cert_check_result.stat.exists

- name: FND-MBD-monasca | configure_tls |
        Make sure mysql TLS cert is readable
  become: yes
  file:
    path: "{{ mysql_server_cert_monitoring }}"
    mode: '0644'
  when: mysql_server_cert_check_result.stat.exists

- name: FND-MDB-monasca | configure_tls |
        Run Monasca detection plugin for mysql TLS certs
  become: yes
  monasca_agent_plugin:
    name: CertificateFileCheck
    args:
      cert_files: "{{ mysql_server_cert_monitoring }}"
      dimensions: "service:mysql"
  when: mysql_server_cert_check_result.stat.exists
07070100000040000041ED0000000000000000000000025E6914DB00000000000000000000000000000000000000000000003C00000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/defaults07070100000041000081A40000000000000000000000015E6914DB000019C3000000000000000000000000000000000000004500000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/defaults/main.yml#
# (c) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#

# Global variables used in the plays
# Note: A number of the vars coming from configprocessor
# need changing here for full V2 compatibility, will
# be fixed in  subsequent change
mysql_no_nodesdown: 0
mysql_is_upgrade: false
mysql_is_major_upgrade: false
mysql_bootstrapping: false
mysql_bootstrapped: false
mysql_service: mysql
mysql_initialised: /var/lib/galera.initialised
mysql_initialised_deprecated: /var/lib/mysql/galera.initialised
mysql_pre_v301_bootstrapped: false
mysql_root_user: "{{ FND_MDB.vars.mysql_root_user }}"
mysql_root_pwd: "{{ FND_MDB.vars.mysql_root_pwd | quote }}"
mysql_sst_user: "{{ FND_MDB.vars.mysql_sst_user }}"
mysql_sst_pwd: "{{ FND_MDB.vars.mysql_sst_password | quote }}"
mysql_clustercheck_user: "{{ FND_MDB.vars.mysql_clustercheck_user }}"
mysql_clustercheck_pwd: "{{ FND_MDB.vars.mysql_clustercheck_pwd | quote }}"
mysql_clustercheck_port: "{{ FND_MDB.vars.mysql_clustercheck_port }}"
mysql_log_dir: /var/log/mysql
# Section  [client]
mysql_client_port: "{{ FND_MDB.members.private[0].port }}"
mysql_client_socket: /var/run/mysqld/mysqld.sock
# Section [mysqld_safe]
mysql_safe_socket: /var/run/mysqld/mysqld.sock
mysql_nice: 0
# Section [mysqld]
mysql_user: mysql
mysql_pid_file: /var/run/mysqld/mysqld.pid
mysql_socket: /var/run/mysqld/mysqld.sock
mysql_server_socket: /var/run/mysqld/mysqld.sock
mysql_server_port: "{{ host.bind['FND_MDB'].internal.port }}"
mysql_basedir: /usr
mysql_datadir: /var/lib/mysql
mysql_tmpdir: /tmp
mysql_lc_messages_dir: /usr/share/mysql
mysql_bind_address: "{{ host.bind['FND_MDB'].internal.ip_address }}"
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
mysql_myisam_recover: BACKUP
mysql_log_error: "{{ mysql_log_dir }}/error.log"
mysql_collation_server:  utf8_general_ci
mysql_init_connect: 'SET NAMES utf8'
mysql_character_set_server: utf8
mysql_wsrep_provider: /usr/lib/libgalera_smm.so
mysql_binlog_format: ROW
mysql_default_storage_engine: InnoDB
# This changes how InnoDB autoincrement locks are managed and is a requirement for Galera
mysql_innodb_autoinc_lock_mode: 2

innodb_flush_method: fsync
# 0 should bring better performance but has slight risk of losing some logs
innodb_flush_log_at_trx_commit: 1
innodb_flush_log_at_timeout: 1

# cluster name
mysql_wsrep_cluster_name: "{{ FND_MDB.vars.mysql_cluster_name }}"
# server id
mysql_server_id: "{{ ( FND_MDB.vars.mysql_cluster_name ~ host.vars.member_id ) | adler32_unsigned }}"
# Default address used for Group Comms, SST and IST
mysql_wsrep_node_address: "{{ host.bind['FND_MDB'].admin.ip_address }}"
mysql_gmcast_ip: "{{ host.bind['FND_MDB'].mysql_gcomms.ip_address }}"
mysql_gmcast_port: "{{ host.bind['FND_MDB'].mysql_gcomms.port }}"

mysql_mdb_servers: "{{ FND_MDB.members.mysql_gcomms }}"
mysql_mdb_hosts: "{{ groups[verb_hosts.FND_MDB] }}"
mysql_mdb_cluster_size: "{{ mysql_mdb_hosts | length }}"

# SST method
mysql_wsrep_sst_method: mariabackup

# authentication for SST method
mysql_wsrep_sst_auth: "{{ FND_MDB.vars.mysql_sst_user ~ ':' ~ ( FND_MDB.vars.mysql_sst_password | quote ) }}"

mysql_consumed_by: "{{ FND_MDB.consumed_by | default({}) }}"
mysql_accounts: "[ {% for component in mysql_consumed_by -%} {% if component.vars.accounts is defined -%} {% for account in component.vars.accounts -%} {% for grant in component.vars.accounts[account].grants -%} {{ component.vars.accounts[account] | to_json }} {%- if not loop.last -%} , {% endif -%} {% endfor -%} {%- if not loop.last -%} , {% endif -%} {% endfor -%} {% endif -%} {%- if not loop.last -%} , {% endif -%} {% endfor %} ]"

mysql_grants: "[ {% for component in mysql_consumed_by -%} {% if component.vars.accounts is defined -%} {% for account in component.vars.accounts -%} {% for grant in component.vars.accounts[account].grants -%} {{ grant | to_json }} {%- if not loop.last -%} , {% endif -%} {% endfor -%} {%- if not loop.last -%} , {% endif -%} {% endfor -%} {% endif -%} {%- if not loop.last -%} , {% endif -%} {% endfor %} ]"

mysql_databases: "[ {% for component in mysql_consumed_by -%} {% if component.vars.databases != {} -%} {% for db in component.vars.databases -%} {{ component.vars.databases[db] | to_json }} {%- if not loop.last -%} , {% endif -%} {% endfor -%} {% endif -%} {%- if not loop.last -%} {% if component.vars.databases != {} -%} , {% endif -%} {% endif -%} {% endfor %} ]"

# Certs, CA and deploys
mysql_tls_certs_dir: "/tmp/ardana_tls_certs"
mysql_ca_certs: "{{ trusted_ca_bundle }} "
mysql_cert_deploy_dir: "/etc/mysql/"

# TLS flags
mysql_admin_bind_tls: "{{ host.bind['FND_MDB'].admin.tls }}"

# TLS disabled for cluster
#mysql_gcomms_bind_tls: "{{ host.bind['FND_MDB'].mysql_gcomms.tls }}"
mysql_gcomms_bind_tls: False

# TLS disabled for SST
#mysql_sst_bind_tls: "{{ host.bind['FND_MDB'].mysql_sst.tls }}"
mysql_sst_bind_tls: False

# This variable tells if we have any TLS binds so that certs gets deployed
mysql_bind_tls: "{{ mysql_admin_bind_tls or mysql_gcomms_bind_tls or mysql_sst_bind_tls }}"

# We use the admin cert for all mysql listeners till there's a need to have
# individual certs.
mysql_server_cert_name: "{{ host.bind['FND_MDB'].admin.cert_name | default(None) }}"
mysql_server_cert: "{{ mysql_cert_deploy_dir }}/{{ mysql_server_cert_name }}.pem"
mysql_server_key: "{{ mysql_cert_deploy_dir }}/{{ mysql_server_cert_name }}.pem"
mysql_gcomms_cert: "{{ mysql_server_cert }}"
mysql_gcomms_key: "{{ mysql_server_key }}"
mysql_sst_cert:  "{{ mysql_server_cert }}"
mysql_sst_key: "{{ mysql_server_key }}"
# certificate only, for monitoring purpose
mysql_server_cert_monitoring: "{{ mysql_cert_deploy_dir }}/{{ mysql_server_cert_name }}-monitoring.pem"

mysql_tls_expiry_check: "2592000" #30 days
mysql_certs_needs_regeneration: False
mysql_sync_retries: 20

# command to bootstrap the Galera cluster
mysql_galera_bootstrap_command: "/etc/init.d/mysql restart-bootstrap"

mysql_xinetd_mysqlchk_user: nobody

mysql_open_files_limit: 65536
07070100000042000041ED0000000000000000000000035E6914DB00000000000000000000000000000000000000000000003900000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/files07070100000043000041ED0000000000000000000000035E6914DB00000000000000000000000000000000000000000000003D00000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/files/usr07070100000044000041ED0000000000000000000000025E6914DB00000000000000000000000000000000000000000000004100000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/files/usr/bin07070100000045000081ED0000000000000000000000015E6914DB00000E6E000000000000000000000000000000000000004E00000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/files/usr/bin/clustercheck#!/bin/bash
#
# Script to make a proxy (ie HAProxy) capable of monitoring Percona XtraDB Cluster nodes properly
#
# Author: Olaf van Zandwijk <olaf.vanzandwijk@nedap.com>
# Author: Raghavendra Prabhu <raghavendra.prabhu@percona.com>
#
# Documentation and download: https://github.com/olafz/percona-clustercheck
#
# Based on the original script from Unai Rodriguez
#

if [[ $1 == '-h' || $1 == '--help' ]];then
    echo "Usage: $0 <user> <pass> <available_when_donor=0|1> <log_file> <available_when_readonly=0|1> <defaults_extra_file>"
    exit
fi

# if the disabled file is present, return 503. This allows
# admins to manually remove a node from a cluster easily.
if [ -e "/var/tmp/clustercheck.disabled" ]; then
    # Shell return-code is 1
    echo -en "HTTP/1.1 503 Service Unavailable\r\n"
    echo -en "Content-Type: text/plain\r\n"
    echo -en "Connection: close\r\n"
    echo -en "Content-Length: 51\r\n"
    echo -en "\r\n"
    echo -en "Percona XtraDB Cluster Node is manually disabled.\r\n"
    sleep 0.1
    exit 1
fi

MYSQL_USERNAME="${1-clustercheckuser}"
MYSQL_PASSWORD="${2-clustercheckpassword!}"
AVAILABLE_WHEN_DONOR=${3:-0}
ERR_FILE="${4:-/dev/null}"
AVAILABLE_WHEN_READONLY=${5:-1}
DEFAULTS_EXTRA_FILE=${6:-/etc/my.cnf}

#Timeout exists for instances where mysqld may be hung
TIMEOUT=10

EXTRA_ARGS=""
if [[ -n "$MYSQL_USERNAME" ]]; then
    EXTRA_ARGS="$EXTRA_ARGS --user=${MYSQL_USERNAME}"
fi
if [[ -n "$MYSQL_PASSWORD" ]]; then
    EXTRA_ARGS="$EXTRA_ARGS --password=${MYSQL_PASSWORD}"
fi
if [[ -r $DEFAULTS_EXTRA_FILE ]];then
    MYSQL_CMDLINE="mysql --defaults-extra-file=$DEFAULTS_EXTRA_FILE -nNE --connect-timeout=$TIMEOUT \
                    ${EXTRA_ARGS}"
else
    MYSQL_CMDLINE="mysql -nNE --connect-timeout=$TIMEOUT ${EXTRA_ARGS}"
fi
#
# Perform the query to check the wsrep_local_state
#
WSREP_STATUS=$($MYSQL_CMDLINE -e "SHOW STATUS LIKE 'wsrep_local_state';" \
    2>${ERR_FILE} | tail -1 2>>${ERR_FILE})

if [[ "${WSREP_STATUS}" == "4" ]] || [[ "${WSREP_STATUS}" == "2" && ${AVAILABLE_WHEN_DONOR} == 1 ]]
then
    # Check only when set to 0 to avoid latency in response.
    if [[ $AVAILABLE_WHEN_READONLY -eq 0 ]];then
        READ_ONLY=$($MYSQL_CMDLINE -e "SHOW GLOBAL VARIABLES LIKE 'read_only';" \
                    2>${ERR_FILE} | tail -1 2>>${ERR_FILE})

        if [[ "${READ_ONLY}" == "ON" ]];then
            # Percona XtraDB Cluster node local state is 'Synced', but it is in
            # read-only mode. The variable AVAILABLE_WHEN_READONLY is set to 0.
            # => return HTTP 503
            # Shell return-code is 1
            echo -en "HTTP/1.1 503 Service Unavailable\r\n"
            echo -en "Content-Type: text/plain\r\n"
            echo -en "Connection: close\r\n"
            echo -en "Content-Length: 43\r\n"
            echo -en "\r\n"
            echo -en "Percona XtraDB Cluster Node is read-only.\r\n"
            sleep 0.1
            exit 1
        fi
    fi
    # Percona XtraDB Cluster node local state is 'Synced' => return HTTP 200
    # Shell return-code is 0
    echo -en "HTTP/1.1 200 OK\r\n"
    echo -en "Content-Type: text/plain\r\n"
    echo -en "Connection: close\r\n"
    echo -en "Content-Length: 40\r\n"
    echo -en "\r\n"
    echo -en "Percona XtraDB Cluster Node is synced.\r\n"
    sleep 0.1
    exit 0
else
    # Percona XtraDB Cluster node local state is not 'Synced' => return HTTP 503
    # Shell return-code is 1
    echo -en "HTTP/1.1 503 Service Unavailable\r\n"
    echo -en "Content-Type: text/plain\r\n"
    echo -en "Connection: close\r\n"
    echo -en "Content-Length: 44\r\n"
    echo -en "\r\n"
    echo -en "Percona XtraDB Cluster Node is not synced.\r\n"
    sleep 0.1
    exit 1
fi
07070100000046000041ED0000000000000000000000025E6914DB00000000000000000000000000000000000000000000003C00000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/handlers07070100000047000081A40000000000000000000000015E6914DB000002DB000000000000000000000000000000000000004500000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/handlers/main.yml#
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#

- name: restart xinetd
  become: yes
  service:
    name: xinetd
    state: restarted
07070100000048000041ED0000000000000000000000025E6914DB00000000000000000000000000000000000000000000003800000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/meta07070100000049000081A40000000000000000000000015E6914DB00000263000000000000000000000000000000000000004100000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/meta/main.yml# (c) Copyright 2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
dependencies:
  - role: tls-vars
0707010000004A000041ED0000000000000000000000025E6914DB00000000000000000000000000000000000000000000003900000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks0707010000004B000081A40000000000000000000000015E6914DB00000ADE000000000000000000000000000000000000004C00000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/_configure_tls.yml#
# (c) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- name: FND-MDB | _configure_tls | create cert directory
  become: yes
  file:
    path: "{{ mysql_cert_deploy_dir }}"
    state: directory
    mode: 0755

# If we are told to regenerate all certs remove existing reqs
- name: FND-MDB | _configure_tls | remove mysql cert requests
  become: yes
  file:
    path: "{{ mysql_cert_deploy_dir }}/{{ item }}.req"
    state: absent
  with_items: "{{ mysql_server_cert_name }}"
  when: (mysql_certs_needs_regeneration | bool)

# Are there any certs about to expire? The openssl -checkend option
# will return 1 if cert is about to expire. So we use it as a filter
# in the next step to replace the expiring certs
- name: FND-MDB | _configure_tls | check cert expiry
  become: yes
  command: >
    openssl x509 -in {{ item }}.pem -checkend {{ mysql_tls_expiry_check }}
  args:
    chdir: "{{ mysql_cert_deploy_dir }}"
  with_items: "{{ mysql_server_cert_name }}"
  register: _mysql_cert_expiry_checks_result
  ignore_errors: yes

# Delete the cert requests whose certs are about to expire
- name: FND-MDB | _configure_tls | remove expiring cert requests
  become: yes
  file:
    path: "{{ mysql_cert_deploy_dir }}/{{ item }}.req"
    state: absent
  with_items: "{{ mysql_server_cert_name }}"
  when: (_mysql_cert_expiry_checks_result | failed)
  ignore_errors: yes

# Copy cert requests. A successful copy indicates that the
# corresponding cert needs to be copied too.
- name: FND-MDB | _configure_tls | copy mysql cert requests
  become: yes
  copy:
    src: "{{ mysql_tls_certs_dir }}/{{ item }}.req"
    dest: "{{ mysql_cert_deploy_dir }}/{{ item }}.req"
    owner: mysql
    group: mysql
    mode: 0400
  with_items: "{{ mysql_server_cert_name }}"
  register: _mysql_cert_request_update_result

- name: FND-MDB | _configure_tls | copy mysql certs
  become: yes
  copy:
    src: "{{ mysql_tls_certs_dir }}/{{ item.item }}"
    dest: "{{ mysql_cert_deploy_dir }}/{{ item.item }}.pem"
    owner: mysql
    group: mysql
    mode: 0400
  with_items: "{{ _mysql_cert_request_update_result.results | default([]) }}"
  when: item.changed | bool
  register: ardana_notify_mysql_restart_required
0707010000004C000081A40000000000000000000000015E6914DB00000A2F000000000000000000000000000000000000005300000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/_debian_check_install.yml#
# (c) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
# Check for versions of percona package available
- name: FND-MDB | _debian_check_install | Search for Percona packages
  become: yes
  shell:  >
    /usr/bin/apt-cache search
    percona-xtradb-cluster-server-[0-9\.]+ 2>/dev/null |
    awk '{NR==1split($1,ver,"-"); print ver[5]}' |sort  -r
  register: percona_avail_versions_result

# Check for version of percona installed
- name: FND-MDB | _debian_check_install | Find percona version installed
  become: yes
  shell:  >
    /usr/bin/dpkg -l |
    awk '/percona-xtradb-cluster-server-[0-9\.]*/{NR==1split($2,ver,"[/-]") ;
    print ver[5] }' | sort -r
  register: percona_installed_versions_result

- name: FND-MDB | _debian_check_install | Get latest available version
  set_fact:
    percona_latest_avail_version:
      "{{ percona_avail_versions_result.stdout_lines[0] }}"
  when: percona_avail_versions_result.stdout_lines[0] is defined

- name: FND-MDB | _debian_check_install | Get latest installed version
  set_fact:
    percona_latest_installed_version:
      "{{ percona_installed_versions_result.stdout_lines[0] }}"
  when: percona_installed_versions_result.stdout_lines[0] is defined


- name: FND-MDB | _debian_check_install | Print latest available version
  debug:
    msg: "percona_latest_avail_version {{ percona_latest_avail_version }}"
  when: percona_latest_avail_version is defined

- name: FND-MDB | _debian_check_install | Print latest installed version
  debug:
    msg: >
      percona_latest_installed_version {{ percona_latest_installed_version }}
  when: percona_latest_installed_version is defined

# Bool will still be needed on a when to check this
- name: FND-MDB | _debian_check_install | Check if this could be a major upgrade
  set_fact:
    mysql_is_major_upgrade: "{{ percona_latest_installed_version |
    version_compare( percona_latest_avail_version , '<') }}"
  when: percona_latest_installed_version is defined
        and percona_latest_avail_version is defined
0707010000004D000081A40000000000000000000000015E6914DB00000496000000000000000000000000000000000000004D00000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/_debian_install.yml#
# (c) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- name: FND-MDB | _debian_install | Print latest available version
  debug:
    msg: "percona_latest_avail_version {{ percona_latest_avail_version }}"

- name: FND-MDB | _debian_install | Install MDB packages
  become: yes
  apt:
    pkg: "{{ item }}"
    force: yes
    state: latest
  with_items:
    - percona-xtradb-cluster-server-{{ percona_latest_avail_version }}
    - python-mysqldb
    - xinetd # for clustercheck
    - curl
  register: _debian_packages_installed_result
  when: not ( mysql_is_major_upgrade | bool )
0707010000004E000081A40000000000000000000000015E6914DB000005E1000000000000000000000000000000000000005100000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/_post_major_upgrade.yml#
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
# Make sure it went down the order I want;  first one down last
# Should be ok if status checked all were up before we upgraded

- name: FND-MDB | _post_major_upgrade | upgrade_configuration
  include: upgrade_configuration.yml

- name: FND-MDB | _post_major_upgrade | stop on package change
  include: stop.yml

- name: FND-MDB | _post_major_upgrade | cluster_node
  include: cluster_node.yml

# Re-Initialise and force a bootstrap here

- name: FND-MDB | _post_major_upgrade | initialise
  include: initialise.yml

- name: FND-MDB | _post_major_upgrade | set bootstrapped to false
  set_fact:
    mysql_bootstrapped: false
  run_once_per: verb_hosts.FND_MDB

- name: FND-MDB | _post_major_upgrade | Notify I am bootstrapping
  set_fact:
    mysql_bootstrapping: true

- name: FND-MDB | _post_major_upgrade | bootstrap
  include: galera_bootstrap.yml
0707010000004F000081A40000000000000000000000015E6914DB0000049A000000000000000000000000000000000000005100000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/_post_minor_upgrade.yml#
# (c) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- name: FND-MDB | _post_minor_upgrade | Check if singlenode setup
  become: yes
  command: >
    grep -qE '^wsrep_cluster_address = gcomm://{{ ansible_fqdn }}$'
    {{ mysql_conf_file }}
  ignore_errors: True
  register: is_singleton_result

- name: FND-MDB | _post_minor_upgrade | Change provider to join cluster
  become: yes
  lineinfile:
    dest: "{{ mysql_conf_file }}"
    state: present
    regexp: "^wsrep_provider = "
    line: "wsrep_provider = {{ mysql_wsrep_provider }}"
  when: (is_singleton_result | success)

07070100000050000081A40000000000000000000000015E6914DB000005CC000000000000000000000000000000000000004B00000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/_post_upgrade.yml#
# (c) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
# Make sure it went down the order I want;  first one down last
# Should be ok if status checked all were up before we upgraded

- name: FND-MDB | _post_upgrade | Include Post Major Upgrade
  include: _post_major_upgrade.yml
  when: ( mysql_is_major_upgrade | bool )

- name: FND-MDB | _post_upgrade | Include Post Minor Upgrade
  include: _post_minor_upgrade.yml
  when: not ( mysql_is_major_upgrade | bool )

- name: FND-MDB | _post_upgrade | configure mysqlchk
  include: configure_mysqlchk.yml

- name: FND-MDB | _post_upgrade| Enable MDB services
  become: yes
  service:
    name: "{{ mysql_service }}"
    enabled: yes

- name:  FND-MDB | _post_upgrade | check db tables
  become: yes
  shell: >
    mysql --execute=
    "select table_schema, table_name from information_schema.tables;" |
    tee /var/lib/postupgrade.state
07070100000051000081A40000000000000000000000015E6914DB000004B6000000000000000000000000000000000000005000000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/_pre_major_upgrade.yml#
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
# Make sure it went down the order I want;  first one down last
# Should be ok if status checked all were up before we upgraded
- name: FND-MDB | _pre_major_upgrade | Stop
  include: stop.yml

- name: FND-MDB | _pre_major_upgrade | Backup grastate.dat
  shell: >
    cp "{{ mysql_galera_state_file }}"
    /var/lib/grastate.dat.ardanabck.`date +"%Y%m%d_%H:%M:%S:%N"`
  become: yes

- name: FND-MDB | _pre_major_upgrade | remove packages
  include: remove_packages.yml

- name: FND-MDB | _pre_major_upgrade | decluster node
  include: decluster_node.yml
07070100000052000081A40000000000000000000000015E6914DB00000523000000000000000000000000000000000000005000000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/_pre_minor_upgrade.yml#
# (c) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# This task sets the parameters you need to decluster node. It assumes
# you have stopped. If you restart after running this task the node will be out
# of hte cluster first.
---
- name: FND-MDB | _pre_minor_upgrade | Check if singlenode setup
  become: yes
  command: >
    grep -qE '^wsrep_cluster_address = gcomm://{{ ansible_fqdn }}$'
    {{ mysql_conf_file }}
  ignore_errors: True
  register: is_singleton_result

- name: FND-MDB | _pre_minor_upgrade | Change provider to none
  become: yes
  lineinfile:
    dest: "{{ mysql_conf_file }}"
    state: present
    regexp: "^wsrep_provider = "
    line: "wsrep_provider = none"
  when: (is_singleton_result | success)
07070100000053000081A40000000000000000000000015E6914DB00000611000000000000000000000000000000000000004A00000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/_pre_upgrade.yml#
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- name:  FND-MDB | _pre_upgrade | check db tables
  become: yes
  shell: >
    mysql --execute=
    "select table_schema, table_name from information_schema.tables;" |
    tee /var/lib/preupgrade.state

# This is a no-op when not held
- name:  FND-MDB | _pre_upgrade | UnHold the existing Percona Packages
  become: yes
  command: aptitude -y unhold  {{ item }}
  with_items:
  - percona-xtradb-cluster-server-{{ percona_latest_installed_version }}
  - percona-xtradb-cluster-client-{{ percona_latest_installed_version }}
  - percona-xtradb-cluster-common-{{ percona_latest_installed_version }}
  when: ansible_os_family | lower == 'debian'

- name: FND-MDB | _pre_upgrade | _Pre_major_upgrade
  include: _pre_major_upgrade.yml
  when: (mysql_is_major_upgrade | bool)

- name: FND-MDB | _pre_upgrade | _Pre_minor_upgrade
  include: _pre_minor_upgrade.yml
  when: not (mysql_is_major_upgrade | bool)

07070100000054000081A40000000000000000000000015E6914DB00000B77000000000000000000000000000000000000005100000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/_suse_check_install.yml#
# (c) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- name: FND-MDB | _suse_check_install | Set MariabDB server package name
  set_fact:
    mariadb_server_package: mariadb
  when: mariadb_server_package is not defined

- name: FND-MDB | _suse_check_install | Search for packages
  become: yes
  shell:  >
    zypper se --type package --details --match-exact
    {{ mariadb_server_package }} 2>/dev/null |
    grep {{ mariadb_server_package }} | sed 's/^[^|]*|//' |
    awk '/{{ mariadb_server_package }}/{print $5}' | sort -nr
  register: avail_versions_result

- name: FND-MDB | _suse_check_install | Find version installed
  become: yes
  shell:  >
    zypper se --type package --details --match-exact --installed-only
    {{ mariadb_server_package }} 2>/dev/null |
    awk -F" *\\\| *" '/{{ mariadb_server_package }}/{NR==1;print $4}' |
    sort -nr
  register: installed_versions_result

- name: FND-MDB | _suse_check_install | Get latest available version
  set_fact:
    mariadb_latest_avail_version:
      "{{ avail_versions_result.stdout_lines[0] }}"
  when:
    avail_versions_result.stdout_lines[0] is defined

- name: FND-MDB | _suse_check_install | Get latest installed version
  set_fact:
    mariadb_latest_installed_version:
      "{{ installed_versions_result.stdout_lines[0] }}"
  when:
    installed_versions_result.stdout_lines[0] is defined

- name: FND-MDB | _suse_check_install | Print latest available version
  debug:
    msg: "mariadb_latest_avail_version {{ mariadb_latest_avail_version }}"
  when: mariadb_latest_avail_version is defined

- name: FND-MDB | _suse_check_install | Print latest installed version
  debug:
    msg: >
      mariadb_latest_installed_version {{ mariadb_latest_installed_version }}
  when: mariadb_latest_installed_version is defined

# Bool will still be needed on a when to check this. We also remove
# the revision suffix, to differenciate mayor upgrades (10.2.13 to
# 10.2.14) from minor upgrades (10.2.13-4.4 to 10.2.13-4.5)
- name: FND-MDB | _suse_check_install | Check if this could be a major upgrade
  set_fact:
    mysql_is_major_upgrade: "{{ mariadb_latest_installed_version.split('-')[0] |
    version_compare(mariadb_latest_avail_version.split('-')[0] , '<') }}"
  when: mariadb_latest_installed_version is defined
        and mariadb_latest_avail_version is defined
07070100000055000081A40000000000000000000000015E6914DB0000048D000000000000000000000000000000000000004B00000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/_suse_install.yml#
# (c) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- name: FND-MDB | _suse_install | Print latest available version
  debug:
    msg: "mariadb_latest_avail_version {{ mariadb_latest_avail_version }}"

- name: FND-MDB | _suse_install | Install MDB packages
  become: yes
  zypper:
    name: "{{ item }}"
    state: present
  with_items:
    - mariadb
    - galera-3-wsrep-provider
    - mariadb-tools
    - socat
    - mariadb-client
    - python-mysql
    - python-PyMySQL
    - which
    - xinetd
    - mariadb-galera
  register: _suse_packages_installed_result
07070100000056000081A40000000000000000000000015E6914DB00000532000000000000000000000000000000000000004F00000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/_write_home_mycnf.yml#
# (c) Copyright 2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---

# Parameters:
#   _mysql_root_pwd - the root database password
#   ardana_notify_overwrite - True if existing file should be
#                          overwritten (default is True)

- name: FND-MDB | _write_home_mycnf | Set overwrite flag if undefined
  set_fact:
    ardana_notify_overwrite: True
  when: ardana_notify_overwrite is not defined

- name: FND-MDB | _write_home_mycnf | Check if .my.cnf exists
  become: yes
  stat:
    path: ~/.my.cnf
  register: _mycnf_stat_result

- name: FND-MDB | _write_home_mycnf | Write .my.cnf file
  become: yes
  template:
    src: home/.my.cnf
    dest: ~/
    mode: 0600
  when: not _mycnf_stat_result.stat.exists or ardana_notify_overwrite
07070100000057000081A40000000000000000000000015E6914DB00000BB5000000000000000000000000000000000000004700000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/bootstrap.yml#
# (c) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
# On SuSE, we need to empty the wsrep_cluster_address before bring up the
# master node.
- name: FND-MDB | bootstrap | Fix wsrep_cluster_address on MDB Master
  become: yes
  replace:
    dest: "{{ mysql_conf_file }}"
    regexp: '^wsrep_cluster_address = gcomm.*'
    replace: 'wsrep_cluster_address = gcomm://'
    backup: yes
  when: ansible_os_family == 'Suse'
  run_once_per: verb_hosts.FND_MDB

- name: FND-MDB | bootstrap | Bootstrap MDB Master
  become: yes
  command: "{{ mysql_galera_bootstrap_command }}"
  register: mysql_bootstrap_result
  run_once_per: verb_hosts.FND_MDB
  when: not (mysql_bootstrapped | bool)

- name: FND-MDB | bootstrap | Make sure MDB Master started
  become: yes
  service:
    name: "{{ mysql_service }}"
    state: started
  when: (mysql_bootstrapped | bool)
  run_once_per: verb_hosts.FND_MDB

- name: FND-MDB | bootstrap | Create initialisation file
  become: yes
  delegate_to: "{{ item }}"
  file:
    path: "{{ mysql_initialised }}"
    state: touch
    mode: 0660
    owner: mysql
    group: mysql
  with_items: "{{ mysql_mdb_hosts }}"
  when: mysql_bootstrap_result | success
  run_once_per: verb_hosts.FND_MDB

- name: FND-MDB | bootstrap | Wait for MDB master
  wait_for:
    host: "{{ mysql_bind_address }}"
    port: "{{ mysql_server_port }}"
    timeout: 30
  run_once_per: verb_hosts.FND_MDB

# Restart here so that service mysql status indicates mysql
# is up
- name: FND-MDB | bootstrap | Restart MDB Master
  become: yes
  service:
    name: "{{ item }}"
    state: restarted
  with_items: mysql
  run_once_per: verb_hosts.FND_MDB
  when: ansible_os_family != 'Suse'

- name: FND-MDB | bootstrap | Wait for MDB master
  wait_for:
    host: "{{ mysql_bind_address }}"
    port: "{{ mysql_server_port }}"
    timeout: 30
  run_once_per: verb_hosts.FND_MDB
  when: ansible_os_family != 'Suse'

# Check here to see if database is really up
# For now don't fail here but try to keep going if some nodes not up
# A failure here however probably indicates a hard failure so ignore_errors
# should be removed if all codepaths show this
- name: FND-MDB | bootstrap | Check if I can connect to the database
  become: yes
  shell: mysql -e "select 1"
  register: mysql_connect_result
  until: mysql_connect_result | success
  retries: 10
  delay: 4
  ignore_errors: yes
  run_once_per: verb_hosts.FND_MDB
07070100000058000081A40000000000000000000000015E6914DB00000F33000000000000000000000000000000000000004300000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/check.yml#
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- name: FND-MDB | check | Percona not used in CLM
  fail:
    msg: |
        Percona Server for MySQL is not supported in CLM deployments.
        Please check the documentation for instructions on how to bootstrap
        the mysql cluster. Use galera-bootstrap.yml for MariaDB clusters.
  when: ansible_os_family == 'Suse'


- name: FND-MDB | check |
    This bootstrap procedure will WIPE all database data other
    than that on the first controller
  pause:
    prompt: |
        You have 5 minutes to abort this procedure with a ctrl+c

        This procedure assumes the database which exists on
        {{ inventory_hostname }} is the latest. The database server (mysqld) on
        {{ inventory_hostname }} should be the last mysqld in your Percona
        cluster to shutdown and therefore the host with the latest sequence
        number.

        This procedure also assumes mysqld is DOWN on all cluster hosts.
        Confirm this is the case before you run this procedure by running
            $ps -elf |grep mysqld
        On all hosts in your percona cluster.
        If mysqld is up on any host you will need to shut it down by running

            $sudo service mysql stop

        If the mysqld daemon does not stop, kill the daemon using kill -9 <pid>
        BEFORE running this procedure.

        You need to find the sequence number on every host in your MySQL
        cluster by following this procedure, and bootstrap on the host with the
        highest sequence number. For each host, find the sequence number and
        compare it with the other hosts.

        The sequence number on a host can be found using
                $ sudo cat /var/lib/mysql/grastate.dat
        If the sequence number is -1 in the grastate.dat use
                $ sudo /usr/bin/mysqld_safe --wsrep-recover
        when mysqld is down, this logs the sequence number to
        /var/log/mysql/error.log .  For example:

        $ sudo grep --text 'Recovered position'
            /var/log/mysql/error.log| tail -1
            2016-05-05 17:16:52 32336 [Note] WSREP: Recovered position:
            a0cd6b29-f027-11e5-b9e3-fb0ed503c0ac:165252407

        165252407 is the sequence number in the error.log above.

        If {{ inventory_hostname }} HAS the latest sequence number from the list
        of the above controllers then use this script to bootstrap.

        If {{ inventory_hostname }} DOES NOT HAVE the latest sequence number
        from the list of the above controllers then DO NOT use this script to
        bootstrap, ctrl C this script.

        If {{ inventory_hostname }} DOES NOT HAVE the latest sequence number
        then you can restart your cluster as follows:

        On the host which has the latest sequence no do this:
            sudo /etc/init.d/mysql bootstrap-pxc
            sudo service mysql restart
        On the deployer run percona-start.yml:
            ansible-playbook -i hosts/verb_hosts percona-start.yml

  delegate_to: localhost
  when: automate is not defined

- name: FND-MDB | check |
    5 minutes to reconsider. press ctrl+c then c if you are sure.
    if not press ctrl+c then a to abort.
  pause:
    minutes: 5
  delegate_to: localhost
  when: automate is not defined

07070100000059000081A40000000000000000000000015E6914DB0000043D000000000000000000000000000000000000004B00000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/check_install.yml#
# (c) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- name: FND-MDB | check_install | Assume this is not a major upgrade
  set_fact:
    is_major_upgrade: false

# Check for versions of percona and mariadb
- include: _debian_check_install.yml
  when: ansible_os_family == "Debian"

- include: _suse_check_install.yml
  when: ansible_os_family == "Suse"

- name: FND-MDB | check_install | Print mysql_is_major_upgrade
  debug:
    msg: "mysql_is_major_upgrade {{ mysql_is_major_upgrade }}"
0707010000005A000081A40000000000000000000000015E6914DB00000616000000000000000000000000000000000000005100000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/check_upgraded_pkgs.yml#
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- include: check_install.yml

# We do not notify a mysql_change here as for mysql an upgrade of the package
# requires mysql to be restarted at package installation time.
# The restart cannot be delayed until later.  This just logs a message
# to indicate packages have changed
# The exception to this is the singleton upgrade cases and this is handled
# elsewhere

- name: FND-MDB | check_upgraded_pkgs | Check upgraded packages
  debug:
    msg: "Notify change in MySQL package dependency: {{ item.package }}"
  changed_when: true
  when: list_pkg_upgrades_base is defined and
        item.upgrade != "" and
        item.package in list_pkg_upgrades_base | default({})
  with_items:
  - percona-xtradb-cluster-server-{{ percona_latest_installed_version }}
  - percona-xtradb-cluster-client-{{ percona_latest_installed_version }}
  - percona-xtradb-cluster-common-{{ percona_latest_installed_version }}

0707010000005B000081A40000000000000000000000015E6914DB0000049C000000000000000000000000000000000000004A00000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/cluster_node.yml#
# (c) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# This task sets the parameters you need to cluster a node
# After this task if you start the node will attempt to join the cluster
---
- name: FND-MDB | cluster_node | Change provider to join cluster
  become: yes
  lineinfile:
    dest: "{{ mysql_conf_file }}"
    state: present
    regexp: "^wsrep_provider = "
    line: "wsrep_provider =  {{ mysql_wsrep_provider }}"

- name: FND-MDB | cluster_node | Set readonly to off
  become: yes
  lineinfile:
    dest: "{{ mysql_conf_file }}"
    state: absent
    regexp: "^read_only = ON"
0707010000005C000081A40000000000000000000000015E6914DB0000178F000000000000000000000000000000000000004700000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/configure.yml#
# (c) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- name: FND-MDB | configure | Remove lost+found if it exists
  become: yes
  file:
    path: "{{ mysql_datadir }}/lost+found"
    state: absent

- include: _configure_tls.yml
  when: mysql_bind_tls | bool

- name: FND-MDB | configure | Copy my.cnf
  become: yes
  template:
    src: etc/mysql/my.cnf.j2
    dest: "{{ mysql_conf_file }}"
    owner: mysql
    group: mysql
    mode: 0600
  register: ardana_notify_mysql_restart_required

- name: FND-MDB | configure | Install client configuration file
  become: yes
  template:
    src: etc/mysql/client.cnf.j2
    dest: /etc/my.cnf.d/client.cnf
    owner: mysql
    group: mysql
    mode: 0644
  when: ansible_os_family == 'Suse'

- name: FND-MDB | configure | Check initialised
  become: yes
  stat:
    path: "{{ mysql_initialised }}"
  register: checkinitialise_result

- name: FND-MDB | configure | stat the logfile
  become: yes
  stat:
    path: "{{ item }}"
  with_items:
    - "{{ mysql_datadir }}/ib_logfile0"
    - "{{ mysql_datadir }}/ib_logfile1"
  register: checklogfile_result

- name: FND-MDB | configure | list backup logfiles
  become: yes
  shell: find /var/lib/ -name "*.ardanabck*" 2>/dev/null
  ignore_errors: yes
  register: old_logs_result
  when: not checkinitialise_result.stat.exists

- name: FND-MDB | configure | remove old innodb logfiles
  become: yes
  file:
    path: "{{ item }}"
    state: absent
  with_items: old_logs_result.stdout_lines

- name: FND-MDB | configure | set time for backup logfile
  shell: date +"%Y%m%d_%H:%M:%S:%N"
  register: mysql_innodb_time_result

- name: FND-MDB | configure | Backup InnoDB logfile
  become: yes
  shell: >
    mv {{ item.item }}
    /var/lib/"$(basename {{ item.item }})".ardanabck.\
    {{ mysql_innodb_time_result.stdout }}
  with_items: checklogfile_result.results
  when: item.stat.exists and (not checkinitialise_result.stat.exists)

- name:  FND-MDB | configure | Check initialised anywhere else also
  become: yes
  stat:
      path: "{{ mysql_initialised }}"
  delegate_to: "{{ item }}"
  with_items: "{{ mysql_mdb_hosts }}"
  register: mysqlhere_result
  run_once_per: verb_hosts.FND_MDB

- name: FND-MDB | configure | set bootstrapped
  set_fact:
    mysql_bootstrapped: true
  when: item.stat.exists
  with_items:   mysqlhere_result.results
  run_once_per: verb_hosts.FND_MDB

- name: FND-MDB | configure | Notify I am bootstrapping
  set_fact:
    mysql_bootstrapping: true
  when: not checkinitialise_result.stat.exists

- include: bootstrap.yml
  when: not checkinitialise_result.stat.exists

- name: FND-MDB | configure | Copy logrotate file
  become: yes
  template:
    src: etc/logrotate.d/mysql.j2
    dest: /etc/logrotate.d/mysql
    owner: root
    group: root
    mode: 0644

# On an add node the password may already be set so ignore errors here
# NOTE(gyee): login_unix_socket must be specified for local connection
- name: FND-MDB | configure | Set MDB root password
  become: yes
  mysql_user:
    name: root
    password: "{{ mysql_root_pwd }}"
    login_unix_socket: "{{ mysql_socket }}"
  run_once_per: verb_hosts.FND_MDB
  failed_when: false

- name: FND-MDB | install | Write .my.cnf file
  include: _write_home_mycnf.yml
  vars:
    _mysql_root_pwd: "{{ mysql_root_pwd }}"

- name: FND-MDB | configure | Create SST user
  become: yes
  mysql_user:
    name: "{{ mysql_sst_user }}"
    password: "{{ mysql_sst_pwd }}"
    host: localhost
    priv: "*.*:RELOAD,LOCK TABLES,REPLICATION CLIENT,PROCESS"
    login_unix_socket: "{{ mysql_socket }}"
    state: present
  run_once_per: verb_hosts.FND_MDB

- name: FND-MDB | configure | Create clustercheck user
  become: yes
  mysql_user:
    name: "{{ mysql_clustercheck_user }}"
    password: "{{ mysql_clustercheck_pwd }}"
    host: 'localhost'
    priv: "*.*:USAGE"
    state: present
    login_unix_socket: "{{ mysql_socket }}"
  run_once_per: verb_hosts.FND_MDB

- name: FND-MDB | configure | Update services with mysql status service
  become: yes
  lineinfile:
    dest: /etc/services
    state: present
    line: "mysqlchk {{ mysql_clustercheck_port }}/tcp"
    regexp: '^\s*mysqlchk'
  notify: restart xinetd

- name: FND-MDB | configure | configure mysqlchk
  include: configure_mysqlchk.yml

# NOTE direct changes to mysql tables are not replicated.
# However it is safe to run this once here as only the bootstrap
# is up
- name: FND-MDB | configure | Delete blank users if mysql up
  become: yes
  command: mysql mysql -e "
    delete from user where User=\"\";
    flush privileges;"
  run_once_per: verb_hosts.FND_MDB

- name: FND-MDB | configure | Update root password for all hosts
  become: yes
  command: mysql mysql -e "
    update mysql.user
      set password=PASSWORD( \"{{ mysql_root_pwd }}\" )
      where User=\"root\";
    flush privileges;"
  no_log: true
  run_once_per: verb_hosts.FND_MDB

- name: FND-MDB | configure | Change password in Debian.cnf
  become: yes
  replace:
    dest: /etc/mysql/debian.cnf
    regexp: 'password(.*)'
    replace: 'password = {{ mysql_root_pwd }}'
  no_log: true
  when: ansible_os_family == 'Debian'

- name: FND-MDB | configure | Change password for debian-sys-maint
  become: yes
  no_log: true
  command: >
    mysql --execute="SET PASSWORD FOR 'debian-sys-maint'@'localhost' =
    PASSWORD('"{{ mysql_root_pwd }}"');flush privileges;"
  run_once_per: verb_hosts.FND_MDB
  when: ansible_os_family == 'Debian'
0707010000005D000081A40000000000000000000000015E6914DB0000052B000000000000000000000000000000000000005000000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/configure_mysqlchk.yml#
# (c) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- name: FND-MDB | configure_mysqlchk | set server_args
  set_fact:
    creds: "{{ mysql_clustercheck_user }} {{ mysql_clustercheck_pwd }}"

- name: FND-MDB | configure_mysqlchk | Copy clustercheck script
  become: yes
  copy:
    src: usr/bin/clustercheck
    dest: /usr/local/bin/clustercheck
    owner: root
    group: root
    mode: 0755

- name: FND-MDB | configure_mysqlchk | Render mysqlchk xinetd file
  become: yes
  template:
    src: etc/xinetd.d/mysqlchk
    dest: /etc/xinetd.d/mysqlchk
    owner: root
    group: root
    mode: 0644
  notify: restart xinetd

- name: FND-MDB | configure_mysqlchk | Ensure xinetd restart
  become: yes
  meta: flush_handlers
0707010000005E000081A40000000000000000000000015E6914DB00000389000000000000000000000000000000000000005700000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/configure_tls_replication.yml#
# (c) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- include: _configure_tls.yml
  when: mysql_bind_tls | bool

- name: FND-MDB | configure_tls_replication | Copy my.cnf
  become: yes
  template:
    src: etc/mysql/my.cnf.j2
    dest: "{{ mysql_conf_file }}"
    owner: mysql
    group: mysql
    mode: 0600
0707010000005F000081A40000000000000000000000015E6914DB0000068C000000000000000000000000000000000000005600000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/create_service_users_dbs.yml#
# (c) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- name: FND-MDB | create_service_users_dbs | Create DB
  become: yes
  mysql_db:
    login_user: "{{ mysql_root_user }}"
    login_password: "{{ mysql_root_pwd }}"
    login_unix_socket: "{{ mysql_socket }}"
    name: "{{ item.dbname }}"
    encoding: "{{ item.character_set }}"
    collation: "{{ item.collation }}"
  run_once_per: verb_hosts.FND_MDB
  no_log: True
  with_items: mysql_databases

#TO DO#
#add a way to change privs
- name: FND-MDB | create_service_users_dbs | Create DB user
  become: yes
  mysql_user:
    login_user: "{{ mysql_root_user }}"
    login_password: "{{ mysql_root_pwd }}"
    login_unix_socket: "{{ mysql_socket }}"
    host: "{{ item.1.host | default('%') }}"
    name: "{{ item.0.username }}"
    password: "{{ item.0.password }}"
    priv: "{{ item.1.dbname }}{{ item.1.priv }}"
    state: present
    append_privs: yes
  run_once_per: verb_hosts.FND_MDB
  no_log: True
  when: item.0.username is defined and item.0.password is defined
  with_together:
    - mysql_accounts
    - mysql_grants
07070100000060000081A40000000000000000000000015E6914DB000004CA000000000000000000000000000000000000004C00000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/decluster_node.yml#
# (c) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
#  This task sets the parameters you need to decluster node. It assumes
#  you have stopped. If you restart after running this task the node will be out
#  of hte cluster first.
---
- name: FND-MDB | decluster_node | Change provider to none
  become: yes
  lineinfile:
    dest: "{{ mysql_conf_file }}"
    state: present
    regexp: "^wsrep_provider = "
    line: "wsrep_provider = none"

- name: FND-MDB | decluster_node | Set readonly on
  become: yes
  lineinfile:
    dest: "{{ mysql_conf_file }}"
    state: present
    insertafter:  "^\\[mysqld]"
    line: "read_only = ON"

07070100000061000081A40000000000000000000000015E6914DB0000161D000000000000000000000000000000000000004E00000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/galera_bootstrap.yml#
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- name: FND-MDB | galera_bootstrap | Check mysql status
  become: yes
  shell: >
    service "{{ mysql_service }}" status
  register: mysql_service_status_result
  ignore_errors: yes

- name: FND-MDB | galera_bootstrap | Check "{{ mysql_service }}" process
  become: yes
  shell: >
    ps -ef | grep "{{ mysql_binary }}" | grep -v grep
  register: mysql_process_status_result
  ignore_errors: yes

# NOTE(gyee): According to
#
# http://galeracluster.com/documentation-webpages/restartingcluster.html
#
# , if the node is down, we'll need to run 'mysqld_safe --wsrep_recover'
# to recover the last transaction ID. However, if the cluster is not
# completely down (i.e. only some nodes are down), running mysqld_safe is
# harmless as we won't need to use the recovered transaction ID. We'll
# simply bring up the down nodes and have them rejoin the cluster.
- name: FND-MDB | galera_bootstrap | Generate recovered position
  become: yes
  shell: >
    "{{ mysql_safe_binary }}" --wsrep_recover
  when: mysql_process_status_result.stdout == ""

- name: FND-MDB | galera_bootstrap | Look up recovered position
  become: yes
  shell: >
    grep 'WSREP: Recovered position: ' "{{ mysql_log_error }}" | tail -1 |
    sed 's/.*Recovered position: //'
  register: recovered_position_result
  when: mysql_process_status_result.stdout == ""

- name: FND-MDB | galera_bootstrap | Lookup safe_to_bootstrap
  become: yes
  shell: >
    cat "{{ mysql_galera_state_file }}" | grep safe_to_bootstrap |
    awk '{print $2}'
  register: safe_to_bootstrap_result

- name: FND-MDB | galera_bootstrap | Lookup seqno
  become: yes
  shell: >
    cat "{{ mysql_galera_state_file }}" | grep seqno |
    awk '{print $2}'
  register: seqno_result

- name: FND-MDB | galera_bootstrap | Find bootstrap host
  find_galera_mariadb_bootstrap_host:
    hostvars: "{{ hostvars }}"
    mdb_hosts: "{{ mysql_mdb_hosts }}"
  register: find_bootstrap_host_result

- name: FND-MDB | galera_bootstrap | Print bootstrap_host
  debug:
    msg: "{{ find_bootstrap_host_result.bootstrap_host }}"
  run_once: yes

- name: FND-MDB | galera_bootstrap | Print hosts_to_start
  debug:
    msg: "{{ find_bootstrap_host_result.hosts_to_start }}"
  run_once: yes

- name: FND-MDB | galera_bootstrap | Print need_recovery
  debug:
    msg: "{{ find_bootstrap_host_result.need_recovery }}"
  run_once: yes

- name: FND-MDB | galera_bootstrap | Set wsrep_cluster_address on master
  become: yes
  replace:
    dest: "{{ mysql_conf_file }}"
    regexp: '^wsrep_cluster_address = gcomm.*'
    replace: 'wsrep_cluster_address = gcomm://'
  when:
    inventory_hostname == "{{ find_bootstrap_host_result.bootstrap_host }}"

- name: FND-MDB | galera_bootstrap | Update uuid on master
  become: yes
  replace:
    dest: "{{ mysql_galera_state_file }}"
    regexp: '^uuid: .*'
    replace: 'uuid: {{ find_bootstrap_host_result.recovered_uuid }}'
  when:
    (inventory_hostname ==
      "{{ find_bootstrap_host_result.bootstrap_host }}" and
      find_bootstrap_host_result.need_recovery)

- name: FND-MDB | galera_bootstrap | Update seqno on master
  become: yes
  replace:
    dest: "{{ mysql_galera_state_file }}"
    regexp: '^seqno: .*'
    replace: 'seqno: {{ find_bootstrap_host_result.recovered_seqno }}'
  when:
    (inventory_hostname ==
      "{{ find_bootstrap_host_result.bootstrap_host }}" and
      find_bootstrap_host_result.need_recovery)

- name: FND-MDB | galera_bootstrap | Update safe_to_bootstrap on master
  become: yes
  replace:
    dest: "{{ mysql_galera_state_file }}"
    regexp: '^safe_to_bootstrap: .*'
    replace: 'safe_to_bootstrap: 1'
  when:
    inventory_hostname == "{{ find_bootstrap_host_result.bootstrap_host }}"

- name: FND-MDB | galera_bootstrap | Re-copy my.cnf
  become: yes
  template:
    src: etc/mysql/my.cnf.j2
    dest: "{{ mysql_conf_file }}"
    owner: mysql
    group: mysql
    mode: 0600
    force: yes
  when:
    inventory_hostname in "{{ find_bootstrap_host_result.hosts_to_start }}"

- name: FND-MDB | galera_bootstrap | Start mysql on master
  include: galera_start_on_hosts.yml
  vars:
    mysql_hosts_to_start:
      - "{{ find_bootstrap_host_result.bootstrap_host }}"
  when:
    inventory_hostname == "{{ find_bootstrap_host_result.bootstrap_host }}"

- name: FND-MDB | galera_bootstrap | Start mysql on non-master
  include: galera_start_on_hosts.yml
  vars:
    mysql_hosts_to_start: "{{ find_bootstrap_host_result.hosts_to_start }}"

- name: FND-MDB | galera_bootstrap | Restore wsrep_cluster_address on master
  become: yes
  template:
    src: etc/mysql/my.cnf.j2
    dest: "{{ mysql_conf_file }}"
    owner: mysql
    group: mysql
    mode: 0600
    force: yes
  when:
    inventory_hostname == "{{ find_bootstrap_host_result.bootstrap_host }}"

- name: FND-MDB | galera_bootstrap | Restart master node to join cluster
  include: galera_start_on_hosts.yml
  vars:
    mysql_start_state: "restarted"
    mysql_hosts_to_start:
      - "{{ find_bootstrap_host_result.bootstrap_host }}"
  when:
    inventory_hostname == "{{ find_bootstrap_host_result.bootstrap_host }}"
07070100000062000081A40000000000000000000000015E6914DB000007EE000000000000000000000000000000000000005300000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/galera_start_on_hosts.yml#
# (c) Copyright 2017 SUSE LLC
#
# Confidential computer software. Valid license from HPE required for
# possession, use or copying. Consistent with FAR 12.211 and 12.212,
# Commercial Computer Software, Computer Software Documentation, and
# Technical Data for Commercial Items are licensed to the U.S.
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- name: FND-MDB | galera_start_on_hosts | Start MySQL
  become: yes
  service:
    name: "{{ mysql_service }}"
    state: "{{ mysql_start_state | default('started') }}"
  when:
    mysql_hosts_to_start is defined and
    inventory_hostname in "{{ mysql_hosts_to_start }}"

- name: FND-MDB | galera_start_on_hosts | Wait for the port to settle
  become: yes
  wait_for:
    host: "{{ mysql_bind_address }}"
    port : "{{ mysql_server_port }}"
    timeout: 30
  when:
    mysql_hosts_to_start is defined and
    inventory_hostname in "{{ mysql_hosts_to_start }}"

# For now try to keep going if we are not fully synced.
# Curl is used here instead of wait_for due to
# https://github.com/ansible/ansible/issues/12305
- name: FND-MDB | galera_start_on_hosts | Wait for percona to sync
  shell: >
    curl --head --silent
    "http://{{ mysql_bind_address ~ ':' ~ mysql_clustercheck_port }}/"
  register: mysql_sync_result
  until: mysql_sync_result.stdout.find("200 OK") != -1
  retries: "{{ mysql_sync_retries }}"
  delay: 4
  ignore_errors: yes
  when:
    mysql_hosts_to_start is defined and
    inventory_hostname in "{{ mysql_hosts_to_start }}"
  tags:
  - skip_ansible_lint

07070100000063000081A40000000000000000000000015E6914DB0000030F000000000000000000000000000000000000004800000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/initialise.yml#
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- name: FND-MDB | initialise | Remove initialisation file
  become: yes
  file:
    path: "{{ mysql_initialised }}"
    state: absent

07070100000064000081A40000000000000000000000015E6914DB00000507000000000000000000000000000000000000004500000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/install.yml#
# (c) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- include: check_install.yml

- include: _debian_install.yml
  when:
    ansible_os_family == 'Debian' and
    not ( mysql_is_major_upgrade | bool )

- include: _suse_install.yml
  when:
    ansible_os_family == 'Suse' and
    not ( mysql_is_major_upgrade | bool )

- include: stop.yml
  when:
    _debian_packages_installed_result.changed or
    _suse_packages_installed_result.changed or
    ( mysql_is_major_upgrade | bool )

- name: FND-MDB | install | Ensure restart xinetd
  become: yes
  meta: flush_handlers

- name: FND-MDB | install | Enable MDB services
  become: yes
  service:
    name: "{{ mysql_service }}"
    enabled: yes
07070100000065000081A40000000000000000000000015E6914DB00000509000000000000000000000000000000000000004C00000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/install_client.yml#
# (c) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- name: FND-MDB | install_client| include required variables
  include_vars: roles/FND-MDB/defaults/main.yml

- name: FND-MDB | install_client| check install
  include: check_install.yml

- name: FND-MDB | install_client| Install the percona client
  become: yes
  apt:
    pkg: "{{ item }}"
    force: yes
  with_items:
    - percona-xtradb-cluster-client-{{ percona_latest_avail_version }}
  when: ansible_os_family == 'Debian'

- name: FND-MDB | install_client| Install MariaDB client
  become: yes
  zypper:
    name: "{{ item }}"
  with_items:
    - mariadb-client-{{ mariadb_latest_avail_version }}
  when: ansible_os_family == 'Suse'
07070100000066000081A40000000000000000000000015E6914DB0000059A000000000000000000000000000000000000004E00000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/install_packages.yml#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
# Make sure it went down the order I want;  first one down last
# Should be ok if status checked all were up before we upgraded

- name: FND-MDB | install_packages  | Install MDB packages
  become: yes
  apt:
    pkg: "{{ item }}"
    force: yes
    state: latest
  with_items:
    - percona-xtradb-cluster-server-{{ percona_latest_avail_version }}
    - python-mysqldb
    - xinetd # for clustercheck
    - curl
  register: packages_upgraded_result

- name: FND-MDB | install_packages | Notify restart singleton/minor upgrade
  shell: echo "Notify Restart required"
  when: not (mysql_is_major_upgrade | bool) and
        is_singleton_result is defined and
        is_singleton_result | success and
        packages_upgraded_result.changed
  register: ardana_notify_mysql_restart_required

07070100000067000081A40000000000000000000000015E6914DB00000371000000000000000000000000000000000000004200000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/main.yml#
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Warning: If this is used to  stop on all nodes the whole cluster is down
# and can only be started by bootstrapping the cluster manually
#
---
- name: FND-MDB | main | Include platform vars
  include_vars: "{{ item }}"
  with_first_found:
    - "{{ ansible_os_family | lower }}.yml"
    - "default.yml"
07070100000068000081A40000000000000000000000015E6914DB00000939000000000000000000000000000000000000005000000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/percona-change-pwd.yml#
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- name: FND-MDB | percona-change-pwd | sst change
  become: yes
  command: >
    mysql --execute="SET PASSWORD FOR
    '"{{ mysql_sst_user }}"'@'localhost' =
    PASSWORD('"{{ mysql_sst_pwd }}"');"
  no_log: true
  run_once_per: verb_hosts.FND_MDB

- name: FND-MDB | percona-change-pwd | clustercheck change
  become: yes
  no_log: true
  command: >
    mysql --execute="SET PASSWORD FOR
    '"{{ mysql_clustercheck_user }}"'@'localhost' =
    PASSWORD('"{{ mysql_clustercheck_pwd }}"');"
  run_once_per: verb_hosts.FND_MDB

- name: FND-MDB | percona-change-pwd | service change
  become: yes
  no_log: true
  command: >
    mysql --execute="SET PASSWORD FOR
    '"{{ item.0.username }}"'@'"{{ item.1.host | default('%') }}"' =
    PASSWORD('"{{ item.0.password }}"');"
  run_once_per: verb_hosts.FND_MDB
  with_together:
    - mysql_accounts
    - mysql_grants

- name: FND-MDB | percona-change-pwd | get root hosts
  become: yes
  no_log: true
  command: mysql -N --execute="Select host from mysql.user WHERE User='root';"
  run_once_per: verb_hosts.FND_MDB
  ignore_errors: true
  register: success_result

- name: FND-MDB | percona-change-pwd | root change
  become: yes
  no_log: true
  command: >
    mysql --execute="SET PASSWORD FOR
    '"{{ mysql_root_user }}"'@'"{{ item }}"' =
    PASSWORD('"{{ mysql_root_pwd }}"');"
  when: item != "localhost"
  run_once_per: verb_hosts.FND_MDB
  with_items: success_result.stdout_lines

- name: FND-MDB | percona-change-pwd | root localhost change
  become: yes
  no_log: true
  command: >
    mysql --execute="SET PASSWORD FOR
    '"{{ mysql_root_user }}"'@'localhost' =
    PASSWORD('"{{ mysql_root_pwd }}"');flush privileges;"
  run_once_per: verb_hosts.FND_MDB
07070100000069000081A40000000000000000000000015E6914DB00000472000000000000000000000000000000000000004A00000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/post-upgrade.yml#
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
# Should have unheld by now but make sure of this
- include: check_install.yml

- name:  FND-MDB | post-upgrade | UnHold the existing Percona Packages
  become: yes
  command: aptitude -y unhold {{ item }}
  with_items:
  - percona-xtradb-cluster-server-{{ percona_latest_installed_version }}
  - percona-xtradb-cluster-client-{{ percona_latest_installed_version }}
  - percona-xtradb-cluster-common-{{ percona_latest_installed_version }}
  when: ansible_os_family | lower == 'debian'
0707010000006A000081A40000000000000000000000015E6914DB00000A39000000000000000000000000000000000000004900000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/pre-upgrade.yml#
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# This will not handle complex rolling upgrades which are not
# compatible at a replication level.   To handle this this
# play may need to lay down a new config prior to upgrade and
# make the db read only for the duration of the upgrade
---
- include: check_install.yml

#  Code needed here if minor upgrade to do an aptitude hold
#  on a minor upgrade
- name:  FND-MDB | pre-upgrade | Hold the existing Percona Packages
  become: yes
  command: aptitude -y hold {{ item }}
  with_items:
  - percona-xtradb-cluster-server-{{ percona_latest_installed_version }}
  - percona-xtradb-cluster-client-{{ percona_latest_installed_version }}
  - percona-xtradb-cluster-common-{{ percona_latest_installed_version }}
  when: ansible_os_family | lower == 'debian'

# For V3.0.1 mv galera.initialised out of /var/lib/mysql
- name:  FND-MDB | pre-upgrade | Check initialised anywhere
  become: yes
  stat:
    path: "{{ mysql_initialised_deprecated }}"
  delegate_to: "{{ item }}"
  with_items: "{{ mysql_mdb_hosts }}"
  register: mysql_pre_v301_here_result
  run_once_per: verb_hosts.FND_MDB

- name: FND-MDB | pre-upgrade | set pre_bootstrap
  set_fact:
    mysql_pre_v301_bootstrapped: True
  when: item.stat.exists
  with_items: mysql_pre_v301_here_result.results
  run_once_per: verb_hosts.FND_MDB

- name: FND-MDB | pre-upgrade | print initialised status
  debug:
    msg: "galera.initialised exists {{ mysql_pre_v301_bootstrapped }}"

- name: FND-MDB | pre-upgrade | Create initialisation file
  become: yes
  delegate_to: "{{ item }}"
  file:
    path: "{{ mysql_initialised }}"
    state: touch
    mode: 0660
    owner: mysql
    group: mysql
  with_items: "{{ mysql_mdb_hosts }}"
  run_once_per: verb_hosts.FND_MDB

- name: FND-MDB | pre-upgrade | Remove old initialisation file
  become: yes
  delegate_to: "{{ item }}"
  file:
    path: "{{ mysql_initialised_deprecated }}"
    state: absent
  with_items: "{{ mysql_mdb_hosts }}"
  run_once_per: verb_hosts.FND_MDB

0707010000006B000081A40000000000000000000000015E6914DB000005C4000000000000000000000000000000000000004F00000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/remove_mysql_dirs.yml#
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- name: FND-MDB | remove_mysql_dirs | Remove Percona Debian packages
  become: yes
  apt:
    name: mysql-common
    install_recommends: no
    state: absent
    purge: yes
    force: yes
  when: ansible_os_family | lower == 'debian'

# Until file supports recursive remove we need to use rm -rf
- name: FND-MDB | remove_mysql_dirs | remove /var/lib/mysql
  become: yes
  shell: rm -rf "{{ mysql_datadir }}"/*
  tags:
  - skip_ansible_lint

- name: FND-MDB | remove_mysql_dirs | remove /etc/mysql
  become: yes
  file:
    path: /etc/mysql
    state: absent

- name: FND-MDB | remove_mysql_dirs | remove ~root/.my.cnf
  become: yes
  file:
    path: ~root/.my.cnf
    state: absent

- name: FND-MDB | remove_mysql_dirs | remove galera.initialised
  become: yes
  file:
    path: "{{ mysql_initialised }}"
    state: absent
0707010000006C000081A40000000000000000000000015E6914DB0000083C000000000000000000000000000000000000004D00000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/remove_packages.yml#
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
# Purge old major packages if they are there

- name: FND-MDB | remove_packages | Remove Percona Debian packages
  become: yes
  apt:
    name:  "{{ item }}"
    install_recommends: no
    state: absent
    purge: yes
    force: yes
  with_items:
    - percona-xtradb-cluster-server-{{ percona_latest_installed_version }}
    - percona-xtradb-cluster-client-{{ percona_latest_installed_version }}
  when: ansible_os_family | lower == 'debian'
  register: packages_removed_result

# Autoremove dependent packages (Not yet supported by the apt module)
#  https://github.com/ansible/ansible-modules-core/issues/1976
- name: FND-MDB | remove_packages | Remove Dependent Percona Debian packages
  become: yes
  shell: >
    /usr/bin/apt-get --yes autoremove
    percona-xtradb-cluster-server-{{ percona_latest_installed_version }}
    percona-xtradb-cluster-client-{{ percona_latest_installed_version }}
  environment:
    DEBIAN_FRONTEND: noninteractive
  register: dependent_packages_removed_result
  when: ansible_os_family | lower == 'debian'
  tags:
    - skip_ansible_lint

- name: FND-MDB | remove_packages | Remove Maria db and its dependent Suse
        packages
  become: yes
  shell: >
    zypper --non-interactive remove --clean-deps
    mariadb galera-3-wsrep-provider mariadb-tools mariadb-galera mariadb-client
  register: packages_removed_result
  ignore_errors: true
  when: ansible_os_family | lower == 'suse'
  tags:
    - skip_ansible_lint
0707010000006D000081A40000000000000000000000015E6914DB000007B6000000000000000000000000000000000000004C00000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/restart_master.yml#
# (c) Copyright 2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Start mysql on these nodes. Note if the whole cluster is down
# this will not start as a boostrap will need to run on one node
#
---
- name: FND-MDB | restart_master | Restore wsrep_cluster_address
  become: yes
  template:
    src: etc/mysql/my.cnf.j2
    dest: "{{ mysql_conf_file }}"
    owner: mysql
    group: mysql
    mode: 0600
    force: yes
  run_once_per: verb_hosts.FND_MDB
  when: ansible_os_family == 'Suse' and mysql_mdb_cluster_size | int  > 1

- name: FND-MDB | restart_master | Restart MDB Master
  become: yes
  service:
    name: "{{ mysql_service }}"
    state: restarted
  run_once_per: verb_hosts.FND_MDB
  when: ansible_os_family == 'Suse' and mysql_mdb_cluster_size | int  > 1

# For now try to keep going if we are not fully synced.
# Curl is used here instead of wait_for due to
# https://github.com/ansible/ansible/issues/12305
- name: FND-MDB | restart_master | Wait for cluster to sync
  shell: >
    curl --head --silent
    "http://{{ mysql_bind_address ~ ':' ~ mysql_clustercheck_port }}/"
  register: mysql_restart_sync_result
  until: mysql_restart_sync_result.stdout.find("200 OK") != -1
  retries: "{{ mysql_sync_retries }}"
  delay: 4
  ignore_errors: yes
  run_once_per: verb_hosts.FND_MDB
  tags:
  - skip_ansible_lint
  when: ansible_os_family == 'Suse' and mysql_mdb_cluster_size | int  > 1
0707010000006E000081A40000000000000000000000015E6914DB00001659000000000000000000000000000000000000004300000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/start.yml#
# (c) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Start mysql on these nodes. Note if the whole cluster is down
# this will not start as a boostrap will need to run on one node
#
---
- name: FND-MDB | start | Check if service is active (exited)
  become: yes
  shell: "systemctl status {{ mysql_service }}"
  register: mysql_service_result
  failed_when: false
  when: ansible_os_family == 'Debian'
  changed_when: '"active (exited)" in mysql_service_result.stdout'

- name: FND-MDB | start | Check if daemon is down
  become: yes
  shell: "killall -0 mysqld"
  register: mysql_running_result
  failed_when: false
  when: ansible_os_family == 'Debian'
  changed_when: '"no process found" in mysql_running_result.stderr'

- name: FND-MDB | start | Stop if we are inactive (exited) and daemon is down
  become: yes
  service:
    name: "{{ mysql_service }}"
    state: stopped
  when: ansible_os_family == 'Debian' and
        mysql_service_result.changed and
        mysql_running_result.changed

- name: FND-MDB | start | Start MySQL
  become: yes
  service:
    name: "{{ mysql_service }}"
    state: started

- name: FND-MDB | start | Wait for the port to settle
  become: yes
  wait_for:
    host: "{{ mysql_bind_address }}"
    port : "{{ mysql_server_port }}"
    timeout: 30

# For now try to keep going if we are not fully synced.
# Curl is used here instead of wait_for due to
# https://github.com/ansible/ansible/issues/12305
- name: FND-MDB | start | Wait for cluster to sync
  shell: >
    curl --head --silent
    "http://{{ mysql_bind_address ~ ':' ~ mysql_clustercheck_port }}/"
  register: mysql_sync_result
  until: mysql_sync_result.stdout.find("200 OK") != -1
  retries: "{{ mysql_sync_retries }}"
  delay: 4
  ignore_errors: yes
  tags:
  - skip_ansible_lint

- name: FND-MDB | start | Check if singlenode setup
  become: yes
  command: >
    grep -qE '^wsrep_cluster_address = gcomm://{{ mysql_mdb_servers[0].host }}$'
    "{{ mysql_conf_file }}"
  ignore_errors: True
  register: is_singleton_result

# In the normal multinode bootstrap case configure is called before start
# so we could have just run a bootstrap through that sequence in which
# case mysql_bootstrapping should be set
- name: FND-MDB | start | Restart MDB Master
  become: yes
  service:
    name: "{{ mysql_service }}"
    state: restarted
  run_once_per: verb_hosts.FND_MDB
  when: ardana_notify_mysql_restart_required is defined and
        ardana_notify_mysql_restart_required.changed and
        mysql_restarted_result is not defined and
        is_singleton_result | failed and not mysql_bootstrapping
  register: mysql_restarted_result

- include: initialise.yml
  when: ardana_notify_mysql_restart_required is defined and
        ardana_notify_mysql_restart_required.changed and
        is_singleton_result | success and
        not mysql_bootstrapping

- name: FND-MDB | start | set bootstrapped
  set_fact:
    mysql_bootstrapped: false
  when: ardana_notify_mysql_restart_required is defined and
        ardana_notify_mysql_restart_required.changed and
        is_singleton_result | success and
        not mysql_bootstrapping

- include: bootstrap.yml
  when: ardana_notify_mysql_restart_required is defined and
        ardana_notify_mysql_restart_required.changed and
        is_singleton_result | success and
        not mysql_bootstrapping

- name: FND-MDB | start | Notify I am bootstrapping
  set_fact:
    mysql_bootstrapping: true
  when: ardana_notify_mysql_restart_required is defined and
        ardana_notify_mysql_restart_required.changed and
        is_singleton_result | success and
        not mysql_bootstrapping

- name: FND-MDB | start | Wait for MDB master
  become: yes
  wait_for:
    host: "{{ mysql_bind_address }}"
    port: "{{ mysql_server_port }}"
    timeout: 30
  run_once_per: verb_hosts.FND_MDB
  when: ardana_notify_mysql_restart_required is defined and
        ardana_notify_mysql_restart_required.changed and
        mysql_restarted_result is not defined and
        not mysql_bootstrapping
  register: mysql_restarted_result

# For now try to keep going if we are not fully synced.
# Curl is used here instead of wait_for due to
# https://github.com/ansible/ansible/issues/12305
- name: FND-MDB | start | Wait for cluster to sync
  shell: >
    curl --head --silent
    "http://{{ mysql_bind_address ~ ':' ~ mysql_clustercheck_port }}/"
  register: mysql_restart_sync_result
  until: mysql_restart_sync_result.stdout.find("200 OK") != -1
  retries: "{{ mysql_sync_retries }}"
  delay: 4
  ignore_errors: yes
  tags:
  - skip_ansible_lint

- name: FND-MDB | start | Restart MySQL on non-primary nodes
  become: yes
  service:
    name: "{{ mysql_service }}"
    state: restarted
  when: ardana_notify_mysql_restart_required is defined and
        ardana_notify_mysql_restart_required.changed and
        mysql_restarted_result is not defined and
        groups [verb_hosts.FND_MDB].index(inventory_hostname) != 0 and
        not mysql_bootstrapping
  register: mysql_restarted_result

- name: FND-MDB | start | Start xinetd
  become: yes
  service:
    name: xinetd
    state: started0707010000006F000081A40000000000000000000000015E6914DB000012CA000000000000000000000000000000000000004400000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/status.yml#
# (c) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- name: FND-MDB | status | Print service being checked
  debug:
    msg: "Running service check for {{ mysql_service }}"
  run_once_per: verb_hosts.FND_MDB

- name: FND-MDB | status | Check system service running (Debian)
  become: yes
  shell: "systemctl status {{ mysql_service }} && killall -0 mysqld"
  ignore_errors: yes
  changed_when: false
  when: ansible_os_family == 'Debian'
  register: systemctl_status_result

- name: FND-MDB | status | Check system service running
  become: yes
  shell: "systemctl status {{ mysql_service }}"
  ignore_errors: yes
  changed_when: false
  register: systemctl_status_result
  when: ansible_os_family != 'Debian'

- name: FND-MDB | status | Report status of "{{ mysql_service }}"
  fail:
    msg: |
      {{ mysql_service }} is not running.
      systemctl status {{ mysql_service }}
      {{ systemctl_status_result.stdout }}
      {{ systemctl_status_result.stderr }}
  when: systemctl_status_result | failed

# Check percona sync status,
# for now do not actually fail if we are not synced/ignore errors
- name: FND-MDB | status | Check percona sync status
  shell: >
    curl --head --silent
    "http://{{ mysql_bind_address }}:{{ mysql_clustercheck_port }}/"
  ignore_errors: yes
  register: mysql_sync_result
  tags:
  - skip_ansible_lint

- name: FND-MDB | status | Report status of "{{ mysql_service }}"
  debug:
    msg: |
      {{ mysql_service }} is synced.
  when: mysql_sync_result.stdout.find("200 OK") != -1

- name: FND-MDB | status | Report status of "{{ mysql_service }}"
  debug:
    msg: |
      {{ mysql_service }} is not synced.
  when: mysql_sync_result.stdout.find("200 OK") == -1

# Check if the cluster is valid.
# First mysql may not yet be up on all hosts, and that is ok

- name: FND-MDB | status | Find out if mysql down on any hosts
  become: yes
  delegate_to: "{{ item }}"
  shell: mysql -e "select 1"
  with_items: "{{ mysql_mdb_hosts }}"
  ignore_errors: yes
  changed_when: false
  failed_when: false
  register: mysql_full_cluster_result
  run_once_per: verb_hosts.FND_MDB

# This is a workaround for because ansible will not allow set fact to work with
# with_items to increment mysql_nodes_down.So we do this in jinja2 instead.
# This builds a string of xxxx.. for nodes down
- name: FND-MDB | status | Find the nodes which are down
  set_fact:
    mysql_nodesdown: >
      {% for i in mysql_full_cluster_result.results %}
      {%- if i.stderr is not equalto "" -%}x{% endif -%}
      {%endfor%}
  run_once_per: verb_hosts.FND_MDB

- name: FND-MDB | status | Calculate the number of nodes down
  set_fact:
    mysql_no_nodesdown: "{{ mysql_nodesdown | length }}"
  run_once_per: verb_hosts.FND_MDB

- name: FND-MDB | status | Check cluster size on every host
  become: yes
  shell: >
    mysql -sNe "SHOW GLOBAL STATUS LIKE
    'wsrep_cluster_size'"| awk '{ print $2}'
  register: mysql_cluster_size_result

- name: FND-MDB | status | Check cluster address on every host
  become: yes
  shell: >
    mysql -sNe "SHOW GLOBAL VARIABLES LIKE
    'wsrep_cluster_address'" | awk '{n=split($2,a,","); print n }'
  register: mysql_no_nodes_result

# Now the cluster is valid if the cluster_size = no of nodes normally in
# cluster -  nodes down. This check has to be done on each host as
# each has a different status

- name: FND-MDB | status | Check realcluster size
  set_fact:
    mysql_actual_cluster_size: >
      {{ mysql_no_nodes_result.stdout |
      int - mysql_no_nodesdown | int }}
  run_once_per: verb_hosts.FND_MDB

- name: FND-MDB | status | print cluster size
  debug:
    msg: "{{ mysql_cluster_size_result }}"

- name: FND-MDB | status | Report if the cluster seems partitioned
  fail:
    msg: |
      The cluster size is {{ mysql_cluster_size_result.stdout }}
      The number of nodes in the cluster {{ mysql_no_nodes_result.stdout }}
      The number of nodes with mysql down is  {{ mysql_no_nodesdown }}
      Check the cluster is not partitioned!!
  when: (mysql_cluster_size_result is defined and
        mysql_actual_cluster_size is defined and
        mysql_cluster_size_result.stdout !=  mysql_actual_cluster_size)
  run_once_per: verb_hosts.FND_MDB
07070100000070000081A40000000000000000000000015E6914DB00000491000000000000000000000000000000000000004200000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/stop.yml#
# (c) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Warning: If this is used to  stop on all nodes the whole cluster is down
# and can only be started by bootstrapping the cluster manually
#
---
# Stop on slaves first
- name: FND-MDB | stop | Stop MySQL
  become: yes
  service:
    name: "{{ mysql_service }}"
    state: stopped
  when: mysql_mdb_hosts.index(inventory_hostname) != 0

# Stop on master last
- name: FND-MDB | stop | Stop MySQL
  become: yes
  service:
    name: "{{ mysql_service }}"
    state: stopped
  when: mysql_mdb_hosts.index(inventory_hostname) == 0
07070100000071000081A40000000000000000000000015E6914DB0000037F000000000000000000000000000000000000005300000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/tasks/upgrade_configuration.yml#
# (c) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- name: FND-MDB | upgrade_configuration | Start MySQL
  become: yes
  service:
    name: "{{ mysql_service }}"
    state: started

- name: FND-MDB | upgrade_configuration | Run mysql_upgrade
  become: yes
  command: /usr/bin/mysql_upgrade --force
07070100000072000041ED0000000000000000000000045E6914DB00000000000000000000000000000000000000000000003D00000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/templates07070100000073000041ED0000000000000000000000055E6914DB00000000000000000000000000000000000000000000004100000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/templates/etc07070100000074000041ED0000000000000000000000025E6914DB00000000000000000000000000000000000000000000004D00000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/templates/etc/logrotate.d07070100000075000081A40000000000000000000000015E6914DB000004A2000000000000000000000000000000000000005600000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/templates/etc/logrotate.d/mysql.j2{#
#
# (c) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
#}
{{ mysql_log_dir }}/*.log {
        daily
        rotate 7
        missingok
        create 640 mysql adm
        notifempty
        compress
        delaycompress
        sharedscripts
        postrotate
                if test -x /usr/bin/mysqladmin && \
                   /usr/bin/mysqladmin ping &>/dev/null
                then
                   roothome="$(realpath ~root)"
                   /usr/bin/mysqladmin --defaults-file=${roothome}/.my.cnf --socket="{{ mysql_socket}}" flush-logs
                fi
        endscript
}
07070100000076000041ED0000000000000000000000025E6914DB00000000000000000000000000000000000000000000004700000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/templates/etc/mysql07070100000077000081A40000000000000000000000015E6914DB00000328000000000000000000000000000000000000005500000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/templates/etc/mysql/client.cnf.j2{#
#
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
#}

# Client configuration options are moved to separate file, which has file mode
# 0644 and therefore is readable by all users.

[client]
port = {{ mysql_client_port }}
ssl-ca = {{ mysql_ca_certs }}
socket = {{ mysql_socket }}
07070100000078000081A40000000000000000000000015E6914DB00001B2C000000000000000000000000000000000000005100000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/templates/etc/mysql/my.cnf.j2{#
#
# (c) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
#}
# This file has the Ardana Openstack values that apply only to the MySQL 
# service.
#
# The MySQL database server configuration file.
#
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# For custom site-specific configuration, please see the end of this file.

[client]
port = {{ mysql_client_port }}
ssl-ca = {{ mysql_ca_certs }}

socket		= {{ mysql_socket }}

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket		= {{ mysql_socket }}
nice		= {{ mysql_nice }}
# make sure we have enough open files so we do run into
# Resource Temporarily Unavailable error
open_files_limit	= {{ mysql_open_files_limit }}

[mysqld]
#
# * Basic Settings
#
user		=  {{ mysql_user }}
pid-file	=  {{ mysql_pid_file }}
socket		=  {{ mysql_socket }}

port = {{ mysql_server_port }}

# port		= 3306

basedir		= {{ mysql_basedir }}
datadir		= {{ mysql_datadir }}
tmpdir		= {{ mysql_tmpdir }}
lc-messages-dir	= {{ mysql_lc_messages_dir }}
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
# bind-address		= 127.0.0.1
bind-address		= {{ mysql_bind_address }}

#
# * Fine Tuning
#
key_buffer_size		= 16M
max_allowed_packet	= 16M
thread_stack		= 192K
thread_cache_size       = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover         = {{ mysql_myisam_recover }}
max_connections        = 8000
# Increase the number of connect_errors from the default of 100
max_connect_errors      = 1000
# make sure we have enough open files so we do run into
# Resource Temporarily Unavailable error
open_files_limit	= {{ mysql_open_files_limit }}
# Enable diagnostics on a per user basis
userstat                = 1
#table_cache            = 64
#thread_concurrency     = 10
#
# * Query Cache Configuration
#
query_cache_limit	= 1M
query_cache_size        = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file        = /var/log/mysql/mysql.log
#general_log             = 1
#
# Error log - should be very few entries.
#
log_error = {{ mysql_log_error }}
#
# Here you can see queries with especially long duration
slow_query_log          = 0
slow_query_log_file	= /var/log/mysql/mysql-slow.log
long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
#       other settings you may need to change.
server-id		= {{ mysql_server_id }}
#log_bin			= /var/log/mysql/mysql-bin.log
expire_logs_days	= 10
max_binlog_size         = 100M
#binlog_do_db		= include_database_name
#binlog_ignore_db	= include_database_name
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem

{% if mysql_admin_bind_tls | bool %}
ssl-cert = {{ mysql_server_cert }}
ssl-key = {{ mysql_server_key }}
ssl-ca = {{ mysql_ca_certs }}
{% endif %}

# encoding
collation-server = {{ mysql_collation_server }}
init-connect = {{ mysql_init_connect }}
character-set-server = {{ mysql_character_set_server }}

# Galera library
wsrep_on = ON
wsrep_provider = {{ mysql_wsrep_provider }}

# In order for Galera to work correctly binlog format should be ROW
binlog_format = {{ mysql_binlog_format }}

# MyISAM storage engine has only experimental support
default_storage_engine = {{ mysql_default_storage_engine }}

# This changes how InnoDB autoincrement locks are managed and is a requirement for Galera
innodb_autoinc_lock_mode = {{ mysql_innodb_autoinc_lock_mode }}

# innodb settings
innodb_log_buffer_size = 64M
innodb_log_file_size = 128M
innodb_flush_method = {{ innodb_flush_method }}
# 0 should bring better performance but has slight risk of losing some logs
innodb_flush_log_at_trx_commit = {{ innodb_flush_log_at_trx_commit }}
innodb_flush_log_at_timeout = {{ innodb_flush_log_at_timeout }}

# cluster name
wsrep_cluster_name = {{ mysql_wsrep_cluster_name }}
wsrep_node_address = {{ mysql_wsrep_node_address }}

{% if mysql_gcomms_bind_tls | bool %}
# TLS gcomms listener
wsrep_provider_options = "gmcast.listen_addr=tcp://{{ mysql_gmcast_ip ~ ':' ~ mysql_gmcast_port }};socket.ssl_key={{ mysql_gcomms_key }};socket.ssl_cert={{ mysql_gcomms_cert }};socket.ssl_ca={{ mysql_ca_certs }}"
{% else %}
wsrep_provider_options = "gmcast.listen_addr=tcp://{{ mysql_gmcast_ip ~ ':' ~ mysql_gmcast_port }}"
{% endif %}

{% set cluster_addresses = [] %}
{%- for h in mysql_mdb_servers %}
    {%- set _ = cluster_addresses.append(h.host) -%}
{% endfor -%}

wsrep_cluster_address = gcomm://{{ ",".join(cluster_addresses) }}

# SST method
wsrep_sst_method = {{ mysql_wsrep_sst_method }}

# authentication for SST method
wsrep_sst_auth = {{ mysql_wsrep_sst_auth }}

[sst]
inno-backup-opts="--skip-ssl"
{% if mysql_sst_bind_tls | bool %}
# TLS sst listener
encrypt=3
tkey={{ mysql_sst_key }}
tcert={{ mysql_sst_cert}}
{% endif %}


[mysqldump]
quick
quote-names
max_allowed_packet	= 16M

[mysql]
#no-auto-rehash	# faster start of mysql but no tab completition

[isamchk]
key_buffer		= 16M


#
# BEGIN CUSTOM CONFIGURATION
#
# Place any custom mysql sections with their options here
# options placed here will override earlier options in this file
#
# e.g.
#
# [section]
# mysqloption = mysqlvalue
#
# MySQL options are detailed in MySQL documentation:
#
#    http://dev.mysql.com/doc/mysql/en/server-system-variables.html
#
# END CUSTOM CONFIGURATION
#
07070100000079000041ED0000000000000000000000025E6914DB00000000000000000000000000000000000000000000004A00000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/templates/etc/xinetd.d0707010000007A000081A40000000000000000000000015E6914DB000001C9000000000000000000000000000000000000005300000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/templates/etc/xinetd.d/mysqlchk# default: on
# description: mysqlchk
service mysqlchk
{
        disable = no
        flags = REUSE
        socket_type = stream
        port = {{ mysql_clustercheck_port }}
        bind = {{ mysql_bind_address }}
        wait = no
        user = {{ mysql_xinetd_mysqlchk_user }}
        server = /usr/local/bin/clustercheck
        server_args = {{ creds }} 1
        log_on_failure += USERID
        only_from = 0.0.0.0/0
        per_source = UNLIMITED
}
0707010000007B000041ED0000000000000000000000025E6914DB00000000000000000000000000000000000000000000004200000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/templates/home0707010000007C000081A40000000000000000000000015E6914DB000002E8000000000000000000000000000000000000004A00000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/templates/home/.my.cnf{#
#
# (c) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
#}
[client]
user={{ mysql_root_user }}
password={{ _mysql_root_pwd }}

socket={{ mysql_socket }}
0707010000007D000041ED0000000000000000000000025E6914DB00000000000000000000000000000000000000000000003800000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/vars0707010000007E000081A40000000000000000000000015E6914DB00000267000000000000000000000000000000000000004400000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/vars/default.yml#
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
mysql_conf_file: /etc/mysql/my.cnf
0707010000007F000081A40000000000000000000000015E6914DB0000043B000000000000000000000000000000000000004100000000ardana-db-8.0+git.1583944923.03cca6c/roles/FND-MDB/vars/suse.yml#
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
mariadb_server_package: mariadb
mysql_service: mysql
mysql_binary: /usr/sbin/mysqld
mysql_safe_binary: /usr/bin/mysqld_safe

mysql_conf_file: /etc/my.cnf.d/server.cnf
mysql_pid_file: /run/mysql/mysqld.pid
mysql_socket: /run/mysql/mysql.sock
mysql_wsrep_provider: /usr/lib64/galera-3/libgalera_smm.so
mysql_lc_messages_dir: /usr/share/mariadb
mysql_xinetd_mysqlchk_user: mysql

mysql_galera_bootstrap_command: "/usr/bin/galera_new_cluster mysql"
mysql_galera_state_file: /var/lib/mysql/grastate.dat
07070100000080000081A40000000000000000000000015E6914DB000005D8000000000000000000000000000000000000004100000000ardana-db-8.0+git.1583944923.03cca6c/tls-percona-reconfigure.yml#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
# Please note that this playbook should only be run to enable replication
# over TLS after changing mysql_gcomms_bind_tls in main.yml.
- hosts: FND-MDB
  max_fail_percentage: 0
  roles:
    - guard-cluster
    - FND-MDB
  tasks:
    - include: roles/FND-MDB/tasks/status.yml
    - include: roles/FND-MDB/tasks/configure_tls_replication.yml
    - include: roles/FND-MDB/tasks/stop.yml

- hosts: FND-MDB
  max_fail_percentage: 0
  roles:
    - guard-cluster
    - FND-MDB
  tasks:
    - include: roles/FND-MDB/tasks/initialise.yml
    - include: roles/FND-MDB/tasks/galera_bootstrap.yml

- hosts: FND-MDB
  roles:
    - FND-MDB
  tasks:
    - include: roles/FND-MDB/tasks/status.yml

- hosts: FND-MDB:&MON-AGN
  max_fail_percentage: 0
  roles:
    - FND-MDB
    - FND-MDB-monasca
  tasks:
    - include: roles/FND-MDB-monasca/tasks/configure_tls.yml
07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!409 blocks
openSUSE Build Service is sponsored by