File ardana-freezer-8.0+git.1586539529.b7d295f.obscpio of Package ardana-freezer

07070100000000000081A40000000000000000000000015E90AC0900000083000000000000000000000000000000000000003500000000ardana-freezer-8.0+git.1586539529.b7d295f/.gitreview[gerrit]
host=gerrit.suse.provo.cloud
port=29418
project=ardana/freezer-ansible.git
defaultremote=ardana
defaultbranch=stable/pike
07070100000001000081A40000000000000000000000015E90AC090000000C000000000000000000000000000000000000003800000000ardana-freezer-8.0+git.1586539529.b7d295f/.rsync-filter- ardana-ci
07070100000002000081A40000000000000000000000015E90AC090000279F000000000000000000000000000000000000003200000000ardana-freezer-8.0+git.1586539529.b7d295f/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.

07070100000003000081A40000000000000000000000015E90AC0900000BFE000000000000000000000000000000000000003400000000ardana-freezer-8.0+git.1586539529.b7d295f/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.


**Freezer/BURA playbooks for Ardana**
===================

## Prerequisite
For now we assume the freezer-api role will always be installed on the same host
as the logging-server role (they share the elasticsearch database without a vip).

## Infra
The playbooks will deploy the freezer infrastructure:

 - freezer-api
 - freezer-agent and freezer-scheduler on nodes where backup should happen

## Roles
We provide four ansible roles:

 - freezer-api
 - freezer-agent
 - freezer-post-configure (keystone and database configuration)
 - freezer-jobs (backup and restore job managment)

## Auto backup
Backup of the following items will be automaticaly configured:
(Datas are backuped to swift every 12 to 48h)

Deployer node:

 - /home/
 - /etc/passwd
 - /etc/shadow
 - /etc/group
 - /etc/ssh/
 - /etc/group
 - /var/lib/cobbler/
 - /srv/www/cobbler/

Mysql nodes:

 - mysql database

Swift Proxy node:

- /etc/swiftlm/builder_dir


It is possible to disable the creation of the backup and restore jobs by setting the following variables to false:
freezer_create_backup_jobs
freezer_create_restore_jobs

For example:

    ansible-playbook -i hosts/verb_hosts site.yml -e "{\"freezer_create_backup_jobs\": false, \"freezer_create_restore_jobs\": false}"

Notice that you must use the JSON format for these variables. This ensures that they are interpreted
by Ansible as Booleans and not as Strings. Please see [Ansible Documentation on command line variables](http://docs.ansible.com/ansible/playbooks_variables.html#passing-variables-on-the-command-line) for more details on Boolean versus String interpretation.

## Serialization
By default we use some serialization in two steps of the deployement:

 - During the start of all freezer-scheduler. As the it is polling the
   freezer-api and keystone every 60 sec, this will avoid a big number of
   scheduler to do query at the same time.
 - During the upload of backup and restore jobs, to avoid DDoS-ing the
   infrastrucure if installing a large number of compute.

The default value of the serialization is 3, which means those steps will
execute on three nodes in parallel (instead of all of them).
You can tune it by setting the freezer_serialization parameter like this:
> ansible-playbook -i hosts/verb_hosts site.yml -e freezer_serialization=10

This serialization can be turned off completly byt setting it to 100%
> ansible-playbook -i hosts/verb_hosts site.yml -e "freezer_serialization=100%"
07070100000004000081A40000000000000000000000015E90AC09000005E3000000000000000000000000000000000000004700000000ardana-freezer-8.0+git.1586539529.b7d295f/_deployer_restore_helper.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: localhost
  connection: local
  vars_prompt:
    - name: old_deployer_hostname
      prompt: |
        What was the hostname of the old deployer?
        Most probably something like <cloudname>-ccp-c0-m1-mgmt
        Or <cloudname>-ccp-c1-m1-mgmt if it was running on the first controller.
      confirm: yes
  roles:
    - freezer-agent
    - freezer-jobs
  tasks:
    - include: roles/freezer-agent/tasks/install.yml
    - name: freezer-agent | install | Activate the latest install
      become: yes
      install_package:
        name: freezer_agent
        service: freezer-agent
        activate: act_on
        version: "{{ freezer_agent_install_result.version }}"
      when: freezer_agent_install_result is defined and
            deployer_media_legacy_layout|bool
    - include: roles/freezer-jobs/tasks/_deployer_restore_helper.yml
07070100000005000081A40000000000000000000000015E90AC0900000325000000000000000000000000000000000000004800000000ardana-freezer-8.0+git.1586539529.b7d295f/_freezer-schedule-restart.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.
#
---
# Schedule a restart of all freezer services using ardana_notify_... variables
- hosts: all
  tasks:
    - include: roles/freezer-agent/tasks/_schedule_restart.yml
    - include: roles/freezer-api/tasks/_schedule_restart.yml
07070100000006000081A40000000000000000000000015E90AC0900000977000000000000000000000000000000000000004300000000ardana-freezer-8.0+git.1586539529.b7d295f/_freezer_manage_jobs.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: FRE-AGN
  roles:
    - freezer-jobs
  tasks:
    - include_vars: roles/freezer-jobs/defaults/activate.yml
    - include: roles/freezer-jobs/tasks/_pre_manage_jobs.yml
      when: freezer_create_backup_jobs or freezer_create_restore_jobs
    - include: roles/freezer-jobs/tasks/_deploy_ssh_key.yml
  serial: "{{ freezer_serialization | default(3) | int }}"

- hosts: FND-MDB:&FRE-AGN
  roles:
    - freezer-jobs
  tasks:
    - include: roles/freezer-jobs/tasks/_mysql_credentials.yml
      when: freezer_create_backup_jobs and jobs['mysql']['enabled']
    - include: roles/freezer-jobs/tasks/_manage_job.yml job_name=mysql
  serial: "{{ freezer_serialization | default(3) | int }}"

- hosts: SWF-PRX[0]:&FRE-AGN
  roles:
    - freezer-jobs
  tasks:
    - include: roles/freezer-jobs/tasks/_manage_job.yml job_name=swift

- hosts: OPS-LM:&FRE-AGN
  roles:
    - freezer-jobs
  tasks:
    - name: freezer-jobs | manage_job | Get the hostname of the active Lifecycle Manager
      local_action: command hostname
      register: active_lifecycle_manager_hostname
      run_once: true
    - include: roles/freezer-jobs/tasks/_manage_job.yml job_name=deployer
      when: ansible_hostname == active_lifecycle_manager_hostname.stdout

- hosts: FRE-AGN
  roles:
    - freezer-jobs
  tasks:
    - name: freezer-jobs | manage_job | Check for audit log directory presence
      become: yes
      stat:
        path: "{{ FRE.audit.dir }}"
      register: var_audit_presence_result
      ignore_errors: true
    - include: roles/freezer-jobs/tasks/_manage_job.yml job_name=audit
      vars:
        freezer_audit_dir: "{{ FRE.audit.dir }}"
      when: var_audit_presence_result and var_audit_presence_result.stat.exists
  serial: "{{ freezer_serialization | default(3) | int }}"
07070100000007000041ED0000000000000000000000045E90AC0900000000000000000000000000000000000000000000003400000000ardana-freezer-8.0+git.1586539529.b7d295f/ardana-ci07070100000008000041ED0000000000000000000000035E90AC0900000000000000000000000000000000000000000000003C00000000ardana-freezer-8.0+git.1586539529.b7d295f/ardana-ci/project07070100000009000041ED0000000000000000000000035E90AC0900000000000000000000000000000000000000000000004800000000ardana-freezer-8.0+git.1586539529.b7d295f/ardana-ci/project/input-model0707010000000A000041ED0000000000000000000000035E90AC0900000000000000000000000000000000000000000000004D00000000ardana-freezer-8.0+git.1586539529.b7d295f/ardana-ci/project/input-model/data0707010000000B000081A40000000000000000000000015E90AC09000007A0000000000000000000000000000000000000005F00000000ardana-freezer-8.0+git.1586539529.b7d295f/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: ccp
      control-plane-prefix: ccp
      region-name: region1
      failure-zones:
        - AZ1
        - AZ2
        - AZ3

      common-service-components:
        - lifecycle-manager-target
        - monasca-agent
        - freezer-agent
        - logging-rotate
        - logging-producer

      clusters:
        - name: cluster0
          cluster-prefix: c0
          server-role:
            - SERVER1-ROLE
            - SERVER2-ROLE
            - SERVER3-ROLE
          member-count: 3
          allocation-policy: strict
          service-components:
            - lifecycle-manager
            - openstack-client
            - ntp-server
            - ntp-client
            - kafka
            - zookeeper
            - vertica
            - monasca-api
            - monasca-persister
            - ntp-server
            - openstack-client
            - memcached
            - mysql
            - rabbitmq
            - keystone-api
            - keystone-client
            - ip-cluster
            - tempest
            - logging-server
            - swift-proxy
            - swift-account
            - swift-container
            - swift-ring-builder
            - swift-client
            - swift-object
            - freezer-api
0707010000000C000081A40000000000000000000000015E90AC0900000728000000000000000000000000000000000000005700000000ardana-freezer-8.0+git.1586539529.b7d295f/ardana-ci/project/input-model/data/disks.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
  disk-models:
  - name: DISKS
    volume-groups:
      # The policy is not to consume 100% of the space of each volume group.
      # 5% should be left free for snapshots and to allow for some flexibility.
      # sda_root is a templated value to align with whatever partition is really used
      # This value is checked in os config and replaced by the partition actually used
      # on sda e.g. sda1 or sda5
      - name: ardana-vg
        physical-volumes:
         - /dev/sda_root
        logical-volumes:
          - name: root
            size: 75%
            fstype: ext4
            mount: /
          - name: log
            size: 15%
            mount: /var/log
            fstype: ext4
            mkfs-opts: -O large_file
          - name: crash
            size: 2%
            mount: /var/crash
            fstype: ext4
            mkfs-opts: -O large_file
    device-groups:
      - name: swift
        devices:
          - name: /dev/sdb
          - name: /dev/sdc
          - name: /dev/sdd
        consumer:
          name: swift
          attrs:
            rings:
              - account
              - container
              - object-0
0707010000000D000081A40000000000000000000000015E90AC09000003B3000000000000000000000000000000000000005E00000000ardana-freezer-8.0+git.1586539529.b7d295f/ardana-ci/project/input-model/data/server_roles.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
  server-roles:
    - name: SERVER1-ROLE
      interface-model: NET-INTERFACES
      disk-model: DISKS
    - name: SERVER2-ROLE
      interface-model: NET-INTERFACES
      disk-model: DISKS
    - name: SERVER3-ROLE
      interface-model: NET-INTERFACES
      disk-model: DISKS
0707010000000E000081A40000000000000000000000015E90AC09000005CF000000000000000000000000000000000000005900000000ardana-freezer-8.0+git.1586539529.b7d295f/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: AZ1
      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: AZ2
      mac-addr: a4:93:0c:4f:7d:74
      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: AZ3
      mac-addr: a4:93:0c:4f:7e:75
      nic-mapping: VAGRANT
      ilo-ip: 192.168.109.5
      ilo-password: password
      ilo-user: admin
0707010000000F000041ED0000000000000000000000025E90AC0900000000000000000000000000000000000000000000005300000000ardana-freezer-8.0+git.1586539529.b7d295f/ardana-ci/project/input-model/data/swift07070100000010000081A40000000000000000000000015E90AC0900000560000000000000000000000000000000000000005D00000000ardana-freezer-8.0+git.1586539529.b7d295f/ardana-ci/project/input-model/data/swift/rings.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

ring-specifications:

    - region-name: region1
      swift-zones:
        - id: 1
          server-groups:
            - CLOUD
      rings:
        - name: account
          display-name: Account Ring
          min-part-hours: 16
          partition-power: 12
          replication-policy:
            replica-count: 3

        - name: container
          display-name: Container Ring
          min-part-hours: 16
          partition-power: 12
          replication-policy:
            replica-count: 3

        - name: object-0
          display-name: General
          default: no
          min-part-hours: 16
          partition-power: 12
          replication-policy:
            replica-count: 3
07070100000011000041ED0000000000000000000000025E90AC0900000000000000000000000000000000000000000000003A00000000ardana-freezer-8.0+git.1586539529.b7d295f/ardana-ci/tests07070100000012000081A40000000000000000000000015E90AC090000040B000000000000000000000000000000000000004900000000ardana-freezer-8.0+git.1586539529.b7d295f/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.
#
---

- name: Test reconfigure
  logfile: testsuite-reconfigure.log
  prefix: reconfigure
  playbooks:
    - freezer-reconfigure.yml

- name: Validate Freezer status
  exec:
    - validate-freezer-status.bash

- name: Test stop / start of Freezer
  logfile: stop-start.log
  prefix: stop-start
  playbooks:
    - freezer-stop.yml
    - freezer-start.yml
  exec:
    - validate-freezer-status.bash
07070100000013000081ED0000000000000000000000015E90AC090000036C000000000000000000000000000000000000005700000000ardana-freezer-8.0+git.1586539529.b7d295f/ardana-ci/tests/validate-freezer-status.bash#!/bin/bash

#
# (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.
#

test_fail(){
  if [ $? -eq 0 ]
  then
    echo "Ok"
  else
    echo "Fail"
    exit 1
  fi
}

ansible-playbook -i hosts/verb_hosts freezer-status.yml
test_fail
source ~/backup.osrc
test_fail
freezer job-list
test_fail
07070100000014000041ED0000000000000000000000025E90AC0900000000000000000000000000000000000000000000003100000000ardana-freezer-8.0+git.1586539529.b7d295f/config07070100000015000081A40000000000000000000000015E90AC0900000479000000000000000000000000000000000000004600000000ardana-freezer-8.0+git.1586539529.b7d295f/config/freezer-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:
  "freezer/activate_jobs.yml": "roles/freezer-jobs/defaults/activate.yml"
  "freezer/jobs.yml": "roles/freezer-jobs/defaults/jobs.yml"
  "freezer/ssh_credentials.yml": "roles/freezer-jobs/defaults/ssh_credentials.yml"
  "freezer/api/freezer-api.conf.j2": "roles/freezer-api/templates/freezer-api.conf.j2"
  "freezer/api/freezer-modwsgi.conf.j2": "roles/freezer-api/templates/freezer-modwsgi.conf.j2"
07070100000016000081A40000000000000000000000015E90AC0900000871000000000000000000000000000000000000003D00000000ardana-freezer-8.0+git.1586539529.b7d295f/freezer-deploy.yml#
# (c) Copyright 2015 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: FRE-API
  roles:
    - freezer-api
    - freezer-post-configure
  tasks:
    - include: roles/freezer-api/tasks/install.yml
    - include: roles/freezer-api/tasks/configure.yml
    # This task should be set to run-once
    - include: roles/freezer-post-configure/tasks/elasticsearch_mappings.yml

- hosts: FRE-API
  roles:
    - freezer-post-configure
  # Those tasks should be set to run-once
  tasks:
    - include: roles/freezer-post-configure/tasks/keystone_conf.yml
      ansible_python_interpreter: "{{ KEY_CLI.vars.keystone_client_python_interpreter }}"
    - include: roles/freezer-post-configure/tasks/ardana_backup_env.yml
      ansible_python_interpreter: "{{ KEY_CLI.vars.keystone_client_python_interpreter }}"

- hosts: FRE-API
  roles:
    - freezer-api
  tasks:
    - include: roles/freezer-api/tasks/start.yml
  serial: 1

- hosts: FRE-API:&MON-AGN
  roles:
    - freezer-api
  tasks:
    - include: roles/freezer-api/tasks/monitor.yml
  serial: 1

- hosts: FRE-AGN
  roles:
    - freezer-agent
  tasks:
    - include: roles/freezer-agent/tasks/install.yml
    - include: roles/freezer-agent/tasks/configure.yml

- hosts: FRE-AGN
  roles:
    - freezer-agent
  tasks:
    - include: roles/freezer-agent/tasks/start.yml
  serial: "{{ freezer_serialization | default(3) | int }}"

- hosts: FRE-AGN:&MON-AGN
  roles:
    - freezer-agent
  tasks:
    - include: roles/freezer-agent/tasks/monitor.yml
  serial: "{{ freezer_serialization | default(3) | int }}"

- include: _freezer_manage_jobs.yml
07070100000017000081A40000000000000000000000015E90AC09000004D2000000000000000000000000000000000000005500000000ardana-freezer-8.0+git.1586539529.b7d295f/freezer-reconfigure-credentials-change.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: FRE-API
  roles:
    - freezer-api
  tasks:
    - include_vars: roles/logging-common/defaults/main.yml
    - include: roles/freezer-api/tasks/configure.yml

- hosts: FRE-AGN
  roles:
    - freezer-agent
  tasks:
    - include: roles/freezer-agent/tasks/configure.yml

- hosts: FRE-API
  become: yes
  roles:
    - freezer-post-configure
  # This task should be set to run-once
  tasks:
    - include: roles/freezer-post-configure/tasks/keystone_change_pwd.yml
      ansible_python_interpreter: "{{ KEY_CLI.vars.keystone_client_python_interpreter }}"

- include: freezer-start.yml
07070100000018000081A40000000000000000000000015E90AC0900000844000000000000000000000000000000000000004200000000ardana-freezer-8.0+git.1586539529.b7d295f/freezer-reconfigure.yml#
# (c) Copyright 2015 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: FRE-API
  roles:
    - freezer-api
    - freezer-post-configure
  tasks:
    - include_vars: roles/logging-common/defaults/main.yml
    - include: roles/freezer-api/tasks/configure.yml
    # This task should be set to run-once
    - include: roles/freezer-post-configure/tasks/elasticsearch_mappings.yml

- hosts: FRE-API
  roles:
    - freezer-post-configure
  # Those tasks should be set to run-once
  tasks:
    - include: roles/freezer-post-configure/tasks/keystone_conf.yml
      ansible_python_interpreter: "{{ KEY_CLI.vars.keystone_client_python_interpreter }}"
    - include: roles/freezer-post-configure/tasks/ardana_backup_env.yml
      ansible_python_interpreter: "{{ KEY_CLI.vars.keystone_client_python_interpreter }}"

- hosts: FRE-API
  roles:
    - freezer-api
  tasks:
    - include: roles/freezer-api/tasks/start.yml
  serial: 1

- hosts: FRE-API:&MON-AGN
  roles:
    - freezer-api
  tasks:
    - include: roles/freezer-api/tasks/monitor.yml
  serial: 1

- hosts: FRE-AGN
  roles:
    - freezer-agent
  tasks:
    - include: roles/freezer-agent/tasks/configure.yml

- hosts: FRE-AGN
  roles:
    - freezer-agent
  tasks:
    - include: roles/freezer-agent/tasks/start.yml
  serial: "{{ freezer_serialization | default(3) | int }}"

- hosts: FRE-AGN:&MON-API
  roles:
    - freezer-agent
  tasks:
    - include: roles/freezer-agent/tasks/monitor.yml
  serial: "{{ freezer_serialization | default(3) | int }}"

- include: _freezer_manage_jobs.yml
07070100000019000081A40000000000000000000000015E90AC090000028B000000000000000000000000000000000000003E00000000ardana-freezer-8.0+git.1586539529.b7d295f/freezer-restart.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.
#
---
- include: _freezer-schedule-restart.yml

- include: freezer-start.yml
0707010000001A000081A40000000000000000000000015E90AC0900000390000000000000000000000000000000000000003C00000000ardana-freezer-8.0+git.1586539529.b7d295f/freezer-start.yml#
# (c) Copyright 2015 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: FRE-API
  roles:
    - freezer-api
  tasks:
    - include: roles/freezer-api/tasks/start.yml

- hosts: FRE-AGN
  roles:
    - freezer-agent
  tasks:
    - include: roles/freezer-agent/tasks/start.yml
  serial: "{{ freezer_serialization | default(3) | int }}"
0707010000001B000081A40000000000000000000000015E90AC0900000389000000000000000000000000000000000000003D00000000ardana-freezer-8.0+git.1586539529.b7d295f/freezer-status.yml#
# (c) Copyright 2015 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: FRE-API
  max_fail_percentage: 0
  roles:
    - freezer-api
  tasks:
    - include: roles/freezer-api/tasks/status.yml

- hosts: FRE-AGN
  max_fail_percentage: 0
  roles:
    - freezer-agent
  tasks:
    - include: roles/freezer-agent/tasks/status.yml
0707010000001C000081A40000000000000000000000015E90AC0900000353000000000000000000000000000000000000003B00000000ardana-freezer-8.0+git.1586539529.b7d295f/freezer-stop.yml#
# (c) Copyright 2015 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: FRE-AGN
  roles:
    - freezer-agent
  tasks:
    - include: roles/freezer-agent/tasks/stop.yml

- hosts: FRE-API
  roles:
    - freezer-api
  tasks:
    - include: roles/freezer-api/tasks/stop.yml
0707010000001D000081A40000000000000000000000015E90AC09000002E0000000000000000000000000000000000000003E00000000ardana-freezer-8.0+git.1586539529.b7d295f/freezer-upgrade.yml#
# (c) Copyright 2015 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: freezer-status.yml

- include: freezer-deploy.yml

- include: freezer-status.yml
0707010000001E000041ED0000000000000000000000065E90AC0900000000000000000000000000000000000000000000003000000000ardana-freezer-8.0+git.1586539529.b7d295f/roles0707010000001F000041ED0000000000000000000000075E90AC0900000000000000000000000000000000000000000000003E00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-agent07070100000020000041ED0000000000000000000000025E90AC0900000000000000000000000000000000000000000000004700000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-agent/defaults07070100000021000081A40000000000000000000000015E90AC09000004A3000000000000000000000000000000000000006000000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-agent/defaults/keystone_credentials.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.
#
---

backup_keystone_host: "{{ FRE_AGN.consumes_KEY_API.vips.private[0].host }}"
backup_keystone_port: "{{ FRE_AGN.consumes_KEY_API.vips.private[0].port }}"
backup_keystone_url: "{{ FRE_AGN.consumes_KEY_API.vips.private[0].url }}"
backup_region_name: "{{ FRE_API.advertises.vips.private[0].region_name }}"
backup_username: "{{ FRE_AGN.consumes_KEY_API.vars.keystone_backup_user }}"
backup_password: "{{ FRE_AGN.consumes_KEY_API.vars.keystone_backup_password }}"
backup_tenant_name: "{{ FRE_AGN.consumes_KEY_API.vars.keystone_backup_tenant }}"
07070100000022000081A40000000000000000000000015E90AC0900000A21000000000000000000000000000000000000005000000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-agent/defaults/main.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 file contains settings that are common to all operating systems.

freezer_agent_packages:
  - bzip2

ardanauser: "{{ ansible_env['USER'] }}"
ardanauser_home: "{{ ansible_env['HOME'] }}"

freezer_agent_bin_dir: "{%- if deployer_media_legacy_layout|bool %}
                            {{ 'freezer-agent' | bin_dir() }}
                        {%- else -%}
                            /usr/bin
                        {%- endif -%}"
freezer_agent_conf_dir: "{%- if deployer_media_legacy_layout|bool %}
                            {{ 'freezer-agent' | config_dir() }}
                        {%- else -%}
                            /etc/freezer
                        {%- endif -%}"
freezer_scheduler_service: "{%- if deployer_media_legacy_layout|bool -%}
                                freezer-scheduler
                            {%- else -%}
                                openstack-freezer-scheduler
                            {%- endif -%}"

# Logging
freezer_agent_log_dir: "{{ '/var/log/freezer-agent' if deployer_media_legacy_layout|bool else '/var/log/freezer' }}"
freezer_agent_log_file: "{{ freezer_agent_log_dir }}/freezer-agent.log"
freezer_agent_json_log_file: "{{ freezer_agent_log_dir }}/freezer-agent-json.log"
freezer_scheduler_log_file: "{{ freezer_agent_log_dir }}/freezer-scheduler.log"
freezer_scheduler_json_log_file: "{{ freezer_agent_log_dir }}/freezer-scheduler-json.log"
freezer_user: "{{ 'root' if deployer_media_legacy_layout|bool else 'freezer' }}"
freezer_group: "{{ freezer_user }}"
freezer_log_group: "{{ 'adm' if deployer_media_legacy_layout|bool else freezer_group }}"

# Freezer scheduler options
freezer_command: "source {{ ardanauser_home }}/backup.osrc && freezer"
freezer_client_id: "{{ old_deployer_hostname | default(ansible_hostname) }}"
freezer_scheduler_poll_interval: 60
freezer_scheduler_loglevel: INFO
freezer_scheduler_logstash_loglevel: INFO

freezer_agent_restart_required: false
07070100000023000041ED0000000000000000000000025E90AC0900000000000000000000000000000000000000000000004400000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-agent/files07070100000024000081A40000000000000000000000015E90AC09000004A2000000000000000000000000000000000000005E00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-agent/files/FreezerSchedulerDetect.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 monasca_setup.detection


class FreezerSchedulerDetect(monasca_setup.detection.ServicePlugin):

    def __init__(self, template_dir, overwrite=True, args=None):
        service_params = {
            'args': args,
            'template_dir': template_dir,
            'overwrite': overwrite,
            'service_name': 'backup',
            'process_names': ['freezer-scheduler'],
            'service_api_url': None,
            'search_pattern': None
        }

        super(FreezerSchedulerDetect, self).__init__(service_params)
07070100000025000041ED0000000000000000000000025E90AC0900000000000000000000000000000000000000000000004300000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-agent/meta07070100000026000081A40000000000000000000000015E90AC09000002D5000000000000000000000000000000000000004C00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-agent/meta/main.yml#
# (c) Copyright 2015 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.
#
---

dependencies:
  - { role: monasca-agent, run_mode: Use }
  - role: tls-vars
07070100000027000041ED0000000000000000000000025E90AC0900000000000000000000000000000000000000000000004400000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-agent/tasks07070100000028000081A40000000000000000000000015E90AC0900000332000000000000000000000000000000000000005A00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-agent/tasks/_schedule_restart.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.
#
---
- name: freezer-agent | _schedule_restart | Schedule a restart for freezer scheduler
  debug:
    msg: "Trigger a change notification in freezer scheduler"
  changed_when: true
  register: ardana_notify_freezer_scheduler_restart_required
07070100000029000081A40000000000000000000000015E90AC090000059B000000000000000000000000000000000000005200000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-agent/tasks/configure.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_vars: ../defaults/keystone_credentials.yml

- name: freezer-agent | configure | Create configuration files
  become: yes
  template:
    src: "{{ item }}.j2"
    dest: "{{ freezer_agent_conf_dir }}/{{ item }}"
    owner: "{{ freezer_user }}"
    group: "{{ freezer_group }}"
    mode: 0640
  with_items:
    - systemd_env_vars.cfg
    - scheduler-logging.conf
    - agent-logging.conf
    - scheduler.conf
  register: ardana_notify_freezer_scheduler_restart_required

- name: freezer-agent | configure | Create backup.osrc credential file
  become: yes
  template:
    src: backup.osrc.j2
    dest: "{{ ardanauser_home }}/backup.osrc"
    owner: "{{ ardanauser }}"
    group: "{{ ardanauser }}"
    mode: 0640
  register: ardana_notify_freezer_scheduler_restart_required
0707010000002A000081A40000000000000000000000015E90AC0900000F26000000000000000000000000000000000000005700000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-agent/tasks/install-legacy.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: freezer-agent | install | Update venv cache
  become: yes
  install_package:
    cache: update

- name: freezer-agent | install | Install Freezer_agent virtual env
  become: yes
  install_package:
    name: freezer_agent
    service: freezer-agent
    state: present
    activate: act_off
  register: freezer_agent_install_result

- name: freezer-agent | install | Register freezer-scheduler with systemd
  become: yes
  setup_systemd:
    name: freezer-scheduler
    service: freezer-agent
    cmd: freezer-scheduler
    restart: on-failure
    user: root
    group: root
    args: "start --config-file {{ freezer_agent_conf_dir }}/scheduler.conf "

- name: freezer-agent | install | Set service directories
  set_fact:
    freezer_agent_conf_dir: "{{ 'freezer-agent' |  config_dir(freezer_agent_install_result.version) }}"
    freezer_agent_bin_dir: "{{ 'freezer-agent' |  bin_dir(freezer_agent_install_result.version) }}"

- name: freezer-agent | install | Check if Freezer agent is available
  become: yes
  stat:
    path: "{{ freezer_agent_bin_dir }}/freezerc"
  register: freezer_agent_bin_result

- name: freezer-agent | install | Check if Freezer scheduler is available
  become: yes
  stat:
    path: "{{ freezer_agent_bin_dir }}/freezer-scheduler"
  register: freezer_scheduler_bin_result

- name: freezer-agent | install | Enabling freezer agent for all users
  become: yes
  file:
    src: "{{ freezer_agent_bin_dir }}/freezerc"
    dest: /usr/bin/freezer-agent
    state: link
    force: yes
  when: freezer_agent_bin_result.stat.exists and freezer_agent_bin_result.stat.xusr

- name: freezer-agent | install | Enabling freezer scheduler for all users
  become: yes
  file:
    src: "{{ freezer_agent_bin_dir }}/freezer-scheduler"
    dest: /usr/bin/freezer-scheduler
    state: link
    force: yes
  when: freezer_scheduler_bin_result.stat.exists and freezer_scheduler_bin_result.stat.xusr

- name: freezer-agent | configure | Create directories
  become: yes
  file:
    path: "{{ item }}"
    mode: 0770
    state: directory
  with_items:
    - /etc/freezer
    - /etc/freezer/scheduler
    - /etc/freezer/scheduler/conf.d
    - /root/.freezer

- name: freezer-agent | configure | Create Freezer log directory
  become: yes
  file:
    path: "{{ freezer_agent_log_dir }}"
    owner: root
    group: "{{ freezer_log_group }}"
    mode: 0750
    state: directory

- name: freezer-agent | configure | Touch Freezer log files
  become: yes
  file:
    path: "{{ item }}"
    owner: root
    group: "{{ freezer_log_group }}"
    mode: 0640
    state: touch
  with_items:
    - "{{ freezer_agent_log_file }}"
    - "{{ freezer_agent_json_log_file }}"
    - "{{ freezer_scheduler_log_file }}"
    - "{{ freezer_scheduler_json_log_file }}"

- name: freezer-client | install | Check if Freezer client is available
  become: yes
  stat:
    path: "{{ freezer_agent_bin_dir }}/freezer"
  register: freezer_client_bin_result

- name: freezer-client | install | Enabling freezer client for all users
  become: yes
  file:
    src: "{{ freezer_agent_bin_dir }}/freezer"
    dest: /usr/bin/freezer
    state: link
    force: yes
  when: freezer_client_bin_result.stat.exists and freezer_client_bin_result.stat.xusr
0707010000002B000081A40000000000000000000000015E90AC09000007A7000000000000000000000000000000000000005000000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-agent/tasks/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: freezer-agent | install | Install package dependencies
  become: yes
  package:
    state: present
    name: "{{ item }}"
  with_items: freezer_agent_packages

- include: install-legacy.yml
  when:
    - deployer_media_legacy_layout|bool

- name: freezer-agent | install | Install freezer-agent and scheduler (rpm)
  become: yes
  package:
    state: present
    name: "{{ item }}"
  with_items:
    - openstack-freezer-agent
    - openstack-freezer-scheduler
    - python-python-logstash
  when:
    - not deployer_media_legacy_layout|bool

- name: freezer-agent | install | Create systemd overlay dir
  become: yes
  file:
    name: "/etc/systemd/system/{{ freezer_scheduler_service }}.service.d/"
    state: directory

- name: freezer-agent | install | Add environment loading to systemd config file
  become: yes
  template:
    src: freezer-scheduler.service.overlay
    dest: "/etc/systemd/system/{{ freezer_scheduler_service }}.service.d/ardana.conf"
  register: insert_line_env_result

- name: freezer-agent | install | Notify Systemd
  become: yes
  command: systemctl daemon-reload
  when: insert_line_env_result.changed

- name: freezer-agent | install | Set the freezer-scheduler to start on reboot
  become: yes
  service:
    name: "{{ freezer_scheduler_service }}"
    enabled: yes
0707010000002C000081A40000000000000000000000015E90AC09000005A7000000000000000000000000000000000000005000000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-agent/tasks/monitor.yml#
# (c) Copyright 2015 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: freezer-agent | monitor | freezer-scheduler detection plugin directory creation
  become: yes
  file: path=/usr/lib/monasca/agent/custom_detect.d state=directory owner=root group=root mode=0755
  when: '"MON-AGN" in group_names'

- name: freezer-agent | monitor | freezer-scheduler detection plugin file copy
  become: yes
  copy: src=FreezerSchedulerDetect.py dest=/usr/lib/monasca/agent/custom_detect.d/FreezerSchedulerDetect.py owner=root group=root mode=0644
  when: '"MON-AGN" in group_names'

- name: freezer-agent | monitor | Restart freezer-scheduler Monitor Plugin
  become: yes
  monasca_agent_plugin: name="FreezerSchedulerDetect"
  register: freezer_monitor_restart_result
  until: "freezer_monitor_restart_result.rc == 0"
  retries: 3
  delay: 10
  when: '"MON-AGN" in group_names'
0707010000002D000081A40000000000000000000000015E90AC09000006D7000000000000000000000000000000000000004E00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-agent/tasks/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.
#
---

- include_vars: ../defaults/keystone_credentials.yml

- name: freezer-agent | start | Activate the latest install
  become: yes
  install_package:
    name: freezer_agent
    service: freezer-agent
    activate: act_on
    version: "{{ freezer_agent_install_result.version }}"
  when: freezer_agent_install_result is defined and
        deployer_media_legacy_layout|bool

- name: freezer-agent | start | Make sure keystone is reachable
  wait_for: host={{ backup_keystone_host }} port={{ backup_keystone_port }} state=started
  ignore_errors: true

- name: freezer-agent | start | Restart freezer-scheduler
  become: yes
  service:
    name: "{{ freezer_scheduler_service }}"
    state: restarted
  when: ((ardana_notify_freezer_scheduler_restart_required is defined
        and ardana_notify_freezer_scheduler_restart_required.changed)
        or (freezer_agent_install_result is defined
        and freezer_agent_install_result.changed))

- name: freezer-agent | start | Ensure freezer-scheduler is started
  become: yes
  service:
    name: "{{ freezer_scheduler_service }}"
    state: started
0707010000002E000081A40000000000000000000000015E90AC09000004C6000000000000000000000000000000000000004F00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-agent/tasks/status.yml#
# (c) Copyright 2015 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: freezer-agent | status | Check if systemd service is running
  become: yes
  command: "systemctl status {{ freezer_scheduler_service }}"
  ignore_errors: yes
  changed_when: false
  no_log: True
  register: freezer_scheduler_systemd_status_result

- name: freezer-agent | status | Report status of freezer-agent
  fail:
    msg: |
      freezer-agent is not running:
      Command output:
      {{ freezer_scheduler_systemd_status_result.stdout }}
      {{ freezer_scheduler_systemd_status_result.stderr }}
  when: "freezer_scheduler_systemd_status_result.rc != 0"
0707010000002F000081A40000000000000000000000015E90AC090000031D000000000000000000000000000000000000004D00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-agent/tasks/stop.yml#
# (c) Copyright 2015 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: freezer-agent | stop | Stop Freezer through systemd
  become: yes
  service:
    name: "{{ freezer_scheduler_service }}"
    state: stopped
07070100000030000041ED0000000000000000000000025E90AC0900000000000000000000000000000000000000000000004800000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-agent/templates07070100000031000081A40000000000000000000000015E90AC090000070F000000000000000000000000000000000000005E00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-agent/templates/agent-logging.conf.j2{#
#
# (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.
#
#}
[loggers]
keys: root, iso8601, dogpile

[handlers]
keys: watchedfile, logstash

[formatters]
keys:  debug, normal, logstash


###########
# Loggers #
###########

[logger_root]
qualname: root
handlers: watchedfile, logstash
level: NOTSET

[logger_iso8601]
qualname: iso8601
handlers: watchedfile, logstash
level: INFO

[logger_dogpile]
qualname: dogpile
handlers: watchedfile, logstash
level: INFO

################
# Log Handlers #
################

# Writes to disk
[handler_watchedfile]
class: handlers.WatchedFileHandler
args: ('{{ freezer_agent_log_file }}',)
formatter = normal
level: {{ freezer_scheduler_loglevel }}

# Writes JSON to disk, beaver will ship to logstash
[handler_logstash]
class: handlers.WatchedFileHandler
args: ('{{ freezer_agent_json_log_file }}',)
formatter= logstash
level: {{ freezer_scheduler_logstash_loglevel }}

##################
# Log Formatters #
##################

[formatter_normal]
format=(%(name)s): %(asctime)s %(levelname)s %(message)s

[formatter_debug]
format=(%(name)s): %(asctime)s %(levelname)s %(module)s %(funcName)s %(message)s

[formatter_logstash]
class = logstash.LogstashFormatterVersion1
format = freezer
07070100000032000081A40000000000000000000000015E90AC090000046A000000000000000000000000000000000000005700000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-agent/templates/backup.osrc.j2{#
#
# (c) Copyright 2015 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.
#
#}
# OpenStack variables for the freezer agent to authenticate to Keystone

unset OS_DOMAIN_NAME
export OS_AUTH_URL={{ backup_keystone_url }}/v3
export OS_PROJECT_NAME={{ backup_tenant_name }}
export OS_USERNAME={{ backup_username }}
export OS_PASSWORD={{ backup_password }}
export OS_PROJECT_DOMAIN_NAME=Default
export OS_USER_DOMAIN_NAME=Default
export OS_IDENTITY_API_VERSION=3
export OS_AUTH_VERSION=3
export OS_CACERT={{ trusted_ca_bundle }}
export OS_ENDPOINT_TYPE=internalURL
07070100000033000081A40000000000000000000000015E90AC090000028D000000000000000000000000000000000000006A00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-agent/templates/freezer-scheduler.service.overlay#
# (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.
#

[Service]
EnvironmentFile=-{{ freezer_agent_conf_dir }}/systemd_env_vars.cfg07070100000034000081A40000000000000000000000015E90AC0900000717000000000000000000000000000000000000006200000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-agent/templates/scheduler-logging.conf.j2{#
#
# (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.
#
#}
[loggers]
keys: root, iso8601, dogpile

[handlers]
keys: watchedfile, logstash

[formatters]
keys:  debug, normal, logstash


###########
# Loggers #
###########

[logger_root]
qualname: root
handlers: watchedfile, logstash
level: NOTSET

[logger_iso8601]
qualname: iso8601
handlers: watchedfile, logstash
level: INFO

[logger_dogpile]
qualname: dogpile
handlers: watchedfile, logstash
level: INFO

################
# Log Handlers #
################

# Writes to disk
[handler_watchedfile]
class: handlers.WatchedFileHandler
args: ('{{ freezer_scheduler_log_file }}',)
formatter = normal
level: {{ freezer_scheduler_loglevel }}

# Writes JSON to disk, beaver will ship to logstash
[handler_logstash]
class: handlers.WatchedFileHandler
args: ('{{ freezer_scheduler_json_log_file }}',)
formatter= logstash
level: {{ freezer_scheduler_logstash_loglevel }}

##################
# Log Formatters #
##################

[formatter_normal]
format=(%(name)s): %(asctime)s %(levelname)s %(message)s

[formatter_debug]
format=(%(name)s): %(asctime)s %(levelname)s %(module)s %(funcName)s %(message)s

[formatter_logstash]
class = logstash.LogstashFormatterVersion1
format = freezer
07070100000035000081A40000000000000000000000015E90AC0900000341000000000000000000000000000000000000005A00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-agent/templates/scheduler.conf.j2{#
#
# (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.
#
#}
[DEFAULT]

log_config_append = {{ freezer_agent_conf_dir }}/scheduler-logging.conf

client_id = {{ freezer_client_id }}

interval = {{ freezer_scheduler_poll_interval }}

no_daemon = True
07070100000036000081A40000000000000000000000015E90AC0900000450000000000000000000000000000000000000006000000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-agent/templates/systemd_env_vars.cfg.j2{#
#
# (c) Copyright 2015 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.
#
#}
# OpenStack variables for the freezer agent to authenticate to Keystone
# Will be injected in freezer-scheduler's environment by systemd

OS_AUTH_URL={{ backup_keystone_url }}/v3
OS_PROJECT_NAME={{ backup_tenant_name }}
OS_USERNAME={{ backup_username }}
OS_PASSWORD={{ backup_password }}
OS_PROJECT_DOMAIN_NAME=Default
OS_USER_DOMAIN_NAME=Default
OS_IDENTITY_API_VERSION=3
OS_AUTH_VERSION=3
OS_CACERT={{ trusted_ca_bundle }}
OS_ENDPOINT_TYPE=internalURL
07070100000037000041ED0000000000000000000000075E90AC0900000000000000000000000000000000000000000000003C00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-api07070100000038000041ED0000000000000000000000025E90AC0900000000000000000000000000000000000000000000004500000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-api/defaults07070100000039000081A40000000000000000000000015E90AC0900000D39000000000000000000000000000000000000004E00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-api/defaults/main.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 file contains settings that are common to all operating systems.

freezer_keystone_identity_uri: "{{ FRE_API.consumes_KEY_API.vips.private[0].url }}"
freezer_keystone_auth_uri: "{{ FRE_API.consumes_KEY_API.vips.private[0].url }}"
freezer_keystone_service_user: "{{ FRE_API.consumes_KEY_API.vars.keystone_freezer_user }}"
freezer_keystone_service_password: "{{ FRE_API.consumes_KEY_API.vars.keystone_freezer_password | quote }}"
freezer_keystone_service_project_name: "{{ KEY_API.vars.keystone_service_tenant }}"
freezer_keystone_user_domain_name: "{{ KEY_API.vars.keystone_default_domain }}"
freezer_keystone_project_domain_name: "{{ KEY_API.vars.keystone_default_domain }}"
freezer_keystone_cacert: "{{ trusted_ca_bundle }}"
memcached_servers: "{% for x in FRE.consumes_FND_MEM.members.private %}{{ x.host }}:{{ x.port }}{%if
 not loop.last %},{% endif %}{% endfor %}"
memcache_secret_key: "{{ FRE.consumes_FND_MEM.vars.memcached.freezer.secret_key | quote }}"

freezer_bind_host: "{{ host.bind.FRE_API.admin.ip_address }}"
freezer_bind_port: "{{ host.bind.FRE_API.admin.port }}"
freezer_vip_url: "{{ FRE_API.advertises.vips.private[0].url }}"

freezer_system_user: freezer
freezer_system_group: freezer
freezer_home_dir: /var/lib/freezer

freezer_api_venv_conf_dir: "{{ 'freezer-api' | config_dir() }}"
freezer_api_venv_bin_dir: "{{ 'freezer-api' | bin_dir() }}"

freezer_api_log_dir: "/var/log/freezer-api"
freezer_api_log_python: "{{ freezer_api_log_dir }}/freezer-api.log"
freezer_api_log_python_json: "{{ freezer_api_log_dir }}/freezer-api-json.log"
freezer_api_log_access: "{{ freezer_api_log_dir }}/freezer-api-access.log"
freezer_api_log_wsgi: "{{ freezer_api_log_dir }}/freezer-api-modwsgi.log"
freezer_api_log_audit_dir: "{{ FRE.audit.dir }}/freezer"
freezer_api_log_audit: "{{ freezer_api_log_audit_dir }}/freezer-api-audit.log"
freezer_api_audit_enabled: "{{ FRE.audit.enabled }}"
freezer_api_loglevel: INFO
freezer_api_logstash_loglevel: INFO
freezer_api_log_group: adm

# Tuning
freezer_api_es_replicas: "{{ ( groups[verb_hosts.LOG_SVR] | length ) - 1 }}"
freezer_api_token_cache_time: 3600
freezer_api_process_count: 4
freezer_api_thread_count: 4
freezer_api_socket_timeout: 300
freezer_api_http_request_max_retries: 5
freezer_api_elasticsearch_retries: 20
freezer_api_elasticsearch_timeout: 60

freezer_api_conf_symlinks:
  - { dst: '/etc/freezer/freezer-api.conf', src: 'freezer-api.conf' }
  - { dst: '/etc/freezer/freezer-api-audit-map.conf', src: 'freezer-api-audit-map.conf' }
  - { dst: '/etc/freezer/freezer-api-logging.conf', src: 'freezer-api-logging.conf' }
  - { dst: '/etc/freezer/freezer-api-paste.ini', src: 'freezer-api-paste.ini' }
  - { dst: '/etc/freezer/policy.json', src: 'policy.json' }
0707010000003A000041ED0000000000000000000000025E90AC0900000000000000000000000000000000000000000000004100000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-api/meta0707010000003B000081A40000000000000000000000015E90AC09000002E7000000000000000000000000000000000000004A00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-api/meta/main.yml#
# (c) Copyright 2015 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.
#
---

dependencies:
  - { role: monasca-agent, run_mode: Use }
  - role: FND-AP2
  - role: tls-vars
0707010000003C000041ED0000000000000000000000025E90AC0900000000000000000000000000000000000000000000004200000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-api/tasks0707010000003D000081A40000000000000000000000015E90AC090000031E000000000000000000000000000000000000005800000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-api/tasks/_schedule_restart.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.
#
---
- name: freezer-api | _schedule_restart | Schedule a restart for freezer API
  debug:
    msg: "Trigger a change notification in freezer API"
  changed_when: true
  register: ardana_notify_freezer_api_restart_required
0707010000003E000081A40000000000000000000000015E90AC0900000BAB000000000000000000000000000000000000005000000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-api/tasks/configure.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: freezer-api | configure | Copy freezer-api configuration files
  become: yes
  template:
    src: "{{ item }}.j2"
    dest: "{{ freezer_api_venv_conf_dir_by_version | default(freezer_api_venv_conf_dir) }}/{{ item }}"
    owner: "{{ freezer_system_user }}"
    group: "{{ freezer_system_group }}"
    mode: 0640
  with_items:
    - freezer-api.conf
    - freezer-api-audit-map.conf
    - freezer-api-paste.ini
    - freezer-api-logging.conf
    - policy.json
  register: ardana_notify_freezer_api_restart_required

- name: freezer-api | configure | Create logging directory
  become: yes
  file:
    path: "{{ freezer_api_log_dir }}"
    owner: "{{ freezer_system_user }}"
    group: "{{ freezer_api_log_group }}"
    mode: 0750
    state: directory

- name: freezer-api | configure | Create audit logging directory
  become: yes
  file:
    path: "{{ freezer_api_log_audit_dir }}"
    owner: "{{ freezer_system_user }}"
    group: "{{ freezer_api_log_group }}"
    mode: 0750
    state: directory
  when: freezer_api_audit_enabled | bool

- name: freezer-api | configure | Touch log files
  become: yes
  file:
    path: "{{ item }}"
    owner: "{{ freezer_system_user }}"
    group: "{{ freezer_api_log_group }}"
    mode: 0640
    state: touch
  with_items:
    - "{{ freezer_api_log_python }}"
    - "{{ freezer_api_log_python_json }}"
    - "{{ freezer_api_log_access }}"
    - "{{ freezer_api_log_wsgi }}"

- name: freezer-api | configure | Touch the audit log file
  become: yes
  file:
    path: "{{ freezer_api_log_audit }}"
    owner: "{{ freezer_system_user }}"
    group: "{{ freezer_api_log_group }}"
    mode: 0640
    state: touch
  when: freezer_api_audit_enabled | bool

- name: freezer-api | configure | Create config directory
  become: yes
  file:
    path: /etc/freezer/
    owner: "{{ freezer_system_user }}"
    group: "{{ freezer_system_group }}"
    mode: 0770
    state: directory

- name: freezer-api | configure | Copies modwsgi config file
  become: yes
  template:
    src: freezer-modwsgi.conf.j2
    dest: "{{ apache2_vhost_dir }}/freezer-modwsgi.vhost"
  register: ardana_notify_freezer_api_restart_required

# TODO(howleyt): Can this be moved to apache playbook?
- name: freezer-api | configure | Enable wsgi module in apache
  become: yes
  apache2_module:
    state: present
    name: wsgi
0707010000003F000081A40000000000000000000000015E90AC0900000B01000000000000000000000000000000000000004E00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-api/tasks/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: freezer-api | install | Check if node is configured to run elasticsearch
  fail:
    msg: "freezer-api should be installed on same node as LOG-SVR (they share the elasticsearch)"
  when: '"LOG-SVR" not in group_names'

- include_vars: ../../logging-common/defaults/main.yml

- name: freezer-api | install | Install apt dependencies
  become: yes
  package:
    state: present
    name: "{{ item }}"
  with_items: freezer_api_packages

- name: freezer-api | install | Update venv cache
  become: yes
  install_package:
    cache: update

- name: freezer-api | install | Install Freezer_api virtual env
  become: yes
  install_package:
    name: "{{ 'freezer_api' if deployer_media_legacy_layout|bool else 'freezer' }}"
    service: freezer-api
    state: present
    activate: act_off
  register: freezer_api_install_result

- name: freezer-api | install | Set service directories
  set_fact:
    freezer_api_venv_bin_dir_by_version: "{{ 'freezer-api' | bin_dir(freezer_api_install_result.version) }}"
    freezer_api_venv_conf_dir_by_version: "{{ 'freezer-api' | config_dir(freezer_api_install_result.version) }}"

- name: freezer-api | install | Create freezer WSGI directory
  become: yes
  file:
    path: "{{ www_root }}/freezer"
    state: directory

- name: freezer-api | install | Create symlink to freezer wsgi module
  become: yes
  file:
    dest: "{{ www_root }}/freezer/freezer-api"
    src: "{{ freezer_api_venv_bin_dir_by_version }}/../lib/python2.7/site-packages/freezer_api/cmd/wsgi.py"
    state: link

- name: freezer-api | install | Add group '{{ freezer_system_group }}'
  become: yes
  group:
    name: "{{ freezer_system_group }}"
    state: present

- name: freezer-api | install | Add user '{{ freezer_system_user }}'
  become: yes
  user:
    name: "{{ freezer_system_user }}"
    group: "{{ freezer_system_group }}"
    createhome: no
    home: "{{ freezer_home_dir }}"
    shell: /bin/true
    state: present

- name: freezer-api | install | Add user home
  become: yes
  file:
    path: "{{ freezer_home_dir }}"
    state: directory
    owner: "{{ freezer_system_user }}"
    group: "{{ freezer_system_group }}"
    mode: 0750
07070100000040000081A40000000000000000000000015E90AC09000002F0000000000000000000000000000000000000004B00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-api/tasks/main.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.
#
---
- name: freezer-api | main | Set os-specific variables
  include_vars: "{{ ansible_os_family | lower }}.yml"
07070100000041000081A40000000000000000000000015E90AC09000004AB000000000000000000000000000000000000004E00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-api/tasks/monitor.yml#
# (c) Copyright 2015 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: freezer-api | monitor | Setup freezer-api local endpoint monitoring
  become: yes
  monasca_agent_plugin:
    name: "httpcheck"
    args: "url=http://{{ freezer_bind_host }}:{{ freezer_bind_port }}/healthcheck dimensions=service:backup,component:freezer-api"

- name: freezer-api | monitor | Setup freezer-api internal VIP monitoring
  become: yes
  monasca_agent_plugin:
    name: "httpcheck"
    args: "url={{ freezer_vip_url }}/healthcheck dimensions=service:backup,component:freezer-api,monitored_host_type:vip,api_endpoint:private"

07070100000042000081A40000000000000000000000015E90AC0900000841000000000000000000000000000000000000004C00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-api/tasks/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.
#
---
- name: freezer-api | start | Enable Freezer-api site
  become: yes
  file:
    src: "{{ apache2_vhost_dir }}/freezer-modwsgi.vhost"
    dest: "{{ apache2_vhost_dir }}/freezer-modwsgi.conf"
    state: link
  register: freezer_api_a2_enable_site_result

- name: freezer-api | start | Activate the latest install
  become: yes
  install_package:
    name: "{{ 'freezer_api' if deployer_media_legacy_layout|bool else 'freezer' }}"
    service: freezer-api
    activate: act_on
    version: "{{ freezer_api_install_result.version }}"
  when: freezer_api_install_result is defined

- name: freezer-api | start | Update conf dir symlinks
  become: yes
  file:
    src: "{{ freezer_api_venv_conf_dir }}/{{ item.src }}"
    dest: "{{ item.dst }}"
    owner: "{{ freezer_system_user }}"
    group: "{{ freezer_system_group }}"
    mode: 0640
    state: link
  when: freezer_api_install_result is defined
  with_items: freezer_api_conf_symlinks

- include: "{{ playbook_dir }}/roles/FND-AP2/tasks/start_reload.yml"
  vars:
    apache_restart_requested: "{{ ardana_notify_freezer_api_restart_required is defined and ardana_notify_freezer_api_restart_required.changed }}"
    apache_reload_requested: "{{ (ardana_notify_freezer_api_restart_required is defined and ardana_notify_freezer_api_restart_required.changed) or
                                 (freezer_api_a2_enable_site_result is defined and freezer_api_a2_enable_site_result.changed) }}"

- include: status.yml
07070100000043000081A40000000000000000000000015E90AC09000004B6000000000000000000000000000000000000004D00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-api/tasks/status.yml#
# (c) Copyright 2015 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: freezer-api | status | Make sure freezer-api is up and responding on each node
  uri:
    url: "http://127.0.0.1:{{ freezer_bind_port }}/healthcheck"
    status_code: 200
    timeout: 100
  ignore_errors: yes
  changed_when: false
  register: freezer_api_status_result
  until: not freezer_api_status_result | failed
  retries: 5
  delay: 10

- name: freezer-api | status | Report freezer-api's status
  uri:
    url: "http://127.0.0.1:{{ freezer_bind_port }}/healthcheck"
    status_code: 200
    timeout:  20
  when: freezer_api_status_result | failed
07070100000044000081A40000000000000000000000015E90AC0900000415000000000000000000000000000000000000004B00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-api/tasks/stop.yml#
# (c) Copyright 2015 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: freezer-api | stop | Disable freezer site
  become: yes
  file:
    state: absent
    path: "{{ apache2_vhost_dir }}/freezer-modwsgi.conf"

# Reload Apache, ignore errors, if reload fails in stop as apache not
# running, keep going
- name: freezer-api | reload | Reload Apache after disabling freezer-api
  become: yes
  service:
    name: apache2
    state: reloaded
  ignore_errors: yes
07070100000045000041ED0000000000000000000000025E90AC0900000000000000000000000000000000000000000000004600000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-api/templates07070100000046000081A40000000000000000000000015E90AC09000003B4000000000000000000000000000000000000006400000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-api/templates/freezer-api-audit-map.conf.j2{#
#
# (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.
#
#}
[DEFAULT]
# default target endpoint type
# should match the endpoint type defined in service catalog
target_endpoint_type = None

# map urls ending with specific text to a unique action
[custom_actions]


# possible end path of api requests
[path_keywords]


# map endpoint type defined in service catalog to CADF typeURI
[service_endpoints]
backup = service/backup
07070100000047000081A40000000000000000000000015E90AC09000007FE000000000000000000000000000000000000006200000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-api/templates/freezer-api-logging.conf.j2[loggers]
{% if freezer_api_audit_enabled | bool %}
keys: root, iso8601, audit
{% else %}
keys: root, iso8601
{% endif %}

[handlers]
{% if freezer_api_audit_enabled | bool %}
keys: watchedfile, logstash, auditfile
{% else %}
keys: watchedfile, logstash
{% endif %}

[formatters]
keys: context, logstash, minimal

[logger_root]
qualname: root
handlers: watchedfile, logstash
level: NOTSET

[logger_iso8601]
qualname: iso8601
handlers: watchedfile, logstash
level: INFO

{% if freezer_api_audit_enabled | bool %}
[logger_audit]
qualname: oslo.messaging.notification.audit
handlers: auditfile
propagate: 0
level: INFO
{% endif %}


# Writes to disk
# Note: log rotation configuration is being handled by Centralized Logging
# and is surfaced to customers on the deployer via ...configs/logging/vars/glance-clr.yml
[handler_watchedfile]
class: handlers.WatchedFileHandler
args: ('{{ freezer_api_log_python }}',)
formatter: context
level: {{ freezer_api_loglevel }}

# Writes JSON to disk, beaver will ship to logstash
# Note: log rotation configuration is being handled by Centralized Logging
# and is surfaced to customers on the deployer via ...configs/logging/vars/glance-clr.yml
[handler_logstash]
class: handlers.WatchedFileHandler
args: ('{{ freezer_api_log_python_json }}',)
formatter: logstash
level: {{ freezer_api_logstash_loglevel }}

{% if freezer_api_audit_enabled | bool %}
[handler_auditfile]
class: handlers.WatchedFileHandler
args: ('{{ freezer_api_log_audit }}',)
formatter = minimal
level: INFO
{% endif %}


# datefmt must be set otherwise you end up with too many (msecs) fields
[formatter_context]
class: oslo_log.formatters.ContextFormatter
args: (datefmt=datefmt)
format: %(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user)s %(tenant)s] %(instance)s%(message)s
datefmt: %Y-%m-%d %H:%M:%S

# the "format" and "datefmt" actually set the "type" and "tags"
[formatter_logstash]
class: logstash.LogstashFormatterVersion1
format: freezer
datefmt: freezer-api

[formatter_minimal]
format=%(message)s

07070100000048000081A40000000000000000000000015E90AC09000007BD000000000000000000000000000000000000005F00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-api/templates/freezer-api-paste.ini.j2{#
# (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.
#
#}
[app:api_versions]
paste.app_factory = freezer_api.api.versions:api_versions

[app:appv1]
paste.app_factory = freezer_api.service:freezer_appv1_factory

[app:appv2]
paste.app_factory = freezer_api.service:freezer_appv2_factory

[app:service_v1]
use = egg:freezer-api#service_v1

{% if freezer_api_audit_enabled | bool %}
[filter:audit]
paste.filter_factory = keystonemiddleware.audit:filter_factory
audit_map_file = /etc/freezer/freezer-api-audit-map.conf

{% endif %}
[filter:authtoken]
paste.filter_factory = keystonemiddleware.auth_token:filter_factory

[filter:healthcheck]
paste.filter_factory = oslo_middleware:Healthcheck.factory
backends = disable_by_file
disable_by_file_path = /etc/freezer/healthcheck_disable

[filter:context]
paste.filter_factory = freezer_api.api.common.middleware:ContextMiddleware.factory

[filter:versionsNegotiator]
paste.filter_factory = freezer_api.api.versions:VersionNegotiator.factory

[filter:http_proxy_to_wsgi]
paste.filter_factory = oslo_middleware:HTTPProxyToWSGI.factory

[pipeline:main]
pipeline = healthcheck http_proxy_to_wsgi versionsNegotiator authtoken
{%- if freezer_api_audit_enabled | bool %} audit{% endif %}
 context backupapp

[pipeline:unauthenticated_freezer_api]
pipeline = http_proxy_to_wsgi healthcheck freezer_app

[composite:backupapp]
paste.composite_factory = freezer_api.service:root_app_factory
/: api_versions
/v1: appv1
/v2: appv2
07070100000049000081A40000000000000000000000015E90AC0900000BB0000000000000000000000000000000000000005A00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-api/templates/freezer-api.conf.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.
#
#}
[DEFAULT]
# Show debugging output in logs (sets DEBUG log level output)
#debug = False

# If `log_file` is omitted and `use_syslog` is false, then log messages are
# sent to stdout as a fallback.
log_config_append = {{ freezer_api_venv_conf_dir_by_version |
                       default(freezer_api_venv_conf_dir)
                       }}/freezer-api-logging.conf

# ================= Syslog Options ============================

# Send logs to syslog (/dev/log) instead of to file specified
# by `log_file`
use_syslogd = false

# Facility to use. If unset defaults to LOG_USER.
#syslog_log_facility = LOG_LOCAL0

# ================= Authtoken Options ============================

[keystone_authtoken]
auth_type = password
auth_uri = {{ freezer_keystone_auth_uri }}
auth_url = {{ freezer_keystone_auth_uri }}
username = {{ freezer_keystone_service_user }}
password = {{ freezer_keystone_service_password }}
user_domain_name = {{ freezer_keystone_user_domain_name }}
project_name = {{ freezer_keystone_service_project_name }}
project_domain_name = {{ freezer_keystone_project_domain_name }}
cafile = {{ freezer_keystone_cacert }}
include_service_catalog = False
token_cache_time = {{ freezer_api_token_cache_time }}
http_request_max_retries = {{ freezer_api_http_request_max_retries }}
service_token_roles_required = true
service_token_roles = admin
memcached_servers = {{ memcached_servers }}
memcache_security_strategy = ENCRYPT
memcache_secret_key = {{ memcache_secret_key }}
memcache_pool_socket_timeout = 1


# ================= Storage Options ============================

[storage]
backend = elasticsearch

[elasticsearch]
hosts = http://{{ elasticsearch_http_host }}:{{ elasticsearch_http_port }}
timeout = {{ freezer_api_elasticsearch_timeout }}
retries = {{ freezer_api_elasticsearch_retries }}
number_of_replicas = {{ freezer_api_es_replicas }}
#use_ssl=False
#ca_certs=''

# ================= Paste Options ============================

[paste_deploy]
# Name of the paste configuration file that defines the available pipelines.
# (string value)
config_file = {{ freezer_api_venv_conf_dir_by_version |
                 default(freezer_api_venv_conf_dir)
                 }}/freezer-api-paste.ini

# ================= Audit Options ============================

[audit_middleware_notifications]
driver = log 
workers = 2

0707010000004A000081A40000000000000000000000015E90AC09000006B9000000000000000000000000000000000000005E00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-api/templates/freezer-modwsgi.conf.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.
#
#}
Listen {{ freezer_bind_host }}:{{ freezer_bind_port }}
## Need to enable binding to localhost/127.0.0.1 for
## monitoring checks, which will verify if the freezer-api
## is running on the host or not.
Listen 127.0.0.1:{{ freezer_bind_port }}

<VirtualHost *:{{ freezer_bind_port }}>
    WSGIDaemonProcess freezer-api processes={{ freezer_api_process_count }} threads={{ freezer_api_thread_count }} socket-timeout={{ freezer_api_socket_timeout }}  user={{ freezer_system_user }} group={{ freezer_system_user }} python-path={{ freezer_api_venv_bin_dir }}/../lib/python2.7/site-packages/
    WSGIProcessGroup freezer-api
    WSGIApplicationGroup %{GLOBAL}
    WSGIScriptAlias / {{ www_root }}/freezer/freezer-api

    ErrorLog {{ freezer_api_log_wsgi }}
    LogLevel info
    CustomLog {{ freezer_api_log_access }} combined

    <Directory {{ www_root }}/freezer>
      Options Indexes FollowSymLinks MultiViews
      Require all granted
      AllowOverride None
      Order allow,deny
      allow from all
      LimitRequestBody 102400
    </Directory>
</VirtualHost>
0707010000004B000081A40000000000000000000000015E90AC090000038B000000000000000000000000000000000000005500000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-api/templates/policy.json.j2{
    "context_is_admin": "role:admin",
    "admin_or_owner": "is_admin:True or project_id:%(project_id)s",
    "default": "rule:admin_or_owner",

    "jobs:get_all": "",
    "jobs:create": "",
    "jobs:get": "",
    "jobs:delete": "",
    "jobs:update": "",
    "jobs:event:create": "",

    "actions:get_all": "",
    "actions:create": "",
    "actions:get": "",
    "actions:delete": "",
    "actions:update": "",
    "actions:replace": "",

    "sessions:get_all": "",
    "sessions:create": "",
    "sessions:get": "",
    "sessions:delete": "",
    "sessions:update": "",
    "sessions:replace": "",
    "sessions:action:create": "",
    "sessions:job:add": "",
    "sessions:job:remove": "",

    "backups:get_all": "",
    "backups:create": "",
    "backups:get": "",
    "backups:delete": "",

    "clients:get_all": "",
    "clients:create": "",
    "clients:get": "",
    "clients:delete": ""
}
0707010000004C000041ED0000000000000000000000025E90AC0900000000000000000000000000000000000000000000004100000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-api/vars0707010000004D000081A40000000000000000000000015E90AC0900000314000000000000000000000000000000000000004C00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-api/vars/debian.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.
#
---
# python-httplib2 is an ansible dependency for the module uri sed in start.yml
freezer_api_packages:
  - libapache2-mod-wsgi
  - python-httplib2
0707010000004E000081A40000000000000000000000015E90AC09000002A6000000000000000000000000000000000000004C00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-api/vars/redhat.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.
#
---
freezer_api_packages:
  - mod_wsgi
0707010000004F000081A40000000000000000000000015E90AC09000002C2000000000000000000000000000000000000004A00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-api/vars/suse.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.
#
---
freezer_api_packages:
  - apache2-mod_wsgi
  - python-httplib2
07070100000050000041ED0000000000000000000000055E90AC0900000000000000000000000000000000000000000000003D00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-jobs07070100000051000041ED0000000000000000000000025E90AC0900000000000000000000000000000000000000000000004600000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-jobs/defaults07070100000052000081A40000000000000000000000015E90AC090000032E000000000000000000000000000000000000005300000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-jobs/defaults/activate.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.
#
---

# If set to false, We wont create backups jobs.
freezer_create_backup_jobs: true

# If set to false, We wont create restore jobs.
freezer_create_restore_jobs: true

07070100000053000081A40000000000000000000000015E90AC090000194A000000000000000000000000000000000000004F00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-jobs/defaults/jobs.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.
#
---

jobs:
  deployer:
    enabled: true
    store_in_swift: true
    store_in_ssh: true
    store_in_local: false
    also_create_restore_job: true
    container: freezer_lifecycle_manager_backups
    schedule: "48 hours"
    actions:
      - backup_name: freezer_home_backup
        backup_path: "{{ ardanauser_home }}"
        restore_path: "{{ ardanauser_home }}"
        max_retries_interval: 600
        backup_options:
          snapshot: true
          no_incremental: true
          remove_older_than: 365
        restore_options:
           overwrite: true
      - backup_name: freezer_etc_ssh_backup
        backup_path: /etc/ssh/
        restore_path: /etc/ssh/
        max_retries_interval: 600
        backup_options:
          snapshot: true
          max_level: 15
          remove_older_than: 365
        restore_options:
           overwrite: true
      - backup_name: freezer_shadow_backup
        backup_path: /etc/shadow
        restore_path: /etc/
        max_retries_interval: 600
        backup_options:
          snapshot: true
          max_level: 15
          remove_older_than: 365
        restore_options:
           overwrite: true
      - backup_name: freezer_passwd_backup
        backup_path: /etc/passwd
        restore_path: /etc/
        max_retries_interval: 600
        backup_options:
          snapshot: true
          max_level: 15
          remove_older_than: 365
        restore_options:
           overwrite: true
      - backup_name: freezer_group_backup
        backup_path: /etc/group
        restore_path: /etc/
        max_retries_interval: 600
        backup_options:
          snapshot: true
          max_level: 15
          remove_older_than: 365
        restore_options:
           overwrite: true
      - backup_name: freezer_ansible_backup
        backup_path: /etc/ansible
        restore_path: /etc/ansible/
        max_retries_interval: 600
        backup_options:
          snapshot: true
          max_level: 15
          remove_older_than: 365
        restore_options:
           overwrite: true
      - backup_name: freezer_tmp_tls_cacerts_backup
        backup_path: /tmp/ardana_tls_cacerts
        restore_path: /tmp/ardana_tls_cacerts/
        max_retries_interval: 600
        backup_options:
          snapshot: true
          max_level: 15
          remove_older_than: 365
        restore_options:
           overwrite: true
      - backup_name: freezer_tmp_tls_certs_backup
        backup_path: /tmp/ardana_tls_certs
        restore_path: /tmp/ardana_tls_certs/
        max_retries_interval: 600
        backup_options:
          snapshot: true
          max_level: 15
          remove_older_than: 365
        restore_options:
           overwrite: true
      - backup_name: freezer_tmp_octavia_tls_backup
        backup_path: /tmp/ardana_octavia_tls
        restore_path: /tmp/ardana_octavia_tls/
        max_retries_interval: 600
        backup_options:
          snapshot: true
          max_level: 15
          remove_older_than: 365
        restore_options:
           overwrite: true
      - backup_name: freezer_tmp_octavia_certs_backup
        backup_path: /tmp/ardana_octavia_certs
        restore_path: /tmp/ardana_octavia_certs/
        max_retries_interval: 600
        backup_options:
          snapshot: true
          max_level: 15
          remove_older_than: 365
        restore_options:
           overwrite: true
      - backup_name: freezer_ssl_backup
        backup_path: /etc/ssl
        restore_path: /etc/ssl/
        max_retries_interval: 600
        backup_options:
          snapshot: true
          max_level: 15
          remove_older_than: 365
        restore_options:
           overwrite: true
      - backup_name: freezer_cobbler_backup
        backup_path: /var/lib/cobbler/
        restore_path: /var/lib/cobbler/
        max_retries_interval: 600
        backup_options:
        options:
          snapshot: true
          max_level: 15
          remove_older_than: 365
        restore_options:
           overwrite: true
      - backup_name: freezer_www_cobbler_backup
        backup_path: /srv/www/cobbler/
        restore_path: /srv/www/cobbler/
        max_retries_interval: 600
        backup_options:
          snapshot: true
          max_level: 15
          remove_older_than: 365
        restore_options:
           overwrite: true

  mysql:
    enabled: true
    store_in_swift: true
    store_in_ssh: true
    store_in_local: false
    also_create_restore_job: true
    container: freezer_database_backups
    schedule: "12 hours"
    actions:
      - backup_name: freezer_mysql_backup
        backup_path: /var/lib/mysql/
        restore_path: /tmp/mysql_restore/
        backup_options:
          mode: mysql
          mysql_conf: /etc/freezer/ardana_mysql.conf
          snapshot: true
          max_level: 14
          remove_older_than: 90

  swift:
    enabled: true
    store_in_swift: true
    store_in_ssh: true
    store_in_local: false
    also_create_restore_job: true
    container: freezer_rings_backups
    schedule: "24 hours"
    actions:
      - backup_name: freezer_swift_builder_dir_backup
        backup_path: /etc/swiftlm/
        restore_path: /tmp/swift_builder_dir_restore/
        backup_options:
          snapshot: true
          max_level: 14
          remove_older_than: 90

  audit:
    enabled: true
    store_in_swift: true
    store_in_ssh: true
    store_in_local: false
    also_create_restore_job: true
    container: freezer_audit_logs_backups
    schedule: "24 hours"
    actions:
      - backup_name: freezer_audit_log_backup
        backup_path: "{{ freezer_audit_dir }}"
        restore_path: "{{ freezer_audit_dir }}"
        backup_options:
          snapshot: true
          max_level: 14
          remove_older_than: 90
        restore_options:
           overwrite: true
07070100000054000081A40000000000000000000000015E90AC0900000FB4000000000000000000000000000000000000005700000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-jobs/defaults/jobs_hacking.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.
#
---

# When adding a new job, it it necessary to assign it to specific nodes in _freezer_manage_jobs.yml
# This is how you define which server should execute which backup in function of their role:
#
#- hosts: <which ansible role should execute this job, use FRE-AGN to target all>
#  roles:
#    - freezer-jobs
#  tasks:
#    - include: roles/freezer-jobs/tasks/_manage_job.yml job_name=<job_name>
#
#jobs:
#  <job_name>:
#    # [mandatory] If the job should be created
#    enabled: <true or false> #If the job should be created
#
#    # [mandatory] If the job should be created to store its backup in swift
#    store_to_swift: <true or false>
#
#    # [mandatory] If the job should be created to store its backup to an SSH server. The job won't be created if valid ssh credentials aren't provided in ssh_credentials.yml
#    store_to_ssh: <true or false>
#
#    # [mandatory] If the job should be created to store its backup localy, require you to set local_storage_base_dir as well
#    store_to_local: <true or false>
#
#    #The base directory to store backups to when using storage_local
#    local_storage_base_dir: <path>
#
#    # [mandatory] If we should create matching restore jobs
#    also_create_restore_job: <true or false>
#
#    # [mandatory] Name of the container to store backup to.
#    container: freezer_lifecycle_manager_backup
#
#    # [mandatory] Repeat the backup every <value>
#    schedule: <"n hours|minutes|days">
#
#    actions: # The order of your actions matters, they will be executed in the specified order.
#
#        # [mandatory] Name of the backup
#      - backup_name: <name>
#
#        # [mandatory] Path to backup
#        backup_path: <path>
#
#        # Path to restore the backup when using also_create_restore_job
#        restore_path: <path>
#
#        # Any valid freezer-agent option to pass to the freezer agent when executing the backup
#        backup_options:
#          <option1_name> : <option1_value>
#          <option2_name> : <option2_value>
#
#        # Any valid freezer-agent option to pass to the freezer agent when executing the restore
#        restore_options:
#          <option1_name> : <option1_value>
#          <option2_name> : <option2_value>
#
#        # Number of time to retry the action if it fails [defaults 5]
#        max_retries: <int>
#
#        # Amount of time in seconds to wait between retries [defaults 60]
#        max_retries_interval: <int>
#
#
#
#
# For example:
#
#  foo:
#    enabled: true
#    storage_swift: true
#    storage_ssh: true
#    storage_local: false
#    also_create_restore_job: true
#    container: foo_container
#    schedule: "24 hours"
#    actions:
#      - backup_name: action_1
#        backup_path: /home/user1/
#        restore_path: /tmp/user1_restore/
#        backup_options:
#          snapshot: true
#          max_level: 15
#        max_retries_interval: 2
#        max_retries_interval: 10
#      - backup_name: action_2
#        backup_path: /etc/passwd
#        restore_path: /etc/
#        restore_options:
#          max_priority: true
#          overwrite: true
#
#
# Then the _freezer_manage_jobs.yml needs to be edited to add this.
#
#- hosts: NOV-CMP:&FRE-AGN     # only on compute node, Don't forget to add ":&FRE-AGN" to the role name
#  roles:
#    - freezer-jobs
#  tasks:
#    - include: roles/freezer-jobs/tasks/_manage_job.yml job_name=foo
07070100000055000081A40000000000000000000000015E90AC09000003BA000000000000000000000000000000000000004F00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-jobs/defaults/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.
#
---

# By default ssh backups are disabled. If variables in ssh_credentials.yml are
# set, they will be turned on automatically.
freezer_ssh_ready: false

# Default audit directory path, This is needed so that the loading of jobs.yml
# doesn't fail when FRE.audit.dir is not set.
freezer_audit_dir: /var/audit
07070100000056000081A40000000000000000000000015E90AC0900000402000000000000000000000000000000000000005C00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-jobs/defaults/mysql_credentials.yml#
# (c) Copyright 2015 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 credentials to flush tables before backup
---

backup_mysql_host: "{{ FRE_AGN.consumes_FND_MDB.vips.private[0].host }}"
backup_mysql_port: "{{ FRE_AGN.consumes_FND_MDB.vips.private[0].port }}"
backup_mysql_service_user: "{{ FRE_AGN.consumes_FND_MDB.vars.accounts.freezer.username }}"
backup_mysql_service_password: "{{ FRE_AGN.consumes_FND_MDB.vars.accounts.freezer.password }}"
07070100000057000081A40000000000000000000000015E90AC0900000A81000000000000000000000000000000000000005A00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-jobs/defaults/ssh_credentials.yml#
# (c) Copyright 2015 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.
#
---

freezer_ssh_host:
freezer_ssh_port:
freezer_ssh_username:
freezer_ssh_base_dir:
freezer_ssh_private_key:


# To write the ssh key on multiple lines, use this syntax:
# Please, note the pipe on the first line and the two space indent on the following lines

#freezer_ssh_private_key: |
#  -----BEGIN RSA PRIVATE KEY-----
#  MIIEpAIBAAKCAQEAuOWtzWsy8/STJzKd18pQJC/XNj1YXTimawjc0l/uFsT+BDvr
#  U05edrIbI4tSkVFfMdVYHP6BSAHHfOL2ZfQItNtoZZZ4t8qfNcKtXJShHouWfs9K
#  6elGAecTOOlXhHVCnwPglKyf3Qq8/Lspm+jMP49W/J8ipZdYjld72vtPBGyhAqNa
#  Q0rYT4d2uOBkNrzQ/AHYGwAIozmrMx3jJV4E7daaEw9O/ax1hjDB+WTVV9fgJINP
#  Qs1VdqQhuNgYVIkshJLZ+d5HLokXcyxTcDT9wDrJ7a5Xskn0I1/NIM60UvbhwpzM
#  SuLCr6m2zYvcWj+zlUhoqcFC7sHRnnOtpl88TQIDAQABAoIBAQCmJaXfYEQCGjWd
#  VIuoHGGVkvPWBpv/8OcCaY1c8d0V0uDb1ygozNRv3q4qa4i/kppzQl4Sd9SeaxLi
#  s2RsyzSDqGGQX/2MUmRsv8pe1iROOWr7+rQ7q2ZAUW/hhTUijuhV0fsePlzNGVgn
#  1tuWAUSAnQKysSFGIdDu38gpSAiCVL8QV1ch5F46VfsJQYI2trHBAM3FxKceAbGE
#  vN2j4xV5q5G0TlA4jZttb/6aqyvysopFnlTssN+42N8Es7KRQnIg6X1piHptyBQo
#  /mZkxewZVRi5SEzE70z9gg5+E7+h53j+0EBzJSai/VFb+SqIo42Ep8Ayb2SsD65s
#  RrlUTqQVAoGBAOkKpxBJzHqj2U28Y9dg4ykIoEzmJ0szTwcD2TFKy2yADyAIbLU1
#  LxLEuTXKL9YPnxaeDugN6lgUj/nLOd2rPmUnQk7R3btDGu+8fW6QC0SSK7lPlD82
#  baQ8L8RTzr5A9VL6zqKNl9EygCGeBMZtyVidudjKF4Y4Q3JzQQf4sMTnAoGBAMsc
#  0OUfcxbXd4VXhywVOKznPMX63CckAWeFKwLM9YBfnuv7TrkI0DSFTFIZ33MawjWh
#  YtxPigJKx89YutBeSMlA//UMprT9NjNb45Y8xlVzGgPJs89nuHeLWRre6JNWjtuc
#  2xKRb/1RCCBqNuThqxaZwpwEuADrfat2n0s3idqrAoGBAOFxVL0FJ7Nc3tO89Dlf
#  mWIQ3kKGRG0TbdgzeOGeobyNBhTPEZsboDZf6WyH9E75PcX7kiAbliEvgzj7yTcQ
#  eoQQvqzRidemy2Aw0IctAjmLzpCu05NzbA39y5f6G38iCDIGP/AxWjUezaW34Ja1
#  jpsTur5mguttcpI9vSOhCiDxAoGAJpQymVJ/6bbDXPBjHFxrh2vkfzZG2qhcG+2P
#  XdjQSLHg3bG+IicqZM9sz6taZeKPQOCGhpIVBJpvmVKhKTK/YHqYI1Nj1rzBrr+l
#  WsPwaAqUxmNpY9uvjgVJx3DPfCzUtaH1enFldBgQExgZlR/H/2L1M+0xhfs0w3yk
#  hQTnikECgYBJTdVd921n5HDd8eooDMd48UwkKK57OdWxTniO5blyyyzQfV6dBY+A
#  NnkiIbTGI88Y/Bx8vWMzFJOgd4O+mXDkyXBfj6Cq/VFPf7RtAoNcNLZ0LwpEb52u
#  LDjUGJ+wf4SxU3fBDuxUaNCdZrJRtx1S59WxsQkaiTwHexw1Pi7G1g==
#  -----END RSA PRIVATE KEY-----
07070100000058000041ED0000000000000000000000025E90AC0900000000000000000000000000000000000000000000004300000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-jobs/tasks07070100000059000081A40000000000000000000000015E90AC090000042B000000000000000000000000000000000000005700000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-jobs/tasks/_deploy_ssh_key.yml#
# (c) Copyright 2015 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_vars: ../defaults/ssh_credentials.yml

- set_fact:
    freezer_ssh_ready: true
  when: freezer_ssh_private_key and freezer_ssh_username and freezer_ssh_host and freezer_ssh_port and freezer_ssh_base_dir

- name: freezer-jobs | deploy_ssh_key | Deploy SSH key
  become: yes
  template:
    src: "ssh_key.j2"
    dest: "/etc/freezer/ssh_key"
    owner: root
    group: root
    mode: 0600
  when: freezer_ssh_ready
0707010000005A000081A40000000000000000000000015E90AC0900000854000000000000000000000000000000000000006000000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-jobs/tasks/_deployer_restore_helper.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.
#

- include: _deploy_ssh_key.yml

- include_vars: roles/freezer-jobs/defaults/jobs.yml

- name: freezer-jobs | deployer_restore_helper | Create Directory
  become: yes
  file:
    path: /root/deployer_restore_helper
    owner: root
    group: root
    state: directory
  when: freezer_ssh_ready

- name: freezer-jobs | deployer_restore_helper | Copy restore files
  become: yes
  template:
    src: deployer_restore.ini.j2
    dest: "/root/deployer_restore_helper/{{ item['backup_name'] }}.ini"
    owner: root
    group: root
    mode: 0640
  with_items: jobs['deployer']['actions']
  when: freezer_ssh_ready

- name: freezer-jobs | deployer_restore_helper | Copy restore script
  become: yes
  template:
    src: deployer_restore_script.sh.j2
    dest: /root/deployer_restore_helper/deployer_restore_script.sh
    owner: root
    group: root
    mode: 0740
  when: freezer_ssh_ready

- name: freezer-jobs | deployer_restore_helper | SSH credentials are setup
  debug:
    msg: "SSH restore script for the deployer has been deployed in \
      /root/deployer_restore_helper/"
  when: freezer_ssh_ready

- name: freezer-jobs | deployer_restore_helper | SSH credentials are not setup
  debug:
    msg: "SSH credentials are not setup, therefore this script will only \
      install the freezer-agent but won't prepare it for SSH restore. \
      If needed, please fill in valid SSH credentials in \
      openstack/my_cloud/config/freezer/ssh_credentials.yml"
  when: not freezer_ssh_ready
0707010000005B000081A40000000000000000000000015E90AC0900000A19000000000000000000000000000000000000005300000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-jobs/tasks/_manage_job.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.
#
---

- include_vars: roles/freezer-jobs/defaults/jobs.yml

- include: _manage_single_job.yml
  vars:
    job_storage: swift
    job_type: backup
    job_description: "Ardana Default: {{ job_name }} backup to Swift"
    job_is_enabled: "{{ jobs[job_name]['enabled'] and jobs[job_name]['store_in_swift'] }}"
  when: freezer_create_backup_jobs

- include: _manage_single_job.yml
  vars:
    job_storage: swift
    job_type: restore
    job_description: "Ardana Default: {{ job_name }} restore from Swift"
    job_is_enabled: "{{ jobs[job_name]['enabled'] and jobs[job_name]['store_in_swift'] and jobs[job_name]['also_create_restore_job'] }}"
  when: freezer_create_restore_jobs

- include: _manage_single_job.yml
  vars:
    job_storage: ssh
    job_type: backup
    job_description: "Ardana Default: {{ job_name }} backup to SSH"
    job_is_enabled: "{{ jobs[job_name]['enabled'] and jobs[job_name]['store_in_ssh'] }}"
  when: freezer_create_backup_jobs and freezer_ssh_ready

- include: _manage_single_job.yml
  vars:
    job_storage: ssh
    job_type: restore
    job_description: "Ardana Default: {{ job_name }} restore from SSH"
    job_is_enabled: "{{ jobs[job_name]['enabled'] and jobs[job_name]['store_in_ssh'] and jobs[job_name]['also_create_restore_job'] }}"
  when: freezer_create_restore_jobs and freezer_ssh_ready

- include: _manage_single_job.yml
  vars:
    job_storage: local
    job_type: backup
    job_description: "Ardana Default: {{ job_name }} backup to local"
    job_is_enabled: "{{ jobs[job_name]['enabled'] and jobs[job_name]['store_in_local'] }}"
  when: freezer_create_backup_jobs

- include: _manage_single_job.yml
  vars:
    job_storage: local
    job_type: restore
    job_description: "Ardana Default: {{ job_name }} restore from local"
    job_is_enabled: "{{ jobs[job_name]['enabled'] and jobs[job_name]['store_in_local'] and jobs[job_name]['also_create_restore_job'] }}"
  when: freezer_create_restore_jobs
0707010000005C000081A40000000000000000000000015E90AC09000009B4000000000000000000000000000000000000005A00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-jobs/tasks/_manage_single_job.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.
#
---
- set_fact:
    job_is_present: "{{ jobs_list_result.stdout.find( job_description ) != -1 }}"

- name: freezer-jobs | manage_single_job | Show which job is being managed
  debug:
    msg: "Name: {{ job_description }} | Is present: {{ job_is_present }} | Should be present: {{ job_is_enabled }}"

- name: freezer-jobs | manage_job | Copy job template
  become: yes
  template:
    src: "job.json.j2"
    dest: "/etc/freezer/scheduler/to_upload/{{ job_name }}_{{ job_type }}_{{ job_storage }}.json"
  register: job_copy_result
  when: ( job_is_enabled | bool )

- name: freezer-jobs | manage_job | Remove job
  become: yes
  shell: "{{ freezer_command }} job-delete {{ item.split('|')[0] | trim() }}"
  args:
    executable: /bin/bash
  with_items: jobs_list_result.stdout_lines
  when: ( job_description in item ) and
        (( job_copy_result is defined and job_copy_result.changed ) or
        (( job_is_present | bool ) and not ( job_is_enabled | bool )))
  register: remove_job_result
  until: "remove_job_result.rc == 0"
  retries: 5
  delay: 10

- name: freezer-jobs | manage_job | Remove job template
  become: yes
  file:
    dest: "/etc/freezer/scheduler/to_upload/{{ job_name }}_{{ job_type }}_{{ job_storage }}.json"
    state: absent
  when: not ( job_is_enabled | bool )

- name: freezer-jobs | manage_job | Create job
  become: yes
  shell: "source {{ ardanauser_home }}/backup.osrc && freezer job-create --file {{ job_name }}_{{ job_type }}_{{ job_storage }}.json --client {{ freezer_client_id }}"
  args:
    executable: /bin/bash
    chdir: /etc/freezer/scheduler/to_upload
  when: ( job_is_enabled | bool ) and
        (( job_copy_result is defined and job_copy_result.changed ) or
        not ( job_is_present | bool ))
  register: create_job_result
  until: "create_job_result.rc == 0"
  retries: 5
  delay: 10
0707010000005D000081A40000000000000000000000015E90AC090000039E000000000000000000000000000000000000005A00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-jobs/tasks/_mysql_credentials.yml#
# (c) Copyright 2015 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_vars: ../defaults/mysql_credentials.yml

- name: freezer-jobs | mysql_credentials | Create mysql backup credential file
  become: yes
  template:
    src: "ardana_mysql.conf.j2"
    dest: "/etc/freezer/ardana_mysql.conf"
    owner: "root"
    group: "root"
    mode: 0640
0707010000005E000081A40000000000000000000000015E90AC0900000843000000000000000000000000000000000000005800000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-jobs/tasks/_pre_manage_jobs.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_vars: ../../freezer-agent/defaults/main.yml

- include_vars: ../../freezer-jobs/defaults/jobs.yml

- name: freezer-jobs | pre_manage_backup | Check for freezer client's presence
  become: yes
  stat:
    path: "/usr/bin/freezer"
  register: freezer_bin_result

- name: freezer-jobs | pre_manage_backup | Report freezer client's absence
  fail:
    msg: |
      You are trying to use freezer to create a backup or restore job.
      However freezer does not seem to be installed on this server.
      This could be caused by an error in your model or because the concerned node failed earlier in the deployment process.
      Concerned server: hostname: {{ ansible_hostname }} / inventory_hostname: {{ inventory_hostname }}
  when: not freezer_bin_result.stat.exists

- name: freezer-jobs | pre_manage_backup | Create directory
  become: yes
  file:
    path: /etc/freezer/scheduler/to_upload
    owner: root
    group: root
    mode: 0600
    state: directory

- name: freezer-jobs | pre_manage_backup | List current freezer jobs
  become: yes
  shell: "{{ freezer_command }} job-list -C  {{ ansible_hostname }} | grep -E '^\\| [a-z0-9]{32}' | cut -d '|' -f2,3 ; exit ${PIPESTATUS[0]}"
  args:
    executable: /bin/bash
  register: jobs_list_result
  until: "jobs_list_result.rc == 0"
  retries: 5
  delay: 10

- name: freezer-jobs | pre_manage_backup | Debug job-list if failed
  debug: var=jobs_list_result.stderr
  when: "jobs_list_result.rc != 0"
0707010000005F000041ED0000000000000000000000025E90AC0900000000000000000000000000000000000000000000004700000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-jobs/templates07070100000060000081A40000000000000000000000015E90AC0900000369000000000000000000000000000000000000005C00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-jobs/templates/ardana_mysql.conf.j2{#
#
# (c) Copyright 2015 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 credentials used to flush the tables before a backup

[default]
host = {{ backup_mysql_host }}
port = {{ backup_mysql_port }}
user = {{ backup_mysql_service_user }}
password = {{ backup_mysql_service_password | quote }}
07070100000061000081A40000000000000000000000015E90AC09000004A9000000000000000000000000000000000000005F00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-jobs/templates/deployer_restore.ini.j2{#
#
# (c) Copyright 2015,2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License,   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.
#
#}
[default]
action = restore
storage = ssh
ssh_host = {{ freezer_ssh_host }}
ssh_username = {{ freezer_ssh_username }}
ssh_key = /etc/freezer/ssh_key
container = {{ freezer_ssh_base_dir }}/{{ jobs['deployer']['container'] }}
backup_name = {{ item['backup_name'] }}
restore_abs_path = {{ item['restore_path'] }}
log_file = {{ freezer_agent_log_file }}
hostname = {{ freezer_client_id }}
{% if item['restore_options'] is mapping %}
{% for opt_key, opt_val in item['restore_options'].iteritems() %}
{{ opt_key }} = {{ opt_val }}
{% endfor %}
{% endif %}
07070100000062000081A40000000000000000000000015E90AC0900000660000000000000000000000000000000000000006500000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-jobs/templates/deployer_restore_script.sh.j2#!/bin/bash
#
# (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.
#


echo "Executing this restore script will completly wipe the following paths and restore them at an older state:"
{% for action in jobs['deployer']['actions'] %}
echo "{{ action['backup_path'] }}"
{% endfor %} 

echo -e "\n\nBy default, the restore will be done from the lastest present backup."
echo "Would you like to provide a date to restore the backup from ?"
echo "Exact format required: YYYY-MM-DDThh:mm:ss     ie: 1979-10-03T23:23:23"
echo "Default: None"
read requested_date

if [ "$requested_date" != "" ]; then
freezer_command="freezer-agent --restore-from-date $requested_date --config "
else
freezer_command="freezer-agent --config "
fi

echo -e "\n\nDo you want to execute the restore ? yes/NO"
echo "Default: No"
read resp

if [ "$resp" = "yes" ]; then
{% for action in jobs['deployer']['actions'] %}
    echo "=== Restoring {{ action['backup_path'] }} ==="
    $freezer_command {{ action['backup_name'] }}.ini

{% endfor %} 
else
    echo "Not executing."
fi
07070100000063000081A40000000000000000000000015E90AC0900000B80000000000000000000000000000000000000005300000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-jobs/templates/job.json.j2{#
#
# (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.
#
#}
{
    "action_defaults": {
{% if job_storage == 'ssh' %}
        "storage": "ssh",
        "ssh_host": "{{ freezer_ssh_host }}",
        "ssh_port": "{{ freezer_ssh_port }}",
        "ssh_username": "{{ freezer_ssh_username }}",
        "ssh_key": "/etc/freezer/ssh_key",
        "container": "{{ freezer_ssh_base_dir }}/{{ jobs[job_name]['container'] }}",
{% elif job_storage == 'local' %}
        "storage": "local",
        "container": "{{ jobs[job_name]['local_storage_base_dir'] }}/{{ jobs[job_name]['container'] }}",
{% elif job_storage == 'swift' %}
        "container": "{{ jobs[job_name]['container'] }}",
{% endif %}
        "log_config_append": "{{ freezer_agent_conf_dir }}/agent-logging.conf"
    },
    "job_actions": [
{% for action in jobs[job_name]['actions'] %}
        {
            "freezer_action": {
{% if job_type == 'backup' %}
                "action": "backup",
                "path_to_backup": "{{ action['backup_path'] }}",
{% if action['backup_options'] is mapping  %}
{% for opt_key, opt_val in action['backup_options'].iteritems() %}
{% if opt_val is string %}
                "{{ opt_key }}": "{{ opt_val }}",
{% else %}
                "{{ opt_key }}": {{ opt_val | lower }},
{% endif %}
{% endfor %}
{% endif %}
{% elif job_type == 'restore' %}
                "action": "restore",
                "hostname": "{{ ansible_hostname }}",
                "restore_abs_path": "{{ action['restore_path'] }}",
{% if action['restore_options'] is mapping  %}
{% for opt_key, opt_val in action['restore_options'].iteritems() %}
{% if opt_val is string %}
                "{{ opt_key }}": "{{ opt_val }}",
{% else %}
                "{{ opt_key }}": {{ opt_val | lower}},
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
                "backup_name": "{{ action['backup_name'] }}"
            },
            "max_retries": {{ action['max_retries'] | default(5) }},
            "max_retries_interval": {{ action['max_retries_interval'] | default(60) }}
{% if loop.last %}
        }
{% else %}
        },
{% endif %}
{% endfor %}
    ],
    "job_schedule": {
{% if job_type == 'backup' %}
        "schedule_interval": "{{ jobs[job_name]['schedule'] }}"
{% elif job_type == 'restore' %}
        "event": "stop"
{% endif %}
    },
    "description": "{{ job_description }}"
}
07070100000064000081A40000000000000000000000015E90AC09000002A3000000000000000000000000000000000000005200000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-jobs/templates/ssh_key.j2{#
#
# (c) Copyright 2015 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.
#
#}
{{ freezer_ssh_private_key }}
07070100000065000041ED0000000000000000000000055E90AC0900000000000000000000000000000000000000000000004700000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-post-configure07070100000066000041ED0000000000000000000000025E90AC0900000000000000000000000000000000000000000000005000000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-post-configure/defaults07070100000067000081A40000000000000000000000015E90AC09000005D6000000000000000000000000000000000000005900000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-post-configure/defaults/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.
#
---

keystone_endpoint: "{{ FRE_API.consumes_KEY_API.vips.private[0].url }}/v3"
keystone_service_tenant: "{{ KEY_API.vars.keystone_service_tenant }}"
keystone_admin_role_name: "{{ KEY_API.vars.keystone_admin_tenant }}"

freezer_service_username: "{{ FRE_API.consumes_KEY_API.vars.keystone_freezer_user }}"
freezer_service_password: "{{ FRE_API.consumes_KEY_API.vars.keystone_freezer_password | quote }}"

backup_username: "{{ FRE_AGN.consumes_KEY_API.vars.keystone_backup_user }}"
backup_password: "{{ FRE_AGN.consumes_KEY_API.vars.keystone_backup_password | quote }}"
backup_tenant_name: "{{ FRE_AGN.consumes_KEY_API.vars.keystone_backup_tenant }}"

keystone:
  admin_user: "{{ KEY_API.vars.keystone_admin_user }}"
  admin_password: "{{ KEY_API.vars.keystone_admin_pwd | quote }}"
  default_domain_name: "{{ KEY_API.vars.keystone_default_domain }}"
07070100000068000041ED0000000000000000000000025E90AC0900000000000000000000000000000000000000000000004C00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-post-configure/meta07070100000069000081A40000000000000000000000015E90AC0900000283000000000000000000000000000000000000005500000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-post-configure/meta/main.yml#
# (c) Copyright 2015 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.
#
---
0707010000006A000041ED0000000000000000000000025E90AC0900000000000000000000000000000000000000000000004D00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-post-configure/tasks0707010000006B000081A40000000000000000000000015E90AC090000091F000000000000000000000000000000000000006300000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-post-configure/tasks/ardana_backup_env.yml#
# (c) Copyright 2015 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.
#
# Keystone configuration for freezer to backup control pane
---

- name: freezer-post-configure | ardana_backup_env | Create backup tenant
  become: yes
  keystone_v3:
    action: create_project
    login_token: "{{ domain_scoped_token.result }}"
    endpoint: "{{ keystone_endpoint }}"
    project_name: "{{ backup_tenant_name }}"
    project_domain_name: Default
    description: Tenant to host Freezer backup of Ardana infrastructure
  run_once: true
  register: freezer_backup_tenant_result
  until: not freezer_backup_tenant_result | failed
  retries: 5
  delay: 10

- name: freezer-post-configure | ardana_backup_env | Create backup Keystone User
  become: yes
  keystone_v3:
    action: create_user
    login_token: "{{ domain_scoped_token.result }}"
    endpoint: "{{ keystone_endpoint }}"
    user_name: "{{ backup_username }}"
    user_password: "{{ backup_password }}"
    description: User used to upload backup of Ardana's infrastructure to swift
    user_domain_name: Default
  run_once: true
  register: freezer_backup_user_result
  until: not freezer_backup_user_result | failed
  retries: 5
  delay: 10

- name: freezer-post-configure | ardana_backup_env | Give backup user admin role in backup tenant
  become: yes
  keystone_v3:
    action: grant_project_role
    login_token: "{{ domain_scoped_token.result }}"
    endpoint: "{{ keystone_endpoint }}"
    user_name: "{{ backup_username }}"
    project_name: "{{ backup_tenant_name }}"
    role_name: "{{ keystone_admin_role_name }}"
    user_domain_name: Default
    project_domain_name: Default
  run_once: true
  register: freezer_backup_role_result
  until: not freezer_backup_role_result | failed
  retries: 5
  delay: 10
0707010000006C000081A40000000000000000000000015E90AC09000004CB000000000000000000000000000000000000006800000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-post-configure/tasks/elasticsearch_mappings.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: freezer_post_configure | elasticsearch_mappings | Create elasticsearch mappings
  become: yes
  command: "{{ freezer_api_venv_bin_dir_by_version | default(freezer_api_venv_bin_dir) }}/freezer-manage --yes --erase --config-file {{ freezer_api_venv_conf_dir_by_version | default(freezer_api_venv_conf_dir) }}/freezer-api.conf --config-dir {{ freezer_api_venv_conf_dir_by_version | default(freezer_api_venv_conf_dir) }} db update"
  run_once: true
  register: freezer_manage_db_update_result
  until: "not freezer_manage_db_update_result.rc != 0"
  retries: 12
  delay: 10
0707010000006D000081A40000000000000000000000015E90AC090000079B000000000000000000000000000000000000006500000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-post-configure/tasks/keystone_change_pwd.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.
#
---
- name: freezer-post-configure |  keystone_change_pwd | Get a domain scoped token
  keystone_v3:
    endpoint: "{{ keystone_endpoint }}"
    login_username: "{{ keystone.admin_user }}"
    login_password: "{{ keystone.admin_password }}"
    login_user_domain_name: "{{ keystone.default_domain_name }}"
    login_domain_name: "{{ keystone.default_domain_name }}"
    action: "token_get"
  run_once: true
  register: domain_scoped_token

- name: freezer-post-configure | keystone_change_pwd | Update the password for freezer user
  keystone_v3:
    action: "reset_password_by_admin"
    login_token: "{{ domain_scoped_token.result }}"
    endpoint: "{{ keystone_endpoint }}"
    user_name: "{{ freezer_service_username }}"
    user_password: "{{ freezer_service_password }}"
    description: Freezer service user
    user_domain_name: Default
  run_once: true

- name: freezer-post-configure | keystone_change_pwd | Update the password for backup user
  keystone_v3:
    action: "reset_password_by_admin"
    login_token: "{{ domain_scoped_token.result }}"
    endpoint: "{{ keystone_endpoint }}"
    user_name: "{{ backup_username }}"
    user_password: "{{ backup_password }}"
    description: User used to upload backup of Ardana's infrastructure to swift
    user_domain_name: Default
  run_once: true
0707010000006E000081A40000000000000000000000015E90AC0900000894000000000000000000000000000000000000005F00000000ardana-freezer-8.0+git.1586539529.b7d295f/roles/freezer-post-configure/tasks/keystone_conf.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: freezer-post-configure |  keystone_conf | Get a domain scoped token
  keystone_v3:
    endpoint: "{{ keystone_endpoint }}"
    login_username: "{{ keystone.admin_user }}"
    login_password: "{{ keystone.admin_password }}"
    login_user_domain_name: "{{ keystone.default_domain_name }}"
    login_domain_name: "{{ keystone.default_domain_name }}"
    action: "token_get"
  run_once: true
  register: domain_scoped_token

- name: freezer-post-configure | keystone_conf | Create Freezer Keystone User
  become: yes
  keystone_v3:
    action: create_user
    login_token: "{{ domain_scoped_token.result }}"
    endpoint: "{{ keystone_endpoint }}"
    user_name: "{{ freezer_service_username }}"
    user_password: "{{ freezer_service_password }}"
    description: Freezer service user
    user_domain_name: Default
  run_once: true
  register: freezer_keystone_user_result
  until: not freezer_keystone_user_result | failed
  retries: 5
  delay: 10

- name: freezer-post-configure | keystone_conf | Give freezer user admin role in service tenant
  become: yes
  keystone_v3:
    action: grant_project_role
    login_token: "{{ domain_scoped_token.result }}"
    endpoint: "{{ keystone_endpoint }}"
    user_name: "{{ freezer_service_username }}"
    project_name: "{{ keystone_service_tenant }}"
    role_name: "{{ keystone_admin_role_name }}"
    user_domain_name: Default
    project_domain_name: Default
  run_once: true
  register: freezer_keystone_role_result
  until: not freezer_keystone_role_result | failed
  retries: 5
  delay: 10
0707010000006F000041ED0000000000000000000000025E90AC0900000000000000000000000000000000000000000000003000000000ardana-freezer-8.0+git.1586539529.b7d295f/sos.d07070100000070000081A40000000000000000000000015E90AC0900000512000000000000000000000000000000000000004500000000ardana-freezer-8.0+git.1586539529.b7d295f/sos.d/openstack-freezer.py#
# (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.
#
from sos.plugins import DebianPlugin
from sos.plugins import Plugin


class Freezer(Plugin, DebianPlugin):
    """ Freezer related information for Debian distributions
    """
    plugin_name = "freezer"
    option_list = [("log", "gathers all freezer logs", "slow", False)]
    files = ('/var/log/freezer-agent/',
             '/var/log/freezer.log',
             '/var/log/freezer-api/',
             '/etc/freezer/',
             '/root/.freezer/',
             '/usr/bin/freezer-agent',
             '/usr/bin/freezer-scheduler')

    def setup(self):
        self.add_copy_spec([
            "/etc/freezer/",
            "/var/log/freezer-*",
        ])
07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!317 blocks
openSUSE Build Service is sponsored by