File ardana-ansible-8.0+git.1540411858.7223b0a.obscpio of Package ardana-ansible

0707010012024C000081A40000000000000000000000015BD0D1D200000023000000FD0000000200000000000000000000003B00000000ardana-ansible-8.0+git.1540411858.7223b0a/.copyrightignorelibrary/service.py
hosts/localhost
070701001203CF000081A40000000000000000000000015BD0D1D200000082000000FD0000000200000000000000000000003500000000ardana-ansible-8.0+git.1540411858.7223b0a/.gitreview[gerrit]
host=gerrit.suse.provo.cloud
port=29418
project=ardana/ardana-ansible.git
defaultremote=ardana
defaultbranch=stable/pike
07070100120228000081A40000000000000000000000015BD0D1D20000279F000000FD0000000200000000000000000000003200000000ardana-ansible-8.0+git.1540411858.7223b0a/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.

07070100120428000081A40000000000000000000000015BD0D1D2000002EC000000FD0000000200000000000000000000004800000000ardana-ansible-8.0+git.1540411858.7223b0a/_ardana-base-post-upgrade.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.
#
# Playbook to carry out pre-upgrade actions for
# certain base packages
---
- include: _ssh-post-upgrade.yml
0707010012022C000081A40000000000000000000000015BD0D1D2000002F0000000FD0000000200000000000000000000004700000000ardana-ansible-8.0+git.1540411858.7223b0a/_ardana-base-pre-upgrade.yml#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Playbook to carry out pre-upgrade actions for
# certain base packages
---
- include: _ssh-pre-upgrade.yml
0707010012022B000081A40000000000000000000000015BD0D1D200000378000000FD0000000200000000000000000000004200000000ardana-ansible-8.0+git.1540411858.7223b0a/_ardana-post-reboot.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.
#
---
# Node reboot was completed successfully, reset the pending reboot status
# variable (useful on the deployer, which is rebooted manually)
- include: _ardana-update-status.yml
  vars:
    update_status_var: system-reboot
    update_status_reset: true

- include: ardana-start.yml
- include: ardana-status.yml
070701001203D0000081A40000000000000000000000015BD0D1D20000025F000000FD0000000200000000000000000000004100000000ardana-ansible-8.0+git.1540411858.7223b0a/_ardana-pre-reboot.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: ardana-stop.yml
0707010012043B000081A40000000000000000000000015BD0D1D2000003FE000000FD0000000200000000000000000000004C00000000ardana-ansible-8.0+git.1540411858.7223b0a/_ardana-remove-legacy-service.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: _ardana-remove-legacy-service | Stop and disable legacy service
  become: yes
  service:
    name: "{{ service }}"
    state: stopped
    enabled: no

- name: _ardana-remove-legacy-service | Delete the legacy service file
  become: yes
  file:
    path: "/etc/systemd/system/{{ service }}.service"
    state: absent

- name: _ardana-remove-legacy-service | Reload service definitions
  become: yes
  command: systemctl daemon-reload
07070100120222000081A40000000000000000000000015BD0D1D2000004DC000000FD0000000200000000000000000000004A00000000ardana-ansible-8.0+git.1540411858.7223b0a/_ardana-service-get-pkgdata.yml#
# (c) Copyright 2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- hosts: all:!localhost
  max_fail_percentage: 100
  tasks:
    - name: Gather package information from all known hosts
      get_all_pkg_data:
      become: yes
      register: pkgs
      ignore_errors: yes

    - name: Aggregate package data to a temporary file
      copy:
        content: "{
                  {% for host in play_hosts %}
                      '{{ host }}': {{ hostvars[host]['pkgs'] }}
                      {% if not loop.last %},{% endif %}
                  {% endfor %}
                  }"
        dest: "{{ host_pkgs_file | default('/tmp/host_pkgs_file') }}"
      delegate_to: localhost
      when: inventory_hostname == play_hosts[0]
0707010012043F000081A40000000000000000000000015BD0D1D20000073D000000FD0000000200000000000000000000004B00000000ardana-ansible-8.0+git.1540411858.7223b0a/_ardana-service-post-upgrade.yml#
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Playbook to carry out post-upgrade actions for each Ardana OpenStack service
# based on the set of package upgrades for this node.
---
#- include: sosreport-post-upgrade.yml
#- include: monasca-agent-post-upgrade.yml
#- include: tls-post-upgrade.yml
#- include: clients-post-upgrade.yml
- include: percona-post-upgrade.yml
- include: rabbitmq-post-upgrade.yml
- include: FND-CLU-post-upgrade.yml
- include: FND-AP2-post-upgrade.yml
#- include: keystone-post-upgrade.yml
#- include: barbican-post-upgrade.yml
#- include: ops-console-post-upgrade.yml
- include: zookeeper-post-upgrade.yml
- include: monasca-post-upgrade.yml
#- include: swift-post-upgrade.yml
#- include: nova-post-upgrade.yml
#- include: glance-post-upgrade.yml
#- include: neutron-post-upgrade.yml
#- include: cinder-post-upgrade.yml
#- include: octavia-post-upgrade.yml
#- include: designate-post-upgrade.yml
#- include: powerdns-post-upgrade.yml
#- include: bind-post-upgrade.yml
#- include: ironic-post-upgrade.yml
#- include: heat-post-upgrade.yml
#- include: horizon-post-upgrade.yml
#- include: logging-post-upgrade.yml
#- include: ceilometer-post-upgrade.yml
#- include: freezer-post-upgrade.yml
#- include: tempest-post-upgrade.yml
07070100120435000081A40000000000000000000000015BD0D1D20000075F000000FD0000000200000000000000000000004A00000000ardana-ansible-8.0+git.1540411858.7223b0a/_ardana-service-pre-upgrade.yml#
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Playbook to carry out pre-upgrade actions for each Ardana OpenStack service
# based on the set of package upgrades for this node.
---
# We always upgrade TLS first as any service could rely on certs.
- include: tls-pre-upgrade.yml
#- include: sosreport-pre-upgrade.yml
#- include: monasca-agent-pre-upgrade.yml
#- include: clients-pre-upgrade.yml
- include: percona-pre-upgrade.yml
- include: rabbitmq-pre-upgrade.yml
- include: FND-CLU-pre-upgrade.yml
- include: FND-AP2-pre-upgrade.yml
#- include: keystone-pre-upgrade.yml
#- include: barbican-pre-upgrade.yml
#- include: ops-console-pre-upgrade.yml
#- include: zookeeper-pre-upgrade.yml
- include: monasca-pre-upgrade.yml
#- include: swift-pre-upgrade.yml
#- include: nova-pre-upgrade.yml
#- include: glance-pre-upgrade.yml
#- include: neutron-pre-upgrade.yml
#- include: cinder-pre-upgrade.yml
#- include: octavia-pre-upgrade.yml
#- include: designate-pre-upgrade.yml
#- include: powerdns-pre-upgrade.yml
#- include: bind-pre-upgrade.yml
#- include: ironic-pre-upgrade.yml
#- include: heat-pre-upgrade.yml
#- include: horizon-pre-upgrade.yml
- include: kronos-pre-upgrade.yml
#- include: ceilometer-pre-upgrade.yml
#- include: freezer-pre-upgrade.yml
#- include: tempest-pre-upgrade.yml
070701001203FC000081A40000000000000000000000015BD0D1D2000007D8000000FD0000000200000000000000000000004200000000ardana-ansible-8.0+git.1540411858.7223b0a/_ardana-update-base.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.
#
# Use this playbook to install available system package updates
---

- hosts: resources
  roles:
    - ardana-upgrade-tools
  tasks:

  - include: roles/ardana-upgrade-tools/tasks/check-deployer.yml

  # When running on multiple nodes (not recommended), first update packages on
  # deployer, to account for possible CLM package updates
  - name: _ardana-update-base | Update packages on the deployer node
    include: roles/ardana-upgrade-tools/tasks/pkg-update.yml
    when: ansible_os_family | lower == 'suse' and
          install_package_updates | default(false) | bool and
          running_on_deployer

  # Bail out if CLM package updates were installed on the deployer
  # and if other nodes are targeted by the play run
  - include: roles/ardana-upgrade-tools/tasks/check-pending-clm-update.yml
    when: running_on_deployer and (play_hosts | length) > 1

  - name: _ardana-update-base | Fail if CLM packages were updated
    fail:
      msg: "{{ pending_clm_update_msg }}"
    run_once: true
    when: running_on_deployer and (play_hosts | length) > 1 and
          pending_clm_update | bool

  # Then install package updates on remaining nodes
  - name: _ardana-update-base | Update packages on non deployer nodes
    include: roles/ardana-upgrade-tools/tasks/pkg-update.yml
    when: ansible_os_family | lower == 'suse' and
          install_package_updates | default(false) | bool and
          not running_on_deployer
0707010012024A000081A40000000000000000000000015BD0D1D200000D03000000FD0000000200000000000000000000004400000000ardana-ansible-8.0+git.1540411858.7223b0a/_ardana-update-status.yml#
# (c) Copyright 2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- hosts: resources
  vars:
    update_status_brief: false
    update_status_var: all
    update_status_set: false
    update_status_reset: false
  tasks:
    - name: _ardana-update-status | Initialise update status list
      set_fact:
        update_status: []

    - name: _ardana-update-status | Set default global update status
      set_fact:
        _default_update_status: |
          No pending update actions on the {{ inventory_hostname }} host
          were collected or reset during this update run or persisted during
          previous unsuccessful or incomplete update runs.

    - include: roles/ardana-upgrade-tools/tasks/check-pending-clm-update.yml
      when: update_status_var in ["clm-update", "all"]

    - name: _ardana-update-status | Add pending CLM update status to status list
      set_fact:
        update_status: "{{ update_status +
          [update_status_brief | bool | ternary('CLM update', update_status_msg)] }}"
      when: update_status_var in ["clm-update", "all"] and
            pending_clm_update|bool

    - include: roles/ardana-upgrade-tools/tasks/check-pending-service-update.yml
      when: update_status_var in ["service-update", "all"]

    - name: _ardana-update-status | Add pending service update status to status list
      set_fact:
        update_status: "{{ update_status +
          [update_status_brief | bool | ternary('service update', update_status_msg)] }}"
      when: update_status_var in ["service-update", "all"] and
            pending_service_update|bool

    - include: roles/ardana-upgrade-tools/tasks/check-pending-system-reboot.yml
      when: update_status_var in ["system-reboot", "all"]

    - name: _ardana-update-status | Add pending system reboot status to status list
      set_fact:
        update_status: "{{ update_status +
          [update_status_brief | bool | ternary('system reboot', update_status_msg)] }}"
      when: update_status_var in ["system-reboot", "all"] and
            pending_system_reboot|bool

    - name: _ardana-update-status | Report brief update status
      debug:
        msg: "Pending update actions: {{ update_status|join(', ') }}"
      when: update_status_brief|bool

    - name: _ardana-update-status | Report update status
      debug:
        msg: |
          =====================================================================
          Update status for node {{ inventory_hostname }}:
          =====================================================================
          {% for status in update_status | ternary(update_status, [_default_update_status] ) %}
          {{ status }}

          {% endfor %}
          =====================================================================
      when: not update_status_brief|bool
070701001203C7000081A40000000000000000000000015BD0D1D200000F48000000FD0000000200000000000000000000004300000000ardana-ansible-8.0+git.1540411858.7223b0a/_ardana-upgrade-base.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.
#
# Playbook to apply the available system package upgrades
---
- hosts: resources
  tasks:
  - name: _ardana-upgrade-base | Get set of installed pkgs before upgrade
    dpkg_list:
    when: ansible_os_family | lower == 'debian'

  - name: _ardana-upgrade-base | Get set of installed pkgs before upgrade
    rpm_list:
    when: ansible_os_family | lower == 'suse'

  - name: _ardana-upgrade-base | Set pre_upgrade_pkgs fact
    set_fact:
      ardana_pre_upgrade_pkgs: "{{ installed_pkgs | default([]) }}"

  - name: _ardana-upgrade-base | Print list of pkgs available for upgrade
    debug:
      msg: "Packages available for upgrade: {{ list_pkg_upgrades_base | default([]) }}"

  - name: _ardana-upgrade-base | Apply package updates
    become: yes
    apt:
      upgrade: full
      force: yes
      dpkg_options: force-overwrite,force-confdef,force-confold
    when: ansible_os_family | lower == 'debian'

  - name: _ardana-upgrade-base | Add SLES and Cloud repos
    set_fact:
      _repositories:
        - SLES-OS
        - Cloud
        - PTF
        - SLES12-SP3-Pool
        - SLES12-SP3-Updates
        - OpenStack-Cloud-8-Pool
        - OpenStack-Cloud-8-Updates
    when: ansible_os_family | lower == 'suse'

  - name: _ardana-upgrade-base | Determine the repos currently installed
    become: yes
    # stdout will be comprised of lines like " <repo-alias> "
    shell: zypper repos | tail "-n +2" | cut -d'|' -f2
    register: _existing_repos_result
    when: ansible_os_family | lower == 'suse'

  - name: osconfig | setup-zypp | Generate SLES repos exists map
    set_fact:
      _dup_flags: >
        {%- set _flags = [] -%}
        {%- for r in _repositories if " " + r + " " in _existing_repos_result.stdout -%}
        {%-   set _ = _flags.append("--from " + r) -%}
        {%- endfor -%}
        {{ _flags }}
    when: ansible_os_family | lower == 'suse'

  - name: _ardana-upgrade-base | Download and install package upgrades
    become: yes
    command: zypper dup --download in-advance -y --no-recommends --allow-vendor-change {{ _dup_flags | join(' ') }}
    when: ansible_os_family | lower == 'suse'

  # Upgrade from 2.x to 3.0 need to 'cleanup' the /etc/init.d/openvswitch-switch
  # which was customized in 2.x
  - name: _ardana-upgrade-base | Determine if openvswitch-switch script needs cleanup
    stat:
      path: /etc/init.d/openvswitch-switch.dpkg-dist
    register: new_openvswitch_switch

  - name: _ardana-upgrade-base | Put new openvswitch-switch init script in place
    become: yes
    command:  mv /etc/init.d/openvswitch-switch.dpkg-dist /etc/init.d/openvswitch-switch
    when: new_openvswitch_switch.stat.exists

  - name: _ardana-upgrade-base | Get set of installed pkgs after upgrade
    dpkg_list:
    when: ansible_os_family | lower == 'debian'

  - name: _ardana-upgrade-base | Get set of installed pkgs after upgrade
    rpm_list:
    when: ansible_os_family | lower == 'suse'

  - name: _ardana-upgrade-base | Set post_upgrade_pkgs fact
    set_fact:
      ardana_post_upgrade_pkgs: "{{ installed_pkgs | default([]) }}"

  - name: _ardana-upgrade-base | Set fact with full set of upgraded pkgs
    set_fact:
      ardana_upgraded_pkgs: "{{ ardana_pre_upgrade_pkgs | upgraded_pkgs(ardana_post_upgrade_pkgs) }}"
070701001203F7000081A40000000000000000000000015BD0D1D200000913000000FD0000000200000000000000000000004E00000000ardana-ansible-8.0+git.1540411858.7223b0a/_installui-server-delayed-reset.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.
#
---

# During the install process, the installer-server is loaded up with some
# default configuration settings, including a localhost reference for
# the ardana-service on which it depends. After a deployment the ardana-service
# is no longer accessible on localhost. The url is updated via a call
# to installui-reconfigure near the end of the site.yml playbook, but
# the installer-server doesn't pickup that change until the server is
# restarted, either with a systemctl restart installer-server  or
# by calling its restart endpoint (done below)
# due to timing concerns this must be delayed at least as long as the
# ardana-service restart is delayed, ideally a bit longer

# hosts must be ARD-SVC to have access to the host.bind vars
- hosts: ARD-SVC
  roles:
    - ARD-SVC
  tasks:
     # The delayed reset playbook causes the installUI service to restart
     # to pick up config file updates

    - name: installui | restart | restart via POST call
      uri:
        # ansible v1.9 parameters:
        HEADER_Content-Type: "application/json"
        url: "http://localhost:3000/api/v1/restart"
        method: POST
        body: >
          {"delay": 360}
      register: restart_cmd_result
      ignore_errors: yes
      when: ardana_svc_host_is_deployer and ardana_svc_on_localhost|success

    # TODO: Temporary workaround for the above command in astack environments
    #       We can remove this once we move to ansible 2
    - name: installui | restart | restart retry is failure was detected previously
      command: >
        curl -X POST -d '{"delay": 360}' -H "Content-Type: application/json" http://localhost:3000/api/v1/restart
      ignore_errors: yes
      when: restart_cmd_result|failed and ardana_svc_host_is_deployer
070701001203BE000081A40000000000000000000000015BD0D1D200000383000000FD0000000200000000000000000000004000000000ardana-ansible-8.0+git.1540411858.7223b0a/_ssh-post-upgrade.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: resources
  tasks:
    - name: ssh-post-upgrade | Re-enable restarting ssh when package upgrades
      become: yes # noqa
      service_restart:
        service: ssh
        state: enabled
      when: (ssh_update_required | default(false) | bool)
0707010012021F000081A40000000000000000000000015BD0D1D2000006A4000000FD0000000200000000000000000000003F00000000ardana-ansible-8.0+git.1540411858.7223b0a/_ssh-pre-upgrade.yml#
# (c) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- hosts: resources
  roles:
    - ardana-upgrade-tools

  tasks:
    - name: ssh-pre-upgrade | Include vars from ardana-upgrade-tools role
      include_vars: roles/ardana-upgrade-tools/defaults/main.yml

    - name: ssh-pre-upgrade | Get kernel version
      shell: uname -r | grep "^4[.]4[.].*"
      register: kernel_version_result
      failed_when: false

    - name: ssh-pre-upgrade | Is kernel version <= 4.4.7-1-amd64-hpelinux
      set_fact:
        version_is_leq: "{{ kernel_version_result.stdout |
                          version_compare('4.4.7-1-amd64-hpelinux', '<=') }}"
      when: (kernel_version_result | success)

    - name: ssh-pre-upgrade | Is SSH to be updated
      set_fact:
        ssh_update_required: "{{ (version_is_leq | default(false)) and
                              'ssh' in list_pkg_upgrades_base }}"

    - name: ssh-pre-upgrade | Disable restarting of ssh when package upgrades
      become: yes # noqa
      service_restart:
        service: ssh
        state: disabled
      when: (ssh_update_required | bool)
070701001203EE000081A40000000000000000000000015BD0D1D20000067E000000FD0000000200000000000000000000004A00000000ardana-ansible-8.0+git.1540411858.7223b0a/_third-party-import-ansible.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.
#

# Import third-party Ansible playbooks and roles
---

- hosts: localhost
  connection: local
  roles:
    - deployer-setup
    - third-party
    - git-operations

  tasks:
    - include: roles/third-party/tasks/_import-content.yml
      vars:
        work_dir: "{{ third_party_scratch_dir }}/ansible"
        dir_glob: "{{ third_party_ansible_dir_glob }}"

    - include: roles/third-party/tasks/_create_symlinks.yml
      vars:
        work_dir: "{{ third_party_scratch_dir }}/config"
        dir_glob: "{{ third_party_ansible_dir_glob }}"

    - include: roles/third-party/tasks/_persist-to-git.yml
      vars:
        repo: "{{ git_operations.main_repo }}"
        commit_msg: "Third-party Ansible import"
        branches:
          - name: "{{ git_operations.site_branch }}"
            copies:
              - from: "{{ third_party_scratch_dir }}/ansible"
                to: "{{ main_repo_ansible_dir }}"
              - from: "{{ third_party_scratch_dir }}/config"
                to: "{{ main_repo_config_dir }}"
070701001203BD000081A40000000000000000000000015BD0D1D2000005BF000000FD0000000200000000000000000000004E00000000ardana-ansible-8.0+git.1540411858.7223b0a/_third-party-import-debian-pkgs.yml#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#

# Update thirdparty apt repo with new packages
---

- hosts: localhost
  connection: local
  roles:
    - deployer-setup
    - third-party
    - thirdparty-repo
  tasks:
    # Check if any third-party pkgs are present
    - shell: "ls {{ third_party_debian_pkgs_dir_glob }} | wc -l"
      register: deb_count_result
    - include: roles/thirdparty-repo/tasks/update_apt_repo.yml
      vars:
        import_fileglob: "{{ third_party_debian_pkgs_dir_glob }}"
      when: ("{{ deb_count_result.stdout | int }} > 0" and
             ansible_os_family | lower == 'debian')
    - include: roles/thirdparty-repo/tasks/update_apt_repo_on_sles.yml
      vars:
        import_fileglob: "{{ third_party_debian_pkgs_dir_glob }}"
      when: ("{{ deb_count_result.stdout | int }} > 0" and
             ansible_os_family | lower == 'suse')
07070100120432000081A40000000000000000000000015BD0D1D200000542000000FD0000000200000000000000000000004F00000000ardana-ansible-8.0+git.1540411858.7223b0a/_third-party-import-log-profiles.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.
#

# Import third-party log profiles.
---

- hosts: localhost
  connection: local
  roles:
    - deployer-setup
    - third-party
    - git-operations

  tasks:
    - include: roles/third-party/tasks/_import-content.yml
      vars:
        work_dir: "{{ third_party_scratch_dir }}"
        dir_glob: "{{ third_party_logging_dir_glob }}"

    - include: roles/third-party/tasks/_persist-to-git.yml
      vars:
        repo: "{{ git_operations.main_repo }}"
        commit_msg: "Third-party logging config import"
        branches:
          - name: "{{ git_operations.site_branch }}"
            copies:
              - from: " {{ third_party_scratch_dir }}"
                to: " {{ main_repo_logging_dir }}"
0707010012021C000081A40000000000000000000000015BD0D1D200000574000000FD0000000200000000000000000000004800000000ardana-ansible-8.0+git.1540411858.7223b0a/_third-party-import-other.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: localhost
  connection: local
  roles:
    - deployer-setup
    - third-party
    - thirdparty-other
  tasks:
    - name: _third-party-import-other | Get ardana version
      include_vars: "{{ playbook_dir }}/ardana_version.yml"
    - name: _third-party-import-other | Get list of venvs
      shell: ls -d -- {{ third_party_root_dir }}/{{ third_party_other_dir_glob }}
      register: venv_list_result
      failed_when: venv_list_result.rc == 1
    - include: roles/thirdparty-other/tasks/setup.yml
      vars:
        sources: "{{ venv_list_result.stdout_lines }}"

- hosts: parallel_other
  connection: local
  roles:
    - third-party
    - thirdparty-other
  tasks:
    - include: roles/thirdparty-other/tasks/create-thirdparty-other.yml
07070100120226000081A40000000000000000000000015BD0D1D20000047B000000FD0000000200000000000000000000004C00000000ardana-ansible-8.0+git.1540411858.7223b0a/_third-party-import-rhel-pkgs.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.
#

# Update thirdparty yum repo with new packages
---

- hosts: localhost
  connection: local
  roles:
    - deployer-setup
    - third-party
    - thirdparty-repo
  tasks:
    # Check if any third-party pkgs are present
    - shell: "ls {{ third_party_rhel_pkgs_dir_glob }} | wc -l"
      register: rpm_count_result
    - include: roles/thirdparty-repo/tasks/update_yum_repo.yml
      vars:
        import_fileglob: "{{ third_party_rhel_pkgs_dir_glob }}"
      when: "{{ rpm_count_result.stdout | int }} > 0"
070701001203EA000081A40000000000000000000000015BD0D1D200000544000000FD0000000200000000000000000000004B00000000ardana-ansible-8.0+git.1540411858.7223b0a/_third-party-import-services.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.
#

# Import third-party service definitions
---

- hosts: localhost
  connection: local
  roles:
    - deployer-setup
    - third-party
    - git-operations

  tasks:
    - include: roles/third-party/tasks/_import-content.yml
      vars:
        work_dir: "{{ third_party_scratch_dir }}"
        dir_glob: "{{ third_party_services_dir_glob }}"

    - include: roles/third-party/tasks/_persist-to-git.yml
      vars:
        repo: "{{ git_operations.main_repo }}"
        commit_msg: "Third-party services import"
        branches:
          - name: "{{ git_operations.site_branch }}"
            copies:
              - from: " {{ third_party_scratch_dir }}"
                to: " {{ main_repo_services_dir }}"
07070100120227000081A40000000000000000000000015BD0D1D200000481000000FD0000000200000000000000000000004C00000000ardana-ansible-8.0+git.1540411858.7223b0a/_third-party-import-sles-pkgs.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.
#

# Update thirdparty zypper repo with new packages
---

- hosts: localhost
  connection: local
  roles:
    - deployer-setup
    - third-party
    - thirdparty-repo
  tasks:
    # Check if any third-party pkgs are present
    - shell: "ls {{ third_party_sles_pkgs_dir_glob }} | wc -l"
      register: rpm_count_result
    - include: roles/thirdparty-repo/tasks/update_zypper_repo.yml
      vars:
        import_fileglob: "{{ third_party_sles_pkgs_dir_glob }}"
      when: "{{ rpm_count_result.stdout | int }} > 0"
07070100120245000081A40000000000000000000000015BD0D1D200000621000000FD0000000200000000000000000000004800000000ardana-ansible-8.0+git.1540411858.7223b0a/_third-party-import-venvs.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.
#

# Import third-party plugin code into existing Ardana OpenStack service venvs
# and publish to the venv repo on the deployer.
---

- hosts: localhost
  connection: local
  roles:
    - deployer-setup
    - third-party
    - git-operations
  tasks:
    - name: _third-party-import-venv | Get ardana version
      include_vars: "{{ playbook_dir }}/ardana_version.yml"
    - name: _third-party-import-venv | Get list of third-party venvs
      shell: ls -d1 -- {{ third_party_root_dir }}/{{ third_party_venvs_dir_glob }}
      register: venv_list_result
      failed_when: venv_list_result.rc == 1
    - include: roles/thirdparty-venv/tasks/setup.yml
      vars:
        drivers: "{{ venv_list_result.stdout_lines }}"
      when: venv_list_result.rc == 0

- hosts: parallel_venvedit
  connection: local
  roles:
    - third-party
    - thirdparty-venv
  tasks:
    - include: roles/thirdparty-venv/tasks/create-thirdparty-venvs.yml
070701001203F9000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000003900000000ardana-ansible-8.0+git.1540411858.7223b0a/action_plugins070701001203FA000081A40000000000000000000000015BD0D1D2000006A9000000FD0000000200000000000000000000004100000000ardana-ansible-8.0+git.1540411858.7223b0a/action_plugins/info.py#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# his program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

from ansible.callbacks import display
from ansible.errors import AnsibleError
from ansible.runner.return_data import ReturnData
from ansible import utils


class ActionModule(object):
    '''Output custom message'''

    TRANSFERS_FILES = False

    def __init__(self, runner):
        self.runner = runner

    def run(self, conn, tmp, module_name, module_args, inject,
            complex_args=None, **kwargs):
        args = {}
        if complex_args:
            args.update(complex_args)
        args.update(utils.parse_kv(module_args))
        if 'msg' not in args:
            raise AnsibleError("'msg' is a required argument.")

        # might be handy to allow delayed formatting
        msg = args['msg'].format(args.get('args', {}))
        display(msg, args.get('color', 'normal'))

        result = dict(
            changed=False,
            msg=msg,
        )
        return ReturnData(conn=conn, result=result)
070701001203FB000081A40000000000000000000000015BD0D1D200000508000000FD0000000200000000000000000000004400000000ardana-ansible-8.0+git.1540411858.7223b0a/action_plugins/package.py#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) Copyright 2017 SUSE LLC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# his program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

from ansible import utils

class ActionModule(object):
    '''Output custom message'''

    TRANSFERS_FILES = False

    def __init__(self, runner):
        self.runner = runner

    def run(self, conn, tmp, module_name, module_args, inject,
            complex_args=None, **kwargs):

        module = utils.template.template(self.runner.basedir,
                    '{{ansible_pkg_mgr}}', inject)
        module_return = self.runner._execute_module(conn, tmp, module,
            module_args, inject=inject, complex_args=complex_args, **kwargs)

        return module_return
070701001203E8000081A40000000000000000000000015BD0D1D200000310000000FD0000000200000000000000000000003B00000000ardana-ansible-8.0+git.1540411858.7223b0a/ansible-init.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: localhost
  connection: local
  roles:
    - ansible-setup
  tasks:
    - include: roles/ansible-setup/tasks/configure-ansible.yml
070701001203EC000081A40000000000000000000000015BD0D1D200000309000000FD0000000200000000000000000000004200000000ardana-ansible-8.0+git.1540411858.7223b0a/ardana-extra-deploy.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: localhost
  tasks:
    - name: ardana-extra-deploy.yml dummy play
      debug:
        msg: "Skipping - nothing to do here"
07070100120434000081A40000000000000000000000015BD0D1D2000002CB000000FD0000000200000000000000000000004300000000ardana-ansible-8.0+git.1540411858.7223b0a/ardana-extra-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.
#
---

- hosts: localhost
  tasks:
    - name: ardana-extra-restart.yml dummy play
      debug:
        msg: "Skipping - nothing to do here"
070701001203C8000081A40000000000000000000000015BD0D1D2000002D4000000FD0000000200000000000000000000004C00000000ardana-ansible-8.0+git.1540411858.7223b0a/ardana-extra-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.
#
---

- hosts: localhost
  tasks:
    - name: ardana-extra-schedule-restart.yml dummy play
      debug:
        msg: "Skipping - nothing to do here"
070701001203CE000081A40000000000000000000000015BD0D1D200000308000000FD0000000200000000000000000000004100000000ardana-ansible-8.0+git.1540411858.7223b0a/ardana-extra-start.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: localhost
  tasks:
    - name: ardana-extra-start.yml dummy play
      debug:
        msg: "Skipping - nothing to do here"
070701001203CB000081A40000000000000000000000015BD0D1D200000322000000FD0000000200000000000000000000004200000000ardana-ansible-8.0+git.1540411858.7223b0a/ardana-extra-status.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: localhost
  max_fail_percentage: 0
  tasks:
    - name: ardana-extra-status.yml dummy play
      debug:
        msg: "Skipping - nothing to do here"
07070100120438000081A40000000000000000000000015BD0D1D200000307000000FD0000000200000000000000000000004000000000ardana-ansible-8.0+git.1540411858.7223b0a/ardana-extra-stop.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: localhost
  tasks:
    - name: ardana-extra-stop.yml dummy play
      debug:
        msg: "Skipping - nothing to do here"
070701001203CD000081A40000000000000000000000015BD0D1D200000349000000FD0000000200000000000000000000004400000000ardana-ansible-8.0+git.1540411858.7223b0a/ardana-gen-hosts-file.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: pbstart.yml
  vars:
    playbook_name: "ardana-gen-hosts-file.yml"

- hosts: all
  roles:
    - osconfig
  tasks:
    - include: roles/osconfig/tasks/setup-hosts-file.yml

- include: pbfinish.yml
  vars:
    playbook_name: "ardana-gen-hosts-file.yml"07070100120249000081A40000000000000000000000015BD0D1D2000005D3000000FD0000000200000000000000000000004800000000ardana-ansible-8.0+git.1540411858.7223b0a/ardana-pre-upgrade-status.yml#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Top-level Ardana pre-upgrade status playbook
# A separate pre-upgrade status is required to account for parts of a
# service not yet deployed as part of the upgrade, e.g. the introduction of
# of the object-reconstructor service in Ardana OpenStack.
# Another possible solution is to implement a check that handles the fact
# that a service has not been deployed yet (e.g. not registered with
# systemd). For the majority of cases, the pre-upgrade status check is
# identical to the regular status check.
# BUG 2913 used to track an alternative solution.
---

- include: osconfig-status.yml
- include: ardana-status.yml
  vars:
    ardana_pre_upgrade_check: true
    # We may be transitioning TLS in RabbitMQ so we cannot check the TLS
    # state. For example we are rerunning upgrade play after a failure.
    rabbitmq_tls_check_status: false
0707010012042F000081ED0000000000000000000000015BD0D1D2000008AB000000FD0000000200000000000000000000003C00000000ardana-ansible-8.0+git.1540411858.7223b0a/ardana-quiesce.sh#!/bin/bash
#
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#

# this script runs the logging-test playbook to simulate service log (JSON) growth
set -eu
set -o pipefail

SCRIPT_NAME=$(basename $0)

usage() {
    echo "$SCRIPT_NAME [options]"
    echo
    echo "Quiesces OpenStack service activity on cloud controllers"
    echo
    echo "Options:"
    echo "-l, --limit <limit> -- Applies an Ansible pattern to select hosts"
    echo "                       Example: '!ardana-cp1-c1-m1' (avoids host)"
    echo "-h, --help          -- Shows this help information"
    echo
}

TEMP=$(getopt -o l:h -l limit:,help -n $SCRIPT_NAME -- "$@")
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
echo $TEMP
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"

LIMIT=""

while true ; do
    case "$1" in
        -h | --help) usage ; exit 0 ;;
        -l | --limit) LIMIT="-l $2"; shift 2 ;;
        --) shift ; break;;
        *) break ;;
    esac
done

function quiesce_simul() {
    services=("$@")
    for service in "${services[@]}"
    do
        playbook=${service}-stop.yml
        if [[ -e $playbook ]]
        then
            ansible-playbook -i hosts/verb_hosts $LIMIT $playbook &
        else
            echo "Bypassing missing playbook $playbook"
        fi
    done
    wait
}

phase_one=(
    freezer
    ceph
    ceilometer
    heat
    ironic
    designate
    cinder
    glance
    magnum
)

phase_two=(
    neutron
    nova
    octavia
    swift
)

phase_three=(
    barbican
    keystone
)

quiesce_simul "${phase_one[@]}"
quiesce_simul "${phase_two[@]}"
quiesce_simul "${phase_three[@]}"

echo "OpenStack services have now been stopped/quiesced"
070701001203F0000081A40000000000000000000000015BD0D1D20000087A000000FD0000000200000000000000000000003C00000000ardana-ansible-8.0+git.1540411858.7223b0a/ardana-reboot.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.
#

# Regather facts on all hosts in case of configuration changes that haven't
# been reflected in the fact cache
- include: ardana-refresh-facts.yml

- include: pbstart.yml
  vars:
    playbook_name: "ardana-reboot.yml"

# Prevents the playbook being run on multiple targets
- hosts: resources
  roles:
    - ardana-upgrade-tools
  tasks:
  - include: roles/ardana-upgrade-tools/tasks/check-single-host.yml
    vars:
      playbook_name: "ardana-reboot.yml"

- include: _ardana-pre-reboot.yml

- hosts: resources
  roles:
    - ardana-upgrade-tools
  tasks:
    - include: roles/ardana-upgrade-tools/tasks/check-deployer.yml

    # First reboot non-deployer nodes, if included
    - include: roles/ardana-upgrade-tools/tasks/reboot.yml
      when: not running_on_deployer

    # Node reboot was completed successfully, reset the reboot status variable
    - include: roles/ardana-upgrade-tools/tasks/check-pending-system-reboot.yml
      vars:
        update_status_reset: true
      when: not running_on_deployer

    # Next, reboot deployer node, if included
    - name: ardana-reboot | Deployer node has to be rebooted manually
      fail:
        msg: "The deployer node needs to be rebooted manually.
              After reboot, resume by running the post-reboot playbook:

            cd ~/scratch/ansible/next/ardana/ansible
            ansible-playbook -i hosts/verb_hosts _ardana-post-reboot.yml \
              --limit {{ inventory_hostname }}"
      when: running_on_deployer

- include: _ardana-post-reboot.yml

- include: pbfinish.yml
  vars:
    playbook_name: "ardana-reboot.yml"
070701001203F3000081A40000000000000000000000015BD0D1D20000056A000000FD0000000200000000000000000000004300000000ardana-ansible-8.0+git.1540411858.7223b0a/ardana-refresh-facts.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.
#
# We can limit this to run on one host:
#   ansible-playbook -i hosts/verb_hosts
#                     ardana-refresh-facts.yml
#                     --limit single-ccp-c1-m1-mgmt
# Or ignore a node:
#   ansible-playbook -i hosts/verb_hosts
#                     ardana-refresh-facts.yml
#                     --limit '!single-ccp-c1-m1-mgmt'
---
# Refresh facts for all hosts in scope for play, ensuring they are reachable
- hosts: all
  gather_facts: False
  max_fail_percentage: 0
  tasks:
    - action: setup
      # don't need to run this multiple times during a deployment, just
      # at the start of any entry points an end user may execute
      register: _ardana_refresh_fact_cache
      when: _ardana_refresh_fact_cache is not defined
0707010012021E000081A40000000000000000000000015BD0D1D2000005F0000000FD0000000200000000000000000000004A00000000ardana-ansible-8.0+git.1540411858.7223b0a/ardana-replace-legacy-repos.yml#
# (c) Copyright 2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
---
- hosts: resources
  tasks:
    - name: ardana-replace-legacy-repos | Remove old repos
      become: yes
      zypper_repository:
        name: "{{ item }}"
        state: absent
      when: ansible_os_family | lower == 'suse'
      with_items:
        - openstack-newton
        - openstack-pike
        - cloud8-openstack-devel
        - cloud8-openstack-devel-staging
        - sles12sp3-network
        - powerdns
        - opensuse-leap-network
        - sle-12-ga-standard
        - sle-12-sp2-update-products-manager31-standard
        - sle-12-update-standard
        - SLES-SDK
        - SLES-OS
        - vertica

- hosts: localhost
  tasks:
    - name: ardana-replace-legacy-repos | Rename extras directory to avoid its reuse
      become: yes
      command: mv /opt/ardana_packager/ardana/sles12/zypper/extras /opt/ardana_packager/ardana/sles12/zypper/extras_legacy
      ignore_errors: true

- include: _osconfig-setup-repos.yml
0707010012024D000081A40000000000000000000000015BD0D1D200000576000000FD0000000200000000000000000000004100000000ardana-ansible-8.0+git.1540411858.7223b0a/ardana-update-pkgs.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.
#

# Regather facts on all hosts in case of configuration changes that haven't
# been reflected in the fact cache
- include: ardana-refresh-facts.yml

- include: pbstart.yml
  vars:
    playbook_name: "ardana-update-pkgs.yml"

# Prevents the playbook being run on multiple targets
- hosts: resources
  roles:
    - ardana-upgrade-tools
  tasks:
  - include: roles/ardana-upgrade-tools/tasks/check-single-host.yml
    vars:
      playbook_name: "ardana-reboot.yml"

# Run this now to synchronize zypper repositories present on the deployer
- include: _osconfig-setup-repos.yml

- include: osconfig-status.yml

- include: _ardana-update-base.yml
  vars:
    install_package_updates: true

# Report update status
- include: _ardana-update-status.yml

- include: pbfinish.yml
  vars:
    playbook_name: "ardana-update-pkgs.yml"
070701001203F1000081A40000000000000000000000015BD0D1D2000005E7000000FD0000000200000000000000000000004300000000ardana-ansible-8.0+git.1540411858.7223b0a/ardana-update-status.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.
#
# This playbook can be used to handle special ardana_notify_... variables
# associated with outstanding update actions resulted from running the
# update playbooks.
#
# The following parameters are available:
#
#   * update_status_var: used to select a particular update status variable.
#     It can take the following values:
#
#       service-update - target the status of pending service updates
#       clm-update - target the status of pending CLM updates
#       system-reboot - target the status of pending system reboots
#       all (default) - target all supported update status variables
#
#   * update_status_check (default: true): check if the status variable is set
#   * update_status_reset (default: false): reset the status variable
#   * update_status_set (default: false): set the status variable
#   * update_status_brief (default: false): use a brief update status output
#
---
- include: _ardana-update-status.yml070701001203F8000081A40000000000000000000000015BD0D1D2000003C2000000FD0000000200000000000000000000004700000000ardana-ansible-8.0+git.1540411858.7223b0a/ardana-upgrade-pkg-query.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.
#
# Playbook to query apt for set of packages available for upgrade
---
- hosts: resources
  roles:
    - ardana-upgrade-tools
  tasks:
    - include: roles/ardana-upgrade-tools/tasks/configure.yml
    - include: roles/ardana-upgrade-tools/tasks/install.yml
    - include: roles/ardana-upgrade-tools/tasks/pkg-query.yml
070701001203BB000081A40000000000000000000000015BD0D1D200000390000000FD0000000200000000000000000000004800000000ardana-ansible-8.0+git.1540411858.7223b0a/ardana-upgrade-pkg-verify.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.
#
# Playbook to verify that node is up-to-date wrt. to all available
# package updates.
---

- hosts: resources
  roles:
    - ardana-upgrade-tools
  tasks:
    - include: roles/ardana-upgrade-tools/tasks/pkg-verify.yml
      when: ansible_os_family | lower == 'debian'
07070100120220000081A40000000000000000000000015BD0D1D2000013DD000000FD0000000200000000000000000000003B00000000ardana-ansible-8.0+git.1540411858.7223b0a/birdseyeview.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: Perform initial, local operations
  hosts: localhost
  tasks:
    - name: Create local temporary directory
      command: mktemp -d
      register: _local_tmpdir


- name: Collect hardware and software details
  hosts: all
  tasks:
    - name: Create remote temporary directories
      command: mktemp -d
      register: _remote_tmpdir

    - name: Collect hostname
      become: yes
      shell: 'hostname > {{ _remote_tmpdir.stdout }}/hostname'

    - name: Collect network details
      become: yes
      shell: 'ip a > {{ _remote_tmpdir.stdout }}/ipa'

    - name: Collect hardware details
      become: yes
      shell: 'dmidecode | sed -n "/^System Information/,/^$/p" > {{ _remote_tmpdir.stdout }}/dmidecode'

    - name: Collect operating system details
      become: yes
      command: 'cp /etc/os-release {{ _remote_tmpdir.stdout }}/'

    - name: Gather remote file listings
      command: 'ls {{ _remote_tmpdir.stdout }}'
      register: files_to_fetch

    - name: Create local destination directories for nodes' files
      file:
        path: '{{ hostvars["localhost"]._local_tmpdir.stdout }}/nodes/{{ inventory_hostname }}/'
        state: directory
        mode: 0700
        recurse: True
      delegate_to: localhost

    - name: Collect data files from nodes
      become: yes
      fetch:
        src: '{{ _remote_tmpdir.stdout }}/{{ item }}'
        dest: '{{ hostvars["localhost"]._local_tmpdir.stdout }}/nodes/{{ inventory_hostname }}/'
        flat: True
      with_items: '{{ files_to_fetch.stdout_lines }}'

    - name: Remove remote temporary directories
      file:
        path: '{{ _remote_tmpdir.stdout }}'
        state: absent


# configuration files are explicitly referenced in services files, not
# picked up from /etc/cinder
- name: Collect cinder configuration files
  hosts: CND-VOL
  tasks:
    - name: Fetch service configurations
      run_once: True
      become: yes
      fetch:
        src: '{{ item[0] | replace("NAME", item[1]) }}'
        dest: '{{ hostvars["localhost"]._local_tmpdir.stdout }}/'
        flat: True
      with_nested:
        # service directories
        - [
            # hLinux
            '/usr/lib/systemd/system/NAME.service',
            # SLES
            '/etc/systemd/system/NAME.service'
          ]
        # services
        - [ 'cinder-api' ]
      ignore_errors: True

    - name: Get configuration file list
      run_once: True
      delegate_to: localhost
      birdseyeview:
        action: list_cinder_config_files
        src: '{{ hostvars["localhost"]._local_tmpdir.stdout }}/'
      register: config_files

    - name: Fetch configuration files
      run_once: True
      become: yes
      fetch:
        src: '{{ item }}'
        dest: '{{ hostvars["localhost"]._local_tmpdir.stdout }}/'
        flat: True
      with_items: '{{ config_files.files }}'
      ignore_errors: True


# configuration files are explicitly referenced in services files, not
# picked up from /etc/glance
- name: Collect glance configuration files
  hosts: GLA-API
  tasks:
    - name: Fetch service configurations
      run_once: True
      become: yes
      fetch:
        src: '{{ item[0] | replace("NAME", item[1]) }}'
        dest: '{{ hostvars["localhost"]._local_tmpdir.stdout }}/'
        flat: True
      with_nested:
        # service directories
        - [
            # hLinux
            '/usr/lib/systemd/system/NAME.service',
            # SLES
            '/etc/systemd/system/NAME.service'
          ]
        # services
        - [ 'glance-api' ]
      ignore_errors: True

    - name: Get configuration file list
      run_once: True
      delegate_to: localhost
      birdseyeview:
        action: list_glance_config_files
        src: '{{ hostvars["localhost"]._local_tmpdir.stdout }}/'
      register: config_files

    - name: Fetch configuration files
      run_once: True
      become: yes
      fetch:
        src: '{{ item }}'
        dest: '{{ hostvars["localhost"]._local_tmpdir.stdout }}/'
        flat: True
      with_items: '{{ config_files.files }}'
      ignore_errors: True


- name: Perform final, local operations
  hosts: localhost
  tasks:
    - name: Get file listing
      command: 'ls {{ _local_tmpdir.stdout }}'

    - name: Generate summary
      birdseyeview:
        action: generate_summary
        src: '{{ _local_tmpdir.stdout }}'
        dest: birdseyeview.yml

    - name: Remove local temporary directory
      file:
        path: '{{ _local_tmpdir.stdout }}'
        state: absent
07070100120429000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000003B00000000ardana-ansible-8.0+git.1540411858.7223b0a/callback_plugins0707010012042B000081A40000000000000000000000015BD0D1D200000422000000FD0000000200000000000000000000004B00000000ardana-ansible-8.0+git.1540411858.7223b0a/callback_plugins/contained_in.py#
# Extends the Jinja2 test filters.
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# his program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
import jinja2.tests


def test_contained_in(thing, other):
    return thing in other


def test_contains(thing, other):
    return other in thing


jinja2.tests.TESTS['contained_in'] = test_contained_in
jinja2.tests.TESTS['contains'] = test_contains


class CallbackModule(object):
    pass
0707010012042A000081A40000000000000000000000015BD0D1D200002892000000FD0000000200000000000000000000006200000000ardana-ansible-8.0+git.1540411858.7223b0a/callback_plugins/persist_registered_ardana_variables.py#
# Apply callback plugin to Ansible to persist certain variables
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# his program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

from jinja2 import parser
from jinja2 import environment
from jinja2 import nodes
from ansible import utils
from ansible import constants as C
from ansible.errors import AnsibleError

import fcntl
import os

from copy import deepcopy

try:
    from ansible.callbacks import display
except ImportError:
    # v2.0 import
    from ansible.utils.display import Display
    my_display = Display()
    display = my_display.warning

ARDANA_PREFIX = "ardana_notify"

def search_node(node, parent_not=False):
    if isinstance(node, nodes.And):
        for child in (node.left, node.right):
            for value in search_node(child):
                yield value
    elif isinstance(node, nodes.Or):
        for child in (node.left, node.right):
            for value in search_node(child):
                yield value
    elif isinstance(node, nodes.Not):
        for value in search_node(node.node, parent_not=True):
            yield value
    elif isinstance(node, nodes.Test):
        if (hasattr(node, 'name') and node.name == "defined"
           and hasattr(node.node, 'name') and node.node.name.startswith(ARDANA_PREFIX)
           and node.node.ctx == "load" and not parent_not):
            yield node.node.name

#
# This function processes the fact cache host entries to remove registered
# ARDANA_PREFIX variables marked for deletion, along with the deletion markers.
#

def _clear_prefix_from_cache(cache, PREFIX):
    corrupt_files = []
    for key in cache:
        try:
            for host_key in cache[key].keys():
                if (host_key.startswith(PREFIX) and host_key.endswith(".deleted")
                   and cache[key].get(host_key, "False")):
                    _key = host_key.split(".deleted")[0]
                    del cache[key][host_key]
                    if _key in cache[key]:
                        del cache[key][_key]
        except Exception:
            display("Fact cache entry for host %s isn't valid, deleting and failing" % key)
            # This next bit only works for JSON fact-cache
            if C.CACHE_PLUGIN == "jsonfile":
                try:
                    os.remove("%s/%s" % (C.CACHE_PLUGIN_CONNECTION, key))
                except (OSError, IOError):
                    display("Couldn't remove cache entry")
                finally:
                    corrupt_files.append(key)
    if len(corrupt_files) > 0:
        files = ', '.join(corrupt_files)
        raise AnsibleError("The JSON cache files %s were corrupt, or did not otherwise contain valid JSON data."
                           " They have been removed, so you can re-run your command now." % files)


def clear_from_cache(cache):
        _clear_prefix_from_cache(cache, ARDANA_PREFIX)



#
# This function is to fix an issue when using "become: true" whereby the HOME is set to
# "/root" and USER is set to "root" in the ansible_env entry in hosts' fact_cache.
# This issue might be fixed in Ansible v2.0, see https://github.com/ansible/ansible/issues/13592
#
def set_ansible_env_HOME(cache):
    for key in cache:
        if 'ansible_env' in cache[key] and cache[key]['ansible_env'].get('HOME') == '/root':
            cache[key]['ansible_env']['HOME'] = os.environ.get('HOME')
            cache[key]['ansible_env']['USER'] = os.environ.get('USER')


class CallbackModule(object):

    def playbook_on_start(self):
        if (C.CACHE_PLUGIN_CONNECTION is None or
           os.getenv("ANSIBLE_PERSIST_VARIABLES_DISABLE") is not None):
            return

        # Remove saved variables from persistent fact_cache if marked for deletion
        # if last run was ctrl-Ced before completion
        clear_from_cache(self.playbook.SETUP_CACHE)
        # Fix-up ansible_env HOME and USER entries if they are set to root
        set_ansible_env_HOME(self.playbook.SETUP_CACHE)

    def playbook_on_task_start(self, name, is_conditional):
        if (C.CACHE_PLUGIN_CONNECTION is None or
           os.getenv("ANSIBLE_PERSIST_VARIABLES_DISABLE") is not None):
            return

        for host in self.playbook.inventory.list_hosts():
            if host in self.playbook.SETUP_CACHE:
                for key, value in self.playbook.SETUP_CACHE[host].iteritems():
                    if key.startswith(ARDANA_PREFIX):
                        self._update_hash(self.playbook.VARS_CACHE, host, {key: value})

    def _get_target_host(self, host):
        if self.task.delegate_to is None:
            return host
        else:
            # The only way to work out the delegated host is to split the string apart.
            return host.split(' -> ')[-1]

    def _process_persistent_variables(self, host, res, PREFIX):
        _notify_set_false_prefix = PREFIX + "_set_false_prefix"

        if self.task.register and self.task.register == _notify_set_false_prefix:
            # Get _notify variables from SETUP_CACHE and set changed to False
            update_dict = {}
            prefix_to_set_false = PREFIX
            if _notify_set_false_prefix in self.playbook.VARS_CACHE[host]:
                prefix = self.playbook.VARS_CACHE[host].pop(_notify_set_false_prefix)
                prefix_to_set_false = prefix if prefix.startswith(PREFIX) else PREFIX
            for key in self.playbook.SETUP_CACHE[host]:
                if key.startswith(prefix_to_set_false) and not key.endswith(".deleted"):
                    new_state = deepcopy(self.playbook.SETUP_CACHE[host][key])
                    if new_state.get("changed", True):
                        new_state["changed"] = False
                        update_dict[key] = new_state
            if update_dict:
                res.update(update_dict)
                self._update_hash(res, "ansible_facts", update_dict)

        elif self.task.register and self.task.register.startswith(PREFIX):
            my_host = self._get_target_host(host)

            if res.get('changed'):
                # save the facts immediately in case there is an exception elsewhere
                self._update_hash(self.playbook.SETUP_CACHE, my_host,
                                  {self.task.register: res})

                if my_host == host:
                    # return a copy of the result data for ansible to save as well when
                    # it writes down facts after the task is complete on all hosts
                    result = {k: v for k, v in res.items() if k != 'ansible_facts'}
                    self._update_hash(res, 'ansible_facts',
                                      {self.task.register: result})

            else:
                previous_state = self.playbook.SETUP_CACHE[my_host].get(self.task.register)
                if previous_state:
                    res.update(previous_state)
                    result = {k: v for k, v in res.items() if k != 'ansible_facts'}
                    self._update_hash(res, 'ansible_facts',
                                      {self.task.register: result})

        if self.task.when:
            if isinstance(self.task.when, list):
                when = None
                for elem in self.task.when:
                    if PREFIX in elem:
                        when = elem
            else:
                when = self.task.when if PREFIX in self.task.when else None
            if when:
                # Mark saved variable for removal from persistent cache at end of run
                # if check is "is defined"
                my_host = self._get_target_host(host)
                envir = environment.Environment()
                when = when.replace('{{', '')
                when = when.replace('}}', '')
                parse = parser.Parser(envir, when, state='variable')
                expr = parse.parse_expression()
                deleted_keys = {}
                for key in search_node(expr):
                    deleted_keys["%s.deleted" % key] = True

                self._update_hash(res, 'ansible_facts', deleted_keys)

                # If delegating task, mark persisted facts for deletion on node to which
                # you're delegating
                if my_host != host:
                    self._update_hash(self.playbook.SETUP_CACHE, my_host, deleted_keys)

    def runner_on_ok(self, host, res):
        if (C.CACHE_PLUGIN_CONNECTION is None or
           os.getenv("ANSIBLE_PERSIST_VARIABLES_DISABLE") is not None):
            return

        if self.task:
            self._process_persistent_variables(host, res, ARDANA_PREFIX)

    def _update_hash(self, hash, key, new_value):
        # If two or more nodes delegate to the same node and attempt to update
        # the fact-cache for that node simultaneously we need to lock using
        # mutex around the update_hash action to stop a collision.
        # Because instances of this callback plugin live within multiple subprocesses
        # during execution, we can't rely on a threading.RLock; nor can we use a
        # POSIX multiprocess.Lock object since there's no way to ensure that the
        # object is correctly created in the parent process.
        # Instead, we'll use a traditional file-based lock for the key item.
        with open("%s/.lock_%s" % (C.CACHE_PLUGIN_CONNECTION, key), "w+") as f:
            fcntl.flock(f, fcntl.LOCK_EX)
            utils.update_hash(hash, key, new_value)

    def playbook_on_stats(self, stats):
        if (C.CACHE_PLUGIN_CONNECTION is None or
           os.getenv("ANSIBLE_PERSIST_VARIABLES_DISABLE") is not None):
            return

        # Remove saved variables from persistent fact_cache if marked for deletion
        clear_from_cache(self.playbook.SETUP_CACHE)
0707010012042D000081A40000000000000000000000015BD0D1D20000098F000000FD0000000200000000000000000000005500000000ardana-ansible-8.0+git.1540411858.7223b0a/callback_plugins/report_playbook_status.py# (c) Copyright 2017-2018 SUSE LLC

import json
import os
import urllib2


class CallbackModule(object):

    # Callback plugin sends events to the ardana-service so that other
    # components can listen to ansible events, particular playbook starts/stops
    def playbook_on_task_start(self, name, is_conditional):
        # Triggers callbacks other services if a specific play was run Since
        # playbooks are being run in a nested fashion, only the top level
        # playbook will trigger playbook_on_stats indicating that its finished
        # (the same is true for playbook_on_start). Instead, fake the
        # start/finish events by injecting a start and finish task into
        # important playbooks, and parse for that task here
        callbacks_map = {
            'pbfinish.yml pb_finish_playbook': 'stop',
            'pbstart.yml pb_start_playbook': 'start'
        }
        playbook_name = self.task.play_vars.get('playbook_name', None)
        if playbook_name is not None and name in callbacks_map:
            self.post_to_listener(playbook_name, callbacks_map[name])

    # function called when playbook is started
    # calls back to the ardana service indicating a playbook start
    def playbook_on_start(self):
        self.post_to_listener(self.playbook.filename, 'start')

    # function called when playbook is finished
    # calls back to the ardana service indicating a playbook stop
    def playbook_on_stats(self, stats):
        action = 'stop'
        if(len(stats.dark) + len(stats.failures) > 0):
            action = 'error'
        self.post_to_listener(self.playbook.filename, action)

    def post_to_listener(self, playbook, action):
        if 'NOTIFY_URL' in os.environ and 'PLAY_ID' in os.environ:
            urlpath = '/api/v2/listener/playbook'
            url = os.environ['NOTIFY_URL'] + urlpath
            try:
                data = json.dumps({
                    'play_id': os.environ['PLAY_ID'],
                    'event': action,
                    'playbook': playbook
                })
                req = urllib2.Request(url, data,
                                      {'Content-type': 'application/json'})
                f = urllib2.urlopen(req)
                f.read()
            except Exception:
                # nothing to do on exception, probably means the URL is
                # incorrect or not available for the playbook in question
                pass
0707010012042C000081A40000000000000000000000015BD0D1D200000EA2000000FD0000000200000000000000000000004B00000000ardana-ansible-8.0+git.1540411858.7223b0a/callback_plugins/run_once_per.py#
# Apply run_once_per: to Ansible that runs a tasks given a group of hosts
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# his program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

# For Ansible 1.9.x

# Apply run_once_per: to ansible tasks.
# Usage:
# On a task with run_once_per set, the value of the run_once_per
# expression will be computed per host in play. Those hosts are
# grouped by the result; the task is then executed once per unique
# value in the result, on the first host in play that evaluated to
# that result.

# Example: in hosts/foo:
# a ansible_ssh_connection=127.0.0.1 bar=1
# b ansible_ssh_connection=127.0.0.1 bar=1
# c ansible_ssh_connection=127.0.0.1 bar=2
# d ansible_ssh_connection=127.0.0.1 bar=2
#
# - debug:
#     msg: "the value of bar is {{ bar }}"
#   run_once_per: bar
#
# This will evaluate the J2 expression, resulting in
# a->1 b->1 c->2 d->2.
# Then hosts a and c will be selected for the task.


import collections

from ansible.callbacks import vv, vvv
from ansible.utils import template


class CallbackModule(object):

    def playbook_on_start(this):
        """ Ansible doesn't provide the hooks for this.
            Instead we inject our code into the appropriate
            modules during initialisation.
        """

        # Monkey-patch ansible.playbook.task.Task
        import ansible.playbook.task

        class T(ansible.playbook.task.Task):
            VALID_KEYS = ansible.playbook.task.Task.VALID_KEYS.union({'run_once_per'})

            def __init__(self, play, ds, **kwargs):
                super(T, self).__init__(play, ds, **kwargs)
                self.run_once_per = ds.get('run_once_per')

        ansible.playbook.task.Task = T

        # We'll need to get ansible.playbook.play.Task too
        import ansible.playbook.play
        ansible.playbook.play.Task = T

        # Monkey-patch ansible.runner.Runner.run
        import ansible.runner

        old_run = ansible.runner.Runner.run
        def run(self):
            # Work out the hosts to run on.
            if this.task is None or this.task.run_once_per is None:
                return old_run(self)

            per_expr = "{{" + this.task.run_once_per + "}}"

            # Evaluate that expression per current host.
            groups = collections.defaultdict(list)

            if not self.run_hosts:
                self.run_hosts = self.inventory.list_hosts(self.pattern)
            hosts = self.run_hosts

            if len(hosts) == 0:
                return old_run(self)

            for host in hosts:
                inject = self.get_inject_vars(host)
                value = template.template(self.basedir, per_expr, inject, fail_on_undefined=True)
                vvv("evaluating {} for {} and got {!r}".format(per_expr, host, value))
                groups[value].append(host)

            vv("run_once_per for each of {!r}".format(groups))
            try:
                self.run_hosts = [groups[value][0] for value in groups]
                return old_run(self)
            finally:
                self.run_hosts = hosts

        ansible.runner.Runner.run = run
070701001203E9000081A40000000000000000000000015BD0D1D200000401000000FD0000000200000000000000000000003C00000000ardana-ansible-8.0+git.1540411858.7223b0a/client-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.
#
# Define install playbook for Openstack client
---
- hosts: "{{ install_hosts }}"
  roles:
    - service-client
  vars:
    service_client: "{{ install_package }}"
  tasks:
    - include: roles/service-client/tasks/install.yml
      when: deployer_media_legacy_layout|bool
    - include: roles/service-client/tasks/install-rpm.yml
      when: deployer_media_legacy_layout|bool == false
070701001203F5000081A40000000000000000000000015BD0D1D200000B31000000FD0000000200000000000000000000003D00000000ardana-ansible-8.0+git.1540411858.7223b0a/clients-deploy.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.
#
# install openstack clients to remote and localhost
---
#TODO: Ansible V2 May be able to use with_items on includes to clean this up

# openstack-client
- include: client-deploy.yml
  vars:
    install_hosts: OPN-CLI
    install_package: "{{ OPN_CLI.vars.openstack_client }}"

# ceilometer-client
- include: client-deploy.yml
  vars:
    install_hosts: CEI-CLI
    install_package: "{{ CEI_CLI.vars.ceilometer_client }}"

# cinder-client
- include: client-deploy.yml
  vars:
    install_hosts: CND-CLI
    install_package: "{{ CND_CLI.vars.cinder_client }}"

# designate-client
- include: client-deploy.yml
  vars:
    install_hosts: DES-CLI
    install_package: "{{ DES_CLI.vars.designate_client }}"

# glance-client
- include: client-deploy.yml
  vars:
    install_hosts: GLA-CLI
    install_package: "{{ GLA_CLI.vars.glance_client }}"

# heat-client
- include: client-deploy.yml
  vars:
    install_hosts: HEA-CLI
    install_package: "{{ HEA_CLI.vars.heat_client }}"

# ironic-client
- include: client-deploy.yml
  vars:
    install_hosts: IRN-CLI
    install_package: "{{ IRN_CLI.vars.ironic_client }}"

# keystone-client
- include: client-deploy.yml
  vars:
    install_hosts: KEY-CLI
    install_package: "{{ KEY_CLI.vars.keystone_client }}"

# neutron-client
- include: client-deploy.yml
  vars:
    install_hosts: NEU-CLI
    install_package: "{{ NEU_CLI.vars.neutron_client }}"

# nova-client
- include: client-deploy.yml
  vars:
    install_hosts: NOV-CLI
    install_package: "{{ NOV_CLI.vars.nova_client }}"

# swift-client
- include: client-deploy.yml
  vars:
    install_hosts: SWF-CLI
    install_package: "{{ SWF_CLI.vars.swift_client }}"

# monasca-client
- include: client-deploy.yml
  vars:
    install_hosts: MON-CLI
    install_package: "{{ MON_CLI.vars.monasca_client }}"

# barbican-client
- include: client-deploy.yml
  vars:
    install_hosts: KEYMGR-CLI
    install_package: "{{ KEYMGR_CLI.vars.barbican_client }}"

# magnum-client
- include: client-deploy.yml
  vars:
    install_hosts: MAG-CLI
    install_package: "{{ MAG_CLI.vars.magnum_client }}"

# manila-client
- include: client-deploy.yml
  vars:
    install_hosts: MNL-CLI
    install_package: "{{ MNL_CLI.vars.manila_client }}"
0707010012022D000081A40000000000000000000000015BD0D1D200000536000000FD0000000200000000000000000000003E00000000ardana-ansible-8.0+git.1540411858.7223b0a/clients-upgrade.yml#
# (c) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
# Disable all localhost client if installed.
- hosts: localhost
  connection: local
  vars:
    service_client_remove:
      - openstack
      - ceilometer
      - cinder
      - designate
      - glance
      - heat
      - ironic
      - keystone
      - neutron
      - nova
      - swift
      - monasca
      - barbican
      - magnum
      - manila
  tasks:
    - name: clients-upgrade | Disable all localhost clients
      become: yes # noqa
      file:
        path: /usr/bin/{{ item }}
        state: absent
      with_items: service_client_remove
      when: deployer_media_legacy_layout|bool

# Upgrade openstack clients that are in model.
- include: clients-deploy.yml
0707010012043E000081A40000000000000000000000015BD0D1D200000306000000FD0000000200000000000000000000004100000000ardana-ansible-8.0+git.1540411858.7223b0a/cloud-client-setup.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: localhost
  connection: local
  roles:
    - osconfig
  tasks:
    - include: roles/osconfig/tasks/setup-hosts-file.yml
070701001203F4000081A40000000000000000000000015BD0D1D200000306000000FD0000000200000000000000000000004500000000ardana-ansible-8.0+git.1540411858.7223b0a/config-processor-clean.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: localhost
  connection: local
  roles:
    - config-processor
  tasks:
    - include: roles/config-processor/tasks/clean.yml
0707010012021D000081A40000000000000000000000015BD0D1D200000748000000FD0000000200000000000000000000004300000000ardana-ansible-8.0+git.1540411858.7223b0a/config-processor-run.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.
#

# Run the Configuration Processor
#
# We assemble a scratch working area, putting the site configuration
# and the CP's persistent state into it.
#
# Then the configuration processor is invoked.
#
# If all runs to completion, then we tentatively save the
# CP output prior to using it in a deployment.
---
- hosts: localhost
  connection: local
  roles:
    - guard-runtime-location
    - git-operations
  tasks:
    - include: roles/git-operations/tasks/prepare-cp-run.yml

- hosts: localhost
  connection: local
  roles:
    - config-processor
  vars_prompt:
    - name: encrypt
      prompt: "Enter encryption key (press return for none)"
      private: yes
      confirm: yes
    - name: rekey
      prompt: "To change encryption key enter new key (press return for none)"
      private: yes
      confirm: yes
  tasks:
    - include: roles/config-processor/tasks/run-config-processor.yml
    - include: roles/config-processor/tasks/add-localhost.yml
    - include: roles/config-processor/tasks/configure.yml
      vars:
        config_processor: "{{ config_processor_runtime }}"

- hosts: localhost
  connection: local
  roles:
    - git-operations
  tasks:
    - include: roles/git-operations/tasks/save-cp-output.yml
0707010012022E000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000003D00000000ardana-ansible-8.0+git.1540411858.7223b0a/connection_plugins07070100120230000081A40000000000000000000000015BD0D1D200004FBC000000FD0000000200000000000000000000004400000000ardana-ansible-8.0+git.1540411858.7223b0a/connection_plugins/ssh.py# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible.  If not, see <http://www.gnu.org/licenses/>.
#

import os
import re
import subprocess
import shlex
import pipes
import random
import select
import fcntl
import hmac
import pwd
import gettext
import pty
from hashlib import sha1
import ansible.constants as C
from ansible.callbacks import vvv
from ansible import errors
from ansible import utils


class Connection(object):
    ''' ssh based connections '''

    def __init__(self, runner, host, port, user, password, private_key_file, *args, **kwargs):
        self.runner = runner
        self.host = host
        self.ipv6 = ':' in self.host
        self.port = port
        self.user = str(user)
        self.password = password
        self.private_key_file = private_key_file
        self.HASHED_KEY_MAGIC = "|1|"
        self.has_pipelining = True

        # TODO: add pbrun, pfexec
        self.become_methods_supported=['sudo', 'su', 'pbrun']

        fcntl.lockf(self.runner.process_lockfile, fcntl.LOCK_EX)
        self.cp_dir = utils.prepare_writeable_dir('$HOME/.ansible/cp',mode=0700)
        fcntl.lockf(self.runner.process_lockfile, fcntl.LOCK_UN)

    def connect(self):
        ''' connect to the remote host '''

        vvv("ESTABLISH CONNECTION FOR USER: %s" % self.user, host=self.host)

        self.common_args = []
        extra_args = C.ANSIBLE_SSH_ARGS
        if extra_args is not None:
            # make sure there is no empty string added as this can produce weird errors
            self.common_args += [x.strip() for x in shlex.split(extra_args) if x.strip()]
        else:
            self.common_args += ["-o", "ControlMaster=auto",
                                 "-o", "ControlPersist=60s",
                                 "-o", "ControlPath=\"%s\"" % (C.ANSIBLE_SSH_CONTROL_PATH % dict(directory=self.cp_dir))]

        cp_in_use = False
        cp_path_set = False
        for arg in self.common_args:
            if "ControlPersist" in arg:
                cp_in_use = True
            if "ControlPath" in arg:
                cp_path_set = True

        if cp_in_use and not cp_path_set:
            self.common_args += ["-o", "ControlPath=\"%s\"" % (C.ANSIBLE_SSH_CONTROL_PATH % dict(directory=self.cp_dir))]

        if not C.HOST_KEY_CHECKING:
            self.common_args += ["-o", "StrictHostKeyChecking=no"]

        if self.port is not None:
            self.common_args += ["-o", "Port=%d" % (self.port)]
        if self.private_key_file is not None:
            self.common_args += ["-o", "IdentityFile=\"%s\"" % os.path.expanduser(self.private_key_file)]
        elif self.runner.private_key_file is not None:
            self.common_args += ["-o", "IdentityFile=\"%s\"" % os.path.expanduser(self.runner.private_key_file)]
        if not self.password:
            self.common_args += ["-o", "KbdInteractiveAuthentication=no",
                                 "-o", "PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey",
                                 "-o", "PasswordAuthentication=no"]
        if self.user != pwd.getpwuid(os.geteuid())[0]:
            self.common_args += ["-o", "User="+self.user]
        self.common_args += ["-o", "ConnectTimeout=%d" % self.runner.timeout]

        return self

    def _run(self, cmd, indata):
        if indata:
            # do not use pseudo-pty
            p = subprocess.Popen(cmd, stdin=subprocess.PIPE,
                                     stdout=subprocess.PIPE, stderr=subprocess.PIPE)
            stdin = p.stdin
        else:
            # try to use upseudo-pty
            try:
                # Make sure stdin is a proper (pseudo) pty to avoid: tcgetattr errors
                master, slave = pty.openpty()
                p = subprocess.Popen(cmd, stdin=slave,
                                     stdout=subprocess.PIPE, stderr=subprocess.PIPE)
                stdin = os.fdopen(master, 'w', 0)
                os.close(slave)
            except:
                p = subprocess.Popen(cmd, stdin=subprocess.PIPE,
                                     stdout=subprocess.PIPE, stderr=subprocess.PIPE)
                stdin = p.stdin

        return (p, stdin)

    def _password_cmd(self):
        if self.password:
            try:
                p = subprocess.Popen(["sshpass"], stdin=subprocess.PIPE,
                    stdout=subprocess.PIPE, stderr=subprocess.PIPE)
                p.communicate()
            except OSError:
                raise errors.AnsibleError("to use the 'ssh' connection type with passwords, you must install the sshpass program")
            (self.rfd, self.wfd) = os.pipe()
            return ["sshpass", "-d%d" % self.rfd]
        return []

    def _send_password(self):
        if self.password:
            os.close(self.rfd)
            os.write(self.wfd, "%s\n" % self.password)
            os.close(self.wfd)

    def _communicate(self, p, stdin, indata, sudoable=False, prompt=None):
        fcntl.fcntl(p.stdout, fcntl.F_SETFL, fcntl.fcntl(p.stdout, fcntl.F_GETFL) & ~os.O_NONBLOCK)
        fcntl.fcntl(p.stderr, fcntl.F_SETFL, fcntl.fcntl(p.stderr, fcntl.F_GETFL) & ~os.O_NONBLOCK)
        # We can't use p.communicate here because the ControlMaster may have stdout open as well
        stdout = ''
        stderr = ''
        rpipes = [p.stdout, p.stderr]
        timeout = 1
        if indata:
            try:
                stdin.write(indata)
                stdin.close()
            except:
                raise errors.AnsibleError('SSH Error: data could not be sent to the remote host. Make sure this host can be reached over ssh')
        # Read stdout/stderr from process
        while True:
            rfd, wfd, efd = select.select(rpipes, [], rpipes, timeout)

            # fail early if the become password is wrong
            if self.runner.become and sudoable:
                incorrect_password = gettext.dgettext(self.runner.become_method, C.BECOME_ERROR_STRINGS[self.runner.become_method])

                if prompt:
                    if self.runner.become_pass:
                        if stdout.endswith("%s\r\n%s" % (incorrect_password, prompt)):
                            raise errors.AnsibleError('Incorrect become password')

                    if stdout.endswith(prompt):
                        raise errors.AnsibleError('Missing become password')
                    elif stdout.endswith("%s\r\n%s" % (incorrect_password, prompt)):
                        raise errors.AnsibleError('Incorrect become password')

            if p.stdout in rfd:
                dat = os.read(p.stdout.fileno(), 9000)
                stdout += dat
                if dat == '':
                    rpipes.remove(p.stdout)
            if p.stderr in rfd:
                dat = os.read(p.stderr.fileno(), 9000)
                stderr += dat
                if dat == '':
                    rpipes.remove(p.stderr)

            # Has the child process exited? If it has,
            # and we've read all available output from it, we're done.

            if p.poll() is not None:
                if not rpipes or timeout == 0:
                    break

                # When ssh has ControlMaster (+ControlPath/Persist) enabled, the
                # first connection goes into the background and we never see EOF
                # on stderr. If we see EOF on stdout and the process has exited,
                # we're probably done. We call select again with a zero timeout,
                # just to make certain we don't miss anything that may have been
                # written to stderr between the time we called select() and when
                # we learned that the process had finished.

                if p.stdout not in rpipes:
                    timeout = 0
                    continue

            # If the process has not yet exited, but we've already read EOF from
            # its stdout and stderr (and thus removed both from rpipes), we can
            # just wait for it to exit.

            elif not rpipes:
                p.wait()
                break

            # Otherwise there may still be outstanding data to read.

        # close stdin after process is terminated and stdout/stderr are read
        # completely (see also issue #848)
        stdin.close()
        return (p.returncode, stdout, stderr)

    def not_in_host_file(self, host):
        if 'USER' in os.environ:
            user_host_file = os.path.expandvars("~${USER}/.ssh/known_hosts")
        else:
            user_host_file = "~/.ssh/known_hosts"
        user_host_file = os.path.expanduser(user_host_file)
        
        host_file_list = []
        host_file_list.append(user_host_file)
        host_file_list.append("/etc/ssh/ssh_known_hosts")
        host_file_list.append("/etc/ssh/ssh_known_hosts2")
        
        hfiles_not_found = 0
        for hf in host_file_list:
            if not os.path.exists(hf):
                hfiles_not_found += 1
                continue
            try:
                host_fh = open(hf)
            except IOError, e:
                hfiles_not_found += 1
                continue
            else:
                data = host_fh.read()
                host_fh.close()
                
            for line in data.split("\n"):
                line = line.strip()
                if line is None or " " not in line:
                    continue
                tokens = line.split()
                if not tokens:
                    continue
                if tokens[0].find(self.HASHED_KEY_MAGIC) == 0:
                    # this is a hashed known host entry
                    try:
                        (kn_salt,kn_host) = tokens[0][len(self.HASHED_KEY_MAGIC):].split("|",2)
                        hash = hmac.new(kn_salt.decode('base64'), digestmod=sha1)
                        hash.update(host)
                        if hash.digest() == kn_host.decode('base64'):
                            return False
                    except:
                        # invalid hashed host key, skip it
                        continue
                else:
                    # standard host file entry
                    if host in tokens[0]:
                        return False

        if (hfiles_not_found == len(host_file_list)):
            vvv("EXEC previous known host file not found for %s" % host)
        return True

    def exec_command(self, cmd, tmp_path, become_user=None, sudoable=False, executable='/bin/sh', in_data=None):
        ''' run a command on the remote host '''

        if sudoable and self.runner.become and self.runner.become_method not in self.become_methods_supported:
            raise errors.AnsibleError("Internal Error: this module does not support running commands via %s" % self.runner.become_method)

        ssh_cmd = self._password_cmd()
        ssh_cmd += ["ssh", "-C"]
        if not in_data:
            # we can only use tty when we are not pipelining the modules. piping data into /usr/bin/python
            # inside a tty automatically invokes the python interactive-mode but the modules are not
            # compatible with the interactive-mode ("unexpected indent" mainly because of empty lines)
            ssh_cmd += ["-tt"]
        if utils.VERBOSITY > 3:
            ssh_cmd += ["-vvv"]
        else:
            if self.runner.module_name == 'raw':
                ssh_cmd += ["-q"]
            else:
                ssh_cmd += ["-v"]
        ssh_cmd += self.common_args

        if self.ipv6:
            ssh_cmd += ['-6']
        ssh_cmd += [self.host]

        if self.runner.become and sudoable:
            becomecmd, prompt, success_key = utils.make_become_cmd(cmd, become_user, executable, self.runner.become_method, '', self.runner.become_exe)
            ssh_cmd.append(becomecmd)
        else:
            prompt = None
            if executable:
                ssh_cmd.append(executable + ' -c ' + pipes.quote(cmd))
            else:
                ssh_cmd.append(cmd)

        vvv("EXEC %s" % ' '.join(ssh_cmd), host=self.host)

        not_in_host_file = self.not_in_host_file(self.host)

        if C.HOST_KEY_CHECKING and not_in_host_file:
            # lock around the initial SSH connectivity so the user prompt about whether to add
            # the host to known hosts is not intermingled with multiprocess output.
            fcntl.lockf(self.runner.process_lockfile, fcntl.LOCK_EX)
            fcntl.lockf(self.runner.output_lockfile, fcntl.LOCK_EX)

        # create process
        (p, stdin) = self._run(ssh_cmd, in_data)

        self._send_password()

        no_prompt_out = ''
        no_prompt_err = ''
        if sudoable and self.runner.become and self.runner.become_pass:
            # several cases are handled for escalated privileges with password
            # * NOPASSWD (tty & no-tty): detect success_key on stdout
            # * without NOPASSWD:
            #   * detect prompt on stdout (tty)
            #   * detect prompt on stderr (no-tty)
            fcntl.fcntl(p.stdout, fcntl.F_SETFL,
                        fcntl.fcntl(p.stdout, fcntl.F_GETFL) | os.O_NONBLOCK)
            fcntl.fcntl(p.stderr, fcntl.F_SETFL,
                        fcntl.fcntl(p.stderr, fcntl.F_GETFL) | os.O_NONBLOCK)
            become_output = ''
            become_errput = ''

            while True:
                if success_key in become_output or \
                    (prompt and become_output.endswith(prompt)) or \
                    utils.su_prompts.check_su_prompt(become_output):
                    break

                rfd, wfd, efd = select.select([p.stdout, p.stderr], [],
                                              [p.stdout], self.runner.timeout)
                if p.stderr in rfd:
                    chunk = p.stderr.read()
                    if not chunk:
                        raise errors.AnsibleError('ssh connection closed waiting for a privilege escalation password prompt')
                    become_errput += chunk
                    incorrect_password = gettext.dgettext(
                        "become", "Sorry, try again.")
                    if become_errput.strip().endswith("%s%s" % (prompt, incorrect_password)):
                        raise errors.AnsibleError('Incorrect become password')
                    elif prompt and become_errput.endswith(prompt):
                        stdin.write(self.runner.become_pass + '\n')

                if p.stdout in rfd:
                    chunk = p.stdout.read()
                    if not chunk:
                        raise errors.AnsibleError('ssh connection closed waiting for %s password prompt' % self.runner.become_method)
                    become_output += chunk

                if not rfd:
                    # timeout. wrap up process communication
                    stdout = p.communicate()
                    raise errors.AnsibleError('ssh connection error while waiting for %s password prompt' % self.runner.become_method)

            if success_key in become_output:
                no_prompt_out += become_output
                no_prompt_err += become_errput
            elif sudoable:
                stdin.write(self.runner.become_pass + '\n')

        (returncode, stdout, stderr) = self._communicate(p, stdin, in_data, sudoable=sudoable, prompt=prompt)

        if C.HOST_KEY_CHECKING and not_in_host_file:
            # lock around the initial SSH connectivity so the user prompt about whether to add 
            # the host to known hosts is not intermingled with multiprocess output.
            fcntl.lockf(self.runner.output_lockfile, fcntl.LOCK_UN)
            fcntl.lockf(self.runner.process_lockfile, fcntl.LOCK_UN)
        controlpersisterror = 'Bad configuration option: ControlPersist' in stderr or \
                              'unknown configuration option: ControlPersist' in stderr

        if C.HOST_KEY_CHECKING:
            if ssh_cmd[0] == "sshpass" and p.returncode == 6:
                raise errors.AnsibleError('Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this.  Please add this host\'s fingerprint to your known_hosts file to manage this host.')

        if p.returncode != 0 and controlpersisterror:
            raise errors.AnsibleError('using -c ssh on certain older ssh versions may not support ControlPersist, set ANSIBLE_SSH_ARGS="" (or ssh_args in [ssh_connection] section of the config file) before running again')
        if p.returncode == 255 and (in_data or self.runner.module_name == 'raw'):
            raise errors.AnsibleError('SSH Error: data could not be sent to the remote host. Make sure this host can be reached over ssh')
        if p.returncode == 255:
            ip = None
            port = None
            for line in stderr.splitlines():
                match = re.search(
                    'Connecting to .*\[(\d+\.\d+\.\d+\.\d+)\] port (\d+)',
                    line)
                if match:
                    ip = match.group(1)
                    port = match.group(2)
            if 'UNPROTECTED PRIVATE KEY FILE' in stderr:
                lines = [line for line in stderr.splitlines()
                         if 'ignore key:' in line]
            else:
                lines = stderr.splitlines()[-1:]
            if ip and port:
                lines.append('    while connecting to %s:%s' % (ip, port))
            lines.append(
                'It is sometimes useful to re-run the command using -vvvv, '
                'which prints SSH debug output to help diagnose the issue.')
            raise errors.AnsibleError('SSH Error: %s' % '\n'.join(lines))

        return (p.returncode, '', no_prompt_out + stdout, no_prompt_err + stderr)

    def put_file(self, in_path, out_path):
        ''' transfer a file from local to remote '''
        vvv("PUT %s TO %s" % (in_path, out_path), host=self.host)
        if not os.path.exists(in_path):
            raise errors.AnsibleFileNotFound("file or module does not exist: %s" % in_path)
        cmd = self._password_cmd()

        host = self.host
        if self.ipv6:
            host = '[%s]' % host

        if C.DEFAULT_SCP_IF_SSH:
            cmd += ["scp"] + self.common_args
            cmd += [in_path,host + ":" + pipes.quote(out_path)]
            indata = None
        else:
            cmd += ["sftp"] + self.common_args + [host]
            indata = "put %s %s\n" % (pipes.quote(in_path), pipes.quote(out_path))

        (p, stdin) = self._run(cmd, indata)

        self._send_password()

        (returncode, stdout, stderr) = self._communicate(p, stdin, indata)

        if returncode != 0:
            raise errors.AnsibleError("failed to transfer file to %s:\n%s\n%s" % (out_path, stdout, stderr))

    def fetch_file(self, in_path, out_path):
        ''' fetch a file from remote to local '''
        vvv("FETCH %s TO %s" % (in_path, out_path), host=self.host)
        cmd = self._password_cmd()

        host = self.host
        if self.ipv6:
            host = '[%s]' % host

        if C.DEFAULT_SCP_IF_SSH:
            cmd += ["scp"] + self.common_args
            cmd += [host + ":" + in_path, out_path]
            indata = None
        else:
            cmd += ["sftp"] + self.common_args + [host]
            indata = "get %s %s\n" % (in_path, out_path)

        p = subprocess.Popen(cmd, stdin=subprocess.PIPE,
                             stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        self._send_password()
        stdout, stderr = p.communicate(indata)

        if p.returncode != 0:
            raise errors.AnsibleError("failed to transfer file from %s:\n%s\n%s" % (in_path, stdout, stderr))

    def close(self):
        ''' not applicable since we're executing openssh binaries '''
        pass

0707010012021B000081A40000000000000000000000015BD0D1D200000629000000FD0000000200000000000000000000003D00000000ardana-ansible-8.0+git.1540411858.7223b0a/dayzero-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.
#
---
# Install Day Zero UI and run it
# Skip if dayzero has been previously installed as dayzero is only used
# for first-time deploy. This playbook will be invoked as part of an
# upgrade.

- hosts: localhost
  connection: local
  tasks:
  - name: Check if dayzero already installed
    stat:
      path: "{{ 'dayzero' | venv_dir }}"
    register: dayzero_venv_dir

- hosts: localhost
  connection: local
  roles:
    - dayzero
  tasks:
    - include: roles/dayzero/tasks/configure.yml
      when: not dayzero_venv_dir.stat.exists
    - include: roles/dayzero/tasks/install.yml
      when: not dayzero_venv_dir.stat.exists
    - include: roles/dayzero/tasks/stop.yml
      when: not dayzero_venv_dir.stat.exists

# Splitting into two plays to ensure restart handler is caught.
- hosts: localhost
  connection: local
  roles:
    - dayzero
  tasks:
    - include: roles/dayzero/tasks/start.yml
      when: not dayzero_venv_dir.stat.exists
07070100120430000081A40000000000000000000000015BD0D1D20000081B000000FD0000000200000000000000000000004300000000ardana-ansible-8.0+git.1540411858.7223b0a/dayzero-os-provision.yml#
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
##############################################################################
#
# This playbook deploys the OS to the specified nodes for the DayZero OS
# install page
#
# Options:
#    -e failed_nodes=<comma-separated list of hosts>
#         removes systems from cobbler
#
#    -e nodelist=<comma-separated list of hosts>
#         provisions systems with an OS
#
##############################################################################
---
- include: pbstart.yml
  vars:
    playbook_name: "dayzero-os-provision.yml"

- hosts: localhost
  tasks:
    - name: install-os | ready | Get failed node list
      set_fact: nodes="{{ failed_nodes | split(',') }}"
      when: failed_nodes is defined

    - name: install-os | ready | Remove failed nodes
      become: yes
      command: cobbler system remove --name="{{item}}"
      ignore_errors: yes
      with_items: nodes
      when: nodes is defined

- include: bm-power-status.yml

# cobbler-deploy has the potential to remove user customizations to
# kickstart/autoyast files.  This will also wipe the grub.cfg files.
# TODO: Optimize cobbler-deploy to not remove customer customizations
- include: cobbler-deploy.yml

# Handle cases where SLES is being provisioned onto boxes with UEFI
# boot mode enabled.  This adds the necessary grub.cfg files and should 
# work with both UEFI and non-UEFI
- include: prepare-sles-grub2.yml

- include: bm-reimage.yml

- include: pbfinish.yml
  vars:
    playbook_name: "dayzero-os-provision.yml"
070701001203F2000081A40000000000000000000000015BD0D1D2000004E9000000FD0000000200000000000000000000004500000000ardana-ansible-8.0+git.1540411858.7223b0a/dayzero-pre-deployment.yml#
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
##############################################################################
#
# This playbook runs both config-processor-run.yml and ready-deployment.yml
# playbook in one operation for the Day0 cloud deployment page.
#
##############################################################################
---
- include: pbstart.yml
  vars:
    playbook_name: "config-processor-run.yml"

- include: config-processor-run.yml

- include: pbfinish.yml
  vars:
    playbook_name: "config-processor-run.yml"

- include: pbstart.yml
  vars:
    playbook_name: "ready-deployment.yml"

- include: ready-deployment.yml

- include: pbfinish.yml
  vars:
    playbook_name: "ready-deployment.yml"
07070100120437000081A40000000000000000000000015BD0D1D200000312000000FD0000000200000000000000000000003B00000000ardana-ansible-8.0+git.1540411858.7223b0a/dayzero-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: localhost
  connection: local
  roles:
    - dayzero
  tasks:
    - include: roles/dayzero/tasks/stop.yml
      when: not keep_dayzero07070100120221000081A40000000000000000000000015BD0D1D20000042A000000FD0000000200000000000000000000004400000000ardana-ansible-8.0+git.1540411858.7223b0a/dayzero-wipe-and-site.yml#
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
##############################################################################
#
# This playbook runs both wipe_disks.yml and site.yml playbook in one operation
# for the Day0 cloud deployment page.
#
##############################################################################
---
- include: pbstart.yml
  vars:
    playbook_name: "dayzero-wipe-and-site.yml"

- include: wipe_disks.yml
- include: site.yml

- include: pbfinish.yml
  vars:
    playbook_name: "dayzero-wipe-and-site.yml"

0707010012043A000081A40000000000000000000000015BD0D1D200001106000000FD0000000200000000000000000000003C00000000ardana-ansible-8.0+git.1540411858.7223b0a/deployer-init.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.
#
---
# Install and configure apache2 for venv and install ardana-input-model
- hosts: localhost
  connection: local
  roles:
    - cobbler
    - FND-AP2
    - package-consumer # Needed for PACKAGE_CONSTANTS details
  tasks:
    # Deploy Apache
    - include: roles/FND-AP2/tasks/install.yml
    - include: roles/FND-AP2/tasks/configure.yml
      vars:
        host:
          vars:
        FND_AP2_sites_enabled:
          deployer_venv_server.conf:
            listen: "*"
            port: "{{ deployer_server_port }}"
            document_root: "{{ PACKAGE_CONSTANTS.REPO_DIR }}"
            additional_dirs:
              SUSE-12-3: /srv/www/suse-12.3

# Start depends on a notification from above,
# split it out to make sure the handler fires first
- hosts: localhost
  connection: local
  gather_facts: no
  roles:
    - FND-AP2
  tasks:
    - include: roles/FND-AP2/tasks/start.yml

- hosts: localhost
  connection: local
  roles:
    - deployer-setup
    - osconfig
    - thirdparty-repo
  tasks:
    - include_vars: roles/deployer-setup/defaults/ardana_tar_locations.yml
    - include: roles/deployer-setup/tasks/install.yml
    - include: roles/deployer-setup/tasks/install-isos-legacy.yml
      when: deployer_media_legacy_layout|bool
    - include: roles/deployer-setup/tasks/install-isos-product.yml
    - include: roles/deployer-setup/tasks/install-isos-rhel.yml
    - include: roles/deployer-setup/tasks/configure-smt.yml
    - include: roles/deployer-setup/tasks/configure-bash.yml
    - include: roles/deployer-setup/tasks/init-third-party.yml
    - include: roles/deployer-setup/tasks/create-ptf-signing-key.yml
    - include: roles/deployer-setup/tasks/install-cloud-ptf-repo.yml
    - include: roles/osconfig/tasks/get-ptf-signing-key.yml
    - include: roles/deployer-setup/tasks/install-sles-support.yml
    - include: roles/osconfig/tasks/check-for-zypp-repo.yml
      when: ansible_os_family | lower | search('suse')
    - include: roles/osconfig/tasks/setup-zypp.yml
      vars:
          zypp_server: "dir:{{ PACKAGE_CONSTANTS.REPO_DIR }}"
          zypp_server_http: "http://localhost:79"
      when: ansible_os_family | lower | search('suse')

# Install contents of repos
- hosts: localhost
  connection: local
  gather_facts: no
  roles:
    - cobbler
    - deployer-setup
  tasks:
    - include: roles/deployer-setup/tasks/install-my-cloud-directory.yml
    - include: roles/deployer-setup/tasks/install-input-model-contents-legacy.yml
      when: deployer_media_legacy_layout|bool
    - include: roles/deployer-setup/tasks/install-input-model-contents.yml
      when: deployer_media_legacy_layout|bool == false
    - include: roles/deployer-setup/tasks/install-venv-contents.yml
    - include: roles/deployer-setup/tasks/install-rhel-support.yml

# Install & configure venv application
- hosts: localhost
  connection: local
  gather_facts: no
  roles:
    - cobbler
    - package-repo
    - package-consumer
  tasks:
    - include: roles/package-repo/tasks/install.yml
      when: deployer_media_legacy_layout|bool
    - include: roles/package-repo/tasks/configure.yml
    - include: roles/package-consumer/tasks/install.yml
    - include: roles/package-consumer/tasks/configure.yml
      vars:
       host:
         vars:
       is_deployer: true

# Install config processor
- hosts: localhost
  connection: local
  gather_facts: no
  roles:
    - config-processor
  tasks:
    - include: roles/config-processor/tasks/install.yml

# Deploy third-party import mechanism
- include: third-party-deploy.yml

# Install and run Day Zero UI
- include: installui-deploy.yml

# Install and run ardana-service, for which Day Zero UI is dependent on
- include: ardana-service-deploy.yml
07070100120229000081A40000000000000000000000015BD0D1D200000337000000FD0000000200000000000000000000003E00000000ardana-ansible-8.0+git.1540411858.7223b0a/deployer-status.yml#
# (c) Copyright 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.
#
# Check if zypper configuration is broken
---
- hosts: localhost
  connection: local
  roles:
    - osconfig
  tasks:
    - include: roles/osconfig/tasks/check-product-status.yml
07070100120431000081A40000000000000000000000015BD0D1D20000054E000000FD0000000200000000000000000000003A00000000ardana-ansible-8.0+git.1540411858.7223b0a/distro-list.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: localhost
  connection: local
  roles:
    - third-party
    - thirdparty-venv
  tasks:
    - name: disto-list | Check what distros are currently deployed
      stat:
        path: "{{ item.value }}/packages"
      register: stat_result
      with_dict: pkg_locs

    - name: distro-list | Get list of distros used across cluster
      set_fact:
        distro: "{{ item.item.key }}"
      register: distro_list_result
      with_items: "{{ stat_result.results | selectattr('stat.inode', 'defined')  | list }}"

    - name: distro-list | Set distro_list fact
      set_fact:
        distro_list: >
          {{ distro_list_result.results |
            map(attribute='ansible_facts.distro') | list | unique }}
07070100120231000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000003900000000ardana-ansible-8.0+git.1540411858.7223b0a/filter_plugins07070100120232000081A40000000000000000000000015BD0D1D2000004C9000000FD0000000200000000000000000000005600000000ardana-ansible-8.0+git.1540411858.7223b0a/filter_plugins/cluster_consistency_check.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.
#
# This filter allows a user to get the control plane names as a set for the
# current play hosts. if host details do not exit in hostvar we skip the
# entry. For example this would be skipped for localhost
#

def cluster_consistency_check(hosts, hostvars):
    control_plane_names = {
        hostvars[host]['host']['my_dimensions']['control_plane']
        for host in hosts
        if 'host' in hostvars[host]
        }

    return list(control_plane_names)


class FilterModule(object):

    def filters(self):
        return {'cluster_consistency_check': cluster_consistency_check}
07070100120243000081A40000000000000000000000015BD0D1D20000036A000000FD0000000200000000000000000000004C00000000ardana-ansible-8.0+git.1540411858.7223b0a/filter_plugins/dict_operations.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.
#


def _values(item):
    return item.values()


def test():
    pass


class FilterModule(object):
    def filters(self):
        test()
        return {
            'values': _values,
        }


if __name__ == "__main__":
    test()
07070100120234000081A40000000000000000000000015BD0D1D200000D7E000000FD0000000200000000000000000000004100000000ardana-ansible-8.0+git.1540411858.7223b0a/filter_plugins/item.py#
# (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.
#
import jinja2.runtime as jrt


def _split_refs(refs):
    # ["a.b[0][1]", "c"] => ["a", "b[0][1]", c"]
    refs = reduce(lambda acc, i: acc + i.split('.'), refs, [])

    def split_indexes(acc, item):
        # "b[0][1]" => ["b", "0", "1"]
        p = item.partition('[')
        if len(p[1]) == 0:
            return acc + [item]
        return (acc + [p[0]] + p[2][:-1].split(']['))
    refs = reduce(split_indexes, refs, [])

    return refs


def item(root, *refs, **kwargs):
    """Complement to attr."""
    default = kwargs.get('d', jrt.StrictUndefined())
    default = kwargs.get('default', default)

    for ref in _split_refs(refs):
        try:
            if type(root) is list and ref.isdigit():
                ref = int(ref)
            try:
                root = root[ref]
            except KeyError:
                if not ref.isdigit():
                    raise
                root = root[int(ref)]
        except (KeyError, jrt.UndefinedError, IndexError):
            return default
    if isinstance(root, jrt.Undefined):
        return default
    return root


def by_item(array, path, value):
    if isinstance(array, jrt.Undefined):
        return []

    return [x for x in array
            if item(x, path, default=jrt.Undefined) == value]


def test_item():
    data = {'a': {'b': {'c': 111}}}
    assert item(data, 'a', 'b', 'c') is 111
    assert item(data, 'a.b', 'c') is 111
    assert item(data, 'a', 'b.c') is 111
    assert item(data, 'a.b.c') is 111

    assert isinstance(item(data, 'x', 'b'), jrt.Undefined)
    assert item(data, 'x', 'b', default=999) is 999
    assert item(data, 'a', 'x', default=999) is 999
    assert item(data, 'x', d=999) is 999
    assert item(data, 'x', d=None) is None

    data = {'a': [{'b': 111}, [222]]}
    assert item(data, 'a[0].b') is 111
    assert item(data, 'a.0.b') is 111
    assert item(data, 'a.0.1', d=999) is 999
    assert item(data, 'a[1][0]') is 222
    assert item(data, 'a.1.0') is 222
    assert item({'0': 111}, '0') is 111
    assert item({0: 111}, '0') is 111

    undef = jrt.StrictUndefined()
    assert item(undef, d=999) is 999
    assert item(undef, 'x', d=999) is 999
    assert item({'a': undef}, 'a', d=999) is 999


def test_by_item():
    data = [{'con': {'env': 'home'}, 'mount': '/var/lib/rabbitmq'},
            {'con': {'env': 'device'}, 'dev': '/dev/sda1'}]
    assert by_item(data, 'con.env', 'home') == [data[0]]
    assert by_item(data, 'con.env', 'device') == [data[1]]
    assert by_item(data, 'con.env', 'invalid') == []
    assert by_item(data, 'con.invalid', 'invaid') == []


class FilterModule(object):
    def filters(self):
        test_item()
        return {
            'item': item,
            'by_item': by_item
        }


if __name__ == "__main__":
    test_item()
    test_by_item()
07070100120240000081A40000000000000000000000015BD0D1D20000062F000000FD0000000200000000000000000000005C00000000ardana-ansible-8.0+git.1540411858.7223b0a/filter_plugins/openstack_user_password_decrypt.py#
# (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.
#

import imp
import os.path


path = os.path.dirname(os.path.realpath(__file__))

ardanaencrypt = imp.load_source('ardanaencrypt', path + '/../ardanaencrypt.py')

encryption_class = 'openssl'

ardanaencrypt_class = getattr(ardanaencrypt, encryption_class)


def openstack_user_password_decrypt(value, *args, **kw):
    prefix = None
    if value.startswith(ardanaencrypt_class.prefix):
        prefix = ardanaencrypt_class.prefix
    # For upgrade cases, need to support existing encrypted values which may
    # have legacy prefix in-use.
    elif value.startswith(ardanaencrypt_class.legacy_prefix):
        prefix = ardanaencrypt_class.legacy_prefix

    if prefix is None:
        return value
    else:
        obj = ardanaencrypt_class()
        return obj.decrypt(value[len(prefix):])


class FilterModule(object):
    def filters(self):
        return {'openstack_user_password_decrypt':
                openstack_user_password_decrypt}
07070100120237000081A40000000000000000000000015BD0D1D200000A46000000FD0000000200000000000000000000005C00000000ardana-ansible-8.0+git.1540411858.7223b0a/filter_plugins/openstack_user_password_encrypt.py#
# (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.
#

import imp
import os.path


path = os.path.dirname(os.path.realpath(__file__))

ardana_encrypt = imp.load_source(
    'ardanaencrypt', path + '/../ardanaencrypt.py')

encryption_class = 'openssl'

ardanaencrypt_class = getattr(ardana_encrypt, encryption_class)

ENCRYPT_KEY_NAME = 'ARDANA_USER_PASSWORD_ENCRYPT_KEY'
LEGACY_KEY_NAME = 'HOS_USER_PASSWORD_ENCRYPT_KEY'


def openstack_user_password_encrypt(value, key=None, *args, **kw):
    # If a key is supplied to the filter, use it. Make sure
    # we stash any existing key value in the environment,
    # as os.environ() changes will persist.
    key_stash = None

    def _get_legacy_value():
        if LEGACY_KEY_NAME in os.environ:
            value = os.environ[LEGACY_KEY_NAME]
            del os.environ[LEGACY_KEY_NAME]
            return value

    def _backup_env_key():
        legacy_value = _get_legacy_value()
        if legacy_value or legacy_value == "":
            key_stash = legacy_value
        elif ENCRYPT_KEY_NAME in os.environ:
            key_stash = os.environ(ENCRYPT_KEY_NAME)
        os.environ[ENCRYPT_KEY_NAME] = key

    def _restore_env_key():
        # Restore the stashed key
        if key_stash is None:
            if LEGACY_KEY_NAME in os.environ:
                del os.environ[LEGACY_KEY_NAME]
            del os.environ[ENCRYPT_KEY_NAME]
        else:
            os.environ[ENCRYPT_KEY_NAME] = key_stash

    if key is not None:
        _backup_env_key()

    if (ENCRYPT_KEY_NAME not in os.environ and
            LEGACY_KEY_NAME not in os.environ):
        return value

    if (os.environ[ENCRYPT_KEY_NAME] is None
            or os.environ[ENCRYPT_KEY_NAME] == ""):
        _restore_env_key()
        return value

    obj = ardanaencrypt_class()
    result = obj.prefix + obj.encrypt(value)

    _restore_env_key()

    return result


class FilterModule(object):
    def filters(self):
        return {'openstack_user_password_encrypt':
                openstack_user_password_encrypt}
0707010012023D000081A40000000000000000000000015BD0D1D2000003D0000000FD0000000200000000000000000000004300000000ardana-ansible-8.0+git.1540411858.7223b0a/filter_plugins/ospath.py#
# (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.
#
# Jinja2 filter to determine if a directory exists

import os


def isdir(directory, path=""):
    return os.path.isdir(os.path.join(path, directory))


class FilterModule(object):

    def filters(self):
        return {
            'isdir': isdir,
            'abspath': os.path.abspath,
            'joinpath': os.path.join
        }
07070100120239000081A40000000000000000000000015BD0D1D20000055E000000FD0000000200000000000000000000005600000000ardana-ansible-8.0+git.1540411858.7223b0a/filter_plugins/package_consistency_check.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.
#
# This filter allows a user to test a set of packages are identical across
# a set of hosts.
#
from collections import defaultdict


def package_consistency_check(hosts, hostvars, result_attr):
    versions = defaultdict(lambda: defaultdict(list))
    for host in hosts:
        for item in hostvars[host].get(result_attr, {}).get('results', []):
            package = item.get('item', {}).get('package')
            version = item.get('stdout')
            if package is not None:
                versions[package][version].append(host)

    return {package: dict(versions[package]) for package in versions}


class FilterModule(object):

    def filters(self):
        return {'package_consistency_check': package_consistency_check}
07070100120241000081A40000000000000000000000015BD0D1D200001B2C000000FD0000000200000000000000000000004D00000000ardana-ansible-8.0+git.1540411858.7223b0a/filter_plugins/packager_filters.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.
#
# Load a "packages" manifest from a directory; cache these
# by default.

# Given such a dictionary, locate the latest version of a
# named package.


import six
import yaml

# J2 expressions are repeatedly re-evaluated.
# Often, we want to access a fixed file on disk.
# So, we cache results on a per-directory basis.

_packages = {}


def load_packages(manifest_loc, cached=True):
    if cached and manifest_loc in _packages:
        return _packages[manifest_loc]

    try:
        with open(manifest_loc) as f:
            manifest = yaml.safe_load(f)
    except IOError:
        # The file might turn up later - don't cache this result.
        return None

    if cached:
        _packages[manifest_loc] = manifest

    return manifest


def parse_version(v_str):
    """Convert a string representation of a version into a comparable tuple"""

    return [[int(n) if n.isdigit() else n for n in p.split('.')]
            for p in v_str.split(':')]


def package_max_version(manifest, package):
    packages = manifest['packages']
    if package in packages:
        return max(packages[package], key=parse_version)


def package_max_unpatched_version(manifest, package):
    """Find the base version of the latest unpatched venv"""
    packages = manifest['packages']
    if package in packages:
        max_version = None
        max_v_str = None
        for v in packages[package]:
            version = parse_version(v)
            # Unpatched version?
            if len(version) > 2:
                # Nope
                continue
            if max_version is not None and max_version > version:
                continue
            max_version = version
            max_v_str = v
        return max_v_str


def package_next_patch_number(manifest, package, base_v_str):
    """Find the next patch number available for a given venv

       This will be 1, if no patched version exists,
       1 more than the highest patch value if a patched version is
       found,
       and None if there is no venv that has the same upstream
       patch value as the base_version"""

    packages = manifest['packages']
    base_version = parse_version(base_v_str)

    if package in packages:
        max_version = None
        for v in packages[package]:
            version = parse_version(v)

            # Unpatched version?
            if len(version) <= 2:
                # Yes!
                # Check if this is the only matching version
                if max_version is None and version[:2] == base_version[:2]:
                    # If so, remember it
                    max_version = version
                continue

            # Upstream parts of the verison match?
            if version[:2] != base_version[:2]:
                continue  # Nope

            # Remember highest patch number
            if max_version is not None and max_version > version:
                continue
            max_version = version

        # Did we find any suitable version at all?
        if max_version is None:
            return None  # Nope

        # Did we find a patched version?
        if len(max_version) <= 2:
            return 1  # Nope

        # Return the next available patch number
        try:
            return max_version[2][0] + 1
        except TypeError:
            return 1


def package_get_details(manifest, package, v_str):
    """Return the manifest details for a given version of a package.

       This is just a dictionary access - however, we abstract it away
       behind this filter.
    """

    try:
        return manifest['packages'][package][v_str]
    except KeyError:
        return None


# Return a predictable path to the configuration directory
# or the binary directory for a service component.

# This relies on the service component being "activated" -
# that is, having an unversioned symlink in /opt/stack/service
# pointing to the current version.

# We might have an old string 'version' - which acts as a suffix -
# or a dictionary of .version, .suffix, .v=1

def suffix(version):
    if isinstance(version, six.string_types):
        return version

    # We have a structured return value.
    assert isinstance(version, dict)
    assert version['v'] == 1
    return version['suffix']


def venv_dir(component, version=None):
    if version is None:
        return ("/opt/stack/service/{component}/venv"
                .format(component=component))
    return ("/opt/stack/service/{component}-{suffix}/venv"
            .format(component=component, suffix=suffix(version)))


def config_dir(component, version=None):
    if version is None:
        return ("/opt/stack/service/{component}/etc"
                .format(component=component))
    return ("/opt/stack/service/{component}-{suffix}/etc"
            .format(component=component, suffix=suffix(version)))


def bin_dir(component, version=None):
    if version is None:
        return ("/opt/stack/service/{component}/venv/bin"
                .format(component=component))
    return ("/opt/stack/service/{component}-{suffix}/venv/bin"
            .format(component=component, suffix=suffix(version)))


def share_dir(component, version=None):
    if version is None:
        return ("/opt/stack/service/{component}/venv/share"
                .format(component=component))
    return ("/opt/stack/service/{component}-{suffix}/venv/share"
            .format(component=component, suffix=suffix(version)))


def jar_dir(component, version=None):
    if version is None:
        return ("/opt/stack/service/{component}/venv/lib"
                .format(component=component))
    return ("/opt/stack/service/{component}-{suffix}/venv/lib"
            .format(component=component, suffix=suffix(version)))


class FilterModule(object):

    def filters(self):
        return {'venv_dir': venv_dir,
                'config_dir': config_dir,
                'bin_dir': bin_dir,
                'share_dir': share_dir,
                'jar_dir': jar_dir,
                'load_packages': load_packages,
                'package_max_version': package_max_version,
                'package_max_unpatched_version': package_max_unpatched_version,
                'package_next_patch_number': package_next_patch_number,
                'package_get_details': package_get_details,
                }
07070100120235000081A40000000000000000000000015BD0D1D200000475000000FD0000000200000000000000000000004F00000000ardana-ansible-8.0+git.1540411858.7223b0a/filter_plugins/pkg_upgrade_filter.py#
# (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.
#

# Given two dictionaries of packages with versions, return a new dict
# containing the set of packages where there is a version difference
# in the two provided sets. Packages not in common between the two sets
# are ignored.


def upgraded_pkgs(before_pkgs, after_pkgs):
  return {k:after_pkgs[k] for k in after_pkgs if\
  (k in before_pkgs and before_pkgs[k]["Version"]!=after_pkgs[k]["Version"])}

class FilterModule(object):

    def filters(self):
        return {'upgraded_pkgs': upgraded_pkgs}
07070100120242000081A40000000000000000000000015BD0D1D2000008C7000000FD0000000200000000000000000000005100000000ardana-ansible-8.0+git.1540411858.7223b0a/filter_plugins/provided_data_filter.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.
#
import jinja2.runtime as jrt


#
# provided_data filter:
#
# Sample usage:
# Return the list of 'mechanism_drivers' parameters provided to the
# neutron-ml2-plugin (NEU-ML2) service.
#
#    {{ NEU_ML2 | provided_data('mechanism_drivers') }}
#
def provided_data(grp, option, default=[]):
    value_list = []
    try:
        for pd in grp.get('provided_data', []):
            for pdd in pd.get('data', []):
                if pdd.get('option', '') == option:
                    value_list.extend(pdd.get('values', []))
    except (jrt.UndefinedError, AttributeError):
        return default
    return value_list


def test_provided_data():
    input = {'provided_data': [{'data': [{'option': 'pet',
                                          'values': ['dog', 'cat']},
                                         {'option': 'flowers',
                                          'values': ['iris']}],
                                'provided_by': 'SVC1'},
                               {'data': [{'option': 'pet',
                                          'values': ['turtle']}],
                                'provided_by': 'SVC2'}]}

    expected = ['dog', 'cat', 'turtle']
    assert set(provided_data(input, 'pet')) == set(expected)
    assert provided_data(input, 'flowers') == ['iris']
    assert provided_data('string', 'pet') == []
    assert provided_data(
        'string', 'pet', default=['undefined']) == ['undefined']


class FilterModule(object):
    def filters(self):
        return {
            'provided_data': provided_data
        }


if __name__ == "__main__":
    test_provided_data()
0707010012023F000081A40000000000000000000000015BD0D1D200000508000000FD0000000200000000000000000000004300000000ardana-ansible-8.0+git.1540411858.7223b0a/filter_plugins/re_sub.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.
#

import re


def re_sub(string='', regex='', repl='', flags='', count=1):
    flags = flags.lower()
    re_flags = 0
    if 'u' in flags:
        re_flags |= re.UNICODE
    if 'x' in flags:
        re_flags |= re.VERBOSE
    if 'l' in flags:
        re_flags |= re.LOCALE
    if 'm' in flags:
        re_flags |= re.MULTILINE
    if 's' in flags:
        re_flags |= re.DOTALL
    if 'i' in flags:
        re_flags |= re.IGNORECASE
    if 'g' in flags:
        count = 0

    return re.sub(regex, repl, string, flags=re_flags, count=count)


class FilterModule(object):
    def filters(self):
        return {
            're_sub': re_sub
        }
0707010012023B000081A40000000000000000000000015BD0D1D200000475000000FD0000000200000000000000000000004800000000ardana-ansible-8.0+git.1540411858.7223b0a/filter_plugins/time_format.py#
# (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.
#

import time


# J2 expressions are repeatedly re-evaluated.
# Often, we want a single timestamp. So, we have a single
# default which is the time this filter gets initialised -
# that'll be fixed close to the time that ansible kicks off.
_time = time.gmtime()


def time_format(format, now=False):
    if now:
        return time.strftime(format, time.gmtime())

    return time.strftime(format, _time)


class FilterModule(object):

    def filters(self):
        return {'time_format': time_format}
07070100120233000081A40000000000000000000000015BD0D1D200001ABD000000FD0000000200000000000000000000004D00000000ardana-ansible-8.0+git.1540411858.7223b0a/filter_plugins/topology_filters.py#!/usr/bin/python
#
# (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.
#
"""
The topology is expressed via a group variable that looks like this:

  topology:
    control_planes:
      - name: ccp
        services:
          - name: keystone
            components:
              - name: keystone-api
                hosts:
                  - host1
                  - host2
                  - host3
          - name: foundation
            components:
              - name: mysql
                hosts:
                  - host1
                  - host2
                  - host3
      - name: rcp01
        services:
          - name: nova
            components:
              - name: nova-api
                hosts:
                  - host4
                  - host5
                  - host6
              - name: nova-scheduler
                hosts:
                  - host4
                  - host5
                  - host6


The following filters are provided for correct navigation of that structure:

topology_filter_control_planes: yields a set of (control-plane) named tuples
topology_filter_services: yields a set of (control-plane, service) named tuples
topology_filter_components: yields a set of (control-plane, service, service-element) named tuples
topology_filter_hosts: yields a set of (control-plane, service, service-element, host) named tuples
"""

import collections

control_plane = ['control_plane']
service = control_plane + ['service']
component = service + ['component']
host = component + ['host']


def make_dict(layout):
    def f(*path):
        return dict(zip(layout, path))
    return f


def descend(dictionary, path, remaining, tuple):
    """ Descend one level into a dictionary. """

    if not remaining:
        return [tuple(*path)]

    accessor, collect = remaining[0]
    if callable(collect):
        function = collect
    else:
        function = lambda item: item[collect]
    results = []
    for item in dictionary[accessor]:
        results.extend(descend(item, path + [function(item)], remaining[1:], tuple))
    return results


def topology_filter_control_planes(topology):
    return descend(topology, [], [('control_planes', 'name')], make_dict(control_plane))


def topology_filter_services(topology):
    return descend(topology, [], [('control_planes', 'name'),
                                  ('services', 'name')], make_dict(service))


def topology_filter_components(topology):
    return descend(topology, [], [('control_planes', 'name'),
                                  ('services', 'name'),
                                  ('components', 'name')], make_dict(component))


def topology_filter_hosts(topology):
    return descend(topology, [], [('control_planes', 'name'),
                                  ('services', 'name'),
                                  ('components', 'name'),
                                  ('hosts', str)], make_dict(host))


class FilterModule(object):

    def filters(self):
        return {
            'dict_zip_maker': make_dict,
            'descend': descend,
            'topology_filter_control_planes': topology_filter_control_planes,
            'topology_filter_services': topology_filter_services,
            'topology_filter_components': topology_filter_components,
            'topology_filter_hosts': topology_filter_hosts,
            }


if __name__ == '__main__':
    import yaml

    test = """
---
  topology:
    control_planes:
      - name: ccp
        services:
          - name: keystone
            components:
              - name: keystone-api
                hosts:
                  - host1
                  - host2
                  - host3
          - name: foundation
            components:
              - name: mysql
                hosts:
                  - host1
                  - host2
                  - host3
      - name: rcp01
        services:
          - name: nova
            components:
              - name: nova-api
                hosts:
                  - host4
                  - host5
                  - host6
              - name: nova-scheduler
                hosts:
                  - host4
                  - host5
                  - host6
"""
    topology = yaml.safe_load(test)['topology']

    assert topology_filter_control_planes(topology) == [
        {'control_plane':'ccp'},
        {'control_plane': 'rcp01'}]
    assert topology_filter_services(topology) == [
        {'control_plane': 'ccp', 'service': 'keystone'},
        {'control_plane': 'ccp', 'service': 'foundation'},
        {'control_plane': 'rcp01', 'service': 'nova'}]
    assert topology_filter_components(topology) == [
        {'control_plane': 'ccp', 'service': 'keystone', 'component': 'keystone-api'},
        {'control_plane': 'ccp', 'service': 'foundation', 'component': 'mysql'},
        {'control_plane': 'rcp01', 'service': 'nova', 'component': 'nova-api'},
        {'control_plane': 'rcp01', 'service': 'nova', 'component': 'nova-scheduler'}]
    assert topology_filter_hosts(topology) == [
        {'control_plane': 'ccp', 'service': 'keystone', 'component': 'keystone-api', 'host': 'host1'},
        {'control_plane': 'ccp', 'service': 'keystone', 'component': 'keystone-api', 'host': 'host2'},
        {'control_plane': 'ccp', 'service': 'keystone', 'component': 'keystone-api', 'host': 'host3'},
        {'control_plane': 'ccp', 'service': 'foundation', 'component': 'mysql', 'host': 'host1'},
        {'control_plane': 'ccp', 'service': 'foundation', 'component': 'mysql', 'host': 'host2'},
        {'control_plane': 'ccp', 'service': 'foundation', 'component': 'mysql', 'host': 'host3'},
        {'control_plane': 'rcp01', 'service': 'nova', 'component': 'nova-api', 'host': 'host4'},
        {'control_plane': 'rcp01', 'service': 'nova', 'component': 'nova-api', 'host': 'host5'},
        {'control_plane': 'rcp01', 'service': 'nova', 'component': 'nova-api', 'host': 'host6'},
        {'control_plane': 'rcp01', 'service': 'nova', 'component': 'nova-scheduler', 'host': 'host4'},
        {'control_plane': 'rcp01', 'service': 'nova', 'component': 'nova-scheduler', 'host': 'host5'},
        {'control_plane': 'rcp01', 'service': 'nova', 'component': 'nova-scheduler', 'host': 'host6'}]
0707010012023A000081A40000000000000000000000015BD0D1D20000031C000000FD0000000200000000000000000000004000000000ardana-ansible-8.0+git.1540411858.7223b0a/filter_plugins/zip.py#!/usr/bin/python
#
# (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.
"""
Zip two lists together.
"""


class FilterModule(object):

    def filters(self):
        return {
            'zip': zip,
            }
07070100120225000081A40000000000000000000000015BD0D1D200000331000000FD0000000200000000000000000000004000000000ardana-ansible-8.0+git.1540411858.7223b0a/git-00-initialise.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.
#
# Initialise the client git repository
---
- hosts: localhost
  connection: local
  roles:
    - git-operations
  tasks:
    - include: roles/git-operations/tasks/initialise.yml
070701001203BC000081A40000000000000000000000015BD0D1D2000005A2000000FD0000000200000000000000000000004100000000ardana-ansible-8.0+git.1540411858.7223b0a/git-01-receive-new.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.
#
#

# Receive a new Ardana OpenStack code drop

# (a) create new commit on the ardana branch
# This works identically with the first and subsequent drops, assuming initialisation is complete.
# clone the ardana branch to a working directory.
# replace its contents with an exploded openstack/ directory from the new deployment.
# create a commit that accepts all the new stuff (be sure to delete any unwanted old files)
# push this back to ~/ardana (ardana branch)

# (b) merge site and ardana tips
# in ~/ardana, triger a git commit to the site branch of the ardana branch.
# The user may need to massage this merge (using the usual git tooling) as appropriate.
---
- hosts: localhost
  connection: local
  roles:
    - git-operations
  tasks:
    - include: roles/git-operations/tasks/receive-drop.yml
070701001203B8000081A40000000000000000000000015BD0D1D2000002F2000000FD0000000200000000000000000000003F00000000ardana-ansible-8.0+git.1540411858.7223b0a/guard-deployment.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: localhost
  connection: local
  roles:
    - role: guard-runtime-location
      location: deploy
070701001203C4000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000003200000000ardana-ansible-8.0+git.1540411858.7223b0a/hooks.d070701001203C5000081A40000000000000000000000015BD0D1D200000000000000FD0000000200000000000000000000003800000000ardana-ansible-8.0+git.1540411858.7223b0a/hooks.d/.keep07070100120247000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000003000000000ardana-ansible-8.0+git.1540411858.7223b0a/hosts07070100120248000081A40000000000000000000000015BD0D1D200000047000000FD0000000200000000000000000000003A00000000ardana-ansible-8.0+git.1540411858.7223b0a/hosts/localhostlocalhost  ansible_connection=local deployer_media_legacy_layout=False
070701001203EB000081A40000000000000000000000015BD0D1D20000037A000000FD0000000200000000000000000000003F00000000ardana-ansible-8.0+git.1540411858.7223b0a/installui-deploy.yml#
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
# Install Cloud Install UI and run it

- hosts: localhost
  connection: local
  roles:
    - installui
  tasks:
    - include: roles/installui/tasks/install.yml
    - include: roles/installui/tasks/configure.yml
    - include: roles/installui/tasks/stop.yml
    - include: roles/installui/tasks/start.yml
070701001203CC000081A40000000000000000000000015BD0D1D2000004EA000000FD0000000200000000000000000000004400000000ardana-ansible-8.0+git.1540411858.7223b0a/installui-reconfigure.yml#
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
# Reconfigures installer UI config files during cloud installation (site.yml)

- hosts: ARD-SVC
  roles:
    - installui
  tasks:
    - name: installui | configure | set default is_deployer to false
      set_fact:
        ardana_svc_host_is_deployer: false

    - name: installui | configure | stat openstack path
      stat: path={{ ansible_env['HOME'] }}/openstack
      register: stat_data

    - name: installui | configure | set is_deployer to true, if true
      set_fact:
        ardana_svc_host_is_deployer: true
      when: stat_data is defined and stat_data.stat.exists

    - include: roles/installui/tasks/configure.yml
      when: ardana_svc_host_is_deployer
07070100120427000081A40000000000000000000000015BD0D1D2000002BC000000FD0000000200000000000000000000003E00000000ardana-ansible-8.0+git.1540411858.7223b0a/installui-start.yml#
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- hosts: localhost
  connection: local
  roles:
    - installui
  tasks:
    - include: roles/installui/tasks/start.yml
07070100120436000081A40000000000000000000000015BD0D1D20000037A000000FD0000000200000000000000000000003D00000000ardana-ansible-8.0+git.1540411858.7223b0a/installui-stop.yml#
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- hosts: localhost
  connection: local
  roles:
    - installui
  tasks:
    - include: roles/installui/tasks/stop.yml

# the old dayzero UI was shut off at the end of site.yml
# TODO - determine whether the new UI should do the same
# if so, replace dayzero-stop.yml call in site.yml with
# this play instead
070701001203D1000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000003200000000ardana-ansible-8.0+git.1540411858.7223b0a/library070701001203D9000081A40000000000000000000000015BD0D1D200000D1C000000FD0000000200000000000000000000004600000000ardana-ansible-8.0+git.1540411858.7223b0a/library/apt-upgrade-list.py#!/usr/bin/env python
#
# An Ansible module to query apt for the list of packages
# available for update.
#
# (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.

DOCUMENTATION = '''
---
module: apt-upgrade-list
author: Tom Howley
short_description: Queries apt for list of packages available for upgrade.
description:
    - Updates the local apt cache.
    - Queries the apt cache to get the list of packages avalailable for upgrade.
      That list of packages is written to the fact: list_pkg_upgrades
options:
  timeout:
    description:
      - Timeout the module operation after specified number of seconds.
    required: false
    default: 30
'''

EXAMPLES = '''
- apt-upgrade-list:
    timeout: 30
'''

import datetime
import json
import os
import signal
from threading import Timer

def kill_procgroup(proc):
    os.killpg(os.getpgid(proc.pid), signal.SIGKILL)


def get_list_pkg_upgrades(module, timeout):

    cmd = "sudo aptitude -s -y upgrade"
    p = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True, preexec_fn=os.setsid)
    t = Timer(timeout, kill_procgroup, [p])
    t.start()
    output, err = p.communicate()
    if t.is_alive():
        t.cancel()
    else:
        error_msg = "Timeout on cmd %s output %s" % (cmd, output)
        module.fail_json(msg=error_msg)

    if p.returncode != 0:
        error_msg = "Failed to run %s" % (cmd)
        module.fail_json(msg=error_msg)

    output = output.splitlines()
    list_pkg_upgrades = []

    UPGRADE_STR="The following packages will be upgraded:"
    RECOMMEND_STR="The following packages are RECOMMENDED but will NOT be installed:"
    idx_start_match = next((i for i, v in enumerate(output) if v == UPGRADE_STR), -1)
    if idx_start_match == -1:
      return list_pkg_upgrades

    idx_end_match = next((i for i, v in enumerate(output) if v == RECOMMEND_STR), -1)
    if idx_end_match == -1:
        idx_end_match = next((i for i, v in enumerate(output) if re.match('^\d*\s*packages upgraded.*not upgraded.$',v)), -1)
        if idx_end_match == -1:
            return list_pkg_upgrades

    for line in output[idx_start_match+1:idx_end_match]:
        list_pkg_upgrades.extend(line.split())

    for pkg in list_pkg_upgrades:
        print "Pkg: %s" % pkg

    return list_pkg_upgrades

def main():

    module = AnsibleModule(
        argument_spec = dict(
           timeout=dict(required=False, type='int', default=30)
    ))
    timeout = module.params['timeout']
    list_pkg_upgrades = get_list_pkg_upgrades(module, timeout)
    changed = (len(list_pkg_upgrades) > 0)
    ansible_facts_dict = dict(list_pkg_upgrades=list_pkg_upgrades)
    result = dict(changed=changed, ansible_facts=ansible_facts_dict)
    module.exit_json(**result)

from ansible.module_utils.basic import *
main()
070701001203E6000081A40000000000000000000000015BD0D1D200000BFB000000FD0000000200000000000000000000003F00000000ardana-ansible-8.0+git.1540411858.7223b0a/library/aptly_pkg.py#!/usr/bin/python -tt
# -*- coding: utf-8 -*-

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


def addPackage(module, name, pkg, force, remove, aptly_basecmd):
    res = {}
    res['results'] = []
    res['msg'] = ''
    res['changed'] = False
    res['rc'] = 0

    if(name and pkg):
        cmd = aptly_basecmd + ['add', name] + pkg

        # todo: if packages contain package query syntax raise error
        if(force):
            cmd.insert(1, '-force-replace=%s' % force)
        if(remove):
            cmd.insert(1, '-remove-files=%s' % remove)

        rc, out, err = module.run_command(cmd)

        res['rc'] = rc
        res['results'].append(out)
        res['msg'] = err

    return res


def removePackage(module, name, pkg, aptly_basecmd):
    res = {}
    res['results'] = []
    res['msg'] = ''
    res['changed'] = False
    res['rc'] = 0

    if(name and pkg):
        cmd = aptly_basecmd + ['remove', name] + pkg

        rc, out, err = module.run_command(cmd)

        res['rc'] = rc
        res['results'].append(out)
        res['msg'] = err

    return res


def ensure(module, name, pkg, state, force, remove):
    aptly_bin = module.get_bin_path('aptly')
    aptly_basecmd = [aptly_bin, 'repo']

    if state in ['present']:
        res = addPackage(module, name, pkg, force, remove, aptly_basecmd)
    elif state in ['absent']:
        res = removePackage(module, name, pkg, aptly_basecmd)
    else:
        module.fail_json(msg="This should never happen",
                         changed=False,
                         results='',
                         errors='unexpected state')

    return res


# todo: option to specify aptly.conf
def main():
    module = AnsibleModule(
        argument_spec=dict(
            name=dict(required=True),
            pkg=dict(required=True, aliases=['package', 'packages'], type="list"),
            state=dict(default='present', choices=['absent', 'present']),
            force=dict(default="no", type='bool'),
            remove=dict(default="no", type='bool')
        )
    )

    params = module.params
    name = params['name']
    pkg = [p.strip() for p in params['pkg']]
    state = params['state']
    force = params['force']
    remove = params['remove']
    results = ensure(module, name, pkg, state, force, remove)

    module.exit_json(**results)

# import module snippets
from ansible.module_utils.basic import *
from ansible.module_utils.urls import *
if __name__ == '__main__':
    main()
070701001203D8000081A40000000000000000000000015BD0D1D200001257000000FD0000000200000000000000000000004300000000ardana-ansible-8.0+git.1540411858.7223b0a/library/aptly_publish.py#!/usr/bin/python -tt
# -*- coding: utf-8 -*-

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


def createPub(module, name, prefix, component, distribution,
              force, label, origin, signing,
              from_repo, from_snapshot, aptly_basecmd):
    res = {}
    res['results'] = []
    res['msg'] = ''
    res['changed'] = False
    res['rc'] = 0

    if(name):
        if(from_repo):
            cmd = aptly_basecmd + ['repo', name]
        elif(from_snapshot):
            cmd = aptly_basecmd + ['snapshot', name]
        else:
            module.fail_json(msg="This should never happen",
                             changed=False,
                             results='',
                             errors='unexpected state')

        if(prefix):
            cmd.insert(5, prefix)
        if(component):
            cmd.insert(1, "-component=%s" % component)
        if(distribution):
            cmd.insert(1, "-distribution=%s" % distribution)
        if(force):
            cmd.insert(1, "-force-overwrite=%s" % force)
        if(label):
            cmd.insert(1, "-label=%s" % label)
        if(origin):
            cmd.insert(1, "-origin=%s" % origin)
        if(not signing):
            cmd.insert(1, "-skip-signing=%s" % (not signing))

        rc, out, err = module.run_command(cmd)

        res['rc'] = rc
        res['results'].append(out)
        res['msg'] = err

    return res


def dropPub(module, force, distribution, aptly_basecmd):
    res = {}
    res['results'] = []
    res['msg'] = ''
    res['changed'] = False
    res['rc'] = 0

    if(distribution):
        cmd = aptly_basecmd + ['drop', distribution]

        if(force):
            cmd.insert(1, "force-drop=%s" % force)

        rc, out, err = module.run_command(cmd)

        res['rc'] = rc
        res['results'].append(out)
        res['msg'] = err

    return res


def ensure(module, name, state, prefix, component,
           label, origin, force, distribution, signing,
           from_repo, from_snapshot):
    aptly_bin = module.get_bin_path('aptly')
    aptly_basecmd = [aptly_bin, 'publish']

    if state in ['present']:
        res = createPub(module, name, prefix, component, distribution,
                        force, label, origin, signing,
                        from_repo, from_snapshot, aptly_basecmd)
    elif state in ['absent']:
        res = dropPub(module, force, distribution, aptly_basecmd)
    else:
        module.fail_json(msg="This should never happen",
                         changed=False,
                         results='',
                         errors='unexpected state')

    return res


# todo: option to specify aptly.conf
def main():
    module = AnsibleModule(
        argument_spec=dict(
            name=dict(required=True),
            state=dict(default='present', choices=['absent', 'present']),
            prefix=dict(),
            component=dict(type="list"),
            label=dict(default=None),
            origin=dict(default=None),
            force=dict(default="no", type="bool"),
            distribution=dict(default=None),
            signing=dict(default="yes", type='bool'),
            from_repo=dict(type='bool'),
            from_snapshot=dict(type='bool')
        ),
        required_one_of=[['from_repo', 'from_snapshot']],
        mutually_exclusive=[['from_repo', 'from_snapshot']]
    )

    params = module.params
    name = params['name']
    state = params['state']
    prefix = params['prefix']
    component = params['component']
    label = params['label']
    origin = params['origin']
    force = params['force']
    distribution = params['distribution']
    signing = params['signing']
    from_repo = params['from_repo']
    from_snapshot = params['from_snapshot']
    results = ensure(module, name, state, prefix, component,
                     label, origin, force, distribution, signing,
                     from_repo, from_snapshot)

    module.exit_json(**results)

# import module snippets
from ansible.module_utils.basic import *
from ansible.module_utils.urls import *
if __name__ == '__main__':
    main()
070701001203D7000081A40000000000000000000000015BD0D1D200000EE2000000FD0000000200000000000000000000004000000000ardana-ansible-8.0+git.1540411858.7223b0a/library/aptly_repo.py#!/usr/bin/python -tt
# -*- coding: utf-8 -*-

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


def repoExists(module, name, aptly_basecmd):
    cmd = aptly_basecmd + ['show', name]
    rc, out, err = module.run_command(cmd)
    msgs = [out, err]
    if any("local repo with name %s not found" % name in s for s in msgs):
        return False
    elif(rc is 0):
        # repo already exists
        return True
    else:
        # unknown error
        module.fail_json(msg='The following error occured: %s' % err)


def createRepo(module, name, comment, component, distribution, aptly_basecmd):
    res = {}
    res['results'] = []
    res['msg'] = ''
    res['changed'] = False
    res['rc'] = 0

    if(name):
        if repoExists(module, name, aptly_basecmd):
            res['results'] = "Repo %s already exists." % name
            return res

        cmd = aptly_basecmd + ['create', name]

        if(comment):
            cmd.insert(1, '-comment=%s' % comment)
        if(component):
            cmd.insert(1, '-component=%s' % component)
        if(distribution):
            cmd.insert(1, '-distribution=%s' % distribution)

        rc, out, err = module.run_command(cmd)

        res['rc'] = rc
        res['results'].append(out)
        res['msg'] += err

    return res


def dropRepo(module, name, force, aptly_basecmd):
    res = {}
    res['results'] = []
    res['msg'] = ''
    res['changed'] = False
    res['rc'] = 0

    if(name):
        cmd = aptly_basecmd + ['drop', name]

        if(force):
            cmd += ['-force' + force]

        rc, out, err = module.run_command(cmd)

        res['rc'] = rc
        res['results'].append(out)
        res['msg'] += err

    return res


def ensure(module, name, state, comment, component, distribution, force):
    aptly_bin = module.get_bin_path('aptly')
    aptly_basecmd = [aptly_bin, 'repo']

    if state in ['present']:
        res = createRepo(module, name, comment, component,
                         distribution, aptly_basecmd)
    elif state in ['absent']:
        res = dropRepo(module, name, force, aptly_basecmd)
    else:
        module.fail_json(msg="This should never happen",
                         changed=False,
                         results='',
                         errors='unexpected state')

    return res


# todo: option to specify aptly.conf
def main():
    module = AnsibleModule(
        argument_spec=dict(
            name=dict(required=True),
            state=dict(default="present", choices=["absent", "present"]),
            comment=dict(default=""),
            component=dict(default=""),
            distribution=dict(default=""),
            force=dict(default="no", type='bool')
        )
    )

    params = module.params
    name = params['name']
    state = params['state']
    comment = params['comment']
    component = params['component']
    distribution = params['distribution']
    force = params['force']
    results = ensure(module, name, state, comment,
                     component, distribution, force)

    module.exit_json(**results)

# import module snippets
from ansible.module_utils.basic import *
from ansible.module_utils.urls import *
if __name__ == '__main__':
    main()
070701001203D5000081A40000000000000000000000015BD0D1D200000CDF000000FD0000000200000000000000000000004400000000ardana-ansible-8.0+git.1540411858.7223b0a/library/aptly_snapshot.py#!/usr/bin/python -tt
# -*- coding: utf-8 -*-

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


def createSnapshot(module, name, repo, empty, aptly_basecmd):
    res = {}
    res['results'] = []
    res['msg'] = ''
    res['changed'] = False
    res['rc'] = 0

    if(name and repo):
        cmd = aptly_basecmd + ['create', name, 'from', 'repo', repo]

        # todo: error if repo does not exist
        rc, out, err = module.run_command(cmd)

        res['rc'] = rc
        res['results'].append(out)
        res['msg'] = err
    elif(empty):
        cmd = aptly_basecmd + ['create', name, 'empty']

        # todo: error if repo does not exist
        rc, out, err = module.run_command(cmd)

        res['rc'] = rc
        res['results'].append(out)
        res['msg'] = err

    return res


def dropSnapshot(module, name, force, aptly_basecmd):
    res = {}
    res['results'] = []
    res['msg'] = ''
    res['changed'] = False
    res['rc'] = 0

    if(name):
        cmd = aptly_basecmd + ['drop', name]

        # todo: error if repo does not exist
        if(force):
            cmd.insert(1, '-force=%s' % force)

        rc, out, err = module.run_command(cmd)

        res['rc'] = rc
        res['results'].append(out)
        res['msg'] = err

    return res


def ensure(module, name, state, repo, force, empty):
    aptly_bin = module.get_bin_path('aptly')
    aptly_basecmd = [aptly_bin, 'snapshot']

    if state in ['present']:
        res = createSnapshot(module, name, repo, empty, aptly_basecmd)
    elif state in ['absent']:
        res = dropSnapshot(module, name, force, aptly_basecmd)
    else:
        module.fail_json(msg="This should never happen",
                         changed=False,
                         results='',
                         errors='unexpected state')

    return res


# todo: option to specify aptly.conf
def main():
    module = AnsibleModule(
        argument_spec=dict(
            name=dict(required=True),
            state=dict(default='present', choices=['absent', 'present']),
            repo=dict(aliases=['repo_name']),
            force=dict(default="no", type='bool'),
            empty=dict(default="no", type='bool')
        ),
        required_one_of=[['repo', 'empty']],
        mutually_exclusive=[['repo', 'empty']],
    )

    params = module.params
    name = params['name']
    state = params['state']
    repo = params['repo']
    force = params['force']
    empty = params['empty']

    results = ensure(module, name, state, repo, force, empty)

    module.exit_json(**results)

# import module snippets
from ansible.module_utils.basic import *
from ansible.module_utils.urls import *
if __name__ == '__main__':
    main()
070701001203E1000081A40000000000000000000000015BD0D1D200004072000000FD0000000200000000000000000000004200000000ardana-ansible-8.0+git.1540411858.7223b0a/library/birdseyeview.py#!/usr/bin/python
# -*- coding: utf-8 -*-

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

DOCUMENTATION = '''
---
module: birdseyeview
version_added: "1.9"
short_description: Generate a bird's eye view summary
description:
  This module generates a bird's eye view of an existing installation to help
  facilitate the initial contact with our Support, Consulting, and/or Training
  departments.
options:
    action:
        required: true
        description:
          - The action to be performed
    src:
        required: true
        description:
          - The absolute path to the directory containing remotely fetched
            files
    dest:
        required: false
        description:
          - The name of the file. If a relative name is provided, the absolute
            path to the ".../my_cloud/info" directory will be prepended to make
            it absolute.
    format:
        required: false
        description:
          - The format of the output file. If no value provided, it will
            attempt to determine based on dest extension else it will use the
            default value.
'''

EXAMPLES = '''
- birdseyeview:
    action: list_cinder_config_files
    src: /tmp/my_birdseyeview
    register: cinder_files

- birdseyeview:
    action: generate_summary
    src: /tmp/my_birdseyeview
    dest: /tmp/birdseyeview.yml
'''

import json
import os
import re
import string
import sys
import yaml

from six.moves import configparser

# import module snippets
from ansible.module_utils.basic import *


def get_config_parser():
    if sys.version_info >= (3, 2):
        return configparser.ConfigParser()
    return configparser.SafeConfigParser()


class ServerDetails(object):
    def __init__(self, src_dir):
        self.src_dir = src_dir

    def get_hostname(self):
        with open(os.path.join(self.src_dir, 'hostname')) as f:
            return f.read().strip()

    def get_mac_addresses(self):
        mac_addrs = {}

        pattern = re.compile(
            'link/ether {0} '.format(
                string.join(6 * ('[a-z0-9][a-z0-9]',), ':')
            )
        )
        with open(os.path.join(self.src_dir, 'ipa')) as f:
            for line in f.readlines():
                s = pattern.search(line.lower())
                if s:
                    mac_addrs[s.group(0).split(' ')[1]] = True

        return mac_addrs.keys()

    def get_hardware_details(self):
        ret = {}

        values = [
            'Manufacturer',
            'Family',
            'Product Name',
            'Version',
        ]
        with open(os.path.join(self.src_dir, 'dmidecode')) as f:
            for line in f.readlines():
                line = line.strip()
                if line:
                    tokens = line.strip().split(': ', 1)
                    if len(tokens) > 1 and tokens[0] in values:
                        ret[tokens[0]] = tokens[1]

        return ret

    def get_os_details(self):
        ret = {}

        values = [
            'NAME',
            'VERSION',
        ]
        with open(os.path.join(self.src_dir, 'os-release')) as f:
            for line in f.readlines():
                line = line.strip()
                if line and not line.startswith('#'):
                    tokens = line.strip().split('=', 1)
                    if len(tokens) > 1 and tokens[0] in values:
                        ret[tokens[0]] = tokens[1].strip('\'"')

        return ret


class Service(object):

    def __init__(self, src_dir):
        self.src_dir = src_dir

        # the following variables are populated by subclass
        self.services = []

    # extract filenames from systemd files
    def list_config_files(self):
        files = dict()

        for service in self.services:
            fn = os.path.join(self.src_dir, '{0}.service'.format(service))
            if not os.path.exists(fn):
                continue

            cfgparser = get_config_parser()
            with open(fn) as f:
                cfgparser.readfp(f)

            if not cfgparser.has_section('Service') or \
                    not cfgparser.has_option('Service', 'ExecStart'):
                continue

            i = 0
            params = cfgparser.get('Service', 'ExecStart').split(' ')
            while i < len(params):
                if params[i] == '--config-file':
                    i += 1
                    files[params[i]] = True
                i += 1

        return files.keys()


class CinderService(Service):
    def __init__(self, src_dir):
        super(CinderService, self).__init__(src_dir)

        self.services = [
            'cinder-api'
        ]

    # roles/_CND-CMN/templates/cinder.conf.j2
    # [DEFAULT]
    # enabled_backends=3par_iscsi,3par_iscsi2
    # volume_driver=cinder.volume.drivers.eqlx.DellEQLSanISCSIDriver
    # [3par_iscsi2]
    # volume_driver=cinder.volume.drivers.san.hp.hp_3par_iscsi.HP3PARISCSIDriver
    # [3par_iscsi]
    # volume_driver=cinder.volume.drivers.san.hp.hp_3par_iscsi.HP3PARISCSIDriver
    def birdseye(self):
        conf = dict()

        fn = os.path.join(self.src_dir, 'cinder.conf')
        if not os.path.exists(fn):
            return conf

        cfgparser = get_config_parser()
        with open(fn) as f:
            cfgparser.readfp(f)

        # DEFAULT section
        conf['DEFAULT'] = dict()
        try:
            conf['DEFAULT']['volume_driver'] = \
                cfgparser.get('DEFAULT', 'volume_driver')
        except configparser.NoOptionError:
            pass

        # backends
        enabled_backends = None
        try:
            enabled_backends = cfgparser.get('DEFAULT', 'enabled_backends')
        except configparser.NoOptionError:
            pass
        if enabled_backends:
            conf['DEFAULT']['enabled_backends'] = enabled_backends

            conf['enabled_backends'] = dict()
            for backend in enabled_backends.split(','):
                # skip blanks
                if not backend:
                    continue

                tmp = dict()
                conf['enabled_backends'][backend] = tmp
                try:
                    tmp['volume_driver'] = \
                        cfgparser.get(backend, 'volume_driver')
                except configparser.NoOptionError:
                    pass

        return conf


class GlanceService(Service):
    def __init__(self, src_dir):
        super(GlanceService, self).__init__(src_dir)

        self.services = [
            'glance-api'
        ]

    # roles/GLA-API/templates/glance-api.conf.j2
    # # List of stores enabled. Valid stores are:
    # # cinder
    # # file
    # # http
    # # rbd
    # # sheepdog
    # # swift
    # # vsphere
    # [glance_store]
    # stores = file,http,vsphere
    # default_store = vsphere
    def birdseye(self):
        conf = dict()

        fn = os.path.join(self.src_dir, 'glance-api.conf')
        if not os.path.exists(fn):
            return conf

        cfgparser = get_config_parser()
        with open(fn) as f:
            cfgparser.readfp(f)

        if not cfgparser.has_section('glance_store'):
            return conf

        conf['glance_store'] = dict()

        try:
            conf['glance_store']['stores'] = \
                cfgparser.get('glance_store', 'stores').split(',')
        except configparser.NoOptionError:
            pass

        try:
            conf['glance_store']['default_store'] = \
                cfgparser.get('glance_store', 'default_store')
        except configparser.NoOptionError:
            pass

        return conf


class BirdsEyeView(object):

    @staticmethod
    def format_choices():
        return ['json', 'yaml']

    @staticmethod
    def format_default():
        return 'yaml'

    def __init__(self, mycloud_dir, src_dir):
        self.mycloud_dir = mycloud_dir
        self.src_dir = src_dir

        self.definition_cache = dict()

    def _dir_to_array(self, path):
        ret = []

        files = []
        for fn in sorted(os.listdir(path)):
            absfile = os.path.join(path, fn)
            if os.path.isdir(absfile):
                ret.append({
                    fn: self._dir_to_array(absfile)
                })
            else:
                files.append(fn)

        ret.extend(files)

        return ret

    def _load_definition_file(self, path, reload_file=False):
        if not reload_file and path in self.definition_cache:
            return

        fn = os.path.join(self.mycloud_dir, 'definition/data', path)
        with open(fn, 'r') as f:
            self.definition_cache[path] = yaml.load(f)

    @staticmethod
    def _product_info():
        info = {}

        for fn in [
            '/etc/HPE_Helion_version',
            '/etc/Ardana_version',
        ]:
            if os.path.exists(fn):
                version = []
                with open(fn, 'r') as f:
                    for line in f.readlines():
                        if not line.startswith('#'):
                            version.append(line.strip())
                info['version'] = version
                break

        return info

    def _servers_details(self):
        nodes = []

        nodes_path = os.path.join(self.src_dir, 'nodes')
        for fn in sorted(os.listdir(nodes_path)):
            absfile = os.path.join(nodes_path, fn)
            if os.path.isdir(absfile):
                nodes.append(ServerDetails(absfile))

        return nodes

    # TODO: commented server properties below exist in the CP modeling data
    # but not [easily] in the definition files
    def _servers_definitions(self):
        self._load_definition_file('servers.yml')

        servers = {}
        tmp = self.definition_cache['servers.yml']['servers']
        for server in tmp:
            if 'id' in server:
                servers[server['id']] = {
                    'mac-addr': server.get('mac-addr'),
                    # 'name': server.get('name'),
                    # 'control_plane': server.get('control-plane-name'),
                    # 'failure_zone': server.get('failure-zone'),
                    'group': server.get('server-group'),
                    'role': server.get('role'),
                    # 'state' : server.get('state'),
                }
        return servers

    def _servers(self):
        definitions = self._servers_definitions()
        details = self._servers_details()

        # merge the two structures, join by MAC address
        for name, definition in definitions.iteritems():
            # security: do not share MAC address?
            mac_addr = definition.pop('mac-addr')
            for detail in details:
                if mac_addr in detail.get_mac_addresses():
                    # security: do not share hostname?
                    # definition['hostname'] = detail.get_hostname()
                    definition['hardware'] = detail.get_hardware_details()
                    definition['operating_system'] = detail.get_os_details()
                    break

        return definitions

    def _services(self):
        self._load_definition_file('something.yml')

        services = {}
        tmp = self.definition_cache['something.yml']['services']
        for name, value in tmp:
            service = {}
            services[name] = service
            if 'component-list' in value:
                service['component_list'] = value['component-list']
        return services

    def _control_planes(self):
        self._load_definition_file('control_plane.yml')

        control_planes = {}
        tmp = self.definition_cache['control_plane.yml']['control-planes']
        for plane in tmp:
            clusters = {}
            control_planes[plane['name']] = {
                'clusters': clusters,
            }

            for cluster in plane['clusters']:
                service_components = []
                clusters[cluster['name']] = {
                    'server_roles': cluster['server-role'],
                    'service_components': service_components,
                }

                for component in sorted(cluster['service-components']):
                    service_components.append(component)

        return control_planes

    def _third_party(self):
        return {
            'files': {
                '~/third-party':
                    self._dir_to_array(os.path.expanduser('~/third-party'))
            }
        }

    def _cinder_storage(self):
        return CinderService(self.src_dir).birdseye()

    def _glance_storage(self):
        return GlanceService(self.src_dir).birdseye()

    def generate(self):
        data = dict()
        data['product'] = self._product_info()
        data['servers'] = self._servers()
        # TODO: commented services below exist in the CP modeling data
        # but not [easily] in the definition files
        # data['services'] = self._services()
        data['control_planes'] = self._control_planes()
        data['thirdparty'] = self._third_party()
        data['cinder'] = self._cinder_storage()
        data['glance'] = self._glance_storage()
        return data


def action_list_cinder_config_files(module):
    return {
        'changed': False,
        'files': CinderService(module.params['src']).list_config_files(),
    }


def action_list_glance_config_files(module):
    return {
        'changed': False,
        'files': GlanceService(module.params['src']).list_config_files(),
    }


def action_generate(module):
    src = module.params['src']
    dest = module.params['dest']
    fformat = module.params['format']

    # determine format
    # order of precedence is:
    #   explicitly
    #   by extension
    #   default value
    if not fformat:
        # extract and lower file extension
        (root, ext) = os.path.splitext(dest)
        ext = ext[1:].lower()

        # handle abbreviations
        if ext == 'yml':
            ext = 'yaml'

        # find matching format
        if ext in BirdsEyeView.format_choices():
            fformat = ext
        else:
            fformat = BirdsEyeView.format_default()

    # find my_cloud source directory
    mycloud_dir = None
    for p in [
        # HOS
        '~/helion/my_cloud',
        # Ardana
        '~/openstack/my_cloud',
    ]:
        p = os.path.expanduser(p)
        if os.path.exists(p):
            mycloud_dir = p
            break
    if not mycloud_dir:
        raise Exception('Unable to find directory "my_cloud"')

    # generate summary
    data = BirdsEyeView(mycloud_dir, src).generate()

    # ensure an absolute output filename
    if not dest.startswith(os.sep):
        dest = os.path.join(mycloud_dir, 'info', dest)

    # write summary
    with open(dest, 'wb') as f:
        if fformat == 'json':
            json.dump(data, f)
        elif fformat == 'yaml':
            yaml.dump(data, f, default_flow_style=False)

    return {
        'changed': True,
        'file': dest,
    }


def main():
    module = AnsibleModule(
        argument_spec=dict(
            action=dict(
                required=True,
                choices=[
                    'list_cinder_config_files',
                    'list_glance_config_files',
                    'generate_summary',
                ],
                type='str'
            ),
            src=dict(required=True, type='str'),
            dest=dict(required=False, type='str'),
            format=dict(
                required=False,
                choices=BirdsEyeView.format_choices(),
                default=None,
                type='str'
            )
        )
    )

    ret = dict()
    action = module.params['action']
    if action == 'list_cinder_config_files':
        ret = action_list_cinder_config_files(module)
    elif action == 'list_glance_config_files':
        ret = action_list_glance_config_files(module)
    elif action == 'generate_summary':
        ret = action_generate(module)

    # exit module
    module.exit_json(**ret)


main()
070701001203DA000081A40000000000000000000000015BD0D1D2000022D3000000FD0000000200000000000000000000004200000000ardana-ansible-8.0+git.1540411858.7223b0a/library/deb_to_wheel.py#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (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.
#

"""deb to wheel ansible module."""

import wheel.bdist_wheel
import tempfile
from email.message import Message
from wheel.pkginfo import read_pkg_info, write_pkg_info
from wheel.archive import archive_wheelfile
from email.parser import Parser
import shutil
import debian.debfile
import glob
import distutils
import os
import re

DOCUMENTATION = '''
---
module: deb_to_wheel
short_description: Module for translating deb-packaged python code to a wheel.
description:
    - Ansible module for translating python code packaged as a debian to
    - a python wheel.
author: "Seamus Delaney"
requirements:
    - debian
options:
    src:
        description:
            - The debian package we want to translate to a wheel.
        required: true
    dest:
        description:
            - The location for the produced wheel.
        required: false
        default: null
'''

EXAMPLES = '''
- deb_to_wheel:
    src: /home/debian/my_deb.deb
    dest: /home/debian/my_wheel.whl
'''


def read_control(path):
    """Parse debian package control metadata."""
    with open(path, "r") as headers:
        message = Parser().parse(headers)
    return message


def control_to_metadata(control_dir, wheel_dir):
    """Convert deb control to METADATA file."""
    ctrl_info = read_control(control_dir)
    pkg_name = ctrl_info['Package'].replace('-', '_')
    pkg_version = re.search(r'\d.*', ctrl_info['Version'].replace('-', '_'))
    pkg_string = "%s-%s" % (pkg_name, pkg_version)

    metadata = Message()
    metadata.add_header('Metadata-Version', '2.0')
    metadata['Name'] = ctrl_info['Package']
    metadata['Version'] = pkg_version
    metadata['Home-page'] = ctrl_info['Homepage']

    # get maintainer name and email
    maintainer_pattern = r'\s*(?P<maintainer>.*?)\s*?\<(?P<m_email>.*?)\>'
    re_results = re.search(maintainer_pattern, ctrl_info['Maintainer'])
    metadata['Author'] = re_results.group('maintainer')
    metadata['Author-email'] = re_results.group('m_email')

    metadata['Summary'] = ctrl_info['Description'].split('\n', 1)[0]
    metadata['Description'] = ctrl_info['Description']

    # Write wheelfile
    dist_info_dir = wheel_dir + "/" + pkg_string + ".dist-info"
    os.mkdir(dist_info_dir)
    metadata_path = os.path.join(dist_info_dir, 'METADATA')
    write_pkg_info(metadata_path, metadata)

    return(pkg_name, pkg_version)


def read_egg_metadata(path):
    """Return a dict representing egg metadata."""
    if os.path.isfile(path):
        pkg_info = read_pkg_info(path)
    else:
        pkginfo_path = os.path.join(path, 'PKG-INFO')
        pkg_info = read_pkg_info(pkginfo_path)

    return pkg_info


def egg_to_metadata(module, egg_path, wheel_dir):
    """Convert egg data to METADATA."""
    pkg_info = read_egg_metadata(egg_path)
    pkg_name = pkg_info['Name'].replace('-', '_')
    pkg_version_regex = re.search(r'\d.*',
                                  pkg_info['Version'].replace('-', '_'))
    if pkg_version_regex is None:
        module.fail_json(
            msg="Error: Version string does not comply with PEP440.")
    pkg_version = pkg_version_regex.group(0)

    pkg_string = "%s-%s" % (pkg_name, pkg_version)

    dist_info_dir = wheel_dir + "/" + pkg_string + ".dist-info"
    bw = wheel.bdist_wheel.bdist_wheel(distutils.dist.Distribution())
    bw.egg2dist(egg_path, dist_info_dir)

    return(pkg_name, pkg_version)


def extract_deb(src, dest):
    """Extract deb package content to specified destination."""
    deb = debian.debfile.DebFile(src)

    deb_data = deb.data.tgz()
    deb_data.extractall(path=dest)

    deb_ctrl = deb.control.tgz()
    deb_ctrl.extractall(path=dest + "/DEBIAN")


def cleanup(*scratch_dirs):
    """Remove any directories passed to the function."""
    for dir in scratch_dirs:
        shutil.rmtree(dir)


def copytree(src, dst, symlinks=False, ignore=None):
    """shutil.copytree workaround for copying into an existing directory."""
    names = os.listdir(src)
    if ignore is not None:
        ignored_names = ignore(src, names)
    else:
        ignored_names = set()

    if(not os.path.exists(dst)):
        os.makedirs(dst)
    errors = []
    for name in names:
        if name in ignored_names:
            continue
        srcname = os.path.join(src, name)
        dstname = os.path.join(dst, name)
        try:
            if symlinks and os.path.islink(srcname):
                linkto = os.readlink(srcname)
                os.symlink(linkto, dstname)
            elif os.path.isdir(srcname):
                copytree(srcname, dstname, symlinks, ignore)
            else:
                # Will raise a SpecialFileError for unsupported file types
                shutil.copy2(srcname, dstname)
        # catch the Error from the recursive copytree so that we can
        # continue with other files
        except Error, err:
            errors.extend(err.args[0])
        except EnvironmentError, why:
            errors.append((srcname, dstname, str(why)))
    try:
        shutil.copystat(src, dst)
    except OSError, why:
        errors.append((src, dst, str(why)))
    if errors:
        raise shutil.Error, errors


def deb_to_wheel(module, src, dest):
    """Translate a debian package to a python wheel."""
    res = {}
    res['results'] = []
    res['msg'] = ''
    res['changed'] = False
    res['rc'] = 1

    # Create scratch directories
    temp_deb_dir = tempfile.mkdtemp()
    temp_wheel_dir = tempfile.mkdtemp()

    # Extract deb package content to scratch directory
    extract_deb(src, temp_deb_dir)

    # Check if there's an egg file or directory
    egg_path = glob.glob(temp_deb_dir +
                         "/usr/lib/python2.7/dist-packages/*.egg-info")
    if len(egg_path) != 0:
        egg_path = egg_path[0]
        pkg_name, pkg_version = egg_to_metadata(module,
                                                egg_path,
                                                temp_wheel_dir)
    else:
        # Convert deb control to METADATA file
        control_dir = os.path.join(temp_deb_dir, "DEBIAN/control")
        pkg_name, pkg_version = control_to_metadata(control_dir,
                                                    temp_wheel_dir)

    # How directories in the debian package should be translated to the wheel
    pkg_string = "%s-%s" % (pkg_name, pkg_version)
    data_dir = os.path.join(temp_wheel_dir, pkg_string + ".data")
    dir_map = {
        'usr/lib/python2.7/dist-packages': temp_wheel_dir,
        'usr/bin': os.path.join(data_dir, 'scripts'),
        'usr/include/python2.7/' + pkg_name: os.path.join(data_dir, 'headers'),
        'usr': os.path.join(data_dir, 'data')
    }

    for source, destination in dir_map.iteritems():
        if(os.path.exists(os.path.join(temp_deb_dir, source))):
            ignore = []
            if(source is 'usr'):
                ignore = ['lib', 'bin', 'include']
            copytree(
                os.path.join(temp_deb_dir, source),
                destination,
                ignore=shutil.ignore_patterns(*ignore)
            )

    # Write out record and wheelfile
    dist_info_dir = temp_wheel_dir + "/" + pkg_string + ".dist-info"
    bw = wheel.bdist_wheel.bdist_wheel(distutils.dist.Distribution())
    bw.write_wheelfile(dist_info_dir)
    bw.write_record(temp_wheel_dir, dist_info_dir)

    package_name = "{dist}-{version}-{pyVer}-{abi}-{platform}".format(
        dist=pkg_name,
        version=pkg_version,
        pyVer='py27',
        abi='none',
        platform='any')
    base_name = os.path.join(os.path.dirname(dest), package_name)
    archive_wheelfile(base_name, temp_wheel_dir)

    cleanup(temp_deb_dir, temp_wheel_dir)

    res['rc'] = 0
    res['changed'] = True

    return res


def main():
    """Module entry point."""
    module = AnsibleModule(
        argument_spec=dict(
            src=dict(required=True),
            dest=dict(required=False)
        )
    )

    params = module.params
    src = params['src']
    dest = params['dest']
    if(not dest):
        dest = os.path.dirname(src)
    results = deb_to_wheel(module, src, dest)

    module.exit_json(**results)

# import module snippets
from ansible.module_utils.basic import * # noqa
if __name__ == '__main__':
    main()
070701001203D2000081A40000000000000000000000015BD0D1D200000761000000FD0000000200000000000000000000003F00000000ardana-ansible-8.0+git.1540411858.7223b0a/library/dpkg_list.py#!/usr/bin/env python
#
# An Ansible module to query apt for the list of packages
# available for update.
#
# (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.

DOCUMENTATION = '''
---
module: dpkg_list
author: Tom Howley
short_description: Queries apt for list of packages available for upgrade.
description:
    - Updates the local apt cache.
    - Queries the apt cache to get the list of packages avalailable for upgrade.
      That list of packages is written to the fact: list_pkg_upgrades
options:
    Currently no options.
'''

EXAMPLES = '''
- dpkg_list:
'''

import subprocess


def get_installed_pkgs(module):
    dpkg_query_bin = module.get_bin_path('dpkg-query')
    cmd = [dpkg_query_bin, '-W', "-f=${Package} ${Version}\n"]
    output = subprocess.check_output(cmd).splitlines()
    installed_pkgs = {}

    for line in output:
        (pkg, version) = line.split()
        installed_pkgs[pkg] = {"Version": version}

    return installed_pkgs


def main():

    module = AnsibleModule(argument_spec=dict())
    installed_pkgs = get_installed_pkgs(module)
    changed = False
    ansible_facts_dict = dict(installed_pkgs=installed_pkgs)
    result = dict(changed=changed, ansible_facts=ansible_facts_dict)
    module.exit_json(**result)

from ansible.module_utils.basic import *
main()
070701001203E5000081A40000000000000000000000015BD0D1D200000A31000000FD0000000200000000000000000000004500000000ardana-ansible-8.0+git.1540411858.7223b0a/library/find_zypper_iso.py#!/usr/bin/python
#
# (c) Copyright 2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#

DOCUMENTATION = '''
---
module: find_zypper_iso
short_description: Transform an ISO zypper repo to its local path
description: |
  Search for a matching zypper repository using an ISO as its source and
  transform the source into a local filesystem path.
author: SUSE Linux GmbH
options:
  name:
    description: Name of the ISO to match
'''

EXAMPLES = '''
- find_zypper_iso:
    name: SUSE-OPENSTACK-CLOUD-8
  register: cloud_iso
- debug: msg="{{ cloud_iso.path }}"
'''

import glob
import re
from urlparse import unquote


def _get_iso_uri(name):
    baseurl = None
    for repo in glob.glob('/etc/zypp/repos.d/*.repo'):
        found = False
        with open(repo) as f:
            lines = f.readlines()
            for line in lines:
                if re.search(r'^enabled\s*=\s*0$', line):
                    baseurl = None
                    found = False
                    break
                if re.search(r'^baseurl=iso:///.*%s.*$' % name, line):
                    baseurl = line.split('=', 1)[1].strip()
                    found = True
            if found:
                return baseurl
    return baseurl


def _get_file_path(iso_uri):
    iso_uri = iso_uri.replace('iso:///?iso=', '')
    if '&' in iso_uri:
        iso, dir = iso_uri.split('&')
        dir = dir.replace('url=', '')
        dir = unquote(dir).replace('dir:', '')
        return dir + '/' + iso
    return iso_uri


def main():

    argument_spec = dict(
        name=dict(type='str', required=True)
    )
    module = AnsibleModule(argument_spec=argument_spec,
                           supports_check_mode=False)
    params = module.params

    try:
        iso_uri = _get_iso_uri(params['name'])
        if not iso_uri:
            file_path = ''
        else:
            file_path = _get_file_path(iso_uri)
    except Exception as e:
        module.fail_json(msg=e.message)
    module.exit_json(rc=0, changed=False, path=file_path)


from ansible.module_utils.basic import *


if __name__ == '__main__':
    main()
070701001203DC000081A40000000000000000000000015BD0D1D200000BE3000000FD0000000200000000000000000000004600000000ardana-ansible-8.0+git.1540411858.7223b0a/library/get_all_pkg_data.py#!/usr/bin/env python
#
# An Ansible module to query both timestamped openstack packages and
# RPM packages from SUSE-Openstack-* repos installed on the system
#
# (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.

DOCUMENTATION = '''
---
module: get_all_pkg_data
author: Jack Choy
short_description: Query timestamped openstack packages and RPM packages
from SUSE-Openstack-* repos installed on the system
description:
    - Returns a list of timestamped openstack packages and a dictionary of
      installed RPM packages from SUSE-Openstack-* repos.
options:
    None
'''

EXAMPLES = '''
- get_all_pkg_data:
'''

from ansible.module_utils.basic import *
from os import listdir
from os.path import basename, islink, join, realpath
import re
import subprocess

SRV_DIR = '/opt/stack/service'

# This regex matches all (i)nstalled packages from repos containing the name
# 'SUSE-Openstack'
re_soc_inst =  re.compile(
    r'^i\+?\s*\| '
    r'suse-openstack.* \| '
    r'(?P<pkg>\S+)\s+\| '
    r'(?P<vers>\d\S*)\s+\|',
    re.IGNORECASE)

def get_ts_pkgs():
    try:
        # Get all the linked dirs in the service directory
        service_dirs = [join(SRV_DIR, f) for f in listdir(SRV_DIR)
                        if islink(join(SRV_DIR, f))]

        # From the linked dirs above, determine the list of timestamped packages
        ts_pkgs = sorted(set([basename(realpath(join(f, 'venv')))
                              for f in service_dirs]))
        return ts_pkgs
    except Exception:
        # Something went very wrong here, so return empty list
        return []

def get_zypper_cloud_pkgs():
    try:
        output = subprocess.check_output(
            ['/usr/bin/zypper', 'packages', '--installed'])
        lines = output.split('\n')
        packages = {}
        # We put it the package information in a dict to ensure uniqueness
        # i.e. multiple repos can show >1 of the same package-version installed
        for line in lines:
            match = re.match(re_soc_inst, line)
            if match:
                packages[match.group('pkg')] = match.group('vers')

        return packages
    except Exception:
        # Something went very wrong here, so return empty list
        return {}

def main():
    packages = {}
    packages['ts_os_pkgs'] = get_ts_pkgs()
    packages['zypper_cloud_pkgs'] = get_zypper_cloud_pkgs()
    ans_module = AnsibleModule(argument_spec=dict())
    result = dict(host_pkgs = packages)
    ans_module.exit_json(**packages)

if __name__ == '__main__':
    main()
070701001203D6000081A40000000000000000000000015BD0D1D20000052A000000FD0000000200000000000000000000003A00000000ardana-ansible-8.0+git.1540411858.7223b0a/library/info.py#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# his program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

Documentation = '''
---
module: info
short_description: Output a custom message with formatting
description:
    - This module allows outputting of information messages to allow
      instructions and help to be provided by playbooks for users to
      check in a sensible format.
options:
  msg:
    description:
      - The customized message used for the warning message.
    required: true

author: Darragh Bailey
'''


EXAMPLES = '''
# Example playbook using warning
- info: msg="The available options to be executed:\n\t-1 option one."
'''

070701001203DF000081A40000000000000000000000015BD0D1D2000036DA000000FD0000000200000000000000000000003A00000000ardana-ansible-8.0+git.1540411858.7223b0a/library/lvol.py#!/usr/bin/python
# -*- coding: utf-8 -*-

# (c) 2013, Jeroen Hoekx <jeroen.hoekx@dsquare.be>, Alexander Bulimov <lazywolf0@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible.  If not, see <http://www.gnu.org/licenses/>.

DOCUMENTATION = '''
---
author:
    - "Jeroen Hoekx (@jhoekx)"
    - "Alexander Bulimov (@abulimov)"
module: lvol
short_description: Configure LVM logical volumes
description:
  - This module creates, removes or resizes logical volumes.
version_added: "1.1"
options:
  vg:
    description:
    - The volume group this logical volume is part of.
    required: true
  lv:
    description:
    - The name of the logical volume.
    required: true
  size:
    description:
    - The size of the logical volume, according to lvcreate(8) --size, by
      default in megabytes or optionally with one of [bBsSkKmMgGtTpPeE] units; or
      according to lvcreate(8) --extents as a percentage of [VG|PVS|FREE];
      Float values must begin with a digit.
      Resizing using percentage values was not supported prior to 2.1.
  state:
    choices: [ "present", "absent" ]
    default: present
    description:
    - Control if the logical volume exists. If C(present) the C(size) option
      is required.
    required: false
  force:
    version_added: "1.5"
    choices: [ "yes", "no" ]
    default: "no"
    description:
    - Shrink or remove operations of volumes requires this switch. Ensures that
      that filesystems get never corrupted/destroyed by mistake.
    required: false
  opts:
    version_added: "2.0"
    description:
    - Free-form options to be passed to the lvcreate command
  snapshot:
    version_added: "2.1"
    description:
    - The name of the snapshot volume
    required: false
notes:
  - Filesystems on top of the volume are not resized.
'''

EXAMPLES = '''
# Create a logical volume of 512m.
- lvol: vg=firefly lv=test size=512
# Create a logical volume of 512g.
- lvol: vg=firefly lv=test size=512g
# Create a logical volume the size of all remaining space in the volume group
- lvol: vg=firefly lv=test size=100%FREE
# Create a logical volume with special options
- lvol: vg=firefly lv=test size=512g opts="-r 16"
# Extend the logical volume to 1024m.
- lvol: vg=firefly lv=test size=1024
# Extend the logical volume to consume all remaining space in the volume group
- lvol: vg=firefly lv=test size=+100%FREE
# Extend the logical volume to take all remaining space of the PVs
- lvol: vg=firefly lv=test size=100%PVS
# Resize the logical volume to % of VG
- lvol: vg-firefly lv=test size=80%VG force=yes
# Reduce the logical volume to 512m
- lvol: vg=firefly lv=test size=512 force=yes
# Remove the logical volume.
- lvol: vg=firefly lv=test state=absent force=yes
# Create a snapshot volume of the test logical volume.
- lvol: vg=firefly lv=test snapshot=snap1 size=100m
'''

import re

decimal_point = re.compile(r"(\d+)")

def mkversion(major, minor, patch):
    return (1000 * 1000 * int(major)) + (1000 * int(minor)) + int(patch)

def parse_lvs(data):
    lvs = []
    for line in data.splitlines():
        parts = line.strip().split(';')
        lvs.append({
            'name': parts[0],
            'size': int(decimal_point.match(parts[1]).group(1))
        })
    return lvs

def parse_vgs(data):
    vgs = []
    for line in data.splitlines():
        parts = line.strip().split(';')
        vgs.append({
            'name': parts[0],
            'size': int(decimal_point.match(parts[1]).group(1)),
            'free': int(decimal_point.match(parts[2]).group(1)),
            'ext_size': int(decimal_point.match(parts[3]).group(1))
        })
    return vgs


def get_lvm_version(module):
    ver_cmd = module.get_bin_path("lvm", required=True)
    rc, out, err = module.run_command("%s version" % (ver_cmd))
    if rc != 0:
        return None
    m = re.search("LVM version:\s+(\d+)\.(\d+)\.(\d+).*(\d{4}-\d{2}-\d{2})", out)
    if not m:
        return None
    return mkversion(m.group(1), m.group(2), m.group(3))


def main():
    module = AnsibleModule(
        argument_spec=dict(
            vg=dict(required=True),
            lv=dict(required=True),
            size=dict(type='str'),
            opts=dict(type='str'),
            state=dict(choices=["absent", "present"], default='present'),
            force=dict(type='bool', default='no'),
            snapshot=dict(type='str', default=None),
        ),
        supports_check_mode=True,
    )

    # Determine if the "--yes" option should be used
    version_found = get_lvm_version(module)
    if version_found == None:
        module.fail_json(msg="Failed to get LVM version number")
    version_yesopt = mkversion(2, 2, 99) # First LVM with the "--yes" option
    if version_found >= version_yesopt:
        yesopt = "--yes"
    else:
        yesopt = ""

    vg = module.params['vg']
    lv = module.params['lv']
    size = module.params['size']
    opts = module.params['opts']
    state = module.params['state']
    force = module.boolean(module.params['force'])
    size_opt = 'L'
    size_unit = 'm'
    snapshot = module.params['snapshot']

    if opts is None:
        opts = ""

    if size:
        # LVCREATE(8) -l --extents option with percentage
        if '%' in size:
            size_parts = size.split('%', 1)
            size_percent = int(size_parts[0])
            if size_percent > 100:
                module.fail_json(msg="Size percentage cannot be larger than 100%")
            size_whole = size_parts[1]
            if size_whole == 'ORIGIN':
                module.fail_json(msg="Snapshot Volumes are not supported")
            elif size_whole not in ['VG', 'PVS', 'FREE']:
                module.fail_json(msg="Specify extents as a percentage of VG|PVS|FREE")
            size_opt = 'l'
            size_unit = ''

        if not '%' in size:
        # LVCREATE(8) -L --size option unit
            if size[-1].lower() in 'bskmgtpe':
               size_unit = size[-1].lower()
               size = size[0:-1]

            try:
               float(size)
               if not size[0].isdigit(): raise ValueError()
            except ValueError:
               module.fail_json(msg="Bad size specification of '%s'" % size)

    # when no unit, megabytes by default
    if size_opt == 'l':
        unit = 'm'
    else:
        unit = size_unit

    # Get information on volume group requested
    vgs_cmd = module.get_bin_path("vgs", required=True)
    rc, current_vgs, err = module.run_command(
        "%s --noheadings -o vg_name,size,free,vg_extent_size --units %s --separator ';' %s" % (vgs_cmd, unit, vg))

    if rc != 0:
        if state == 'absent':
            module.exit_json(changed=False, stdout="Volume group %s does not exist." % vg, stderr=False)
        else:
            module.fail_json(msg="Volume group %s does not exist." % vg, rc=rc, err=err)

    vgs = parse_vgs(current_vgs)
    this_vg = vgs[0]

    # Get information on logical volume requested
    lvs_cmd = module.get_bin_path("lvs", required=True)
    rc, current_lvs, err = module.run_command(
        "%s --noheadings --nosuffix -o lv_name,size --units %s --separator ';' %s" % (lvs_cmd, unit, vg))

    if rc != 0:
        if state == 'absent':
            module.exit_json(changed=False, stdout="Volume group %s does not exist." % vg, stderr=False)
        else:
            module.fail_json(msg="Volume group %s does not exist." % vg, rc=rc, err=err)

    changed = False

    lvs = parse_lvs(current_lvs)

    if snapshot is None:
        check_lv = lv
    else:
        check_lv = snapshot
    for test_lv in lvs:
        if test_lv['name'] == check_lv:
            this_lv = test_lv
            break
    else:
        this_lv = None

    if state == 'present' and not size:
        if this_lv is None:
            module.fail_json(msg="No size given.")
        else:
            module.exit_json(changed=False, vg=vg, lv=this_lv['name'], size=this_lv['size'])

    msg = ''
    if this_lv is None:
        if state == 'present':
            ### create LV
            if module.check_mode:
                changed = True
            else:
                lvcreate_cmd = module.get_bin_path("lvcreate", required=True)
                if snapshot is not None:
                    cmd = "%s %s -%s %s%s -s -n %s %s %s/%s" % (lvcreate_cmd, yesopt, size_opt, size, size_unit, snapshot, opts, vg, lv)
                else:
                    cmd = "%s %s -n %s -%s %s%s %s %s" % (lvcreate_cmd, yesopt, lv, size_opt, size, size_unit, opts, vg)
                rc, _, err = module.run_command(cmd)
                if rc == 0:
                    changed = True
                else:
                    module.fail_json(msg="Creating logical volume '%s' failed" % lv, rc=rc, err=err)
    else:
        if state == 'absent':
            ### remove LV
            if module.check_mode:
                module.exit_json(changed=True)
            if not force:
                module.fail_json(msg="Sorry, no removal of logical volume %s without force=yes." % (this_lv['name']))
            lvremove_cmd = module.get_bin_path("lvremove", required=True)
            rc, _, err = module.run_command("%s --force %s/%s" % (lvremove_cmd, vg, this_lv['name']))
            if rc == 0:
                module.exit_json(changed=True)
            else:
                module.fail_json(msg="Failed to remove logical volume %s" % (lv), rc=rc, err=err)

        elif size_opt == 'l':
            ### Resize LV based on % value
            tool = None
            size_free = this_vg['free']
            if size_whole == 'VG' or size_whole == 'PVS':
                size_requested = size_percent * this_vg['size'] / 100
            else: # size_whole == 'FREE':
                size_requested = size_percent * this_vg['free'] / 100
            if '+' in size:
                size_requested += this_lv['size']
            if this_lv['size'] < size_requested:
                if (size_free > 0)  and (('+' not in size) or (size_free >= (size_requested -  this_lv['size']))): 
                    tool = module.get_bin_path("lvextend", required=True)
                else:
                    module.fail_json(msg="Logical Volume %s could not be extended. Not enough free space left (%s%s required / %s%s available)" % (this_lv['name'], (size_requested -  this_lv['size']), unit, size_free, unit))
            elif this_lv['size'] > size_requested + this_vg['ext_size']:  # more than an extent too large
                if size_requested == 0:
                    module.fail_json(msg="Sorry, no shrinking of %s to 0 permitted." % (this_lv['name']))
                elif not force:
                    module.fail_json(msg="Sorry, no shrinking of %s without force=yes" % (this_lv['name']))
                else:
                    tool = module.get_bin_path("lvreduce", required=True)
                    tool = '%s %s' % (tool, '--force')

            if tool:
                if module.check_mode:
                    changed = True
                else:
                    cmd = "%s -%s %s%s %s/%s" % (tool, size_opt, size, size_unit, vg, this_lv['name'])
                    rc, out, err = module.run_command(cmd)
                    if "Reached maximum COW size" in out:
                        module.fail_json(msg="Unable to resize %s to %s%s" % (lv, size, size_unit), rc=rc, err=err, out=out)
                    elif rc == 0:
                        changed = True
                        msg="Volume %s resized to %s%s" % (this_lv['name'], size_requested, unit)
                    elif "matches existing size" in err:
                        module.exit_json(changed=False, vg=vg, lv=this_lv['name'], size=this_lv['size'])
                    else:
                        module.fail_json(msg="Unable to resize %s to %s%s" % (lv, size, size_unit), rc=rc, err=err)

        else:
            ### resize LV based on absolute values
            tool = None
            if int(size) > this_lv['size']:
                tool = module.get_bin_path("lvextend", required=True)
            elif int(size) < this_lv['size']:
                if int(size) == 0:
                    module.fail_json(msg="Sorry, no shrinking of %s to 0 permitted." % (this_lv['name']))
                if not force:
                    module.fail_json(msg="Sorry, no shrinking of %s without force=yes." % (this_lv['name']))
                else:
                    tool = module.get_bin_path("lvreduce", required=True)
                    tool = '%s %s' % (tool, '--force')

            if tool:
                if module.check_mode:
                    changed = True
                else:
                    cmd = "%s -%s %s%s %s/%s" % (tool, size_opt, size, size_unit, vg, this_lv['name'])
                    rc, out, err = module.run_command(cmd)
                    if "Reached maximum COW size" in out:
                        module.fail_json(msg="Unable to resize %s to %s%s" % (lv, size, size_unit), rc=rc, err=err, out=out)
                    elif rc == 0:
                        changed = True
                    elif "matches existing size" in err:
                        module.exit_json(changed=False, vg=vg, lv=this_lv['name'], size=this_lv['size'])
                    else:
                        module.fail_json(msg="Unable to resize %s to %s%s" % (lv, size, size_unit), rc=rc, err=err)

    module.exit_json(changed=changed, msg=msg)

# import module snippets
from ansible.module_utils.basic import *

if __name__ == '__main__':
    main()
070701001203E0000081A40000000000000000000000015BD0D1D20000060E000000FD0000000200000000000000000000003D00000000ardana-ansible-8.0+git.1540411858.7223b0a/library/package.py#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) Copyright 2017 SUSE LLC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# his program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

DOCUMENTATION = '''
---
module: package
short_description: Backport of Ansible 2.0.x 'package' module to 1.9.x
description:
    - Generic OS package manager
options:
  name:
    description:
      - Package name, or package specifier with version, like name-1.0.
        Be aware that packages are not always named the same and this module
        will not 'translate' them per distro.
    required: true
  state:
    description:
      - Whether to install (present, latest), or remove (absent) a package.
    required: true

author: Michael Tupitsyn <mtupitsyn@suse.com>
'''


EXAMPLES = '''
- name: install the latest version of ntpdate
  package:
    name: ntpdate
    state: latest

# This uses a variable as this changes per distribution.
- name: remove the apache package
  package:
    name: "{{ apache }}"
    state: absent
'''

070701001203DB000081A40000000000000000000000015BD0D1D2000006C4000000FD0000000200000000000000000000003E00000000ardana-ansible-8.0+git.1540411858.7223b0a/library/rpm_list.py#!/usr/bin/env python
#
# An Ansible module to query rpm for the list of installed packages.
#
# (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.

DOCUMENTATION = '''
---
module: rpm_list
author: Kent Wu
short_description: RPM queries for list of installed packages.
description:
    - Using rpm to get the list of installed packages.
      That list of packages is written to the fact: installed_pkgs
options:
    Currently no options.
'''

EXAMPLES = '''
- rpm_list:
'''

import subprocess


def get_installed_pkgs(module):
    rpm_query_bin = module.get_bin_path('rpm')
    cmd = [rpm_query_bin, '-qa', "--qf", "%{NAME} %{VERSION}-%{RELEASE}\n"]
    output = subprocess.check_output(cmd).splitlines()
    installed_pkgs = {}

    for line in output:
        (pkg, version) = line.split()
        installed_pkgs[pkg] = {"Version": version}

    return installed_pkgs


def main():

    module = AnsibleModule(argument_spec=dict())
    installed_pkgs = get_installed_pkgs(module)
    changed = False
    ansible_facts_dict = dict(installed_pkgs=installed_pkgs)
    result = dict(changed=changed, ansible_facts=ansible_facts_dict)
    module.exit_json(**result)

from ansible.module_utils.basic import *
main()
070701001203E4000081A40000000000000000000000015BD0D1D20000E2BD000000FD0000000200000000000000000000003D00000000ardana-ansible-8.0+git.1540411858.7223b0a/library/service.py#!/usr/bin/python
# -*- coding: utf-8 -*-

# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible.  If not, see <http://www.gnu.org/licenses/>.

DOCUMENTATION = '''
---
module: service
author: Michael DeHaan
version_added: "0.1"
short_description:  Manage services.
description:
    - Controls services on remote hosts. Supported init systems include BSD init,
      OpenRC, SysV, Solaris SMF, systemd, upstart.
options:
    name:
        required: true
        description:
        - Name of the service.
    state:
        required: false
        choices: [ started, stopped, restarted, reloaded ]
        description:
          - C(started)/C(stopped) are idempotent actions that will not run
            commands unless necessary.  C(restarted) will always bounce the
            service.  C(reloaded) will always reload. B(At least one of state
            and enabled are required.)
    sleep:
        required: false
        version_added: "1.3"
        description:
        - If the service is being C(restarted) then sleep this many seconds
          between the stop and start command. This helps to workaround badly
          behaving init scripts that exit immediately after signaling a process
          to stop.
    pattern:
        required: false
        version_added: "0.7"
        description:
        - If the service does not respond to the status command, name a
          substring to look for as would be found in the output of the I(ps)
          command as a stand-in for a status result.  If the string is found,
          the service will be assumed to be running.
    enabled:
        required: false
        choices: [ "yes", "no" ]
        description:
        - Whether the service should start on boot. B(At least one of state and
          enabled are required.)

    runlevel:
        required: false
        default: 'default'
        description:
        - "For OpenRC init scripts (ex: Gentoo) only.  The runlevel that this service belongs to."
    arguments:
        description:
        - Additional arguments provided on the command line
        aliases: [ 'args' ]
'''

EXAMPLES = '''
# Example action to start service httpd, if not running
- service: name=httpd state=started

# Example action to stop service httpd, if running
- service: name=httpd state=stopped

# Example action to restart service httpd, in all cases
- service: name=httpd state=restarted

# Example action to reload service httpd, in all cases
- service: name=httpd state=reloaded

# Example action to enable service httpd, and not touch the running state
- service: name=httpd enabled=yes

# Example action to start service foo, based on running process /usr/bin/foo
- service: name=foo pattern=/usr/bin/foo state=started

# Example action to restart network service for interface eth0
- service: name=network state=restarted args=eth0
'''

import platform
import os
import re
import tempfile
import shlex
import select
import time
import string
import glob

# The distutils module is not shipped with SUNWPython on Solaris.
# It's in the SUNWPython-devel package which also contains development files
# that don't belong on production boxes.  Since our Solaris code doesn't
# depend on LooseVersion, do not import it on Solaris.
if platform.system() != 'SunOS':
    from distutils.version import LooseVersion

class Service(object):
    """
    This is the generic Service manipulation class that is subclassed
    based on platform.

    A subclass should override the following action methods:-
      - get_service_tools
      - service_enable
      - get_service_status
      - service_control

    All subclasses MUST define platform and distribution (which may be None).
    """

    platform = 'Generic'
    distribution = None

    def __new__(cls, *args, **kwargs):
        return load_platform_subclass(Service, args, kwargs)

    def __init__(self, module):
        self.module         = module
        self.name           = module.params['name']
        self.state          = module.params['state']
        self.sleep          = module.params['sleep']
        self.pattern        = module.params['pattern']
        self.enable         = module.params['enabled']
        self.runlevel       = module.params['runlevel']
        self.changed        = False
        self.running        = None
        self.crashed        = None
        self.action         = None
        self.svc_cmd        = None
        self.svc_initscript = None
        self.svc_initctl    = None
        self.enable_cmd     = None
        self.arguments      = module.params.get('arguments', '')
        self.rcconf_file    = None
        self.rcconf_key     = None
        self.rcconf_value   = None
        self.svc_change     = False

        # select whether we dump additional debug info through syslog
        self.syslogging = False

    # ===========================================
    # Platform specific methods (must be replaced by subclass).

    def get_service_tools(self):
        self.module.fail_json(msg="get_service_tools not implemented on target platform")

    def service_enable(self):
        self.module.fail_json(msg="service_enable not implemented on target platform")

    def get_service_status(self):
        self.module.fail_json(msg="get_service_status not implemented on target platform")

    def service_control(self):
        self.module.fail_json(msg="service_control not implemented on target platform")

    # ===========================================
    # Generic methods that should be used on all platforms.

    def execute_command(self, cmd, daemonize=False):
        if self.syslogging:
            syslog.openlog('ansible-%s' % os.path.basename(__file__))
            syslog.syslog(syslog.LOG_NOTICE, 'Command %s, daemonize %r' % (cmd, daemonize))

        # Most things don't need to be daemonized
        if not daemonize:
            return self.module.run_command(cmd)

        def check_pid_finished(pid):
            try:
                # signal 0 doesn't affect the process
                os.kill(pid, 0)
            except OSError as exc:
                if err.errno == errno.ESRCH:
                    # ESRCH == No such process
                    return True
                raise
            else:
                return False

        # This is complex because daemonization is hard for people.
        # What we do is daemonize a part of this module, the daemon runs the
        # command, picks up the return code and output, and returns it to the
        # main process.
        pipe = os.pipe()
        pid = os.fork()
        if pid == 0:
            os.close(pipe[0])
            # Set stdin/stdout/stderr to /dev/null
            fd = os.open(os.devnull, os.O_RDWR)
            if fd != 0:
                os.dup2(fd, 0)
            if fd != 1:
                os.dup2(fd, 1)
            if fd != 2:
                os.dup2(fd, 2)
            if fd not in (0, 1, 2):
                os.close(fd)

            # Make us a daemon. Yes, that's all it takes.
            pid = os.fork()
            if pid > 0:
                os._exit(0)
            os.setsid()
            os.chdir("/")
            pid = os.fork()
            if pid > 0:
                os._exit(0)

            # Start the command
            if isinstance(cmd, basestring):
                cmd = shlex.split(cmd)
            p = subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
            stdout = ""
            stderr = ""
            fds = [p.stdout, p.stderr]
            # Wait for all output, or until the main process is dead and its output is done.
            timeout = 1
            while fds:
                rfd, wfd, efd = select.select(fds, [], fds, timeout)
                if p.stdout in rfd:
                    dat = os.read(p.stdout.fileno(), 4096)
                    if not dat:
                        fds.remove(p.stdout)
                    stdout += dat
                if p.stderr in rfd:
                    dat = os.read(p.stderr.fileno(), 4096)
                    if not dat:
                        fds.remove(p.stderr)
                    stderr += dat

                # Has the child process exited?
                if p.poll() is not None:
                    if not fds or timeout == 0:
                        break

                    # Call select one more time with a zero timeout to be
                    # certain not to miss anything that may have been written
                    # to stdout/stderr between the time select() was called
                    # and learned that process has finished
                    timeout = 0

                # if the process has not yet exited, but already read EOF
                # from it's stdout/stderr (and thus removed both from fds)
                # can just wait for it to exit.
                elif not fds:
                    p.wait()
                    break

            # Return a JSON blob to parent
            os.write(pipe[1], json.dumps([p.returncode, stdout, stderr]))
            os.fsync(pipe[1])
            os.close(pipe[1])
            os._exit(0)
        elif pid == -1:
            self.module.fail_json(msg="unable to fork")
        else:
            os.close(pipe[1])
            # Wait for data from daemon process and process it.
            data = ""
            fds = [pipe[0]]
            timeout = 1
            while fds:
                rfd, wfd, efd = select.select(fds, [], fds, timeout)
                if pipe[0] in rfd:
                    dat = os.read(pipe[0], 4096)
                    if not dat:
                        fds.remove(pipe[0])
                    data += dat

                # Has the daemonized process exited?
                if check_pid_finished(pid):
                    if not fds or timeout == 0:
                        break

                    # Call select one more time with a zero timeout to be
                    # certain not to miss anything that may have been written
                    # to pipe[0] between the time select() was called and
                    # learned that the process has finished
                    timeout = 0

                # if the process has not yet exited, but already read EOF
                # from pipe[0] (and thus removed both from fds)
                # can just wait for it to exit.
                elif not fds:
                    os.waitpid(pid, 0)
                    break

            return json.loads(data)

    def check_ps(self):
        # Set ps flags
        if platform.system() == 'SunOS':
            psflags = '-ef'
        else:
            psflags = 'auxww'

        # Find ps binary
        psbin = self.module.get_bin_path('ps', True)

        (rc, psout, pserr) = self.execute_command('%s %s' % (psbin, psflags))
        # If rc is 0, set running as appropriate
        if rc == 0:
            self.running = False
            lines = psout.split("\n")
            for line in lines:
                if self.pattern in line and not "pattern=" in line:
                    # so as to not confuse ./hacking/test-module
                    self.running = True
                    break

    def check_service_changed(self):
        if self.state and self.running is None:
            self.module.fail_json(msg="failed determining service state, possible typo of service name?")
        # Find out if state has changed
        if not self.running and self.state in ["started", "running", "reloaded"]:
            self.svc_change = True
        elif self.running and self.state in ["stopped","reloaded"]:
            self.svc_change = True
        elif self.state == "restarted":
            self.svc_change = True
        if self.module.check_mode and self.svc_change:
            self.module.exit_json(changed=True, msg='service state changed')

    def modify_service_state(self):

        # Only do something if state will change
        if self.svc_change:
            # Control service
            if self.state in ['started', 'running']:
                self.action = "start"
            elif not self.running and self.state == 'reloaded':
                self.action = "start"
            elif self.state == 'stopped':
                self.action = "stop"
            elif self.state == 'reloaded':
                self.action = "reload"
            elif self.state == 'restarted':
                self.action = "restart"

            if self.module.check_mode:
                self.module.exit_json(changed=True, msg='changing service state')

            return self.service_control()

        else:
            # If nothing needs to change just say all is well
            rc = 0
            err = ''
            out = ''
            return rc, out, err

    def service_enable_rcconf(self):
        if self.rcconf_file is None or self.rcconf_key is None or self.rcconf_value is None:
            self.module.fail_json(msg="service_enable_rcconf() requires rcconf_file, rcconf_key and rcconf_value")

        self.changed = None
        entry = '%s="%s"\n' % (self.rcconf_key, self.rcconf_value)
        RCFILE = open(self.rcconf_file, "r")
        new_rc_conf = []

        # Build a list containing the possibly modified file.
        for rcline in RCFILE:
            # Parse line removing whitespaces, quotes, etc.
            rcarray = shlex.split(rcline, comments=True)
            if len(rcarray) >= 1 and '=' in rcarray[0]:
                (key, value) = rcarray[0].split("=", 1)
                if key == self.rcconf_key:
                    if value.upper() == self.rcconf_value:
                        # Since the proper entry already exists we can stop iterating.
                        self.changed = False
                        break
                    else:
                        # We found the key but the value is wrong, replace with new entry.
                        rcline = entry
                        self.changed = True

            # Add line to the list.
            new_rc_conf.append(rcline)

        # We are done with reading the current rc.conf, close it.
        RCFILE.close()

        # If we did not see any trace of our entry we need to add it.
        if self.changed is None:
            new_rc_conf.append(entry)
            self.changed = True

        if self.changed is True:

            if self.module.check_mode:
                self.module.exit_json(changed=True, msg="changing service enablement")

            # Create a temporary file next to the current rc.conf (so we stay on the same filesystem).
            # This way the replacement operation is atomic.
            rcconf_dir = os.path.dirname(self.rcconf_file)
            rcconf_base = os.path.basename(self.rcconf_file)
            (TMP_RCCONF, tmp_rcconf_file) = tempfile.mkstemp(dir=rcconf_dir, prefix="%s-" % rcconf_base)

            # Write out the contents of the list into our temporary file.
            for rcline in new_rc_conf:
                os.write(TMP_RCCONF, rcline)

            # Close temporary file.
            os.close(TMP_RCCONF)

            # Replace previous rc.conf.
            self.module.atomic_move(tmp_rcconf_file, self.rcconf_file)

# ===========================================
# Subclass: Linux

class LinuxService(Service):
    """
    This is the Linux Service manipulation class - it is currently supporting
    a mixture of binaries and init scripts for controlling services started at
    boot, as well as for controlling the current state.
    """

    platform = 'Linux'
    distribution = None

    def get_service_tools(self):

        paths = [ '/sbin', '/usr/sbin', '/bin', '/usr/bin' ]
        binaries = [ 'service', 'chkconfig', 'update-rc.d', 'rc-service', 'rc-update', 'initctl', 'systemctl', 'start', 'stop', 'restart', 'insserv' ]
        initpaths = [ '/etc/init.d' ]
        location = dict()

        for binary in binaries:
            location[binary] = self.module.get_bin_path(binary)

        for initdir in initpaths:
            initscript = "%s/%s" % (initdir,self.name)
            if os.path.isfile(initscript):
                self.svc_initscript = initscript

        def check_systemd():
            # verify systemd is installed (by finding systemctl)
            if not location.get('systemctl', False):
                return False

            systemd_enabled = False
            # Check if init is the systemd command, using comm as cmdline could be symlink
            try:
                f = open('/proc/1/comm', 'r')
            except IOError, err:
                # If comm doesn't exist, old kernel, no systemd
                return False

            for line in f:
                if 'systemd' in line:
                    return True

            return False

        # Locate a tool to enable/disable a service
        if location.get('systemctl',False) and check_systemd():
            # service is managed by systemd
            self.__systemd_unit = self.name
            self.svc_cmd = location['systemctl']
            self.enable_cmd = location['systemctl']

        elif location.get('initctl', False) and os.path.exists("/etc/init/%s.conf" % self.name):
            # service is managed by upstart
            self.enable_cmd = location['initctl']
            # set the upstart version based on the output of 'initctl version'
            self.upstart_version = LooseVersion('0.0.0')
            try:
                version_re = re.compile(r'\(upstart (.*)\)')
                rc,stdout,stderr = self.module.run_command('initctl version')
                if rc == 0:
                    res = version_re.search(stdout)
                    if res:
                        self.upstart_version = LooseVersion(res.groups()[0])
            except:
                pass  # we'll use the default of 0.0.0

            if location.get('start', False):
                # upstart -- rather than being managed by one command, start/stop/restart are actual commands
                self.svc_cmd = ''

        elif location.get('rc-service', False):
            # service is managed by OpenRC
            self.svc_cmd = location['rc-service']
            self.enable_cmd = location['rc-update']
            return # already have service start/stop tool too!

        elif self.svc_initscript:
            # service is managed by with SysV init scripts
            if location.get('update-rc.d', False):
                # and uses update-rc.d
                self.enable_cmd = location['update-rc.d']
            elif location.get('insserv', None):
                # and uses insserv
                self.enable_cmd = location['insserv']
            elif location.get('chkconfig', False):
                # and uses chkconfig
                self.enable_cmd = location['chkconfig']

        if self.enable_cmd is None:
            self.module.fail_json(msg="no service or tool found for: %s" % self.name)

        # If no service control tool selected yet, try to see if 'service' is available
        if self.svc_cmd is None and location.get('service', False):
            self.svc_cmd = location['service']

        # couldn't find anything yet
        if self.svc_cmd is None and not self.svc_initscript:
            self.module.fail_json(msg='cannot find \'service\' binary or init script for service,  possible typo in service name?, aborting')

        if location.get('initctl', False):
            self.svc_initctl = location['initctl']

    def get_systemd_service_enabled(self):
        (rc, out, err) = self.execute_command("%s is-enabled %s" % (self.enable_cmd, self.__systemd_unit,))
        if rc == 0:
            return True
        return False

    def get_systemd_status_dict(self):
        (rc, out, err) = self.execute_command("%s show %s" % (self.enable_cmd, self.__systemd_unit,))
        if rc != 0:
            self.module.fail_json(msg='failure %d running systemctl show for %r: %s' % (rc, self.__systemd_unit, err))
        key = None
        value_buffer = []
        status_dict = {}
        for line in out.splitlines():
            if not key:
                key, value = line.split('=', 1)
                # systemd fields that are shell commands can be multi-line
                # We take a value that begins with a "{" as the start of
                # a shell command and a line that ends with "}" as the end of
                # the command
                if value.lstrip().startswith('{'):
                    if value.rstrip().endswith('}'):
                        status_dict[key] = value
                        key = None
                    else:
                        value_buffer.append(value)
                else:
                    status_dict[key] = value
                    key = None
            else:
                if line.rstrip().endswith('}'):
                    status_dict[key] = '\n'.join(value_buffer)
                    key = None
                else:
                    value_buffer.append(value)

        return status_dict

    def get_systemd_service_status(self):
        d = self.get_systemd_status_dict()
        if d.get('ActiveState') == 'active':
            # run-once services (for which a single successful exit indicates
            # that they are running as designed) should not be restarted here.
            # Thus, we are not checking d['SubState'].
            self.running = True
            self.crashed = False
        elif d.get('ActiveState') == 'failed':
            self.running = False
            self.crashed = True
        elif d.get('ActiveState') is None:
            self.module.fail_json(msg='No ActiveState value in systemctl show output for %r' % (self.__systemd_unit,))
        else:
            self.running = False
            self.crashed = False
        return self.running

    def get_service_status(self):
        if self.svc_cmd and self.svc_cmd.endswith('systemctl'):
            return self.get_systemd_service_status()

        self.action = "status"
        rc, status_stdout, status_stderr = self.service_control()

        # if we have decided the service is managed by upstart, we check for some additional output...
        if self.svc_initctl and self.running is None:
            # check the job status by upstart response
            initctl_rc, initctl_status_stdout, initctl_status_stderr = self.execute_command("%s status %s" % (self.svc_initctl, self.name))
            if "stop/waiting" in initctl_status_stdout:
                self.running = False
            elif "start/running" in initctl_status_stdout:
                self.running = True

        if self.svc_cmd and self.svc_cmd.endswith("rc-service") and self.running is None:
            openrc_rc, openrc_status_stdout, openrc_status_stderr = self.execute_command("%s %s status" % (self.svc_cmd, self.name))
            self.running = "started" in openrc_status_stdout
            self.crashed = "crashed" in openrc_status_stderr

        # if the job status is still not known check it by status output keywords
        # Only check keywords if there's only one line of output (some init
        # scripts will output verbosely in case of error and those can emit
        # keywords that are picked up as false positives
        if self.running is None and status_stdout.count('\n') <= 1:
            # first transform the status output that could irritate keyword matching
            cleanout = status_stdout.lower().replace(self.name.lower(), '')
            if "stop" in cleanout:
                self.running = False
            elif "run" in cleanout and "not" in cleanout:
                self.running = False
            elif "run" in cleanout and "not" not in cleanout:
                self.running = True
            elif "start" in cleanout and "not" not in cleanout:
                self.running = True
            elif 'could not access pid file' in cleanout:
                self.running = False
            elif 'is dead and pid file exists' in cleanout:
                self.running = False
            elif 'dead but subsys locked' in cleanout:
                self.running = False
            elif 'dead but pid file exists' in cleanout:
                self.running = False

        # if the job status is still not known check it by response code
        # For reference, see:
        # http://refspecs.linuxbase.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
        if self.running is None:
            if rc in [1, 2, 3, 4, 69]:
                self.running = False
            elif rc == 0:
                self.running = True

        # if the job status is still not known check it by special conditions
        if self.running is None:
            if self.name == 'iptables' and "ACCEPT" in status_stdout:
                # iptables status command output is lame
                # TODO: lookup if we can use a return code for this instead?
                self.running = True

        return self.running


    def service_enable(self):

        if self.enable_cmd is None:
            self.module.fail_json(msg='cannot detect command to enable service %s, typo or init system potentially unknown' % self.name)

        self.changed = True
        action = None

        #
        # Upstart's initctl
        #
        if self.enable_cmd.endswith("initctl"):
            def write_to_override_file(file_name, file_contents, ):
                override_file = open(file_name, 'w')
                override_file.write(file_contents)
                override_file.close()

            initpath = '/etc/init'
            if self.upstart_version >= LooseVersion('0.6.7'):
                manreg = re.compile('^manual\s*$', re.M | re.I)
                config_line = 'manual\n'
            else:
                manreg = re.compile('^start on manual\s*$', re.M | re.I)
                config_line = 'start on manual\n'
            conf_file_name = "%s/%s.conf" % (initpath, self.name)
            override_file_name = "%s/%s.override" % (initpath, self.name)

            # Check to see if files contain the manual line in .conf and fail if True
            if manreg.search(open(conf_file_name).read()):
                self.module.fail_json(msg="manual stanza not supported in a .conf file")

            self.changed = False
            if os.path.exists(override_file_name):
                override_file_contents = open(override_file_name).read()
                # Remove manual stanza if present and service enabled
                if self.enable and manreg.search(override_file_contents):
                    self.changed = True
                    override_state = manreg.sub('', override_file_contents)
                # Add manual stanza if not present and service disabled
                elif not (self.enable) and not (manreg.search(override_file_contents)):
                    self.changed = True
                    override_state = '\n'.join((override_file_contents, config_line))
                # service already in desired state
                else:
                    pass
            # Add file with manual stanza if service disabled
            elif not (self.enable):
                self.changed = True
                override_state = config_line
            else:
                # service already in desired state
                pass

            if self.module.check_mode:
                self.module.exit_json(changed=self.changed)

            # The initctl method of enabling and disabling services is much
            # different than for the other service methods.  So actually
            # committing the change is done in this conditional and then we
            # skip the boilerplate at the bottom of the method
            if self.changed:
                try:
                    write_to_override_file(override_file_name, override_state)
                except:
                    self.module.fail_json(msg='Could not modify override file')

            return

        #
        # SysV's chkconfig
        #
        if self.enable_cmd.endswith("chkconfig"):
            if self.enable:
                action = 'on'
            else:
                action = 'off'

            (rc, out, err) = self.execute_command("%s --list %s" % (self.enable_cmd, self.name))
            if 'chkconfig --add %s' % self.name in err:
                self.execute_command("%s --add %s" % (self.enable_cmd, self.name))
                (rc, out, err) = self.execute_command("%s --list %s" % (self.enable_cmd, self.name))
            if not self.name in out:
                self.module.fail_json(msg="service %s does not support chkconfig" % self.name)
            state = out.split()[-1]

            # Check if we're already in the correct state
            if "3:%s" % action in out and "5:%s" % action in out:
                self.changed = False
                return

        #
        # Systemd's systemctl
        #
        if self.enable_cmd.endswith("systemctl"):
            if self.enable:
                action = 'enable'
            else:
                action = 'disable'

            # Check if we're already in the correct state
            service_enabled = self.get_systemd_service_enabled()

            # self.changed should already be true
            if self.enable == service_enabled:
                self.changed = False
                return

        #
        # OpenRC's rc-update
        #
        if self.enable_cmd.endswith("rc-update"):
            if self.enable:
                action = 'add'
            else:
                action = 'delete'

            (rc, out, err) = self.execute_command("%s show" % self.enable_cmd)
            for line in out.splitlines():
                service_name, runlevels = line.split('|')
                service_name = service_name.strip()
                if service_name != self.name:
                    continue
                runlevels = re.split(r'\s+', runlevels)
                # service already enabled for the runlevel
                if self.enable and self.runlevel in runlevels:
                    self.changed = False
                # service already disabled for the runlevel
                elif not self.enable and self.runlevel not in runlevels:
                    self.changed = False
                break
            else:
                # service already disabled altogether
                if not self.enable:
                    self.changed = False

            if not self.changed:
                return

        #
        # update-rc.d style
        #
        if self.enable_cmd.endswith("update-rc.d"):

            enabled = False
            slinks = glob.glob('/etc/rc?.d/S??' + self.name)
            if slinks:
                enabled = True

            if self.enable != enabled:
                self.changed = True

                if self.enable:
                    action = 'enable'
                    klinks = glob.glob('/etc/rc?.d/K??' + self.name)
                    if not klinks:
                        (rc, out, err) = self.execute_command("%s %s defaults"  % (self.enable_cmd, self.name))
                        if rc != 0:
                            if err:
                                self.module.fail_json(msg=err)
                            else:
                                self.module.fail_json(msg=out) % (self.enable_cmd, self.name, action)
                else:
                    action = 'disable'

                (rc, out, err) = self.execute_command("%s %s %s"  % (self.enable_cmd, self.name, action))
                if rc != 0:
                    if err:
                        self.module.fail_json(msg=err)
                    else:
                        self.module.fail_json(msg=out) % (self.enable_cmd, self.name, action)
            else:
                self.changed = False

            return

        #
        # insserv (Debian 7)
        #
        if self.enable_cmd.endswith("insserv"):
            if self.enable:
                (rc, out, err) = self.execute_command("%s -n %s" % (self.enable_cmd, self.name))
            else:
                (rc, out, err) = self.execute_command("%s -nr %s" % (self.enable_cmd, self.name))

            self.changed = False
            for line in err.splitlines():
                if self.enable and line.find('enable service') != -1:
                    self.changed = True
                    break
                if not self.enable and line.find('remove service') != -1:
                    self.changed = True
                    break

            if self.module.check_mode:
                self.module.exit_json(changed=self.changed)

            if not self.changed:
                return

            if self.enable:
                (rc, out, err) = self.execute_command("%s %s" % (self.enable_cmd, self.name))
                if (rc != 0) or (err != ''):
                    self.module.fail_json(msg=("Failed to install service. rc: %s, out: %s, err: %s" % (rc, out, err)))
                return (rc, out, err)
            else:
                (rc, out, err) = self.execute_command("%s -r %s" % (self.enable_cmd, self.name))
                if (rc != 0) or (err != ''):
                    self.module.fail_json(msg=("Failed to remove service. rc: %s, out: %s, err: %s" % (rc, out, err)))
                return (rc, out, err)

        #
        # If we've gotten to the end, the service needs to be updated
        #
        self.changed = True

        # we change argument order depending on real binary used:
        # rc-update and systemctl need the argument order reversed

        if self.enable_cmd.endswith("rc-update"):
            args = (self.enable_cmd, action, self.name + " " + self.runlevel)
        elif self.enable_cmd.endswith("systemctl"):
            args = (self.enable_cmd, action, self.__systemd_unit)
        else:
            args = (self.enable_cmd, self.name, action)

        if self.module.check_mode:
            self.module.exit_json(changed=self.changed)

        (rc, out, err) = self.execute_command("%s %s %s" % args)
        if rc != 0:
            if err:
                self.module.fail_json(msg="Error when trying to %s %s: rc=%s %s" % (action, self.name, rc, err))
            else:
                self.module.fail_json(msg="Failure for %s %s: rc=%s %s" % (action, self.name, rc, out))

        return (rc, out, err)


    def service_control(self):

        # Decide what command to run
        svc_cmd = ''
        arguments = self.arguments
        if self.svc_cmd:
            if not self.svc_cmd.endswith("systemctl"):
                # SysV and OpenRC take the form <cmd> <name> <action>
                svc_cmd = "%s %s" % (self.svc_cmd, self.name)
            else:
                # systemd commands take the form <cmd> <action> <name>
                svc_cmd = self.svc_cmd
                arguments = "%s %s" % (self.__systemd_unit, arguments)
        elif self.svc_cmd is None and self.svc_initscript:
            # upstart
            svc_cmd = "%s" % self.svc_initscript

        # In OpenRC, if a service crashed, we need to reset its status to
        # stopped with the zap command, before we can start it back.
        if self.svc_cmd and self.svc_cmd.endswith('rc-service') and self.action == 'start' and self.crashed:
            self.execute_command("%s zap" % svc_cmd, daemonize=True)

        if self.action is not "restart":
            if svc_cmd != '':
                # upstart or systemd or OpenRC
                rc_state, stdout, stderr = self.execute_command("%s %s %s" % (svc_cmd, self.action, arguments), daemonize=True)
            else:
                # SysV
                rc_state, stdout, stderr = self.execute_command("%s %s %s" % (self.action, self.name, arguments), daemonize=True)
        elif self.svc_cmd and self.svc_cmd.endswith('rc-service'):
            # All services in OpenRC support restart.
            rc_state, stdout, stderr = self.execute_command("%s %s %s" % (svc_cmd, self.action, arguments), daemonize=True)
        else:
            # In other systems, not all services support restart. Do it the hard way.
            if svc_cmd != '':
                # upstart or systemd
                rc1, stdout1, stderr1 = self.execute_command("%s %s %s" % (svc_cmd, 'stop', arguments), daemonize=True)
            else:
                # SysV
                rc1, stdout1, stderr1 = self.execute_command("%s %s %s" % ('stop', self.name, arguments), daemonize=True)

            if self.sleep:
                time.sleep(self.sleep)

            if svc_cmd != '':
                # upstart or systemd
                rc2, stdout2, stderr2 = self.execute_command("%s %s %s" % (svc_cmd, 'start', arguments), daemonize=True)
            else:
                # SysV
                rc2, stdout2, stderr2 = self.execute_command("%s %s %s" % ('start', self.name, arguments), daemonize=True)

            # merge return information
            if rc1 != 0 and rc2 == 0:
                rc_state = rc2
                stdout = stdout2
                stderr = stderr2
            else:
                rc_state = rc1 + rc2
                stdout = stdout1 + stdout2
                stderr = stderr1 + stderr2

        return(rc_state, stdout, stderr)

# ===========================================
# Subclass: FreeBSD

class FreeBsdService(Service):
    """
    This is the FreeBSD Service manipulation class - it uses the /etc/rc.conf
    file for controlling services started at boot and the 'service' binary to
    check status and perform direct service manipulation.
    """

    platform = 'FreeBSD'
    distribution = None

    def get_service_tools(self):
        self.svc_cmd = self.module.get_bin_path('service', True)

        if not self.svc_cmd:
            self.module.fail_json(msg='unable to find service binary')

    def get_service_status(self):
        rc, stdout, stderr = self.execute_command("%s %s %s %s" % (self.svc_cmd, self.name, 'onestatus', self.arguments))
        if rc == 1:
            self.running = False
        elif rc == 0:
            self.running = True

    def service_enable(self):
        if self.enable:
            self.rcconf_value = "YES"
        else:
            self.rcconf_value = "NO"

        rcfiles = [ '/etc/rc.conf','/etc/rc.conf.local', '/usr/local/etc/rc.conf' ]
        for rcfile in rcfiles:
            if os.path.isfile(rcfile):
                self.rcconf_file = rcfile

        rc, stdout, stderr = self.execute_command("%s %s %s %s" % (self.svc_cmd, self.name, 'rcvar', self.arguments))
        cmd = "%s %s %s %s" % (self.svc_cmd, self.name, 'rcvar', self.arguments)
        rcvars = shlex.split(stdout, comments=True)

        if not rcvars:
            self.module.fail_json(msg="unable to determine rcvar", stdout=stdout, stderr=stderr)

        # In rare cases, i.e. sendmail, rcvar can return several key=value pairs
        # Usually there is just one, however.  In other rare cases, i.e. uwsgi,
        # rcvar can return extra uncommented data that is not at all related to
        # the rcvar.  We will just take the first key=value pair we come across
        # and hope for the best.
        for rcvar in rcvars:
            if '=' in rcvar:
                self.rcconf_key = rcvar.split('=')[0]
                break

        if self.rcconf_key is None:
            self.module.fail_json(msg="unable to determine rcvar", stdout=stdout, stderr=stderr)

        try:
            return self.service_enable_rcconf()
        except:
            self.module.fail_json(msg='unable to set rcvar')

    def service_control(self):

        if self.action is "start":
            self.action = "onestart"
        if self.action is "stop":
            self.action = "onestop"
        if self.action is "reload":
            self.action = "onereload"

        return self.execute_command("%s %s %s %s" % (self.svc_cmd, self.name, self.action, self.arguments))

# ===========================================
# Subclass: OpenBSD

class OpenBsdService(Service):
    """
    This is the OpenBSD Service manipulation class - it uses rcctl(8) or
    /etc/rc.d scripts for service control. Enabling a service is
    only supported if rcctl is present.
    """

    platform = 'OpenBSD'
    distribution = None

    def get_service_tools(self):
        self.enable_cmd = self.module.get_bin_path('rcctl')

        if self.enable_cmd:
            self.svc_cmd = self.enable_cmd
        else:
            rcdir = '/etc/rc.d'

            rc_script = "%s/%s" % (rcdir, self.name)
            if os.path.isfile(rc_script):
                self.svc_cmd = rc_script

        if not self.svc_cmd:
            self.module.fail_json(msg='unable to find svc_cmd')

    def get_service_status(self):
        if self.enable_cmd:
            rc, stdout, stderr = self.execute_command("%s %s %s" % (self.svc_cmd, 'check', self.name))
        else:
            rc, stdout, stderr = self.execute_command("%s %s" % (self.svc_cmd, 'check'))

        if stderr:
            self.module.fail_json(msg=stderr)

        if rc == 1:
            self.running = False
        elif rc == 0:
            self.running = True

    def service_control(self):
        if self.enable_cmd:
            return self.execute_command("%s -f %s %s" % (self.svc_cmd, self.action, self.name))
        else:
            return self.execute_command("%s -f %s" % (self.svc_cmd, self.action))

    def service_enable(self):
        if not self.enable_cmd:
            return super(OpenBsdService, self).service_enable()

        rc, stdout, stderr = self.execute_command("%s %s %s %s" % (self.enable_cmd, 'getdef', self.name, 'flags'))

        if stderr:
            self.module.fail_json(msg=stderr)

        getdef_string = stdout.rstrip()

        # Depending on the service the string returned from 'default' may be
        # either a set of flags or the boolean YES/NO
        if getdef_string == "YES" or getdef_string == "NO":
            default_flags = ''
        else:
            default_flags = getdef_string

        rc, stdout, stderr = self.execute_command("%s %s %s %s" % (self.enable_cmd, 'get', self.name, 'flags'))

        if stderr:
            self.module.fail_json(msg=stderr)

        get_string = stdout.rstrip()

        # Depending on the service the string returned from 'getdef/get' may be
        # either a set of flags or the boolean YES/NO
        if get_string == "YES" or get_string == "NO":
            current_flags = ''
        else:
            current_flags = get_string

        # If there are arguments from the user we use these as flags unless
        # they are already set.
        if self.arguments and self.arguments != current_flags:
            changed_flags = self.arguments
        # If the user has not supplied any arguments and the current flags
        # differ from the default we reset them.
        elif not self.arguments and current_flags != default_flags:
            changed_flags = ' '
        # Otherwise there is no need to modify flags.
        else:
            changed_flags = ''

        rc, stdout, stderr = self.execute_command("%s %s %s %s" % (self.enable_cmd, 'get', self.name, 'status'))

        if self.enable:
            if rc == 0 and not changed_flags:
                return

            if rc != 0:
                status_action = "set %s status on" % (self.name)
            else:
                status_action = ''
            if changed_flags:
                flags_action = "set %s flags %s" % (self.name, changed_flags)
            else:
                flags_action = ''
        else:
            if rc == 1:
                return

            status_action = "set %s status off" % self.name
            flags_action = ''

        # Verify state assumption
        if not status_action and not flags_action:
            self.module.fail_json(msg="neither status_action or status_flags is set, this should never happen")

        if self.module.check_mode:
            self.module.exit_json(changed=True, msg="changing service enablement")

        status_modified = 0
        if status_action:
            rc, stdout, stderr = self.execute_command("%s %s" % (self.enable_cmd, status_action))

            if rc != 0:
                if stderr:
                    self.module.fail_json(msg=stderr)
                else:
                    self.module.fail_json(msg="rcctl failed to modify service status")

            status_modified = 1

        if flags_action:
            rc, stdout, stderr = self.execute_command("%s %s" % (self.enable_cmd, flags_action))

            if rc != 0:
                if stderr:
                    if status_modified:
                        error_message = "rcctl modified service status but failed to set flags: " + stderr
                    else:
                        error_message = stderr
                else:
                    if status_modified:
                        error_message = "rcctl modified service status but failed to set flags"
                    else:
                        error_message = "rcctl failed to modify service flags"

                self.module.fail_json(msg=error_message)

        self.changed = True

# ===========================================
# Subclass: NetBSD

class NetBsdService(Service):
    """
    This is the NetBSD Service manipulation class - it uses the /etc/rc.conf
    file for controlling services started at boot, check status and perform
    direct service manipulation. Init scripts in /etc/rcd are used for
    controlling services (start/stop) as well as for controlling the current
    state.
    """

    platform = 'NetBSD'
    distribution = None

    def get_service_tools(self):
        initpaths = [ '/etc/rc.d' ]		# better: $rc_directories - how to get in here? Run: sh -c '. /etc/rc.conf ; echo $rc_directories'

        for initdir in initpaths:
            initscript = "%s/%s" % (initdir,self.name)
            if os.path.isfile(initscript):
                self.svc_initscript = initscript

        if not self.svc_initscript:
            self.module.fail_json(msg='unable to find rc.d script')

    def service_enable(self):
        if self.enable:
            self.rcconf_value = "YES"
        else:
            self.rcconf_value = "NO"

        rcfiles = [ '/etc/rc.conf' ]		# Overkill?
        for rcfile in rcfiles:
            if os.path.isfile(rcfile):
                self.rcconf_file = rcfile

        self.rcconf_key = "%s" % string.replace(self.name,"-","_")

        return self.service_enable_rcconf()

    def get_service_status(self):
        self.svc_cmd = "%s" % self.svc_initscript
        rc, stdout, stderr = self.execute_command("%s %s" % (self.svc_cmd, 'onestatus'))
        if rc == 1:
            self.running = False
        elif rc == 0:
            self.running = True

    def service_control(self):
        if self.action is "start":
            self.action = "onestart"
        if self.action is "stop":
            self.action = "onestop"

        self.svc_cmd = "%s" % self.svc_initscript
        return self.execute_command("%s %s" % (self.svc_cmd, self.action), daemonize=True)

# ===========================================
# Subclass: SunOS
class SunOSService(Service):
    """
    This is the SunOS Service manipulation class - it uses the svcadm
    command for controlling services, and svcs command for checking status.
    It also tries to be smart about taking the service out of maintenance
    state if necessary.
    """
    platform = 'SunOS'
    distribution = None

    def get_service_tools(self):
        self.svcs_cmd = self.module.get_bin_path('svcs', True)

        if not self.svcs_cmd:
            self.module.fail_json(msg='unable to find svcs binary')

        self.svcadm_cmd = self.module.get_bin_path('svcadm', True)

        if not self.svcadm_cmd:
            self.module.fail_json(msg='unable to find svcadm binary')

    def get_service_status(self):
        status = self.get_sunos_svcs_status()
        # Only 'online' is considered properly running. Everything else is off
        # or has some sort of problem.
        if status == 'online':
            self.running = True
        else:
            self.running = False

    def get_sunos_svcs_status(self):
        rc, stdout, stderr = self.execute_command("%s %s" % (self.svcs_cmd, self.name))
        if rc == 1:
            if stderr:
                self.module.fail_json(msg=stderr)
            else:
                self.module.fail_json(msg=stdout)

        lines = stdout.rstrip("\n").split("\n")
        status = lines[-1].split(" ")[0]
        # status is one of: online, offline, degraded, disabled, maintenance, uninitialized
        # see man svcs(1)
        return status

    def service_enable(self):
        # Get current service enablement status
        rc, stdout, stderr = self.execute_command("%s -l %s" % (self.svcs_cmd, self.name))

        if rc != 0:
            if stderr:
                self.module.fail_json(msg=stderr)
            else:
                self.module.fail_json(msg=stdout)

        enabled = False
        temporary = False

        # look for enabled line, which could be one of:
        #    enabled   true (temporary)
        #    enabled   false (temporary)
        #    enabled   true
        #    enabled   false
        for line in stdout.split("\n"):
            if line.startswith("enabled"):
                if "true" in line:
                    enabled = True
                if "temporary" in line:
                    temporary = True

        startup_enabled = (enabled and not temporary) or (not enabled and temporary)

        if self.enable and startup_enabled:
            return
        elif (not self.enable) and (not startup_enabled):
            return

        # Mark service as started or stopped (this will have the side effect of
        # actually stopping or starting the service)
        if self.enable:
            subcmd = "enable -rs"
        else:
            subcmd = "disable -s"

        rc, stdout, stderr = self.execute_command("%s %s %s" % (self.svcadm_cmd, subcmd, self.name))

        if rc != 0:
            if stderr:
                self.module.fail_json(msg=stderr)
            else:
                self.module.fail_json(msg=stdout)

        self.changed = True


    def service_control(self):
        status = self.get_sunos_svcs_status()

        # if starting or reloading, clear maintenace states
        if self.action in ['start', 'reload', 'restart'] and status in ['maintenance', 'degraded']:
            rc, stdout, stderr = self.execute_command("%s clear %s" % (self.svcadm_cmd, self.name))
            if rc != 0:
                return rc, stdout, stderr
            status = self.get_sunos_svcs_status()

        if status in ['maintenance', 'degraded']:
            self.module.fail_json(msg="Failed to bring service out of %s status." % status)

        if self.action == 'start':
            subcmd = "enable -rst"
        elif self.action == 'stop':
            subcmd = "disable -st"
        elif self.action == 'reload':
            subcmd = "refresh"
        elif self.action == 'restart' and status == 'online':
            subcmd = "restart"
        elif self.action == 'restart' and status != 'online':
            subcmd = "enable -rst"

        return self.execute_command("%s %s %s" % (self.svcadm_cmd, subcmd, self.name))

# ===========================================
# Subclass: AIX

class AIX(Service):
    """
    This is the AIX Service (SRC) manipulation class - it uses lssrc, startsrc, stopsrc
    and refresh for service control. Enabling a service is currently not supported.
    Would require to add an entry in the /etc/inittab file (mkitab, chitab and rmitab
    commands)
    """

    platform = 'AIX'
    distribution = None

    def get_service_tools(self):
        self.lssrc_cmd = self.module.get_bin_path('lssrc', True)

        if not self.lssrc_cmd:
            self.module.fail_json(msg='unable to find lssrc binary')

        self.startsrc_cmd = self.module.get_bin_path('startsrc', True)

        if not self.startsrc_cmd:
            self.module.fail_json(msg='unable to find startsrc binary')

        self.stopsrc_cmd = self.module.get_bin_path('stopsrc', True)

        if not self.stopsrc_cmd:
            self.module.fail_json(msg='unable to find stopsrc binary')

        self.refresh_cmd = self.module.get_bin_path('refresh', True)

        if not self.refresh_cmd:
            self.module.fail_json(msg='unable to find refresh binary')


    def get_service_status(self):
        status = self.get_aix_src_status()
        # Only 'active' is considered properly running. Everything else is off
        # or has some sort of problem.
        if status == 'active':
            self.running = True
        else:
            self.running = False

    def get_aix_src_status(self):
        rc, stdout, stderr = self.execute_command("%s -s %s" % (self.lssrc_cmd, self.name))
        if rc == 1:
            if stderr:
                self.module.fail_json(msg=stderr)
            else:
                self.module.fail_json(msg=stdout)

        lines = stdout.rstrip("\n").split("\n")
        status = lines[-1].split(" ")[-1]
        # status is one of: active, inoperative
        return status

    def service_control(self):
        if self.action == 'start':
            srccmd = self.startsrc_cmd
        elif self.action == 'stop':
            srccmd = self.stopsrc_cmd
        elif self.action == 'reload':
            srccmd = self.refresh_cmd
        elif self.action == 'restart':
            self.execute_command("%s -s %s" % (self.stopsrc_cmd, self.name))
            srccmd = self.startsrc_cmd

        if self.arguments and self.action == 'start':
            return self.execute_command("%s -a \"%s\" -s %s" % (srccmd, self.arguments, self.name))
        else:
            return self.execute_command("%s -s %s" % (srccmd, self.name))


# ===========================================
# Main control flow

def main():
    module = AnsibleModule(
        argument_spec = dict(
            name = dict(required=True),
            state = dict(choices=['running', 'started', 'stopped', 'restarted', 'reloaded']),
            sleep = dict(required=False, type='int', default=None),
            pattern = dict(required=False, default=None),
            enabled = dict(type='bool'),
            runlevel = dict(required=False, default='default'),
            arguments = dict(aliases=['args'], default=''),
        ),
        supports_check_mode=True
    )
    if module.params['state'] is None and module.params['enabled'] is None:
        module.fail_json(msg="Neither 'state' nor 'enabled' set")

    service = Service(module)

    if service.syslogging:
        syslog.openlog('ansible-%s' % os.path.basename(__file__))
        syslog.syslog(syslog.LOG_NOTICE, 'Service instantiated - platform %s' % service.platform)
        if service.distribution:
            syslog.syslog(syslog.LOG_NOTICE, 'Service instantiated - distribution %s' % service.distribution)

    rc = 0
    out = ''
    err = ''
    result = {}
    result['name'] = service.name

    # Find service management tools
    service.get_service_tools()

    # Enable/disable service startup at boot if requested
    if service.module.params['enabled'] is not None:
        # FIXME: ideally this should detect if we need to toggle the enablement state, though
        # it's unlikely the changed handler would need to fire in this case so it's a minor thing.
        service.service_enable()
        result['enabled'] = service.enable

    if module.params['state'] is None:
        # Not changing the running state, so bail out now.
        result['changed'] = service.changed
        module.exit_json(**result)

    result['state'] = service.state

    # Collect service status
    if service.pattern:
        service.check_ps()
    else:
        service.get_service_status()

    # Calculate if request will change service state
    service.check_service_changed()

    # Modify service state if necessary
    (rc, out, err) = service.modify_service_state()

    if rc != 0:
        if err and "Job is already running" in err:
            # upstart got confused, one such possibility is MySQL on Ubuntu 12.04
            # where status may report it has no start/stop links and we could
            # not get accurate status
            pass
        else:
            if err:
                module.fail_json(msg=err)
            else:
                module.fail_json(msg=out)

    result['changed'] = service.changed | service.svc_change
    if service.module.params['enabled'] is not None:
        result['enabled'] = service.module.params['enabled']

    if not service.module.params['state']:
        status = service.get_service_status()
        if status is None:
            result['state'] = 'absent'
        elif status is False:
            result['state'] = 'started'
        else:
            result['state'] = 'stopped'
    else:
        # as we may have just bounced the service the service command may not
        # report accurate state at this moment so just show what we ran
        if service.module.params['state'] in ['started','restarted','running','reloaded']:
            result['state'] = 'started'
        else:
            result['state'] = 'stopped'

    module.exit_json(**result)

from ansible.module_utils.basic import *
main()
070701001203DE000081ED0000000000000000000000015BD0D1D200000A0F000000FD0000000200000000000000000000004200000000ardana-ansible-8.0+git.1540411858.7223b0a/library/service_restart#!/bin/bash
#
# An Ansible module to disable/enable service restart
#  (including reload,stop and start)
# on apt install/reinstall for upgrade
# available for update.
#
# (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.

DOCUMENTATION = '''
---
module: service_restart
author: Therese McHale
short_description: Disables/Enables any restart type operations for upgrade
description:
    - On disable updates /etc/default/policy.rc.d with the service for which
      restart operations (including reload, stop and start) are to be disabled
    - On enable removes the service from /etc/default/policy.rc.d
options:
    service: <name of service>
    state: <enabled/disabled>
'''

EXAMPLES = '''
- service_restart:
     service: apache2
     state: disabled
'''

FILE="/etc/default/policy-rc.d"
function disable_service
{
  if service --status-all | grep -Fq $service ; then
     if grep -Fq $service $FILE ; then
       changed=false
       msg="$service already disabled"
     else
       sed -i 's/SERVICES="/SERVICES="'$service' /' $FILE
       changed="true"
       msg="Disabled $service"
     fi
  else
     changed="false"
     msg="service doesn't exist: $service"
  fi
}

function enable_service
{
  if service --status-all | grep -Fq $service ; then
     if  grep -Fq $service $FILE ; then
       sed -i 's/'$service' //'\g $FILE
       msg="Enabled $service"
       changed="true"
     else
       msg="$service already disabled"
       changed="false"
     fi
  else
     changed="false"
     msg="service doesn't exist: $service"
  fi
}
source $1
if [ -z "$service" ]; then
   printf '{"failed": "true", "msg": "missing required arguments: service"}'
   exit 1
fi

changed="false"
msg=""
contents=""
case $state in
    enabled)
       enable_service
       ;;
    disabled)
       disable_service
       ;;
    *)
       printf '{"failed": true, "msg": "invalid state: %s"}' "$state"
       exit 1
       ;;
esac
printf '{"changed": "%s", "msg": "%s"}' "$changed" "$msg"

exit 0
070701001203D3000081A40000000000000000000000015BD0D1D2000009CA000000FD0000000200000000000000000000004400000000ardana-ansible-8.0+git.1540411858.7223b0a/library/win_build_url.ps1#!powershell
#
# (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.
#
# WANT_JSON
# POWERSHELL_COMMON

$params = Parse-Args $args

$service = Get-Attr $params "service" $FALSE
if ($service -eq $FALSE)
{
    Fail-Json (New-Object psobject) "missing required argument: service"
}

$conf_path = Get-Attr $params "conf_path" $FALSE
If ($conf_path -eq $FALSE)
{
    Fail-Json (New-Object) "missing required argument: conf_path"
}

$cache_path = Get-Attr $params "cache_path" $FALSE
If ($cache_path -eq $FALSE)
{
    Fail-Json (New-Object) "missing required argument: cache_path"
}

$result = New-Object psobject @{
    changed = $FALSE
    url = ""
    svc_dir = ""
    zip = ""
}

# Reading the packager.conf file to get the http server ip & port

$ip_line = Select-String -pattern "url = " -path "$conf_path/packager.conf"
$ip = $ip_line -replace '.*url = ',''


# Downloading the packages file to get the required venv zip file's name
# this will overwrite the packages file if it already exists and we get the
# latest packages file in case the venvs are updated

Invoke-WebRequest "$ip/hyperv_venv/packages" -OutFile "$cache_path/packages"


$entries = Select-String -pattern "$service-.*\.zip" -path `
                "$cache_path/packages" -AllMatches | % { $_.Matches } | `
                % { $_.Value }

# Getting the latest zip file from all the available files if more
# than one entry for the service exists

$result.zip = ($entries | measure -Maximum).Maximum


$result.url = $ip + "hyperv_venv/" + $result.zip

# Returning the venv's name so that it can be used further in the deployment
# as in copying the service conf files
$result.svc_dir = $result.zip -replace '\.zip',''


If (-Not $ip)
{
    Fail-Json (New-Object psobject) "Could not read the ip from conf file"
}

If (-Not $result.zip)
{
    Fail-Json (New-Object psobject) "Could not read the package name"
}

$result.changed = $TRUE

Exit-Json $result;
070701001203D4000081A40000000000000000000000015BD0D1D200000856000000FD0000000200000000000000000000004300000000ardana-ansible-8.0+git.1540411858.7223b0a/library/win_build_url.py#!/usr/bin/python
#
# (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.
#

DOCUMENTATION = '''
---
module: win_build_url
short_description: Builds the url of the windows virtualenv zip file
                   for the service specified
description:
    - The win_build_url module generates the url of the windows virtualenv
      zip file of the given service from the packager.conf file and the
      packages file. It gives the url of the latest build for a venv if
      multiple entries exist.
options:
  service:
    description:
      - The service name whose virtualenv url needs to be built.
    required: True
    aliases: []
  conf_path:
    description:
      - The path to the directory containing the packager.conf file.
    required: True
    aliases: []
  cache_path:
    description:
      - The path to the cache directory containing packages file.
    required: True
    aliases: []
author: "Usha Devulapalli"
'''

RETURN = '''
url:
    description: The url of the service virtualenv.
    type: string
    sample: "http://192.168.7.9:79/ardana-0.9.0/hyperv_venv/nova-20160101T101530Z.zip"
svc_dir:
    description: The name of the folder for the service.
    type: string
    sample: "nova-20160101T101530Z"
zip:
    description: The name of the venv zip file for the service.
    type: string
    sample: "nova-20160101T101530Z.zip"
'''

EXAMPLES = '''

  - name: building uri
    build_uri:
      service: nova
      conf_path: 'c:\Program Files\Ardana\OpenStack\etc'
      cache_path: 'c:\Program Files\Ardana\OpenStack\cache'
'''
070701001203E7000081A40000000000000000000000015BD0D1D200002FD3000000FD0000000200000000000000000000004500000000ardana-ansible-8.0+git.1540411858.7223b0a/library/win_lineinfile.ps1#!powershell
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible.  If not, see <http://www.gnu.org/licenses/>.

# WANT_JSON
# POWERSHELL_COMMON


# Parse the parameters file dropped by the Ansible machinery

$params = Parse-Args $args;


# Initialize defaults for input parameters.

$dest= Get-Attr $params "dest" $FALSE;
$regexp = Get-Attr $params "regexp" $FALSE;
$state = Get-Attr $params "state" "present";
$line = Get-Attr $params "line" $FALSE;
$backrefs = Get-Attr $params "backrefs" "no";
$insertafter = Get-Attr $params "insertafter" $FALSE;
$insertbefore = Get-Attr $params "insertbefore" $FALSE;
$create = Get-Attr $params "create" "no";
$backup = Get-Attr $params "backup" "no";
$validate = Get-Attr $params "validate" $FALSE;
$encoding = Get-Attr $params "encoding" "auto";
$newline = Get-Attr $params "newline" "windows";


# Parse dest / name /destfile param aliases for compatibility with lineinfile
# and fail if at least one spelling of the parameter is not provided.

$dest = Get-Attr $params "dest" $FALSE;
If ($dest -eq $FALSE) {
    $dest = Get-Attr $params "name" $FALSE;
    If ($dest -eq $FALSE) {
        $dest = Get-Attr $params "destfile" $FALSE;
        If ($dest -eq $FALSE) {
            Fail-Json (New-Object psobject) "missing required argument: dest";
        }
    }
}


# Fail if the destination is not a file

If (Test-Path $dest -pathType container) {
    Fail-Json (New-Object psobject) "destination is a directory";
}


# Write lines to a file using the specified line separator and encoding, 
# performing validation if a validation command was specified.

function WriteLines($outlines, $dest, $linesep, $encodingobj, $validate) {
	$temppath = [System.IO.Path]::GetTempFileName();
	$joined = $outlines -join $linesep;
	[System.IO.File]::WriteAllText($temppath, $joined, $encodingobj);
	
	If ($validate -ne $FALSE) {
		
		If (!($validate -like "*%s*")) {
			Fail-Json (New-Object psobject) "validate must contain %s: $validate";
		}

		$validate = $validate.Replace("%s", $temppath);		
		
		$parts = [System.Collections.ArrayList] $validate.Split(" ");
		$cmdname = $parts[0];
		
		$cmdargs = $validate.Substring($cmdname.Length + 1);
		
		$process = [Diagnostics.Process]::Start($cmdname, $cmdargs);
		$process.WaitForExit();
		
		If ($process.ExitCode -ne 0) {
			[string] $output = $process.StandardOutput.ReadToEnd();
			[string] $error = $process.StandardError.ReadToEnd();
			Remove-Item $temppath -force;
			Fail-Json (New-Object psobject) "failed to validate $cmdname $cmdargs with error: $output $error";
		}

	}
	
	# Commit changes to the destination file
	$cleandest = $dest.Replace("/", "\");
	Copy-Item $temppath $cleandest -force;	
	Remove-Item $temppath -force;
}


# Backup the file specified with a date/time filename

function BackupFile($path) {
	$backuppath = $path + "." + [DateTime]::Now.ToString("yyyyMMdd-HHmmss");
	Copy-Item $path $backuppath;
	return $backuppath;
}



# Implement the functionality for state == 'present'

function Present($dest, $regexp, $line, $insertafter, $insertbefore, $create, $backup, $backrefs, $validate, $encodingobj, $linesep) {

	# Note that we have to clean up the dest path because ansible wants to treat / and \ as 
	# interchangable in windows pathnames, but .NET framework internals do not support that.
	$cleandest = $dest.Replace("/", "\");

	# Check if destination exists. If it does not exist, either create it if create == "yes"
	# was specified or fail with a reasonable error message.
	If (!(Test-Path $dest)) {
		If ($create -eq "no") {
			Fail-Json (New-Object psobject) "Destination $dest does not exist !";
		}
		# Create new empty file, using the specified encoding to write correct BOM
		[System.IO.File]::WriteAllLines($cleandest, "", $encodingobj);
	}

	# Read the dest file lines using the indicated encoding into a mutable ArrayList.
    $content = [System.IO.File]::ReadAllLines($cleandest, $encodingobj);
    If ($content -eq $null) {
		$lines = New-Object System.Collections.ArrayList;
	}
	Else {
		$lines = [System.Collections.ArrayList] $content;
	}
	
	# Compile the regex specified, if provided
	$mre = $FALSE;
	If ($regexp -ne $FALSE) {
		$mre = New-Object Regex $regexp, 'Compiled';
	}
	
	# Compile the regex for insertafter or insertbefore, if provided
	$insre = $FALSE;
	
	If ($insertafter -ne $FALSE -and $insertafter -ne "BOF" -and $insertafter -ne "EOF") {
		$insre = New-Object Regex $insertafter, 'Compiled';
	}
	ElseIf ($insertbefore -ne $FALSE -and $insertbefore -ne "BOF") {
		$insre = New-Object Regex $insertbefore, 'Compiled';
	}

    # index[0] is the line num where regexp has been found
    # index[1] is the line num where insertafter/inserbefore has been found
	$index = -1, -1;
	$lineno = 0;
	
	# The latest match object and matched line
	$matched_line = "";
	$m = $FALSE;

	# Iterate through the lines in the file looking for matches
	Foreach ($cur_line in $lines) {
		If ($regexp -ne $FALSE) {
			$m = $mre.Match($cur_line);
			$match_found = $m.Success;
			If ($match_found) {
				$matched_line = $cur_line;
			}
		}
		Else {
			$match_found = $line -ceq $cur_line;
		}
		If ($match_found) {
			$index[0] = $lineno;
		}
		ElseIf ($insre -ne $FALSE -and $insre.Match($cur_line).Success) {
			If ($insertafter -ne $FALSE) {
				$index[1] = $lineno + 1;
			}
			If ($insertbefore -ne $FALSE) {
				$index[1] = $lineno;
			}	
		}
		$lineno = $lineno + 1;
	}
	
	$changed = $FALSE;
	$msg = "";

	If ($index[0] -ne -1) {
		If ($backrefs -ne "no") {
		    $new_line = [regex]::Replace($matched_line, $regexp, $line);
		}
		Else {
			$new_line = $line;
		}
		If ($lines[$index[0]] -cne $new_line) {
			$lines[$index[0]] = $new_line;
			$msg = "line replaced";
			$changed = $TRUE;
		}
	}
	ElseIf ($backrefs -ne "no") {
		# No matches - no-op
	}
	ElseIf ($insertbefore -eq "BOF" -or $insertafter -eq "BOF") {
		$lines.Insert(0, $line);
		$msg = "line added";
		$changed = $TRUE;
	}
	ElseIf ($insertafter -eq "EOF" -or $index[1] -eq -1) {
		$lines.Add($line);
		$msg = "line added";
		$changed = $TRUE;
	}
	Else {
		$lines.Insert($index[1], $line);
		$msg = "line added";
		$changed = $TRUE;
	}

	# Write backup file if backup == "yes"
    $backupdest = "";

	If ($changed -eq $TRUE -and $backup -eq "yes") {
		$backupdest = BackupFile $dest;
	}
	
	# Write changes to the destination file if changes were made
	If ($changed) {
		WriteLines $lines $dest $linesep $encodingobj $validate;
	}

	$encodingstr = $encodingobj.WebName;

	# Return result information
	$result = New-Object psobject @{
    	changed = $changed
		msg = $msg
		backup = $backupdest
		encoding = $encodingstr
	}
	
	Exit-Json $result;
}


# Implement the functionality for state == 'absent'

function Absent($dest, $regexp, $line, $backup, $validate, $encodingobj, $linesep) {

	# Check if destination exists. If it does not exist, fail with a reasonable error message.
	If (!(Test-Path $dest)) {
		Fail-Json (New-Object psobject) "Destination $dest does not exist !";
	}

	# Read the dest file lines using the indicated encoding into a mutable ArrayList. Note
	# that we have to clean up the dest path because ansible wants to treat / and \ as 
	# interchangeable in windows pathnames, but .NET framework internals do not support that.
	 
	$cleandest = $dest.Replace("/", "\");
    $content = [System.IO.File]::ReadAllLines($cleandest, $encodingobj);
    If ($content -eq $null) {
		$lines = New-Object System.Collections.ArrayList;
	}
	Else {
		$lines = [System.Collections.ArrayList] $content;
	}
	
	# Initialize message to be returned on success
	$msg = "";

	# Compile the regex specified, if provided
	$cre = $FALSE;
	If ($regexp -ne $FALSE) {
		$cre = New-Object Regex $regexp, 'Compiled';
	}

	$found = New-Object System.Collections.ArrayList;
	$left = New-Object System.Collections.ArrayList;
	$changed = $FALSE;

	Foreach ($cur_line in $lines) {
		If ($cre -ne $FALSE) {
			$m = $cre.Match($cur_line);
			$match_found = $m.Success;
		}
		Else {
			$match_found = $line -ceq $cur_line;
		}
		If ($match_found) {
			$found.Add($cur_line);
			$changed = $TRUE;
		}
		Else {
			$left.Add($cur_line);
		}
	}

	# Write backup file if backup == "yes"
    $backupdest = "";

	If ($changed -eq $TRUE -and $backup -eq "yes") {
		$backupdest = BackupFile $dest;
	}
	
	# Write changes to the destination file if changes were made
	If ($changed) {
		WriteLines $left $dest $linesep $encodingobj $validate;
	}

	# Return result information
	$fcount = $found.Count;
	$msg = "$fcount line(s) removed";
	$encodingstr = $encodingobj.WebName;

	$result = New-Object psobject @{
    	changed = $changed
		msg = $msg
		backup = $backupdest
		found = $fcount
		encoding = $encodingstr
	}
	
	Exit-Json $result;
}


# Default to windows line separator - probably most common

$linesep = "`r`n";

If ($newline -ne "windows") {
	$linesep = "`n";
}


# Fix any CR/LF literals in the line argument. PS will not recognize either backslash
# or backtick literals in the incoming string argument without this bit of black magic.

If ($line -ne $FALSE) {
	$line = $line.Replace("\r", "`r");
	$line = $line.Replace("\n", "`n");
}


# Figure out the proper encoding to use for reading / writing the target file.

# The default encoding is UTF-8 without BOM
$encodingobj = [System.Text.UTF8Encoding] $FALSE;

# If an explicit encoding is specified, use that instead
If ($encoding -ne "auto") {
	$encodingobj = [System.Text.Encoding]::GetEncoding($encoding);
}

# Otherwise see if we can determine the current encoding of the target file.
# If the file doesn't exist yet (create == 'yes') we use the default or 
# explicitly specified encoding set above.
Elseif (Test-Path $dest) {

	# Get a sorted list of encodings with preambles, longest first

	$max_preamble_len = 0;
	$sortedlist = New-Object System.Collections.SortedList;
	Foreach ($encodinginfo in [System.Text.Encoding]::GetEncodings()) {
		$encoding = $encodinginfo.GetEncoding();
		$plen = $encoding.GetPreamble().Length;
		If ($plen -gt $max_preamble_len) {
			$max_preamble_len = $plen;
		}
		If ($plen -gt 0) {
			$sortedlist.Add(-($plen * 1000000 + $encoding.CodePage), $encoding);
		}
	}

	# Get the first N bytes from the file, where N is the max preamble length we saw
	
	[Byte[]]$bom = Get-Content -Encoding Byte -ReadCount $max_preamble_len -TotalCount $max_preamble_len -Path $dest;
  
	# Iterate through the sorted encodings, looking for a full match.
	
	$found = $FALSE;
	Foreach ($encoding in $sortedlist.GetValueList()) {
		$preamble = $encoding.GetPreamble();
		If ($preamble -and $bom) {
			Foreach ($i in 0..($preamble.Length - 1)) {
				If ($i -ge $bom.Length) {
					break;
				}
				If ($preamble[$i] -ne $bom[$i]) {
					break;
				}
				Elseif ($i + 1 -eq $preamble.Length) {
					$encodingobj = $encoding;
					$found = $TRUE;
				}
			}
			If ($found) {
				break;
			}
		}
	}
}


# Main dispatch - based on the value of 'state', perform argument validation and 
# call the appropriate handler function.

If ($state -eq "present") {

	If ( $backrefs -ne "no" -and $regexp -eq $FALSE ) {
	    Fail-Json (New-Object psobject) "regexp= is required with backrefs=true";
	}
	
	If ($line -eq $FALSE) {
		Fail-Json (New-Object psobject) "line= is required with state=present";
	}
	
	If ($insertbefore -eq $FALSE -and $insertafter -eq $FALSE) {
		$insertafter = "EOF";
	}

	Present $dest $regexp $line $insertafter $insertbefore $create $backup $backrefs $validate $encodingobj $linesep;

}
Else {

	If ($regexp -eq $FALSE -and $line -eq $FALSE) {
		Fail-Json (New-Object psobject) "one of line= or regexp= is required with state=absent";
	}
	
	Absent $dest $regexp $line $backup $validate $encodingobj $linesep;
}

















070701001203E3000081A40000000000000000000000015BD0D1D200001885000000FD0000000200000000000000000000004400000000ardana-ansible-8.0+git.1540411858.7223b0a/library/win_lineinfile.py#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible.  If not, see <http://www.gnu.org/licenses/>.

DOCUMENTATION = """
---
module: win_lineinfile
author: "Brian Lloyd <brian.d.lloyd@gmail.com>"
short_description: Ensure a particular line is in a file, or replace an existing line using a back-referenced regular expression.
description:
  - This module will search a file for a line, and ensure that it is present or absent.
  - This is primarily useful when you want to change a single line in a file only.
version_added: "2.0"
options:
  dest:
    required: true
    aliases: [ name, destfile ]
    description:
      - The path of the file to modify.
  regexp:
    required: false
    description:
      - "The regular expression to look for in every line of the file. For C(state=present), the pattern to replace if found; only the last line found will be replaced. For C(state=absent), the pattern of the line to remove.  Uses .NET compatible regular expressions; see U(https://msdn.microsoft.com/en-us/library/hs600312%28v=vs.110%29.aspx)."
  state:
    required: false
    choices: [ present, absent ]
    default: "present"
    description:
      - Whether the line should be there or not.
  line:
    required: false
    description:
      - Required for C(state=present). The line to insert/replace into the file. If C(backrefs) is set, may contain backreferences that will get expanded with the C(regexp) capture groups if the regexp matches.
  backrefs:
    required: false
    default: "no"
    choices: [ "yes", "no" ]
    description:
      - Used with C(state=present). If set, line can contain backreferences (both positional and named) that will get populated if the C(regexp) matches. This flag changes the operation of the module slightly; C(insertbefore) and C(insertafter) will be ignored, and if the C(regexp) doesn't match anywhere in the file, the file will be left unchanged.
      - If the C(regexp) does match, the last matching line will be replaced by the expanded line parameter.
  insertafter:
    required: false
    default: EOF
    description:
      - Used with C(state=present). If specified, the line will be inserted after the last match of specified regular expression. A special value is available; C(EOF) for inserting the line at the end of the file.
      - If specified regular expresion has no matches, EOF will be used instead.  May not be used with C(backrefs).
    choices: [ 'EOF', '*regex*' ]
  insertbefore:
    required: false
    description:
      - Used with C(state=present). If specified, the line will be inserted before the last match of specified regular expression. A value is available; C(BOF) for inserting the line at the beginning of the file.
      - If specified regular expresion has no matches, the line will be inserted at the end of the file.  May not be used with C(backrefs).
    choices: [ 'BOF', '*regex*' ]
  create:
    required: false
    choices: [ "yes", "no" ]
    default: "no"
    description:
      - Used with C(state=present). If specified, the file will be created if it does not already exist. By default it will fail if the file is missing.
  backup:
    required: false
    default: "no"
    choices: [ "yes", "no" ]
    description:
      - Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly.
  validate:
    required: false
    description:
      - Validation to run before copying into place.  Use %s in the command to indicate the current file to validate.
      - The command is passed securely so shell features like expansion and pipes won't work.
    default: None
  encoding:
    required: false
    default: "auto"
    description:
      - Specifies the encoding of the source text file to operate on (and thus what the output encoding will be). The default of C(auto) will cause the module to auto-detect the encoding of the source file and ensure that the modified file is written with the same encoding.
      - "An explicit encoding can be passed as a string that is a valid value to pass to the .NET framework System.Text.Encoding.GetEncoding() method - see U(https://msdn.microsoft.com/en-us/library/system.text.encoding%28v=vs.110%29.aspx)."
      - This is mostly useful with C(create=yes) if you want to create a new file with a specific encoding. If C(create=yes) is specified without a specific encoding, the default encoding (UTF-8, no BOM) will be used.
  newline:
    required: false
    description:
      - "Specifies the line separator style to use for the modified file. This defaults to the windows line separator (\r\n). Note that the indicated line separator will be used for file output regardless of the original line seperator that appears in the input file."
    choices: [ "windows", "unix" ]
    default: "windows"
"""

EXAMPLES = """
- win_lineinfile: dest=C:\\temp\\example.conf regexp=^name= line="name=JohnDoe"

- win_lineinfile: dest=C:\\temp\\example.conf state=absent regexp="^name="

- win_lineinfile: dest=C:\\temp\\example.conf regexp='^127\.0\.0\.1' line='127.0.0.1 localhost'

- win_lineinfile: dest=C:\\temp\\httpd.conf regexp="^Listen " insertafter="^#Listen " line="Listen 8080"

- win_lineinfile: dest=C:\\temp\\services regexp="^# port for http" insertbefore="^www.*80/tcp" line="# port for http by default"

# Create file if it doesnt exist with a specific encoding
- win_lineinfile: dest=C:\\temp\\utf16.txt create="yes" encoding="utf-16" line="This is a utf-16 encoded file"

# Add a line to a file and ensure the resulting file uses unix line separators
- win_lineinfile: dest=C:\\temp\\testfile.txt line="Line added to file" newline="unix"

"""
070701001203E2000081A40000000000000000000000015BD0D1D200001276000000FD0000000200000000000000000000004000000000ardana-ansible-8.0+git.1540411858.7223b0a/library/win_unzip.ps1#!powershell
# This file is part of Ansible
#
# Copyright 2015, Phil Schwartz <schwartzmx@gmail.com>
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible.  If not, see <http://www.gnu.org/licenses/>.

# WANT_JSON
# POWERSHELL_COMMON

# temporary fix to keep this module working in 2.0. Needs parameter validation fixes to work in future versions
Set-StrictMode -Off

$params = Parse-Args $args;

$result = New-Object psobject @{
    win_unzip = New-Object psobject
    changed = $false
}

# TODO: StrictMode fix
If ($params.creates) {
    If (Test-Path $params.creates) {
        Exit-Json $result "The 'creates' file or directory already exists."
    }

}

# TODO: StrictMode fix
If ($params.src) {
    $src = $params.src.toString()

    If (-Not (Test-Path -path $src)){
        Fail-Json $result "src file: $src does not exist."
    }

    $ext = [System.IO.Path]::GetExtension($src)
}
Else {
    Fail-Json $result "missing required argument: src"
}

If (-Not($params.dest -eq $null)) {
    $dest = $params.dest.toString()

    If (-Not (Test-Path $dest -PathType Container)){
        Try{
            New-Item -itemtype directory -path $dest
        }
        Catch {
            Fail-Json $result "Error creating $dest directory"
        }
    }
}
Else {
    Fail-Json $result "missing required argument: dest"
}

If ($params.recurse) {
   $recurse = ConvertTo-Bool ($params.recurse)
}
Else {
    $recurse = $false
}

If ($params.rm) { 
    $rm = ConvertTo-Bool ($params.rm) 
} 
Else { 
    $rm = $false 
}

If ($ext -eq ".zip" -And $recurse -eq $false) {
    Try {
        $shell = New-Object -ComObject Shell.Application
        $shell.NameSpace($dest).copyhere(($shell.NameSpace($src)).items(), 20)
        $result.changed = $true
    }
    Catch {
        Fail-Json $result "Error unzipping $src to $dest"
    }
}
# Requires PSCX
Else {
    # Check if PSCX is installed
    $list = Get-Module -ListAvailable

    If (-Not ($list -match "PSCX")) {
        Fail-Json $result "PowerShellCommunityExtensions PowerShell Module (PSCX) is required for non-'.zip' compressed archive types."
    }
    Else {
        Set-Attr $result.win_unzip "pscx_status" "present"
    }

    # Import
    Try {
        Import-Module PSCX
    }
    Catch {
        Fail-Json $result "Error importing module PSCX"
    }

    Try {
        If ($recurse) {
            Expand-Archive -Path $src -OutputPath $dest -Force

            If ($rm -eq $true) {
                Get-ChildItem $dest -recurse | Where {$_.extension -eq ".gz" -Or $_.extension -eq ".zip" -Or $_.extension -eq ".bz2" -Or $_.extension -eq ".tar" -Or $_.extension -eq ".msu"} | % {
                    Expand-Archive $_.FullName -OutputPath $dest  -Force
                    Remove-Item $_.FullName -Force
                }
            }
            Else {
                Get-ChildItem $dest -recurse | Where {$_.extension -eq ".gz" -Or $_.extension -eq ".zip" -Or $_.extension -eq ".bz2" -Or $_.extension -eq ".tar" -Or $_.extension -eq ".msu"} | % {
                    Expand-Archive $_.FullName -OutputPath $dest  -Force
                }
            }
        }
        Else {
            Expand-Archive -Path $src -OutputPath $dest -Force
        }
    }
    Catch {
        If ($recurse) {
            Fail-Json $result "Error recursively expanding $src to $dest"
        }
        Else {
            Fail-Json $result "Error expanding $src to $dest"
        }
    }
}

If ($rm -eq $true){
    Remove-Item $src -Recurse -Force
    Set-Attr $result.win_unzip "rm" "true"
}

# Fixes a fail error message (when the task actually succeeds) for a "Convert-ToJson: The converted JSON string is in bad format"
# This happens when JSON is parsing a string that ends with a "\", which is possible when specifying a directory to download to.
# This catches that possible error, before assigning the JSON $result
If ($src[$src.length-1] -eq "\") {
    $src = $src.Substring(0, $src.length-1)
}
If ($dest[$dest.length-1] -eq "\") {
    $dest = $dest.Substring(0, $dest.length-1)
}
Set-Attr $result.win_unzip "src" $src.toString()
Set-Attr $result.win_unzip "dest" $dest.toString()
Set-Attr $result.win_unzip "recurse" $recurse.toString()

Exit-Json $result;070701001203DD000081A40000000000000000000000015BD0D1D200000E35000000FD0000000200000000000000000000003F00000000ardana-ansible-8.0+git.1540411858.7223b0a/library/win_unzip.py#!/usr/bin/python
# -*- coding: utf-8 -*-

# (c) 2015, Phil Schwartz <schwartzmx@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible.  If not, see <http://www.gnu.org/licenses/>.

# this is a windows documentation stub.  actual code lives in the .ps1
# file of the same name

DOCUMENTATION = '''
---
module: win_unzip
version_added: "2.0"
short_description: Unzips compressed files and archives on the Windows node
description:
     - Unzips compressed files and archives. For extracting any compression types other than .zip, the PowerShellCommunityExtensions (PSCX) Module is required.  This module (in conjunction with PSCX) has the ability to recursively unzip files within the src zip file provided and also functionality for many other compression types. If the destination directory does not exist, it will be created before unzipping the file.  Specifying rm parameter will force removal of the src file after extraction.
options:
  src:
    description:
      - File to be unzipped (provide absolute path)
    required: true
  dest:
    description:
      - Destination of zip file (provide absolute path of directory). If it does not exist, the directory will be created.
    required: true
  rm:
    description:
      - Remove the zip file, after unzipping
    required: no
    choices:
      - true
      - false
      - yes
      - no
    default: false
  recurse:
    description:
      - Recursively expand zipped files within the src file.
    required: no
    default: false
    choices:
      - true
      - false
      - yes
      - no
  creates:
    description:
      - If this file or directory exists the specified src will not be extracted.
    required: no
    default: null
author: Phil Schwartz
'''

EXAMPLES = '''
# This unzips a library that was downloaded with win_get_url, and removes the file after extraction
$ ansible -i hosts -m win_unzip -a "src=C:\\LibraryToUnzip.zip dest=C:\\Lib rm=true" all
# Playbook example

# Simple unzip
---
- name: Unzip a bz2 (BZip) file
  win_unzip:
    src: "C:\Users\Phil\Logs.bz2"
    dest: "C:\Users\Phil\OldLogs"
    creates: "C:\Users\Phil\OldLogs"

# This playbook example unzips a .zip file and recursively decompresses the contained .gz files and removes all unneeded compressed files after completion.
---
- name: Unzip ApplicationLogs.zip and decompress all GZipped log files
  hosts: all
  gather_facts: false
  tasks:
    - name: Recursively decompress GZ files in ApplicationLogs.zip
      win_unzip:
        src: C:\Downloads\ApplicationLogs.zip
        dest: C:\Application\Logs
        recurse: yes
        rm: true

# Install PSCX to use for extracting a gz file
  - name: Grab PSCX msi
    win_get_url:
      url: 'http://download-codeplex.sec.s-msft.com/Download/Release?ProjectName=pscx&DownloadId=923562&FileTime=130585918034470000&Build=20959'
      dest: 'C:\\pscx.msi'
  - name: Install PSCX
    win_msi:
      path: 'C:\\pscx.msi'
  - name: Unzip gz log
    win_unzip:
      src: "C:\\Logs\\application-error-logs.gz"
      dest: "C:\\ExtractedLogs\\application-error-logs"
'''
0707010012043D000081ED0000000000000000000000015BD0D1D2000018C0000000FD0000000200000000000000000000003D00000000ardana-ansible-8.0+git.1540411858.7223b0a/merge-baremetal.py#! /usr/bin/env python
#
# A Python module to combine baremetalConfig.yml and servers.yml
# Command line args are a path to a baremetalConfig.yml and a path
# to a servers.yml file. Output is YAML to stdout.
#
# (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.
#
import datetime
import os
import sys
import yaml

cp_primary_key = 'ip-addr'
bm_primary_key = 'pxe_ip_addr'

already_done_msg = 'CP input is already combined'

class CPnetwork(object):
    def __init__(self, bm_data):
        # Fields not listed here will be dropped from the incoming BM
        # data. This is deliberate because old BM files often contain
        # obsolete fields aka noise.
        self.data = {
            'subnet': bm_data['subnet'],
            'netmask': bm_data['netmask'],
            'server-interface': bm_data['server_interface']
        }

    def render(self):
        return self.data


class CPserver(object):
    # Fields not listed here will be dropped from the incoming BM
    # data. This is deliberate because old BM files often contain
    # obsolete fields aka noise. Per-node fields that already have
    # equivalents in servers.yml are *deliberately* omitted because
    # we want the values coming from servers.yml to take precedence.
    fieldmap = {
        'pxe_mac_addr': 'mac-addr',
        'ilo_ip': 'ilo-ip',
        'ilo_user': 'ilo-user',
        'ilo_password': 'ilo-password',
        'ilo_extras': 'ilo-extras',
        'kopt_extras': 'kopt-extras',
        'kopts_extra': 'kopt-extras',
        'moonshot': 'moonshot' }

    def __init__(self, existing_data):
        self.data = existing_data

    def merge(self, bm_data):
        if self.data[cp_primary_key] != bm_data[bm_primary_key]:
            raise ValueError('primary key mismatch ("%s", "%s")' %
                             (self.data[cp_primary_key], bm_data[bm_primary_key]))
        for (key, value) in bm_data.iteritems():
            if key in self.data:
                # Existing data from servers.yml takes precedence.
                continue
            try:
                key = self.fieldmap[key]
                self.data[key] = value
            except KeyError:
                # Obsolete field - noise.
                pass

    def render(self):
        return self.data


class CPserverlist(object):
    def __init__(self, cp_yaml, bm_yaml):
        if bm_yaml['product'] != cp_yaml['product']:
            raise AttributeError(
                'incompatible versions %s and %s' %
                (bm_yaml['product'], cp_yaml['product']))
        bm_server_list = bm_yaml['baremetal_servers']
        self.servers = list()
        for item in cp_yaml['servers']:
            primary = item[cp_primary_key]
            cp_server = CPserver(item)
            for bm_item in bm_server_list:
                if primary == bm_item[bm_primary_key]:
                    cp_server.merge(bm_item)
                    break
            else:
                print >> sys.stderr, 'no BM data for %s %s' % (cp_primary_key, primary)
                # TODO Raise an error? I checked with our model architects... no.
            self.servers.append(cp_server)

    def render(self):
        return [item.render() for item in self.servers]


class CPmerged(object):
    def __init__(self, cp_yaml, bm_yaml):
        if 'baremetal' in cp_yaml:
            raise AttributeError(already_done_msg)
        self.product = cp_yaml['product']
        self.cp_net = CPnetwork(bm_yaml['baremetal_network'])
        self.cp_servers = CPserverlist(cp_yaml, bm_yaml)

    def render(self):
        result = {
            'product': self.product,
            'baremetal': self.cp_net.render(),
            'servers': self.cp_servers.render() }
        return result


def combine(cp_file, bm_file):
    cp_yaml = yaml.safe_load(cp_file)
    bm_yaml = yaml.safe_load(bm_file)
    obj = CPmerged(cp_yaml, bm_yaml)
    return obj.render()


def get_header(cp_file):
    result = ''
    for line in cp_file:
        l2 = line.lstrip()
        if len(l2) == 0 or l2[0] == '#':
            result += line
        else:
            break
    return result


def main():
    if len(sys.argv) != 3:
        print >> sys.stderr, 'usage: %s <baremetalConfig.yml> <servers.yml>' % sys.argv[0]
        exit(22)

    bm_file = file(sys.argv[1])
    cp_file = file(sys.argv[2])

    header = get_header(cp_file)
    cp_file.seek(0)
    try:
        result = combine(cp_file, bm_file)
    except AttributeError as e:
        if str(e) == already_done_msg:
            print >> sys.stderr, already_done_msg
            exit(22)
        else:
            raise e

    # dump will produce valid YAML, but is difficult to read for humans,
    # so let's go with print statements to make the output as close to the
    # existing manual style used in our examples.
    # print yaml.dump(result, default_flow_style=False)

    print header
    print '# Autogenerated %sZ' % datetime.datetime.utcnow().isoformat()
    print '# baremetal: %s' % sys.argv[1]
    print '# CP: %s' % sys.argv[2]

    product = result['product']
    net = result['baremetal']
    servers = result['servers']
    print '''---
  product:
    version: %s

  baremetal:
    subnet: %s
    netmask: %s
    server-interface: %s

  servers:''' % (product['version'], net['subnet'], net['netmask'], net['server-interface'])

    mandatory = ('id', 'ip-addr', 'role')
    for svr in servers:
        print '''
    - %s: %s''' % (mandatory[0], svr[mandatory[0]])
        for key in mandatory[1:]:
            print '      %s: %s' % (key, svr[key])
        for key in sorted(svr.keys()):
            if key in mandatory:
                continue
            print '      %s: %s' % (key, svr[key])

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

- hosts: localhost
  max_fail_percentage: 0
  tasks:
    - name: pbfinish.yml pb_finish_playbook
      debug:
        # message is just for user readability
        # the start of this task indicates to
        # the callback listener that the parent playbook
        # is about to finish
        msg: "Playbook finished - {{ playbook_name }}"
070701001203C1000081A40000000000000000000000015BD0D1D200000399000000FD0000000200000000000000000000003600000000ardana-ansible-8.0+git.1540411858.7223b0a/pbstart.yml#
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---

- hosts: localhost
  max_fail_percentage: 0
  tasks:
    - name: pbstart.yml pb_start_playbook
      debug:
        # message is just for user readability
        # the start of this task indicates to
        # the callback listener that the parent playbook
        # is about to start
        msg: "Playbook started - {{ playbook_name }}"
0707010012043C000081A40000000000000000000000015BD0D1D20000046F000000FD0000000200000000000000000000004400000000ardana-ansible-8.0+git.1540411858.7223b0a/platform-pass-through.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: KEY-API[0]
  roles:
    - { role: platform-pass-through, service: KEY-API }

- hosts: MON-API[0]
  roles:
    - { role: platform-pass-through, service: MON-API }

- hosts: MON-AGN[0]
  roles:
    - { role: platform-pass-through, service: MON-AGN }

- hosts: LOG-SVR[0]
  roles:
    - { role: platform-pass-through, service: LOG-SVR }

- hosts: localhost
  connection: local
  roles:
    - platform-pass-through
  tasks:
    - include: roles/platform-pass-through/tasks/generate.yml
07070100120433000081A40000000000000000000000015BD0D1D2000007F0000000FD0000000200000000000000000000003F00000000ardana-ansible-8.0+git.1540411858.7223b0a/ready-deployment.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.
#
# Run a deployment using the configuration processor's saved state
---
- hosts: localhost
  connection: local
  roles:
    - git-operations
    - guard-runtime-location
    - config-processor
    - deployer-setup
  tasks:
    - include: roles/git-operations/tasks/ready-deployment-tree.yml
    - include: roles/config-processor/tasks/configure.yml
      vars:
        config_processor: "{{ config_processor_deploy }}"
        deploy_subdir: next
      when: last_deployment_timestamp != git_operations.initial_tag_timestamp
    - include: roles/config-processor/tasks/configure.yml
      vars:
        config_processor: "{{ config_processor_deploy }}"
        deploy_subdir: next
    - include: roles/deployer-setup/tasks/ardana-hooks-configure.yml tags=ardana-hooks-configure
      vars:
        deployer_setup_deploy_dir: "{{ git_operations.ansible_target_dir }}/next/ardana/ansible"
    - include: roles/git-operations/tasks/ready-deployment-tree-help.yml

- hosts: localhost
  roles:
    - ansible-setup
  tasks:
    - include: roles/ansible-setup/tasks/configure-ansible.yml
    - include: roles/ansible-setup/tasks/configure-ansible.yml
      vars:
        ansible_cfg_loc: "{{ ardanauser_home }}/scratch/ansible/next/ardana/ansible/ansible.cfg"
        ansible_setup_ardana_filter_plugins: "./filter_plugins"
        ansible_setup_ardana_connection_plugins: "./connection_plugins"
0707010012024E000041ED00000000000000000000001C5BD0D1D200000000000000FD0000000200000000000000000000003000000000ardana-ansible-8.0+git.1540411858.7223b0a/roles070701001202FD000041ED0000000000000000000000055BD0D1D200000000000000FD0000000200000000000000000000003E00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/ansible-setup07070100120303000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004700000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/ansible-setup/defaults07070100120304000081A40000000000000000000000015BD0D1D20000059C000000FD0000000200000000000000000000005000000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/ansible-setup/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.
#
---
ardanauser_home: "{{ ansible_env['HOME'] }}"

ansible_setup_ardana_filter_plugins: "{{ ardanauser_home }}/openstack/ardana/ansible/filter_plugins"
ansible_setup_ardana_connection_plugins: "{{ ardanauser_home }}/openstack/ardana/ansible/connection_plugins"

ansible_setup_bin_dir: "{{ 'ansible'|bin_dir if deployer_media_legacy_layout|bool else '/usr/bin/' }}"
ansible_setup_site_packages: "{{ lookup( 'pipe', ansible_setup_bin_dir ~ '/python -c \"from distutils.sysconfig import get_python_lib; print(get_python_lib())\"' ) }}"
hosts_localhost: "{{ ardanauser_home }}/openstack/ardana/ansible/hosts/localhost"
hosts_verb_hosts: "{{ ardanauser_home }}/scratch/ansible/next/ardana/ansible/hosts/verb_hosts"

ansible_cfg_loc: "{{ ardanauser_home }}/.ansible.cfg"

fact_caching_enabled: true
070701001202FE000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004400000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/ansible-setup/tasks070701001202FF000081A40000000000000000000000015BD0D1D2000003A8000000FD0000000200000000000000000000005A00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/ansible-setup/tasks/configure-ansible.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: ansible-setup | configure-ansible | Check if verb_hosts file exists
  stat:
    path: "{{ hosts_verb_hosts }}"
  register: verb_hosts_exists

- name: ansible-setup | configure-ansible | Create ansible.cfg
  template:
    src: ansible.cfg.j2
    dest: "{{ ansible_cfg_loc }}"
07070100120300000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004800000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/ansible-setup/templates07070100120301000081A40000000000000000000000015BD0D1D200002758000000FD0000000200000000000000000000005700000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/ansible-setup/templates/ansible.cfg.j2#
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# config file for ansible -- http://ansible.com/
# ==============================================

# nearly all parameters can be overridden in ansible-playbook
# or with command line flags. ansible will read ANSIBLE_CONFIG,
# ansible.cfg in the current working directory, .ansible.cfg in
# the home directory or /etc/ansible/ansible.cfg, whichever it
# finds first

[defaults]

# some basic default values...

inventory      = {{ (verb_hosts_exists.stat.exists == True) | ternary( hosts_verb_hosts , hosts_localhost ) }}

# BUG 1259: replace this line with the following (commented-out)
# one if you're disabling the Monasca API deployment.
library        = roles/monasca-alarm-definition/library:/usr/share/ardana/ansible/library
#library        = roles/monasca-ansible-library/noop

remote_tmp     = $HOME/.ansible/tmp
pattern        = *
forks          = 20
poll_interval  = 15
sudo_user      = root
#ask_sudo_pass = True
#ask_pass      = True
transport      = smart
#remote_port    = 22
module_lang    = C

# plays will gather facts by default, which contain information about
# the remote system.
#
# smart - gather by default, but don't regather if already gathered
# implicit - gather by default, turn off with gather_facts: False
# explicit - do not gather by default, must say gather_facts: True
gathering = smart

# additional paths to search for roles in, colon separated
#roles_path    = /etc/ansible/roles

# uncomment this to disable SSH key host checking
host_key_checking = False

# enable additional callbacks
#callback_whitelist = timer

# change this for alternative sudo implementations
sudo_exe = sudo

# what flags to pass to sudo
#sudo_flags = -H

# SSH timeout
timeout = 60

# default user to use for playbooks if user is not specified
# (/usr/bin/ansible will use current user as default)
#remote_user = root

# logging is off by default unless this path is defined
# if so defined, consider logrotate
log_path = $HOME/.ansible/ansible.log

# default module name for /usr/bin/ansible
#module_name = command

# use this shell for commands executed under sudo
# you may need to change this to bin/bash in rare instances
# if sudo is constrained
#executable = /bin/sh

# if inventory variables overlap, does the higher precedence one win
# or are hash values merged together?  The default is 'replace' but
# this can also be set to 'merge'.
#hash_behaviour = replace

# by default, variables from roles will be visible in the global variable
# scope. To prevent this, the following option can be enabled, and only
# tasks and handlers within the role will see the variables there
#private_role_vars = yes

# list any Jinja2 extensions to enable here:
jinja2_extensions = jinja2.ext.do

# if set, always use this private key file for authentication, same as
# if passing --private-key to ansible or ansible-playbook
#private_key_file = /path/to/file

# format of string { { ansible_managed } } available within Jinja2
# templates indicates to users editing templates files will be replaced.
# replacing {file}, {host} and {uid} and strftime codes with proper values.
# ansible_managed = Ansible managed: {file} modified on %Y-%m-%d %H:%M:%S by {uid} on {host}
ansible_managed = Managed by Ardana (via ansible): {file} - a ansible rerun might overwrite any modifications

# by default, ansible-playbook will display "Skipping [host]" if it determines a task
# should not be run on a host.  Set this to "False" if you don't want to see these "Skipping"
# messages. NOTE: the task header will still be shown regardless of whether or not the
# task is skipped.
#display_skipped_hosts = True

# by default (as of 1.3), Ansible will raise errors when attempting to dereference
# Jinja2 variables that are not set in templates or action lines. Uncomment this line
# to revert the behavior to pre-1.3.
#error_on_undefined_vars = False

# by default (as of 1.6), Ansible may display warnings based on the configuration of the
# system running ansible itself. This may include warnings about 3rd party packages or
# other conditions that should be resolved if possible.
# to disable these warnings, set the following value to False:
#system_warnings = True

# by default (as of 1.4), Ansible may display deprecation warnings for language
# features that should no longer be used and will be removed in future versions.
# to disable these warnings, set the following value to False:
#deprecation_warnings = True

# (as of 1.8), Ansible can optionally warn when usage of the shell and
# command module appear to be simplified by using a default Ansible module
# instead.  These warnings can be silenced by adjusting the following
# setting or adding warn=yes or warn=no to the end of the command line
# parameter string.  This will for example suggest using the git module
# instead of shelling out to the git command.
# command_warnings = False


# set plugin path directories here, separate with colons
action_plugins     = {{ ansible_setup_site_packages }}/ansible/runner/action_plugins
callback_plugins   = {{ ansible_setup_site_packages }}/ansible/callback_plugins
connection_plugins = {{ ansible_setup_ardana_connection_plugins }}:{{ ansible_setup_site_packages }}/ansible/runner/connection_plugins
lookup_plugins     = {{ ansible_setup_site_packages }}/ansible/runner/lookup_plugins
vars_plugins       = {{ ansible_setup_site_packages }}/ansible/inventory/vars_plugins
filter_plugins     = {{ ansible_setup_site_packages }}/ansible/runner/filter_plugins:{{ ansible_setup_ardana_filter_plugins }}
shell_plugins      = {{ ansible_setup_site_packages }}/ansible/runner/shell_plugins


# by default callbacks are not loaded for /bin/ansible, enable this if you
# want, for example, a notification or logging callback to also apply to
# /bin/ansible runs
#bin_ansible_callbacks = False


# don't like cows?  that's unfortunate.
# set to 1 if you don't want cowsay support or export ANSIBLE_NOCOWS=1
#nocows = 1

# don't like colors either?
# set to 1 if you don't want colors, or export ANSIBLE_NOCOLOR=1
#nocolor = 1

# the CA certificate path used for validating SSL certs. This path
# should exist on the controlling node, not the target nodes
# common locations:
# RHEL/CentOS: /etc/pki/tls/certs/ca-bundle.crt
# Fedora     : /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
# Ubuntu     : /usr/share/ca-certificates/cacert.org/cacert.org.crt
#ca_file_path =

# the http user-agent string to use when fetching urls. Some web server
# operators block the default urllib user agent as it is frequently used
# by malicious attacks/scripts, so we set it to something unique to
# avoid issues.
#http_user_agent = ansible-agent

# if set to a persistent type (not 'memory', for example 'redis') fact values
# from previous runs in Ansible will be stored.  This may be useful when
# wanting to use, for example, IP information from one group of servers
# without having to talk to them in the same playbook run to get their
# current IP information.

# Turn on fact caching
{% if (fact_caching_enabled | bool) == false %}
#fact_caching = jsonfile
#fact_caching_connection = {{ ardanauser_home }}/.ansible_fact_cache
#fact_caching_timeout = 86400
{% else %}
fact_caching = jsonfile
fact_caching_connection = {{ ardanauser_home }}/.ansible_fact_cache
fact_caching_timeout = 86400
{% endif %}


# retry files
#retry_files_enabled = False
#retry_files_save_path = ~/.ansible-retry

[privilege_escalation]
#become=True
#become_method='sudo'
#become_user='root'
#become_ask_pass=False

[paramiko_connection]

# uncomment this line to cause the paramiko connection plugin to not record new host
# keys encountered.  Increases performance on new host additions.  Setting works independently of the
# host key checking setting above.
#record_host_keys=False

# by default, Ansible requests a pseudo-terminal for commands executed under sudo. Uncomment this
# line to disable this behaviour.
#pty=False

[ssh_connection]

# ssh arguments to use
# Leaving off ControlPersist will result in poor performance, so use
# paramiko on older platforms rather than removing it
ssh_args = -o ControlMaster=auto -o ControlPersist=30m -o ForwardAgent=yes -o GSSAPIAuthentication=false

# The path to use for the ControlPath sockets. This defaults to
# "%(directory)s/ansible-ssh-%%h-%%p-%%r", however on some systems with
# very long hostnames or very long path names (caused by long user names or
# deeply nested home directories) this can exceed the character limit on
# file socket names (108 characters for most platforms). In that case, you
# may wish to shorten the string below.
#
# Example:
# control_path = %(directory)s/%%h-%%r
#control_path = %(directory)s/ansible-ssh-%%h-%%p-%%r

# Enabling pipelining reduces the number of SSH operations required to
# execute a module on the remote server. This can result in a significant
# performance improvement when enabled, however when using "sudo:" you must
# first disable 'requiretty' in /etc/sudoers
#
# By default, this option is disabled to preserve compatibility with
# sudoers configurations that have requiretty (the default on many distros).
#
pipelining = True

# if True, make ansible use scp if the connection type is ssh
# (default is sftp)
scp_if_ssh = True

[accelerate]
accelerate_port = 5099
accelerate_timeout = 30
accelerate_connect_timeout = 5.0

# The daemon timeout is measured in minutes. This time is measured
# from the last activity to the accelerate daemon.
accelerate_daemon_timeout = 30

# If set to yes, accelerate_multi_key will allow multiple
# private keys to be uploaded to it, though each user must
# have access to the system via SSH to add a new key. The default
# is "no".
#accelerate_multi_key = yes

[selinux]
# file systems that require special treatment when dealing with security context
# the default behaviour that copies the existing context or uses the user default
# needs to be changed to use the file system dependant context.
#special_context_filesystems=nfs,vboxsf,fuse
07070100120302000081A40000000000000000000000015BD0D1D2000002EC000000FD0000000200000000000000000000006400000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/ansible-setup/templates/ansible_site_packages.py.j2#!{{ 'ansible' | bin_dir }}/python
#
# (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.
#

from distutils.sysconfig import get_python_lib


print(get_python_lib())
0707010012037F000041ED0000000000000000000000045BD0D1D200000000000000FD0000000200000000000000000000004500000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/ardana-upgrade-tools0707010012038C000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004E00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/ardana-upgrade-tools/defaults0707010012038D000081A40000000000000000000000015BD0D1D2000003B8000000FD0000000200000000000000000000005700000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/ardana-upgrade-tools/defaults/main.yml#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---

list_pkg_upgrades_base: []

zypper_update_licenses_agree: false
zypper_update_gpg_checks: true
zypper_update_include_reboot_patches: false
zypper_update_method: patch

running_on_deployer: false

skip_single_host_checks: false
skip_clm_updates_checks: false

ardanauser_home: "{{ ansible_env['HOME'] }}"07070100120380000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004B00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/ardana-upgrade-tools/tasks07070100120389000081A40000000000000000000000015BD0D1D20000035A000000FD0000000200000000000000000000005E00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/ardana-upgrade-tools/tasks/check-deployer.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.
#
# Simple task to check whether the target host is the deployer
---
- name: ardana-upgrade-tools | check-deployer | Check if running on deployer
  set_fact:
    running_on_deployer: true
  when: hostvars[inventory_hostname].ansible_hostname == hostvars['localhost'].ansible_hostname
07070100120381000081A40000000000000000000000015BD0D1D200000FDC000000FD0000000200000000000000000000006800000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/ardana-upgrade-tools/tasks/check-pending-clm-update.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.
#
# Simple task to handle the special ardana_notify_pending_clm_update variable
# that encodes whether CLM packages have been updated during one of the
# previous update playbook runs.
#
# Parameters:
#
#  update_status_reset (default: false): reset the status variable
#  update_status_set (default: false): set the status variable
#
# Return:
#
#  The pending_clm_update fact is set to reflect the value of the status
#  variable.
#  The update_status_msg fact is set to an output message describing the
#  pending action associated with the status variable.

---

- name: ardana-upgrade-tools | check-pending-clm-update |
        Initialize pending CLM update action message
  set_fact:
    pending_clm_update_msg: |
      WARNING: outstanding installed CLM package updates were detected !

      Before continuing with the update process, the CLM itself needs to
      be updated by running 'ardana-init' on the deployer node followed
      by running the recommended CLM update playbooks, i.e.:

        cd ~/openstack/ardana/ansible
        ansible-playbook -i hosts/localhost cobbler-deploy.yml
        ansible-playbook -i hosts/localhost config-processor-run.yml
        ansible-playbook -i hosts/localhost ready-deployment.yml

      Then the update can be resumed by running the same playbook again,
      with the same parameters.

      To override this check, set the SKIP_UPDATE_CLM_CHECKS environment
      variable or the skip_update_clm_checks ansible variable.

      To recheck the pending CLM update status at a later time, run:

        cd ~/scratch/ansible/next/ardana/ansible
        ansible-playbook -i hosts/verb_hosts ardana-update-status.yml \
          --limit {{ inventory_hostname }} \
          -e update_status_var=clm-update

      To reset the pending CLM update status, run:

        cd ~/scratch/ansible/next/ardana/ansible
        ansible-playbook -i hosts/verb_hosts ardana-update-status.yml \
          --limit {{ inventory_hostname }} \
          -e update_status_var=clm-update \
          -e update_status_reset=true

- name: ardana-upgrade-tools | check-pending-clm-update |
        Check pending CLM update status
  set_fact:
    pending_clm_update: "{{
      pending_clm_update | default(true) | bool and
      ardana_notify_pending_clm_update is defined and
      ardana_notify_pending_clm_update.changed and
      (not skip_update_clm_checks | default(false) | bool) and
      (not lookup('env', 'SKIP_UPDATE_CLM_CHECKS')|default(false, true))}}"

- name: ardana-upgrade-tools | check-pending-clm-update |
        Reset pending CLM update persistent fact
  command: /bin/true
  changed_when: true
  register: _pending_clm_update_reset
  when: (update_status_reset | default(false) | bool) and
        ardana_notify_pending_clm_update is defined and
        ardana_notify_pending_clm_update.changed

- name: ardana-upgrade-tools | check-pending-clm-update |
        Reset pending CLM update cached fact
  set_fact:
    pending_clm_update: false
  when: _pending_clm_update_reset | changed

- name: ardana-upgrade-tools | check-pending-clm-update |
        Set pending CLM update cached/persistent fact
  set_fact:
    pending_clm_update: true
  changed_when: true
  register: ardana_notify_pending_clm_update
  when: (update_status_set | default(false) | bool)

- name: ardana-upgrade-tools | check-pending-clm-update | Set update action
  set_fact:
    update_status_msg: "{{ pending_clm_update|bool|ternary(pending_clm_update_msg,'') }}"
07070100120388000081A40000000000000000000000015BD0D1D200001015000000FD0000000200000000000000000000006C00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/ardana-upgrade-tools/tasks/check-pending-service-update.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.
#
# Simple task to handle the special ardana_notify_pending_service_update
# variable that encodes whether services need to be updated because package
# updates have been installed during one of the previous update playbook runs.
#
#  update_status_reset (default: false): reset the status variable
#  update_status_set (default: false): set the status variable
#
# Return:
#
#  The pending_service_update fact is set to reflect the value of the status
#  variable.
#  The update_status_msg fact is set to an output message describing the
#  pending action associated with the status variable.

---
- name: ardana-upgrade-tools | check-pending-service-update |
        Initialize pending service update action message
  set_fact:
    pending_service_update_msg: |
      WARNING: packages updates have been installed on the
      {{ inventory_hostname }} host during this run or there are outstanding
      update actions persisted from previous unsuccessful or incomplete update
      runs.

      The update process process must be continued by running the
      ardana-update.yml playbook to update all services, e.g.:

        cd ~/scratch/ansible/next/ardana/ansible
        ansible-playbook -i hosts/verb_hosts ardana-update.yml \
          --limit {{ inventory_hostname }}

      To override this check, set the SKIP_UPDATE_SERVICE_CHECKS environment
      variable or the skip_update_service_checks ansible variable.

      To recheck the pending service update status at a later time, run:

        cd ~/scratch/ansible/next/ardana/ansible
        ansible-playbook -i hosts/verb_hosts ardana-update-status.yml \
          --limit {{ inventory_hostname }} \
          -e update_status_var=service-update

      To reset the pending service update status, run:

        cd ~/scratch/ansible/next/ardana/ansible
        ansible-playbook -i hosts/verb_hosts ardana-update-status.yml \
          --limit {{ inventory_hostname }} \
          -e update_status_var=service-update \
          -e update_status_reset=true

- name: ardana-upgrade-tools | check-pending-service-update |
        Check pending service update status
  set_fact:
    pending_service_update: "{{
      pending_service_update | default(true) | bool and
      ardana_notify_pending_service_update is defined and
      ardana_notify_pending_service_update.changed and
      (not skip_update_service_checks | default(false) | bool) and
      (not lookup('env', 'SKIP_UPDATE_SERVICE_CHECKS')|default(false, true))}}"

- name: ardana-upgrade-tools | check-pending-service-update |
        Reset pending service update persistent fact
  command: /bin/true
  changed_when: true
  register: _pending_service_update_reset
  when: (update_status_reset | default(false) | bool) and
        ardana_notify_pending_service_update is defined and
        ardana_notify_pending_service_update.changed

- name: ardana-upgrade-tools | check-pending-service-update |
        Reset pending service update cached fact
  set_fact:
    pending_service_update: false
  when: _pending_service_update_reset | changed

- name: ardana-upgrade-tools | check-pending-service-update |
        Set pending service update cached/persistent fact
  set_fact:
    pending_service_update: true
  changed_when: true
  register: ardana_notify_pending_service_update
  when: (update_status_set | default(false) | bool)

- name: ardana-upgrade-tools | check-pending-service-update | Set update action
  set_fact:
    update_status_msg: "{{ pending_service_update|bool|ternary(pending_service_update_msg,'') }}"
07070100120386000081A40000000000000000000000015BD0D1D200000FFD000000FD0000000200000000000000000000006B00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/ardana-upgrade-tools/tasks/check-pending-system-reboot.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.
#
# Simple task to handle the special ardana_notify_pending_system_reboot that
# encodes whether a system reboot is required after packages have been updated
# during one of the previous update playbook runs.
#
# Parameters:
#
#  update_status_reset (default: false): reset the status variable
#  update_status_set (default: false): set the status variable
#
# Return:
#
#  The pending_system_reboot fact is set to reflect the value of the status
#  variable.
#  The update_status_msg fact is set to an output message describing the
#  pending action associated with the status variable.

---
- name: ardana-upgrade-tools | check-pending-system-reboot |
        Initialize pending system reboot action message
  set_fact:
    pending_system_reboot_msg: |
      WARNING: Package updates installed on the {{ inventory_hostname }}
      host during this run require a system reboot, or there are outstanding
      reboot actions persisted from previous unsuccessful or incomplete update
      or reboot runs.

      The node should be rebooted to complete the update process by running the
      ardana-reboot.yml playbook, e.g.:

        cd ~/scratch/ansible/next/ardana/ansible
        ansible-playbook -i hosts/verb_hosts ardana-reboot.yml \
          --limit {{ inventory_hostname }}

      To override this check, set the SKIP_UPDATE_REBOOT_CHECKS environment
      variable or the skip_update_reboot_checks ansible variable.

      To recheck the pending system reboot status at a later time, run:

        cd ~/scratch/ansible/next/ardana/ansible
        ansible-playbook -i hosts/verb_hosts ardana-update-status.yml \
          --limit {{ inventory_hostname }} \
          -e update_status_var=system-reboot

      To reset the pending system reboot status, run:

        cd ~/scratch/ansible/next/ardana/ansible
        ansible-playbook -i hosts/verb_hosts ardana-update-status.yml \
          --limit {{ inventory_hostname }} \
          -e update_status_var=system-reboot \
          -e update_status_reset=true

- name: ardana-upgrade-tools | check-pending-system-reboot |
        Check pending system reboot status
  set_fact:
    pending_system_reboot: "{{
      pending_system_reboot | default(true) | bool and
      ardana_notify_pending_system_reboot is defined and
      ardana_notify_pending_system_reboot.changed and
      (not skip_update_reboot_checks | default(false) | bool) and
      (not lookup('env', 'SKIP_UPDATE_REBOOT_CHECKS')|default(false, true))}}"

- name: ardana-upgrade-tools | check-pending-system-reboot |
        Reset pending system reboot persistent fact
  command: /bin/true
  changed_when: true
  register: _pending_system_reboot_reset
  when: (update_status_reset | default(false) | bool) and
        ardana_notify_pending_system_reboot is defined and
        ardana_notify_pending_system_reboot.changed

- name: ardana-upgrade-tools | check-pending-system-reboot |
        Reset pending system reboot cached fact
  set_fact:
    pending_system_reboot: false
  when: _pending_system_reboot_reset | changed

- name: ardana-upgrade-tools | check-pending-system-reboot |
        Set pending system reboot cached/persistent fact
  set_fact:
    pending_system_reboot: true
  changed_when: true
  register: ardana_notify_pending_system_reboot
  when: (update_status_set | default(false) | bool)

- name: ardana-upgrade-tools | check-pending-system-reboot | Set update action
  set_fact:
    update_status_msg: "{{ pending_system_reboot|bool|ternary(pending_system_reboot_msg,'') }}"
07070100120384000081A40000000000000000000000015BD0D1D200000475000000FD0000000200000000000000000000006100000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/ardana-upgrade-tools/tasks/check-single-host.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.
#
# Simple task to check whether the playbook is running on a single hosts
---

- name: ardana-upgrade-tools | check-single-host | Check if running on a single host
  fail:
    msg: |
      It is not recommended to run {{ playbook_name }} on multiple hosts.
      To override this check, set the SKIP_SINGLE_HOST_CHECKS environment variable
      or the skip_single_host_checks ansible variable"
  run_once: true
  when: (play_hosts | length) > 1 and
        not skip_single_host_checks and
        (not lookup('env', 'SKIP_SINGLE_HOST_CHECKS')|default(false, true))
0707010012038B000081A40000000000000000000000015BD0D1D2000003B5000000FD0000000200000000000000000000005900000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/ardana-upgrade-tools/tasks/configure.yml#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- name: ardana-upgrade-tools | configure | Update the apt cache
  become: yes
  apt:
    update_cache: yes
  when: ansible_os_family | lower == 'debian'

- name: ardana-upgrade-tools | configure | Update the yum cache
  become: yes
  command: yum check-update
  when: ansible_os_family | lower == 'redhat'
07070100120385000081A40000000000000000000000015BD0D1D200000341000000FD0000000200000000000000000000005700000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/ardana-upgrade-tools/tasks/install.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: ardana-upgrade-tools | install | Install playbook dependencies
  become: yes
  apt:
    name: aptitude
    force: yes
    state: latest
  when: ansible_os_family | lower == 'debian'
07070100120383000081A40000000000000000000000015BD0D1D2000003F5000000FD0000000200000000000000000000005900000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/ardana-upgrade-tools/tasks/pkg-query.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: ardana-upgrade-tools | pkg-query |
        Query apt to get available pkg upgrades
  become: yes
  apt-upgrade-list:
    timeout: 30
  when: ansible_os_family | lower == 'debian'

- name: ardana-upgrade-tools | pkg-query | Set list_pkg_upgrades_base
  set_fact:
    list_pkg_upgrades_base: "{{ list_pkg_upgrades }}"
  when: ansible_os_family | lower == 'debian'
0707010012038A000081A40000000000000000000000015BD0D1D20000230D000000FD0000000200000000000000000000005A00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/ardana-upgrade-tools/tasks/pkg-update.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.
#
# Install available zypper package updates
#
# The behavior can be customized with the following parameters:
#
#   * zypper_update_method: define which zypper subcommand to use for
#     updating. Valid values are:
#
#     'patch' (default) - will install all patches applying to
#     the system from the configured update repositories that are available.
#
#     'update' - will update packages from all configured repositories
#     (not just the update repositories) that have a higher version
#     number than the installed packages.
#
#     'dist-upgrade' - replaces each package installed with the version
#     from the repository and deletes packages not available in the
#     repositories.
#
#   * zypper_update_gpg_checks (default: true): enable GPG checks.
#     If set to true, checks if packages are correctly signed.
#
#   * zypper_update_licenses_agree (default: false): automatically agree
#     with licenses. If set to true, zypper automatically accepts third
#     party licenses.
#
#   * zypper_update_include_reboot_patches (default: false): include patches
#     that need reboots (e.g. kernel). Installs patches that require a reboot
#     (for example kernel or glibc updates).
#
# Sets the following facts:
#
#   * ardana_upgraded_pkgs - list of upgraded packages
#   * ardana_notify_pending_service_update (persistent) - set when at least one
#     package has been updated, to indicate that services need to be updated
#   * ardana_notify_pending_clm_update (persistent) - this flag is set when at
#     least one of the packages used by the CLM itself (e.g. playbook packages)
#     has been updated
#   * ardana_notify_pending_venv_update (persistent) - this flag is set when at
#     least one of the venv packages has been updated
#   * ardana_notify_pending_system_reboot (persistent) - this flag is set if a
#     system reboot is required after the installed package updates
---

- name: ardana-upgrade-tools | pkg-update | Validate update method
  fail:
    msg:
      "{{ zypper_update_method }} is not a valid zypper update method."
  when: zypper_update_method not in ["patch", "update", "dist-upgrade"]

- name: ardana-upgrade-tools | pkg-update | Generate zypper update command args
  set_fact:
    _zypper_args: >
      {%- set _args = ["--non-interactive"] -%}
      {%- if not zypper_update_gpg_checks | bool -%}
      {%-   set _ = _args.append("--no-gpg-checks") -%}
      {%- endif -%}
      {%- if zypper_update_method == "patch" and zypper_update_include_reboot_patches | bool -%}
      {%-   set _ = _args.append("--non-interactive-include-reboot-patches") -%}
      {%- endif -%}
      {%- set _ = _args.append(zypper_update_method) -%}
      {%- if zypper_update_licenses_agree | bool -%}
      {%-   set _ = _args.append("--auto-agree-with-licenses") -%}
      {%- endif -%}
      {{ _args }}

- name: ardana-upgrade-tools | pkg-update | Check if the PTF repository is configured
  become: yes
  shell: zypper lr PTF
  register: _ptf_repo_result
  ignore_errors: true

- name: ardana-upgrade-tools | pkg-update | Refresh PTF repository
  become: yes
  command: zypper --non-interactive --gpg-auto-import-keys refresh -fr PTF
  when: _ptf_repo_result | success

- name: ardana-upgrade-tools | pkg-update | Get set of installed pkgs before update
  rpm_list:

- name: ardana-upgrade-tools | pkg-update  | Set _pre_update_pkgs fact
  set_fact:
    _pre_update_pkgs: "{{ installed_pkgs | default([]) }}"

# Sometimes zypper needs to go through several iterations when installing
# patches, e.g. when those patches include updates to the zypper packages
# themselves. This will be indicated by a 103 return code.
- name: ardana-upgrade-tools | pkg-update | Download and install package updates
  become: yes
  command: zypper {{ _zypper_args | join(' ') }} --download in-advance
  register: zypper_update_result
  until: zypper_update_result.rc != 103 # ZYPPER_EXIT_INF_RESTART_NEEDED
  retries: 5
  ignore_errors: yes

- name: ardana-upgrade-tools | pkg-update | Get set of installed pkgs after update
  rpm_list:

- name: _ardana-update-base | Set _post_update_pkgs fact
  set_fact:
    _post_update_pkgs: "{{ installed_pkgs | default([]) }}"

- name: ardana-upgrade-tools | pkg-update | Set fact with full set of updated pkgs
  set_fact:
    ardana_upgraded_pkgs: "{{ _pre_update_pkgs | upgraded_pkgs(_post_update_pkgs) }}"

- name: ardana-upgrade-tools | pkg-update | Print updated packages
  debug:
    msg: "The following packages have been updated: {{ ardana_upgraded_pkgs.keys() | join(', ') }}"
  when: ardana_upgraded_pkgs

- name: ardana-upgrade-tools | pkg-update | Get set of installed CLM pkgs
  shell: rpm -qa --qf "%{NAME}\n" | grep ardana
  register: _ardana_clm_packages
  when: running_on_deployer

- name: ardana-upgrade-tools | pkg-update | Get set of installed venv pkgs
  command: rpm -qf /opt/ardana_packager --qf "%{NAME}\n"
  register: _ardana_venv_packages
  when: running_on_deployer

- name: ardana-upgrade-tools | pkg-update | Check if CLM packages were updated
  set_fact:
    _clm_packages_updated: true
  when: running_on_deployer and
        item in ardana_upgraded_pkgs | default({})
  with_items: _ardana_clm_packages.stdout_lines | default([])

- name: ardana-upgrade-tools | pkg-update | Check if venv packages were updated
  set_fact:
    _venv_packages_updated: true
  when: running_on_deployer and
        item in ardana_upgraded_pkgs | default({})
  with_items: _ardana_venv_packages.stdout_lines | default([])

- name: ardana-upgrade-tools | pkg-update | Check if system packages were updated
  set_fact:
    _system_packages_updated: true
  when: item.key not in _ardana_clm_packages.stdout_lines | default([]) and
        item.key not in _ardana_venv_packages.stdout_lines | default([])
  with_dict: ardana_upgraded_pkgs | default({})

  # Register a persistent pending CLM update action if
  # CLM packages were updated
- include: check-pending-clm-update.yml
  vars:
    update_status_set: true
  when: _clm_packages_updated | default(false) | bool

  # Register a persistent pending service update action for this node if
  # any packages were updated
- include: check-pending-service-update.yml
  vars:
    update_status_set: true
  when: ardana_upgraded_pkgs

  # Register a persistent pending service update action for all nodes if
  # CLM or venv packages were updated
  # TODO(snica): this isn't working quite right (hosts are iterated, but the
  # condition is always evaluated as false)
- name: ardana-upgrade-tools | pkg-update |
        Register a pending service update action for all other nodes
  command: /bin/true
  changed_when: true
  register: ardana_notify_pending_service_update
  delegate_to: "{{ item }}"
  when: running_on_deployer and
        (_clm_packages_updated | default(false) | bool or
        _venv_packages_updated | default(false) | bool)
  with_items: groups.resources

  # Register a persistent pending system reboot action for this node if
  # installed package updates require it.
  #
  # TODO (snica) for now we also require that a node be rebooted if system packages
  # were updated on it (i.e. anything other than CLM and venv packages).
  # This can be replaced with a node-wide service restart when
  # https://gerrit.suse.provo.cloud/3745/ is merged.
- include: check-pending-system-reboot.yml
  vars:
    update_status_set: true
  when: _system_packages_updated | default(false) | bool or
        zypper_update_result.rc == 102 # ZYPPER_EXIT_INF_REBOOT_NEEDED

  # We deferred from checking the zypper update command status up to this
  # point to get a chance to record any pending update actions as persistent facts
- name: ardana-upgrade-tools | pkg-update | Check update result
  fail:
    msg:
      "zypper {{ zypper_update_method }} command returned {{ zypper_update_result.rc }}."
  when: zypper_update_result.rc not in [0, 100, 101, 102, 103, 104, 105]

- name: ardana-upgrade-tools | pkg-update | Check number of zypper restart cycles
  fail:
    msg:
      "Ran zypper {{ zypper_update_method }} more than five times,
      and it still requires more runs."
  when: zypper_update_result.rc == 103 # ZYPPER_EXIT_INF_RESTART_NEEDED

- name: ardana-upgrade-tools | pkg-update | Check if reboot is required
  command: /bin/true
  register: ardana_notify_pending_system_reboot
  when: zypper_update_result.rc == 102 # ZYPPER_EXIT_INF_REBOOT_NEEDED
07070100120382000081A40000000000000000000000015BD0D1D2000003FA000000FD0000000200000000000000000000005A00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/ardana-upgrade-tools/tasks/pkg-verify.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: ardana-upgrade-tools | pkg-verify | Query apt for list of available pkg upgrades
  become: yes
  apt-upgrade-list:
    timeout: 30

- name: ardana-upgrade-tools | pkg-verify | Fail play if list available updates is not empty
  fail:
    msg: "_ardana-upgrade-pkg-verify | The following pkgs have not been upgraded - {{ list_pkg_upgrades }}"
  when: list_pkg_upgrades
07070100120387000081A40000000000000000000000015BD0D1D2000003C8000000FD0000000200000000000000000000005600000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/ardana-upgrade-tools/tasks/reboot.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: ardana-upgrade-tools | install | Reboot node
  become: yes
  shell: sleep 2 && shutdown -r now
  async: 1
  poll: 0

- name: ardana-upgrade-tools | install | Wait for node to come back up
  delegate_to: localhost
  wait_for:
    host: "{{ ansible_ssh_host | default(inventory_hostname) }}"
    port: 22
    search_regex: OpenSSH
    state: started
    delay: 30
    timeout: 600
07070100120372000041ED0000000000000000000000065BD0D1D200000000000000FD0000000200000000000000000000004100000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/config-processor0707010012037D000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004A00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/config-processor/defaults0707010012037E000081A40000000000000000000000015BD0D1D200000C98000000FD0000000200000000000000000000005300000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/config-processor/defaults/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.
#
# Defaults for the config-processor
---

config_processor_bin_dir: "{{ 'config-processor' | bin_dir if deployer_media_legacy_layout|bool else '/usr/bin/' }}"
config_processor_share_dir: "{{ 'config-processor' | share_dir }}/ardana-config-processor"

config_processor_data_dir: "{{ config_processor_share_dir }}/Data"
config_processor_driver_dir: "{{ config_processor_share_dir + '/Driver' if deployer_media_legacy_layout|bool else '/usr/bin/'}}"

config_processor_install_dir: "{{ git_operations_staging_directory }}"
config_processor_runtime_dir: "{{ git_operations.cp_target_dir }}"
config_processor_deploy_dir: "{{ git_operations.ansible_target_dir }}"

config_processor_install_ardana: "{{ config_processor_install_dir }}/ardana"
config_processor_runtime_ardana: "{{ config_processor_runtime_dir }}/ardana"
config_processor_deploy_ardana: "{{ config_processor_deploy_dir }}/{{ deploy_subdir }}/ardana"
config_processor_install_work: "{{ config_processor_install_dir }}/my_cloud"
config_processor_runtime_work: "{{ config_processor_runtime_dir }}/my_cloud"
config_processor_deploy_work: "{{ config_processor_deploy_dir }}/{{ deploy_subdir }}/my_cloud"

# TODO: nearly the same thing is defined in deployer-setup/defaults/main.yml as deployer_input_model_src
config_processor_input_model_services_src: "{{ ardanauser_home + '/' + ardana_version + '/ardana-input-model/2.0/services' if deployer_media_legacy_layout|bool else '/usr/share/ardana/input-model/2.0/services'}}"

config_processor_install:
  schema:  "{{ config_processor_data_dir }}/Site"
  service: "{{ config_processor_install_ardana }}/services"
  input: "{{ config_processor_install_work }}/definition"
  output: "{{ config_processor_install_work }}"
  log_dir: /var/log/configuration_processor
  logfile_output: "/var/log/configuration_processor/output.log"
  logfile_errors: "/var/log/configuration_processor/errors.log"

config_processor_runtime:
  schema:  "{{ config_processor_data_dir }}/Site"
  service: "{{ config_processor_runtime_ardana + '/services' if deployer_media_legacy_layout|bool else '/usr/share/ardana/input-model/2.0/services' }}"
  input: "{{ config_processor_runtime_work }}/definition"
  output: "{{ config_processor_runtime_work }}"
  log: /var/log/configuration_processor
  target: "{{ config_processor_runtime_ardana }}/ansible"
  change_credentials: "{{ git_operations.main_repo }}/{{ git_operations.change_credentials }}"

config_processor_deploy:
  output: "{{ config_processor_deploy_work }}"
  log: /var/log/configuration_processor
  target: "{{ config_processor_deploy_ardana }}/ansible"
07070100120375000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004600000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/config-processor/meta07070100120376000081A40000000000000000000000015BD0D1D2000002DC000000FD0000000200000000000000000000004F00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/config-processor/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.
#
---
dependencies:
  # We include git-operations for the staging directory
  - git-operations
07070100120377000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004700000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/config-processor/tasks07070100120378000081A40000000000000000000000015BD0D1D2000004B5000000FD0000000200000000000000000000005900000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/config-processor/tasks/add-localhost.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.
#
# Temporarily add localhost to verb_hosts to make tempest install work
---

- name: config-processor | add-localhost | Add localhost group
  lineinfile:
    dest: "{{ config_processor_runtime.output }}/stage/ansible/hosts/verb_hosts"
    state: present
    insertbefore: BOF
    line: "[localhost]"

- name: config-processor | add-localhost | Add localhost group entry
  lineinfile:
    dest: "{{ config_processor_runtime.output }}/stage/ansible/hosts/verb_hosts"
    state: present
    insertafter: "^\\[localhost\\]$"
    line: localhost  ansible_connection=local
0707010012037B000081A40000000000000000000000015BD0D1D20000061C000000FD0000000200000000000000000000005100000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/config-processor/tasks/clean.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: config_processor | clean | Clean V2 hosts file
  file:
    path: "{{ config_processor_runtime.target }}/generated_files/etc/hosts"
    state: absent

- name: config_processor | clean | Clean V2 group and host vars
  file:
    path: "{{ config_processor_runtime.target }}/{{ item }}"
    state: absent
  with_items:
    - group_vars
    - host_vars

- name: config_processor | clean | Clean V2  cloud_hosts and verb_hosts
  file:
    path: "{{ config_processor_runtime.target }}/hosts/{{ item }}"
    state: absent
  with_items:
    - cloud_hosts
    - verb_hosts

- name: config_processor | clean | Clean  net directory
  file:
    path: "{{ config_processor_runtime.target }}/net"
    state: absent

- name: config_processor | clean | Clean V2 persistent and stage directories
  file:
    path: "{{ config_processor_runtime_work }}/{{ item }}"
    state: absent
  with_items:
    - persistent_state
    - stage
0707010012037C000081A40000000000000000000000015BD0D1D20000083B000000FD0000000200000000000000000000005500000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/config-processor/tasks/configure.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.
#
---

# Required for osconfig phase
- name: config-processor | configure | Make directories required for osconfig network configuration
  file:
    path: "{{ config_processor.target }}/generated_files/{{ item }}"
    state: directory
  with_items:
    - etc
    - etc/network

- name: config-processor | configure | Copy hosts.hf for osconfig playbooks
  copy:
    src: "{{ config_processor.output }}/stage/net/hosts.hf"
    dest: "{{ config_processor.target }}/generated_files/etc/hosts"

# Required for cloud deployment update phases
- name: config-processor | configure | Sync ansible vars for cloud deployment
  synchronize:
    src: "{{ config_processor.output }}/stage/ansible/{{ item }}"
    dest: "{{ config_processor.target }}"
  with_items:
    - group_vars
    - host_vars

- name: config-processor | configure | Copy ansible hosts file for cloud deployment (verb_hosts)
  copy:
    src: "{{ config_processor.output }}/stage/ansible/hosts/verb_hosts"
    dest: "{{ config_processor.target }}/hosts/."

- name: config-processor | configure | Sync ansible top-level playbooks for cloud deployment/update
  copy:
    src: "{{ item }}"
    dest: "{{ config_processor.target }}"
  with_fileglob:
    - "{{ config_processor.output }}/stage/ansible/*.yml"

- name: config-processor | configure | Sync generated network artefacts for cloud deployment/update
  synchronize:
    src: "{{ config_processor.output }}/stage/net"
    dest: "{{ config_processor.target }}"
07070100120379000081A40000000000000000000000015BD0D1D2000007CA000000FD0000000200000000000000000000005300000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/config-processor/tasks/install.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.
#
# Playbook for setting up the Configuration Processor on the deployer
---
- include_vars: "{{ playbook_dir }}/ardana_version.yml"

- name: config-processor  | install | Update venv cache
  become: yes
  install_package:
    cache: update

- name: config-processor | install | Install the Configuration Processor
  become: yes
  when: deployer_media_legacy_layout|bool
  install_package:
    name: config_processor
    service: config-processor
    state: present
    activate: act_on

- name: config-processor | install | Create base log directory
  become: yes
  file:
    path: "{{ config_processor_install.log_dir }}"
    owner: "{{ ardanauser }}"
    group: "{{ ardanauser }}"
    state: directory
    mode: 0755

- name: config-processor | install | Create Configuration Processor log files
  become: yes
  file:
    path: "{{ item }}"
    owner: "{{ ardanauser }}"
    group: "{{ ardanauser }}"
    state: touch
    mode: 0755
  with_items:
    - "{{ config_processor_install.logfile_output }}"
    - "{{ config_processor_install.logfile_errors }}"

- name: config-processor | install | Copy Configuration Processor Services into work dir
  when: deployer_media_legacy_layout|bool
  synchronize:
    src: "{{ config_processor_input_model_services_src }}"
    dest: "{{ config_processor_install_ardana }}"
    recursive: yes
  delegate_to: deployer

0707010012037A000081A40000000000000000000000015BD0D1D20000087A000000FD0000000200000000000000000000006000000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/config-processor/tasks/run-config-processor.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.
#
---

# TODO: Change running of ardana-config-processor to use input files sync across
- name: config-processor | run-config-processor | Run Configuration Processor over the given cloud configuration
  command: |
    timeout 600 {{config_processor_bin_dir }}/python
      {{ config_processor_driver_dir }}/ardana-cp
      -c {{ config_processor_runtime.input }}/cloudConfig.yml
      -l {{ config_processor_runtime.log }}
      -s {{ config_processor_runtime.service }}
      -r {{ config_processor_runtime.schema }}
      -P {{ config_processor_runtime.change_credentials }}
      {% if remove_deleted_servers is defined %} -d {% endif %}
      {% if free_unused_addresses is defined %} -f {% endif %}
      {% if encrypt != '' %}
           -q
          {% if rekey == '' %}
              -e -x {{ encrypt }}
          {% elif rekey != '' %}
              -k -x {{ rekey }} -y {{ encrypt }}
          {% endif %}
      {% endif %}
      -w
  args:
    chdir: "{{ config_processor_runtime.output }}"
  register: config_processor_result
  ignore_errors: True
  no_log: True

- debug: var=config_processor_result.stdout_lines
  when: config_processor_result.stdout_lines is defined

- debug: var=config_processor_result.stderr
  when: config_processor_result.stderr is defined and config_processor_result.stderr != ""

- fail: msg="Configuration processor run failed, see log output above for details"
  when: (config_processor_result is defined) and (config_processor_result.rc != 0) or ('failed' in config_processor_result.stdout)
07070100120373000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004600000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/config-processor/vars07070100120374000081A40000000000000000000000015BD0D1D2000002D9000000FD0000000200000000000000000000004F00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/config-processor/vars/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.
#
---
ardanauser : "{{ ansible_env['USER'] }}"
ardanauser_home: "{{ ansible_env['HOME'] }}"
070701001202AB000041ED0000000000000000000000075BD0D1D200000000000000FD0000000200000000000000000000003800000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/dayzero070701001202B8000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004100000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/dayzero/defaults070701001202B9000081A40000000000000000000000015BD0D1D200000330000000FD0000000200000000000000000000004A00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/dayzero/defaults/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.
#
ardanauser: "{{ ansible_env['USER'] }}"
ardanauser_home: "{{ ansible_env['HOME'] }}"
dayzero_restart_required: false
keep_dayzero: false
dayzero_apache2_restart_required: false
070701001202AE000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004100000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/dayzero/handlers070701001202AF000081A40000000000000000000000015BD0D1D200000321000000FD0000000200000000000000000000004A00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/dayzero/handlers/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.
#
---

- name: dayzero_change
  set_fact:
    dayzero_restart_required: true

- name: dayzero_apache2_change
  set_fact:
    dayzero_apache2_restart_required: true
070701001202AC000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000003D00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/dayzero/meta070701001202AD000081A40000000000000000000000015BD0D1D2000002A3000000FD0000000200000000000000000000004600000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/dayzero/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.
#
---
dependencies:
  - role: FND-AP2
070701001202B0000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000003E00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/dayzero/tasks070701001202B4000081A40000000000000000000000015BD0D1D200000898000000FD0000000200000000000000000000004C00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/dayzero/tasks/configure.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.
#
# Playbook for configuring Day Zero UI
---

- name: dayzero | configure | Create dayzero.service.d folder
  become: yes
  file:
    path: "/usr/lib/systemd/system/dayzero.service.d"
    state: directory

- name: dayzero | configure | Apply systemd template
  become: yes
  template:
    src: "{{ item }}.j2"
    dest: "/usr/lib/systemd/system/dayzero.service.d/{{ item }}"
  with_items:
    - "local.conf"
  notify: dayzero_change


- name:  dayzero | configure | Enable proxy-pass module
  become: yes
  apache2_module:
    state: present
    name: proxy_http
  notify: dayzero_apache2_change

- name:  dayzero | configure | Enable websocket proxy-pass module
  become: yes
  apache2_module:
    state: present
    name: proxy_wstunnel
  notify: dayzero_apache2_change

# In Beta 2, the dayzero-apache.conf file was added incorrectly
# so we are removing that old file if it exists
- name: dayzero | configure | Check for dayzero-apache.conf file
  become: yes
  stat: path=/etc/apache2/sites-enabled/dayzero-apache.conf
  register: dayzero_conf_result

- name: dayzero | configure | Remove old config file if present
  become: yes
  file:
    path: "/etc/apache2/sites-enabled/dayzero-apache.conf"
    state: absent
  when: dayzero_conf_result.stat.islnk is defined and dayzero_conf_result.stat.islnk == False

- name: dayzero | configure | create apache config file
  become: yes
  template:
    src: "{{ item }}.j2"
    dest: "/etc/apache2/sites-available/{{ item }}"
    owner: root
    group: root
    mode: 0664
  with_items:
    - "dayzero-apache.conf"
070701001202B3000081A40000000000000000000000015BD0D1D200000ACC000000FD0000000200000000000000000000004A00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/dayzero/tasks/install.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.
#
# Playbook for setting up the Day Zero UI on the deployer
---

- name: dayzero | install | Clear old directory
  become: yes
  file:
    path: "{{ ardanauser_home }}/ardana-installer-ui"
    state: absent

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

- name: dayzero | install | Install Day Zero UI
  become: yes
  install_package:
    name: dayzero
    service: dayzero
    state: present
    activate: act_on
  notify: dayzero_change

- name: dayzero | install | Extract Day Zero UI service files
  become: yes
  unarchive:
    dest: "{{ ardanauser_home }}"
    src: "{{ item }}"
    copy: no
    owner: "{{ ardanauser }}"
    group: "{{ ardanauser }}"
    mode: 0644
  with_fileglob:
    - "{{ 'dayzero' | jar_dir }}/ardana-installer-ui-*.tar.gz"

# Directories need to be executable for GUI to access files
- name: dayzero | install | Set permission on directories to be executable
  become: yes
  command: find {{ ardanauser_home }}/ardana-installer-ui -type d -exec chmod 0755 {} +

- name: dayzero | install | Extract Node.js files
  become: yes
  unarchive:
    dest: "{{ ardanauser_home }}/ardana-installer-ui"
    src: "{{ item }}"
    copy: no
    owner: "{{ ardanauser }}"
    group: "{{ ardanauser }}"
    mode: 0755
  with_fileglob:
    - "{{ ardanauser_home }}/ardana-installer-ui/nodejs.tar.gz"

- name: dayzero | install | Create fake venv bin directory
  become: yes
  file:
    path: "{{ ardanauser_home }}/ardana-installer-ui/dayzero/venv/bin"
    owner: "{{ ardanauser }}"
    group: "{{ ardanauser }}"
    state: directory

- name: dayzero | install | Setup Day Zero UI service
  become: yes
  setup_systemd:
    service: dayzero
    user: "{{ ardanauser }}"
    group: "{{ ardanauser }}"
    install_dir: "{{ ardanauser_home }}/ardana-installer-ui"
    cmd: nodejs
    args: >
      server/server.js

- name: dayzero | install | Symlink nodejs
  become: yes
  file:
    dest: "{{ ardanauser_home }}/ardana-installer-ui/dayzero/venv/bin/nodejs"
    src: "{{ ardanauser_home }}/ardana-installer-ui/nodejs/bin/node"
    force: yes
    state: link
070701001202B2000081A40000000000000000000000015BD0D1D2000005E6000000FD0000000200000000000000000000004800000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/dayzero/tasks/start.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.
#
# Start the Day Zero UI
---

# Restart Apache if required
- include: "{{ playbook_dir }}/roles/FND-AP2/tasks/start_reload.yml"
  vars:
    apache_restart_requested: "{{ dayzero_apache2_restart_required }}"

- name: dayzero | start | Enable dayzero site
  become: yes
  command: a2ensite dayzero-apache.conf
  register: dayzero_a2_enable_site_result
  changed_when: '"already enabled" not in dayzero_a2_enable_site_result.stdout'

- include: "{{ playbook_dir }}/roles/FND-AP2/tasks/start_reload.yml"
  vars:
    apache_reload_requested: "{{ dayzero_a2_enable_site_result.changed }}"

- name: dayzero | start | Restart Day Zero UI service
  become: yes
  service:
    name: dayzero
    state: restarted
  when: dayzero_restart_required

- name: dayzero | start | Ensure that Day Zero UI service is started
  become: yes
  service:
    name: dayzero
    state: started
070701001202B1000081A40000000000000000000000015BD0D1D200000516000000FD0000000200000000000000000000004700000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/dayzero/tasks/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.
#
# Stop the Day Zero UI
---
- name: dayzero | stop | Disable dayzero site
  become: yes
  command: a2dissite dayzero-apache.conf
  register: dayzero_a2_disable_site_result
  changed_when: '"already disabled" not in dayzero_a2_disable_site_result.stdout'

# TODO
# http://localhost:35357 is refusing connections due to an issue in
# start_reload playbook, which incorporates keystone on inventory_host
# - include: "{{ playbook_dir }}/roles/FND-AP2/tasks/start_reload.yml"
#   vars:
#     apache_reload_requested: dayzero_a2_disable_site_result.changed

- name: dayzero | stop | Stop Day Zero UI service
  become: yes
  service:
    name: dayzero
    state: stopped070701001202B5000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004200000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/dayzero/templates070701001202B7000081A40000000000000000000000015BD0D1D2000003B2000000FD0000000200000000000000000000005900000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/dayzero/templates/dayzero-apache.conf.j2{#
#
# (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.
#
#}

ProxyPass /dayzeroapi http://localhost:3000/dayzeroapi
ProxyPassReverse /dayzeroapi http://localhost:3000/dayzeroapi
ProxyPass /dayzero http://localhost:3000
ProxyPassReverse /dayzero http://localhost:3000
ProxyPass /logs ws://localhost:3000/logs
ProxyPassReverse /logs ws://localhost:3000/logs
070701001202B6000081A40000000000000000000000015BD0D1D2000002CB000000FD0000000200000000000000000000005000000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/dayzero/templates/local.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.
#
#}

[Service]
WorkingDirectory={{ ardanauser_home }}/ardana-installer-ui
07070100120313000041ED0000000000000000000000085BD0D1D200000000000000FD0000000200000000000000000000003F00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup0707010012035E000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004800000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/defaults0707010012035F000081A40000000000000000000000015BD0D1D200000783000000FD0000000200000000000000000000005100000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/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.
#
---
hlinux_repo_dir: hlinux
foreign_repo_dir: foreign
hlinux_apt_repo_dir: "{{ PACKAGE_CONSTANTS.REPO_DIR }}/{{ hlinux_repo_dir }}"
foreign_apt_repo_dir: "{{ PACKAGE_CONSTANTS.REPO_DIR }}/{{ hlinux_repo_dir }}"
deployer_prerequisites:
    - python-yaml
    - ipmitool
    - openssl

deployer_packages:
    - screen
    - createrepo

deployer_input_model_src: "{{'{{ ardanauser_home }}/{{ ardana_version }}/ardana-input-model/2.0' if deployer_media_legacy_layout|bool else '/usr/share/ardana/input-model/2.0/'}}"

deployer_setup_hook_plays:
    - cloud-configure
    - cluster-credentials-change
    - deploy
    - keystone-credentials-change
    - other-credentials-change
    - rabbitmq-credentials-change
    - reconfigure
    - start
    - restart
    - schedule-restart
    - status
    - stop
    - upgrade
    - upgrade-from-legacy
    - update
deployer_setup_deploy_dir: "{{ playbook_dir }}"
deployer_setup_play_templates:
  - ardana-{{ item }}.yml.j2
  - _ardana-default.yml.j2
deployer_setup_pre_hook: "hooks.d/%(name)s/pre-%(play)s.yml"
deployer_setup_post_hook: "hooks.d/%(name)s/post-%(play)s.yml"

dupe_files_loc: "/media/cdrom/pool_duplicate_files.list"
delta_target_version_file: "/media/cdrom/delta_target_version"
ardana_version_file: "/etc/Ardana_version"
07070100120319000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004500000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/files07070100120325000081A40000000000000000000000015BD0D1D200000029000000FD0000000200000000000000000000005700000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/files/06apt-hlinux.confAcquire::http::proxy::localhost "DIRECT";07070100120328000081A40000000000000000000000015BD0D1D2000002A6000000FD0000000200000000000000000000005B00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/files/README-third-party.md#
# (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.
#

# Third-party Components Integration

0707010012031E000081A40000000000000000000000015BD0D1D2000002E1000000FD0000000200000000000000000000005A00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/files/cloud-configure.list{#
# (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.
#
#}
glance-cloud-configure
neutron-cloud-configure
ironic-cloud-configure
tempest-cloud-configure
07070100120320000081A40000000000000000000000015BD0D1D200000073000000FD0000000200000000000000000000005500000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/files/cloudConfig.yml# Place your cloud configuration files here.
# (This file is a placeholder; its contents may be overwritten.)
---

07070100120322000081A40000000000000000000000015BD0D1D2000002AD000000FD0000000200000000000000000000006500000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/files/cluster-credentials-change.list{#
#
# (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.
#
#}
FND-AP2-reconfigure
FND-CLU-reconfigure
07070100120321000081A40000000000000000000000015BD0D1D2000005BB000000FD0000000200000000000000000000005100000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/files/deploy.list{#
#
# (c) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
#}
tls-deploy
# BUG 1259: when disabling the monasca part of the deployment,
# edit ~/.ansible.cfg and change the [default] / library setting
# as outlined in that file.
monasca-agent-deploy
clients-deploy
percona-deploy
rabbitmq-deploy
FND-CLU-deploy
FND-AP2-deploy
memcached-deploy
keystone-deploy
barbican-deploy
zookeeper-deploy
cassandra-deploy
monasca-deploy
ardana-service-deploy
# ops console depends on kafka, installed by monasca
ops-console-deploy
spark-deploy
monasca-transform-deploy
keystone-configure-fernet-monitoring
swift-deploy
glance-deploy
neutron-deploy
ironic-deploy
nova-deploy
magnum-deploy
cinder-deploy
octavia-deploy
designate-deploy
powerdns-deploy
bind-deploy
heat-deploy
horizon-deploy
logging-deploy
ceilometer-deploy
freezer-deploy
tempest-deploy
#manila-deploy
ardana-extra-deploy
0707010012031A000081A40000000000000000000000015BD0D1D2000005F8000000FD0000000200000000000000000000006600000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/files/keystone-credentials-change.list{#
#
# (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.
#
#}
# Just in case MySQL passwords were changed in addition to Keystone passwords
percona-reconfigure

keystone-reconfigure-credentials

barbican-reconfigure-credentials-change
monasca-reconfigure-credentials-change
monasca-agent-reconfigure-credentials-change
monasca-transform-reconfigure
ops-console-reconfigure-credentials-change
swift-reconfigure-credentials-change
glance-reconfigure-credentials-change
neutron-reconfigure-credentials-change
ironic-reconfigure-credentials-change
_nova-reconfigure-credentials-change
cinder-reconfigure-credentials-change
designate-reconfigure-credentials-change
heat-reconfigure-credentials-change
kronos-reconfigure
ceilometer-reconfigure-credentials-change
freezer-reconfigure-credentials-change
octavia-reconfigure-credentials-change
tempest-reconfigure-credentials-change
ardana-service-reconfigure
#manila-reconfigure-credentials-change
0707010012031D000081A40000000000000000000000015BD0D1D2000002D1000000FD0000000200000000000000000000006300000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/files/other-credentials-change.list{#
#
# (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.
#
#}
kronos-reconfigure
swift-reconfigure
logging-reconfigure-credentials-change
0707010012032A000081A40000000000000000000000015BD0D1D20000042B000000FD0000000200000000000000000000006600000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/files/rabbitmq-credentials-change.list{#
#
# (c) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
#}
rabbitmq-reconfigure-credentials

keystone-reconfigure
barbican-reconfigure
ops-console-reconfigure
monasca-reconfigure
glance-reconfigure
neutron-reconfigure
ironic-reconfigure
nova-reconfigure
magnum-reconfigure
cinder-reconfigure
designate-reconfigure
powerdns-reconfigure
bind-reconfigure
heat-reconfigure
horizon-reconfigure
kronos-reconfigure
ceilometer-reconfigure
octavia-reconfigure
#manila-reconfigure
07070100120326000081A40000000000000000000000015BD0D1D2000005F9000000FD0000000200000000000000000000005600000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/files/reconfigure.list{#
#
# (c) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
#}
network_interface-reconfigure
osconfig-iptables-reconfigure
tls-reconfigure
monasca-agent-reconfigure
percona-reconfigure
rabbitmq-reconfigure
  vars:
    rabbitmq_config_lock: false
FND-CLU-reconfigure
FND-AP2-reconfigure
memcached-reconfigure
keystone-reconfigure
barbican-reconfigure
zookeeper-reconfigure
monasca-reconfigure
ops-console-reconfigure
spark-reconfigure
monasca-transform-reconfigure
swift-reconfigure
glance-reconfigure
neutron-reconfigure
ironic-reconfigure
nova-reconfigure
magnum-reconfigure
cinder-reconfigure
octavia-reconfigure
designate-reconfigure
powerdns-reconfigure
bind-reconfigure
heat-reconfigure
horizon-reconfigure
kronos-reconfigure
ceilometer-reconfigure
ceilometer-pipeline-reconfigure
freezer-reconfigure
#manila-reconfigure
tempest-reconfigure

# Post Reconfiguration tasks
rabbitmq-reconfigure
  vars:
    rabbitmq_config_lock: false
0707010012032B000081A40000000000000000000000015BD0D1D200000455000000FD0000000200000000000000000000005200000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/files/restart.list{#
#
# (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.
#
#}
monasca-agent-restart
#rabbitmq-restart
FND-CLU-restart
FND-AP2-restart
memcached-restart
keystone-restart
barbican-restart
ardana-service-restart
ops-console-restart
zookeeper-restart
cassandra-restart
monasca-restart
spark-restart
monasca-transform-restart
swift-restart
nova-restart
magnum-restart
glance-restart
neutron-restart
cinder-restart
octavia-restart
designate-restart
powerdns-restart
bind-restart
ironic-restart
heat-restart
horizon-restart
logging-restart
ceilometer-restart
freezer-restart
ardana-extra-restart
07070100120324000081A40000000000000000000000015BD0D1D200000589000000FD0000000200000000000000000000005B00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/files/schedule-restart.list{#
#
# (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.
#
#}
_monasca-agent-schedule-restart
#rabbitmq-schedule-restart
_FND-CLU-schedule-restart
_FND-AP2-schedule-restart
_memcached-schedule-restart
_keystone-schedule-restart
_barbican-schedule-restart
_ardana-service-schedule-restart
_ops-console-schedule-restart
_zookeeper-schedule-restart
_cassandra-schedule-restart
_monasca-schedule-restart
_spark-schedule-restart
_monasca-transform-schedule-restart
_swift-schedule-restart
_nova-schedule-restart
_magnum-schedule-restart
_glance-schedule-restart
_neutron-schedule-restart
_cinder-schedule-restart
_octavia-schedule-restart
_designate-schedule-restart
_powerdns-schedule-restart
_bind-schedule-restart
_ironic-schedule-restart
_heat-schedule-restart
_horizon-schedule-restart
_logging-schedule-restart
_ceilometer-schedule-restart
_freezer-schedule-restart
ardana-extra-schedule-restart
0707010012031F000081A40000000000000000000000015BD0D1D20000047B000000FD0000000200000000000000000000005000000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/files/start.list{#
#
# (c) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
#}
monasca-agent-start
percona-start
rabbitmq-start
FND-CLU-start
FND-AP2-start
memcached-start
keystone-start
barbican-start
ardana-service-start
ops-console-start
zookeeper-start
cassandra-start
monasca-start
spark-start
monasca-transform-start
swift-start
nova-start
magnum-start
glance-start
neutron-start
cinder-start
octavia-start
designate-start
powerdns-start
bind-start
ironic-start
heat-start
horizon-start
logging-start
ceilometer-start
freezer-start
#manila-start
ardana-extra-start
07070100120329000081A40000000000000000000000015BD0D1D2000004D5000000FD0000000200000000000000000000005100000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/files/status.list{#
#
# (c) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
#}
# TODO: There is no osconfig-status yet
#osconfig-status
monasca-agent-status
percona-status
rabbitmq-status
FND-CLU-status
FND-AP2-status
memcached-status
keystone-status
barbican-status
ardana-service-status
ops-console-status
zookeeper-status
cassandra-status
monasca-status
spark-status
monasca-transform-status
swift-status
ironic-status
nova-status
magnum-status
glance-status
neutron-status
cinder-status
octavia-status
designate-status
powerdns-status
bind-status
heat-status
horizon-status
logging-status
ceilometer-status
freezer-status
#manila-status
ardana-extra-status
07070100120330000081A40000000000000000000000015BD0D1D2000004DD000000FD0000000200000000000000000000004F00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/files/stop.list{#
#
# (c) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
#}
# This is reverse order to ardana-deploy.yml and ardana-start.yml
freezer-stop
ceilometer-stop
logging-stop
# missing horizon-stop
heat-stop
ironic-stop
designate-stop
powerdns-stop
bind-stop
cinder-stop
neutron-stop
glance-stop
magnum-stop
nova-stop
octavia-stop
swift-stop
monasca-transform-stop
spark-stop
monasca-stop
cassandra-stop
zookeeper-stop
ardana-service-stop
ops-console-stop
barbican-stop
keystone-stop
memcached-stop
FND-AP2-stop
FND-CLU-stop
rabbitmq-stop
  vars:
    rabbitmq_do_not_reset_node: true
percona-stop
#tls-stop
monasca-agent-stop
#manila-stop
ardana-extra-stop
0707010012032C000081A40000000000000000000000015BD0D1D200000554000000FD0000000200000000000000000000005100000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/files/update.list{#
#
# (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.
#
#}
sosreport-upgrade
supportutils-upgrade
monasca-agent-upgrade
# Update Monasca agent for RabbitMQ.
rabbitmq-monasca-configure
clients-upgrade
#percona-upgrade
FND-AP2-upgrade
memcached-upgrade
keystone-upgrade
barbican-upgrade
zookeeper-upgrade
monasca-upgrade
ardana-service-upgrade
# ops console depends on kafka, installed by monasca
ops-console-upgrade
spark-upgrade
monasca-transform-upgrade
swift-upgrade
nova-upgrade
magnum-upgrade
glance-upgrade
neutron-upgrade
cinder-upgrade
octavia-upgrade
designate-upgrade
powerdns-upgrade
bind-upgrade
ironic-upgrade
heat-upgrade
horizon-upgrade
logging-upgrade
ceilometer-upgrade
freezer-upgrade
tempest-upgrade
# Update haproxy last as it conflicts with a setting in the beta2 kit
# where nova-api listens on the vip.
FND-CLU-upgrade
0707010012031B000081A40000000000000000000000015BD0D1D20000069F000000FD0000000200000000000000000000005E00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/files/upgrade-from-legacy.list{#
#
# (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.
#
#}
tls-upgrade
sosreport-upgrade
supportutils-upgrade
monasca-agent-upgrade
# Update Monasca agent for RabbitMQ.
rabbitmq-monasca-configure
clients-upgrade
#percona-upgrade
# Percona will have already been (nearly) upgraded
percona-configure-monasca

FND-AP2-upgrade
memcached-upgrade
FND-CLU-upgrade
keystone-upgrade
#barbican-upgrade
# Install barbican directly (avoid online status check)
_barbican-install
_barbican-configure
barbican-start
barbican-status

zookeeper-upgrade
#monasca-upgrade
# Install monasca and cassandra from scratch
cassandra-deploy
monasca-deploy

ardana-service-upgrade
# ops console depends on kafka, installed by monasca
ops-console-upgrade
#monasca-transform-upgrade
# Install monasca-transform from scratch
monasca-transform-deploy

swift-upgrade
nova-upgrade
magnum-upgrade
glance-upgrade
neutron-upgrade
cinder-upgrade
octavia-upgrade
designate-upgrade
powerdns-upgrade
bind-upgrade
ironic-upgrade
heat-upgrade
horizon-upgrade
#freezer-upgrade
# Install freezer directly (avoid online status check)
freezer-deploy
freezer-status

logging-upgrade
ceilometer-upgrade

tempest-upgrade
0707010012032F000081A40000000000000000000000015BD0D1D2000005B8000000FD0000000200000000000000000000005200000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/files/upgrade.list{#
#
# (c) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
#}
tls-upgrade
sosreport-upgrade
supportutils-upgrade
monasca-agent-upgrade
# Update Monasca agent for RabbitMQ.
rabbitmq-monasca-configure
clients-upgrade
percona-upgrade
FND-AP2-upgrade
memcached-upgrade
keystone-upgrade
barbican-upgrade
zookeeper-upgrade
monasca-upgrade
ardana-service-upgrade
# ops console depends on kafka, installed by monasca
ops-console-upgrade
spark-upgrade
monasca-transform-upgrade
swift-upgrade
nova-upgrade
magnum-upgrade
glance-upgrade
neutron-upgrade
cinder-upgrade
octavia-upgrade
designate-upgrade
powerdns-upgrade
bind-upgrade
ironic-upgrade
heat-upgrade
horizon-upgrade
logging-upgrade
ceilometer-upgrade
freezer-upgrade
tempest-upgrade
# Update haproxy last as it conflicts with a setting in the beta2 kit
# where nova-api listens on the vip.
#manila-upgrade
FND-CLU-upgrade
07070100120316000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004400000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/meta07070100120318000081A40000000000000000000000015BD0D1D2000002FD000000FD0000000200000000000000000000004D00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/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.
#
---
dependencies:
  - package-constants
  # We import git-operations in order to get the staging directory
  - git-operations
07070100120331000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004500000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/tasks0707010012034A000081A40000000000000000000000015BD0D1D2000004CC000000FD0000000200000000000000000000005A00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/tasks/_create_symlinks.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: deployer-setup | _create-symlinks | Clear config directory
  file:
    dest: "{{ work_dir }}"
    state: absent

- name: deployer-setup | _create-symlinks | Create config directory
  file:
    dest: "{{ work_dir }}"
    state: directory

- name: deployer-setup | _create-symlinks | Create symlinks
  config_symlinks:
    in_files: "{{ git_operations_staging_directory }}/ardana/ansible/config/*-symlinks.yml"
    config_path: "{{ work_dir }}"
    target_path: "{{ ardanauser_home }}/openstack/ardana/ansible"
    source_path: "{{ ardanauser_home }}/openstack/my_cloud/config"
07070100120333000081A40000000000000000000000015BD0D1D200000602000000FD0000000200000000000000000000006000000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/tasks/ardana-hooks-configure.yml#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# build deployment playbooks from templates including user hooks
---

- name: deployer-setup | ardana-hooks-configure | Find all hooks
  command: >
    find hooks.d/ -mindepth 2 -not -path '*/\.*' -type f \( ! -iname ".*" \)
  args:
    chdir: "{{ deployer_setup_deploy_dir }}"
  register:
    _deployer_setup_find_hooks
  changed_when: false

- name: deployer-setup | ardana-hooks-configure | Build list of hooks
  set_fact:
    deployer_setup_hooks: "{{ _deployer_setup_find_hooks.stdout.split('\n') | unique }}"

- name: deployer-setup | ardana-hooks-configure | Display hooks found
  debug:
    var: deployer_setup_hooks

- name: deployer-setup | ardana-hooks-configure | Build ardana entry point playbooks
  template:
    src: "{{ lookup('first_found', deployer_setup_play_templates) }}"
    dest: "{{ deployer_setup_deploy_dir }}/ardana-{{ item }}.yml"
  with_items: deployer_setup_hook_plays
07070100120340000081A40000000000000000000000015BD0D1D2000005EC000000FD0000000200000000000000000000005E00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/tasks/ardana-hooks-display.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.
#
# build deployment playbooks from templates including user hooks
---

- name: deployer-setup | ardana-hooks-display | Available hook points
  info:
    msg: |
      {{ item }} hooks available:
        {{ deployer_setup_pre_hook | format(name='*', play=item) | replace('hooks.d/*/', '') }}
      {% set plays = lookup('file', '../files/' ~ item ~ '.list').split('\n') %}
      {% for play in plays %}
      {%   if play and not play.startswith('#') and not play.startswith(' ') %}
          {{ deployer_setup_pre_hook | format(name='*', play=play) | replace('hooks.d/*/', '') | replace('pre', '[pre|post]', 1) }}
      {%   endif %}
      {% endfor %}
        {{ deployer_setup_post_hook | format(name='*', play=item) | replace('hooks.d/*/', '') }}
    color: bright purple
  with_items: "{{ deployer_setup_hook_plays | intersect(hooks | default(deployer_setup_hook_plays)) }}"
0707010012034B000081A40000000000000000000000015BD0D1D2000014A6000000FD0000000200000000000000000000005300000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/tasks/check-iso.yml#
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Check content of directory to be the right ISO, fail if unexpected content
# found.
#
# Vars:
# check_iso_header - header to display when printing debug/error messages
# check_iso_file - ISO file to mount before checking, can be empty string
# check_iso_mount_dir - dir to check for mounted content, can be empty string
# check_iso_target_dir - target dir
# check_iso_marker_file - file which indicates the entire ISO
# check_iso_marker_file_line - regexp to check in first 2 lines of the file
---
- name: deployer-setup | check-iso | Check if ISO file exists
  become: yes
  stat:
    path: "{{ check_iso_file }}"
  register: check_iso_file_exists_result
  when: check_iso_file|length > 0

- name: deployer-setup | check-iso | Print debug info
  debug:
    msg: "Checking if ISO file {{ check_iso_file }} exists:
      {{ check_iso_file_exists_result.stat.exists }}"
  when: check_iso_file|length > 0

- name: deployer-setup | check-iso | Set fact for ISO file availability
  set_fact:
    check_iso_file_available: "{{ check_iso_file|length > 0 and
      check_iso_file_exists_result.stat.exists }}"

- name: deployer-setup | check-iso | Print debug info
  debug:
    msg: "Mounting {{ check_iso_file }} in {{ check_iso_target_dir }}"
  when: check_iso_file_available|bool

- name: deployer-setup | check-iso | Mount proposed ISO file
  become: yes
  mount:
    name: "{{ check_iso_target_dir }}"
    src: "{{ check_iso_file }}"
    fstype: iso9660
    opts: ro
    state: mounted
  when: check_iso_file_available|bool

# No ternary filter in Jinja 1.7
- name: deployer-setup | check-iso | Identify which directory to check
    if check_iso_mount_dir is provided
  set_fact:
    check_iso_dir: "{{ check_iso_mount_dir }}"
  when: check_iso_mount_dir|length > 0

- name: deployer-setup | check-iso | Identify which directory to check
    if check_iso_mount_dir is not provided
  set_fact:
    check_iso_dir: "{{ check_iso_target_dir }}"
  when: check_iso_mount_dir|length == 0

- name: deployer-setup | check-iso | Print debug info
  debug:
    msg: "Checking if '{{ check_iso_header }}' content is available in
      {{ check_iso_dir }}"

- name: deployer-setup | check-iso | Check if marker file exists
  stat:
    path: "{{ check_iso_dir }}/{{ check_iso_marker_file }}"
  register: check_iso_target_exists_result

- name: deployer-setup | check-iso | Check marker file contents
  shell: "head -2 {{ check_iso_dir }}/{{ check_iso_marker_file }}"
  register: check_iso_target_contents_result
  when: check_iso_target_exists_result.stat.exists

- name: deployer-setup | check-iso | Set internal result flag
  set_fact:
    _check_iso_ok: "{{ check_iso_target_exists_result.stat.exists and
      check_iso_target_contents_result.stdout
      |search(check_iso_marker_file_line) }}"

- name: deployer-setup | check-iso | Override result flag if appropriate
  set_fact:
    _check_iso_ok: true
    when: check_iso_allow_mismatch|bool

- name: deployer-setup | check-iso | Print debug info
  debug:
    msg: "Check if {{ check_iso_dir }} contains '{{ check_iso_header }}':
      {{ _check_iso_ok }}"

- name: deployer-setup | check-iso | Ensure parent of target dir exists
  become: yes
  file:
    path: "{{ check_iso_target_dir|dirname }}"
    state: directory
    recurse: yes
  when: _check_iso_ok|bool and check_iso_mount_dir|length > 0

- name: deployer-setup | check-iso | Symlink target dir to proposed mount dir
  become: yes
  file:
    dest: "{{ check_iso_target_dir }}"
    src: "{{ check_iso_mount_dir }}"
    state: link
  when: _check_iso_ok|bool and check_iso_mount_dir|length > 0

- name: deployer-setup | check-iso | Unmount proposed ISO file in case of
    wrong content
  become: yes
  mount:
    name: "{{ find_iso_target_dir }}"
    src: "{{ find_iso_file }}"
    fstype: iso9660
    opts: ro
    state: unmounted
  when: check_iso_file_available|bool and not _check_iso_ok|bool

- name: deployer-setup | check-iso | Fail if wrong ISO/DVD mounted
  fail:
    msg: "Unrecognized content found in {{ check_iso_target_dir }} folder,
      where content of '{{ check_iso_header }}' DVD/ISO is expected."
  when: check_iso_target_exists_result.stat.exists and
    not check_iso_file_available|bool and not _check_iso_ok|bool

- name: deployer-setup | check-iso | Fail if wrong ISO/DVD file provided
  fail:
    msg: "Unrecognized content found in {{ check_iso_file }} ISO file, where
      content of '{{ check_iso_header }}' DVD/ISO is expected."
  when: check_iso_target_exists_result.stat.exists and
    check_iso_file_available|bool and not _check_iso_ok|bool

- name: deployer-setup | check-iso | Set resulting var for external use
  set_fact:
    check_iso_ok: "{{ _check_iso_ok }}"
07070100120337000081A40000000000000000000000015BD0D1D20000053E000000FD0000000200000000000000000000005800000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/tasks/configure-bash.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.
#
# Configure the bash shell we will be working in
---
- set_fact:
    bashrc_path="{{ ansible_env.HOME }}/.bashrc"

- stat: path=bashrc_path
  register: bashrc

- name: deployer-setup | configure-bash | Unset HISTCONTROL in the environment
  replace:
    dest=bashrc_path
    regexp="HISTCONTROL=[\w]*"
    replace="HISTCONTROL="
  when: bashrc.stat.exists is defined and bashrc.stat.exists

- name: deployer-setup | configure-bash | HISTCONTROL comment fixing
  replace:
    dest=bashrc_path
    regexp="don\'t put duplicate lines or lines starting with space in the history"
    replace="do not filter out any command from the history"
  when: bashrc.stat.exists is defined and bashrc.stat.exists
07070100120339000081A40000000000000000000000015BD0D1D200000716000000FD0000000200000000000000000000005700000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/tasks/configure-smt.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.

---

- set_fact:
    suse_release: suse-{{ansible_distribution_version}}

- include_vars: roles/osconfig/vars/repos-cloud.yml

- name: deployer-setup | configure-smt | Check if SMT paths exist
  stat:
    path: "/srv/www/htdocs/repo/{{ item.value.smt_path }}"
  with_dict: "{{ expected_repodata[suse_release][ansible_architecture] }}"
  register: smt_repos

- name: deployer-setup | configure-smt | Check if repositories are already available
  stat:
    path: /srv/www/{{ suse_release }}/{{ ansible_architecture }}/repos/{{ item.item.value.name }}
  with_items: smt_repos.results
  register: repo_stat
  when: item.stat.exists

- name: deployer-setup | configure-smt | Create repo tree
  file:
    state: directory
    path: /srv/www/{{ suse_release }}/{{ ansible_architecture }}/repos/
  become: yes

- name: deployer-setup | configure-smt | Link SMT paths to repo directories
  file:
    state: link
    src: "/srv/www/htdocs/repo/{{ expected_repodata[suse_release][ansible_architecture][item.item.item.key]['smt_path'] }}"
    dest: /srv/www/{{ suse_release }}/{{ ansible_architecture }}/repos/{{ item.item.item.value.name }}
  become: yes
  with_items: repo_stat.results
  when: (item.skipped is not defined and not item.stat.exists)
07070100120346000081A40000000000000000000000015BD0D1D200000663000000FD0000000200000000000000000000006000000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/tasks/create-ptf-signing-key.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.
#
---

# create a private gpg key. Use the `ansible_fqdn` fact as Name-Email
# to identify the key

- name: deployer-setup | create-ptf-signing-key | Check PTF signing secret key
  command: "/usr/bin/gpg --list-secret-key nobody@{{ ansible_fqdn }}"
  become: yes
  ignore_errors: yes
  register: ptf_signing_secret_key_result

- name: deployer-setup | create-ptf-signing-key | Create PTF signing secret key
  # shell code copied (with modifications) from Crowbar's install-chef-suse.sh
  shell: |
    ARDANA_TMPDIR=$(mktemp -d --tmpdir ardana-gpg-setup-XXXXXX)
    KEY_BATCH=$ARDANA_TMPDIR/SUSE-key.batch
    echo "Key-Type: RSA" >> $KEY_BATCH
    echo "Key-Length: 2048" >> $KEY_BATCH
    echo "Name-Real: PTF repository signing key" >> $KEY_BATCH
    echo "Name-Comment: autogenerated" >> $KEY_BATCH
    echo "Name-Email: nobody@{{ ansible_fqdn }}" >> $KEY_BATCH
    echo "Expire-Date: 0" >> $KEY_BATCH
    echo "%commit" >> $KEY_BATCH
    gpg --batch --gen-key $KEY_BATCH
    rm -rf $ARDANA_TMPDIR
  become: yes
  when: ptf_signing_secret_key_result.rc != 0
07070100120345000081A40000000000000000000000015BD0D1D200000C5A000000FD0000000200000000000000000000005200000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/tasks/find-iso.yml#
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Try to find mounted ISO by content of a specific file, or unmounted ISO file.
# If found, create a symlink from specified directory to mounted CD-ROM, or
# mount ISO file on temporary folder and rsync.
# Vars:
# find_iso_header - name of the ISO to search (for debugging purposes)
# find_iso_file - iso file to mount if mounted content not found
# find_iso_mount_dir - possible mount location (/media/cdrom, etc)
# find_iso_marker_file - file to look for on mounted ISO
# find_iso_marker_file_line - regexp line to search in marker file
# find_iso_target_dir - dir to link or rsync
#
# Sample marker files and content:
#
# SLES
#> cat /media/cdrom/media.1/products
#/ SLES12-SP3 12.3-0
#
# SLES-SDK
#> cat /media/sdk/media.1/products
#/ SDK12-SP3 12.3-0
#
# RHEL
# $ cat /media/rhel/.discinfo
# 1476915898.899142
# Red Hat Enterprise Linux 7.3
# x86_64
# 1
---
- name: deployer-setup | find-iso | Check if existing setup is ok
  include: check-iso.yml
  vars:
    check_iso_header: "{{ find_iso_header }}"
    check_iso_file: ''
    check_iso_mount_dir: ''
    check_iso_target_dir: "{{ find_iso_target_dir }}"
    check_iso_marker_file: "{{ find_iso_marker_file }}"
    check_iso_marker_file_line: "{{ find_iso_marker_file_line }}"
    check_iso_allow_mismatch: "{{ find_iso_allow_mismatch | default(false) }}"

- name: deployer-setup | find-iso | Try proposed mounted directory
  include: check-iso.yml
  vars:
    check_iso_header: "{{ find_iso_header }}"
    check_iso_file: ''
    check_iso_mount_dir: "{{ find_iso_mount_dir }}"
    check_iso_target_dir: "{{ find_iso_target_dir }}"
    check_iso_marker_file: "{{ find_iso_marker_file }}"
    check_iso_marker_file_line: "{{ find_iso_marker_file_line }}"
    check_iso_allow_mismatch: "{{ find_iso_allow_mismatch | default(false) }}"
  when: not check_iso_ok|bool

- name: deployer-setup | find-iso | Try proposed ISO file
  include: check-iso.yml
  vars:
    check_iso_header: "{{ find_iso_header }}"
    check_iso_file: "{{ find_iso_file }}"
    check_iso_mount_dir: ''
    check_iso_target_dir: "{{ find_iso_target_dir }}"
    check_iso_marker_file: "{{ find_iso_marker_file }}"
    check_iso_marker_file_line: "{{ find_iso_marker_file_line }}"
    check_iso_allow_mismatch: "{{ find_iso_allow_mismatch | default(false) }}"
  when: not check_iso_ok|bool

- name: deployer-setup | find-iso | Warn if no ISO content found anywhere
  debug:
    msg: "WARNING: content of '{{ find_iso_header }}' DVD/ISO is not found
      mounted at {{ find_iso_mount_dir }} or in ISO file {{ find_iso_file }}"
  when: not check_iso_ok|bool
07070100120334000081A40000000000000000000000015BD0D1D20000039D000000FD0000000200000000000000000000005A00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/tasks/init-third-party.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: deployer-setup | init-third-party | Create third-party dir
  file:
    path: "{{ third_party_root_dir }}"
    state: directory

- name: deployer-setup | init-third-party | Copy README
  copy:
    src: README-third-party.md
    dest: "{{ third_party_root_dir }}/README.md"

0707010012033A000081A40000000000000000000000015BD0D1D200000474000000FD0000000200000000000000000000006000000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/tasks/install-cloud-ptf-repo.yml#
# (c) Copyright 2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---

- name: deployer-setup | install-cloud-ptf-repo | Install createrep-cloud-ptf script
  template:
    src: createrepo-cloud-ptf.j2
    dest: /usr/local/sbin/createrepo-cloud-ptf
    mode: 0755
  become: yes

- name: deployer-setup | install-cloud-ptf-repo | Create PTF repository directory
  become: yes
  file:
    name: "/srv/www/suse-{{ansible_distribution_version}}/{{ ansible_architecture }}/repos/PTF"
    state: directory

- name: deployer-setup | install-cloud-ptf-repo | Create PTF repodata
  become: yes
  shell: /usr/local/sbin/createrepo-cloud-ptf
0707010012033C000081A40000000000000000000000015BD0D1D2000006A4000000FD0000000200000000000000000000006D00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/tasks/install-input-model-contents-legacy.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/ardana_tar_locations.yml
- include_vars: "{{ playbook_dir }}/ardana_version.yml"

- name: deployer-setup | install-input-model-contents | Install ardana input model (legacy)
  unarchive:
    src: "{{ ardanauser_home }}/{{ deployer_input_model_tarball }}"
    dest: "{{ ardanauser_home }}/{{ ardana_version }}"
    copy: no

- name: deployer-setup | install-input-model-contents | List contents of ardana-input-model/2.0 (legacy)
  command: find . -maxdepth 1 -type d -printf '%P\n'
  args:
    chdir: "{{ ardanauser_home }}/{{ ardana_version }}/ardana-input-model/2.0"
  register: ardana_input_model_deployer
  changed_when: True

- name: deployer-setup | install-input-model-contents | Copy examples to ardana directory (legacy)
  synchronize:
    src: "{{ ardanauser_home }}/{{ ardana_version }}/ardana-input-model/2.0/{{ item }}"
    dest: "{{ git_operations_staging_directory }}"
    delete: yes
    copy_links: yes
  with_items: "{{ ardana_input_model_deployer.stdout_lines | default([]) | difference(['', 'services']) }}"
07070100120338000081A40000000000000000000000015BD0D1D2000005E5000000FD0000000200000000000000000000006600000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/tasks/install-input-model-contents.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: deployer-setup | install-input-model-contents | SUSE- Install ardana input model (rpm)
  become: yes
  when: ansible_os_family == 'Suse'
  zypper:
    name: "{{ item }}"
    state: present
  with_items:
    - ardana-input-model

- name: deployer-setup | install-input-model-contents | List contents of ardana-input-model/2.0 (rpm)
  command: find . -maxdepth 1 -type d -printf '%P\n'
  args:
    chdir: "{{ deployer_input_model_src }}"
  register: ardana_input_model_deployer
  changed_when: True

- name: deployer-setup | install-input-model-contents | Copy examples to ardana directory (rpm)
  synchronize:
    src: "{{ deployer_input_model_src }}/{{ item }}"
    dest: "{{ git_operations_staging_directory }}"
    delete: yes
    copy_links: yes
  with_items: "{{ ardana_input_model_deployer.stdout_lines | default([]) | difference(['', 'services']) }}"
07070100120344000081A40000000000000000000000015BD0D1D200000565000000FD0000000200000000000000000000005D00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/tasks/install-isos-legacy.yml#
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

---

# include with with_items is deprecated/removed in ansible 1.9.6

- include: "find-iso.yml"
  vars:
    find_iso_header: "SLES 12 SP3 Server"
    find_iso_file: "{{ ardanauser_home }}/{{ deployer_sles12_iso }}"
    find_iso_mount_dir: "/media/cdrom"
    find_iso_marker_file: "media.1/products"
    find_iso_marker_file_line: " SLES12-SP3 "
    find_iso_target_dir:
      "{{ PACKAGE_CONSTANTS.REPO_DIR }}/ardana/sles12/zypper/OS"

- include: "find-iso.yml"
  vars:
    find_iso_header: "SLES 12 SP3 Server"
    find_iso_file: "{{ ardanauser_home }}/{{ deployer_sles12_iso }}"
    find_iso_mount_dir: "/media/sles"
    find_iso_marker_file: "media.1/products"
    find_iso_marker_file_line: " SLES12-SP3 "
    find_iso_target_dir:
      "{{ PACKAGE_CONSTANTS.REPO_DIR }}/ardana/sles12/zypper/OS"
07070100120341000081A40000000000000000000000015BD0D1D200000776000000FD0000000200000000000000000000005E00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/tasks/install-isos-product.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: deployer-setup | install-isos | Get SOC8 ISO path
  find_zypper_iso:
    name: SUSE-OPENSTACK-CLOUD-8
  become: yes
  register: soc8_iso

- name: deployer-setup | install-isos | Get HOS8 ISO path
  find_zypper_iso:
    name: HPE-HELION-OPENSTACK
  become: yes
  register: hos8_iso

- name: deployer-setup | install-isos | Fail if both flavors are present
  fail: >
    Found both SUSE OpenStack Cloud 8 and HPE Helion OpenStack 8 present
    on the system. Remove one to continue.
  when: soc8_iso.path != '' and hos8_iso.path != ''

- include: "find-iso.yml"
  vars:
    find_iso_header: "SUSE OpenStack Cloud 8"
    find_iso_file: "{{ soc8_iso.path }}"
    find_iso_mount_dir: ""
    find_iso_marker_file: "media.1/products"
    find_iso_marker_file_line: "SOC8 8-0"
    find_iso_target_dir:
      "/srv/www/suse-{{ansible_distribution_version}}/{{ ansible_architecture }}/repos/Cloud"
  when: soc8_iso.path != ''

- include: "find-iso.yml"
  vars:
    find_iso_header: "HPE Helion OpenStack 8"
    find_iso_file: "{{ hos8_iso.path }}"
    find_iso_mount_dir: ""
    find_iso_marker_file: "media.1/products"
    find_iso_marker_file_line: "HOS8 8-0"
    find_iso_target_dir:
      "/srv/www/suse-{{ansible_distribution_version}}/{{ ansible_architecture }}/repos/Cloud"
  when: hos8_iso.path != '' and soc8_iso.path == ''
0707010012033D000081A40000000000000000000000015BD0D1D200000420000000FD0000000200000000000000000000005B00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/tasks/install-isos-rhel.yml#
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

---

# include with with_items is deprecated/removed in ansible 1.9.6

- include: "find-iso.yml"
  vars:
    find_iso_header: "Red Hat Enterprise Linux"
    find_iso_file: "{{ ardanauser_home }}/{{ deployer_rhel7_iso }}"
    find_iso_mount_dir: "/media/rhel"
    find_iso_marker_file: ".discinfo"
    find_iso_marker_file_line: "Red Hat Enterprise Linux "
    find_iso_target_dir:
      "{{ PACKAGE_CONSTANTS.REPO_DIR }}/ardana/rhel7/yum/OS"
    find_iso_allow_mismatch: true
07070100120347000081A40000000000000000000000015BD0D1D20000067E000000FD0000000200000000000000000000006400000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/tasks/install-my-cloud-directory.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: deployer-setup | install-my-cloud-directory | Create my-cloud directory structure
  file:
    path: "{{ git_operations_staging_directory }}/my_cloud/{{ item }}"
    state: directory
  with_items:
    - config
    - definition

- name: deployer-setup | install-my-cloud-directory | Install placeholder file
  copy:
    src: cloudConfig.yml
    dest: "{{ git_operations_staging_directory }}/my_cloud/definition/cloudConfig.yml"

- include_vars: ../defaults/ardana_tar_locations.yml

- name: deployer-setup | install-my-cloud-directory | Install configuration symlinks
  unarchive:
    src: "{{ ardanauser_home }}/{{ deployer_config_tarball }}"
    dest: "{{ git_operations_staging_directory }}/my_cloud/config"
    copy: no
  when: deployer_media_legacy_layout|bool

- name: deployer-setup | install-my-cloud-directory | Create configuration symlinks
  include: _create_symlinks.yml
  vars:
    work_dir: "{{ git_operations_staging_directory }}/my_cloud/config"
  when: deployer_media_legacy_layout|bool == false07070100120348000081A40000000000000000000000015BD0D1D2000005F3000000FD0000000200000000000000000000005E00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/tasks/install-rhel-support.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: deployer-setup | install-rhel-support | Test if we have the yum tarball
  stat:
    path: "{{ ardanauser_home }}/{{ deployer_rhel7_yum_extras_tarball }}"
  register: _rhel7_yum_extras_tarball_present_result

- name: deployer-setup | install-rhel-support | Create yum_extras repo directory
  become: yes
  file:
    path: "{{ yum_extras_dir }}"
    state: directory
    mode: 0755
  when: _rhel7_yum_extras_tarball_present_result.stat.exists

- name: deployer-setup | install-rhel-support | Populate yum extras repo
  become: yes
  # I have to use tar here because the tarball has an extra directory level
  # embedded in it and the unarchive module can't do "strip".
  command: tar xf {{ ardanauser_home }}/{{ deployer_rhel7_yum_extras_tarball }} --strip-components=1
  args:
    chdir: "{{ yum_extras_dir }}"
  when: _rhel7_yum_extras_tarball_present_result.stat.exists
07070100120343000081A40000000000000000000000015BD0D1D20000056D000000FD0000000200000000000000000000005E00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/tasks/install-sles-support.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.
#
---

- name: deployer-setup | install-sles-support | Test if we have the zypper tarball
  stat:
    path: "{{ ardanauser_home }}/{{ deployer_sles_zypper_extras_tarball }}"
  register: _sles_zypper_extras_tarball_present_result

- name: deployer-setup | install-sles-support | Create zypper_extras repo directory
  become: yes
  file:
    path: "{{ zypper_extras_dir }}"
    state: directory
    mode: 0755
  when: _sles_zypper_extras_tarball_present_result.stat.exists

- name: deployer-setup | install-sles-support | Populate zypper extras repo
  become: yes
  command: tar xf {{ ardanauser_home }}/{{ deployer_sles_zypper_extras_tarball }}
  args:
    chdir: "{{ zypper_extras_dir }}"
  when: _sles_zypper_extras_tarball_present_result.stat.exists
0707010012033E000081A40000000000000000000000015BD0D1D2000006DB000000FD0000000200000000000000000000005F00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/tasks/install-venv-contents.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.
#
# We need the /opt/ardana_packager directory populate so that we have
# the packager-1.tgz file to expand.
---
- include_vars: ../defaults/ardana_tar_locations.yml

- name: deployer-setup | install-venv-contents | Test we are include venv packages to for the os
  stat:
    path: "{{ ardanauser_home }}/{{ item.value }}"
  with_dict: deployer_venv_tarballs
  register: _venv_tar_result

- name: deployer-setup | install-venv-contents | Ensure venv os dir exits exists
  become: yes
  file:
    path: "{{ PACKAGE_CONSTANTS.REPO_DIR }}/{{ ardana_version }}/{{ package_venv_locations[item.item.key][ansible_architecture] }}"
    state: directory
  when: item.stat.exists
  with_items: _venv_tar_result.results

- name: deployer-setup | install-venv-contents | Unarchive venvs to os dir
  become: yes
  unarchive:
    src: "{{ ardanauser_home }}/{{ item.item.value }}"
    dest: "{{ PACKAGE_CONSTANTS.REPO_DIR }}/{{ ardana_version }}/{{ package_venv_locations[item.item.key][ansible_architecture] }}"
    owner: root
    group: root
    copy: no
  when: item.stat.exists
  with_items: _venv_tar_result.results
07070100120342000081A40000000000000000000000015BD0D1D20000034C000000FD0000000200000000000000000000005100000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/tasks/install.yml#
# (c) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- name: deployer-setup | install | Install prerequisites and packages
  become: yes
  package: name={{ item }} state=present
  with_flattened:
    - deployer_prerequisites
    - deployer_packages
0707010012034C000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004900000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/templates07070100120354000081A40000000000000000000000015BD0D1D200000408000000FD0000000200000000000000000000006000000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/templates/_ardana-default.yml.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.
#
# Top-level Ardana {{ item | replace('-', ' ') }} playbook
#
# Automatically managed by Ansible and will be overwritten on each
# deploy ready.
---
# Regather facts on all hosts in case of configuration changes that haven't
# been reflected in the fact cache
- include: ardana-refresh-facts.yml

{% block header %}
{% endblock %}
{% include "hooks.yml.j2" %}
{% block footer %}
{% endblock %}
07070100120359000081A40000000000000000000000015BD0D1D20000030C000000FD0000000200000000000000000000005E00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/templates/ardana-deploy.yml.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.
#}
{% extends "_ardana-default.yml.j2" %}

{% block header %}
- include: sosreport-deploy.yml
- include: upgrade-bootstrap.yml
{% endblock %}
0707010012035B000081A40000000000000000000000015BD0D1D200000302000000FD0000000200000000000000000000006300000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/templates/ardana-reconfigure.yml.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.
#}
{% extends "_ardana-default.yml.j2" %}

{% block footer %}

# Post-reconfigure phase
- include: ardana-status.yml
{% endblock %}
07070100120353000081A40000000000000000000000015BD0D1D200000428000000FD0000000200000000000000000000005F00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/templates/ardana-restart.yml.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.
#
# Top-level Ardana restart playbook
# TODO: This will be generated by Config Processor, iterating through a set
# services defined in a separate json/yaml file.
#
# We can limit this to run on one host like following
#   ansible-playbook -i hosts/verb_hosts ardana-restart.yml --limit single-ccp-c1-m1-mgmt
---
# Regather facts on all hosts in case of configuration changes that haven't
# been reflected in the fact cache
- include: ardana-refresh-facts.yml

{% include "hooks.yml.j2" %}
0707010012034D000081A40000000000000000000000015BD0D1D20000043A000000FD0000000200000000000000000000006800000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/templates/ardana-schedule-restart.yml.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.
#
# Top-level Ardana schedule restart playbook
# TODO: This will be generated by Config Processor, iterating through a set
# services defined in a separate json/yaml file.
#
# We can limit this to run on one host like following
#   ansible-playbook -i hosts/verb_hosts ardana-schedule-restart.yml --limit single-ccp-c1-m1-mgmt
---
# Regather facts on all hosts in case of configuration changes that haven't
# been reflected in the fact cache
- include: ardana-refresh-facts.yml

{% include "hooks.yml.j2" %}
07070100120355000081A40000000000000000000000015BD0D1D2000004F9000000FD0000000200000000000000000000005D00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/templates/ardana-start.yml.j2#
# (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.
#
# Top-level Ardana start playbook
# TODO: This will be generated by Config Processor, iterating through a set
# services defined in a separate json/yaml file.
#
# We can limit this to run on one host like following
#   ansible-playbook -i hosts/verb_hosts ardana-start.yml --limit single-ccp-c1-m1-mgmt
---
- include: pbstart.yml
  vars:
    playbook_name: "ardana-start.yml"

# Regather facts on all hosts in case of configuration changes that haven't
# been reflected in the fact cache
- include: ardana-refresh-facts.yml

{% include "hooks.yml.j2" %}

- include: pbfinish.yml
  vars:
    playbook_name: "ardana-start.yml"07070100120358000081A40000000000000000000000015BD0D1D2000003A7000000FD0000000200000000000000000000005E00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/templates/ardana-status.yml.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.
#}
{% extends "_ardana-default.yml.j2" %}

{% block header %}
# Pre-status Phase
- include: pbstart.yml
  vars:
    playbook_name: "ardana-status.yml"

{% endblock %}



{% block footer %}

# Post-status phase
- include: pbfinish.yml
  vars:
    playbook_name: "ardana-status.yml"

{% endblock %}
0707010012034F000081A40000000000000000000000015BD0D1D20000043E000000FD0000000200000000000000000000005C00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/templates/ardana-stop.yml.j2#
# (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.
#
# Top-level Ardana stop playbook
#
# We can limit this to run on one host like following
#   ansible-playbook -i hosts/verb_hosts ardana-stop.yml --limit single-ccp-c1-m1-mgmt
#
# Automatically managed by Ansible and will be overwritten on each
# deploy ready.
---
# Regather facts on all hosts in case of configuration changes that haven't
# been reflected in the fact cache
- include: ardana-refresh-facts.yml

{% include "hooks.yml.j2" %}
07070100120350000081A40000000000000000000000015BD0D1D200000594000000FD0000000200000000000000000000005E00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/templates/ardana-update.yml.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.
#}
{% extends "_ardana-default.yml.j2" %}

{% block header %}

- include: pbstart.yml
  vars:
    playbook_name: "ardana-update.yml"

# Pre-Update Phase
- include: osconfig-status.yml

#- include: ardana-pre-upgrade-status.yml
#- include: ardana-upgrade-pkg-query.yml
#- include: upgrade-bootstrap.yml
#- include: _osconfig-pre-upgrade.yml
#- include: _ardana-service-pre-upgrade.yml
#- include: _ardana-base-pre-upgrade.yml
# Update phase
#- include: _ardana-upgrade-base.yml
- include: _osconfig-upgrade.yml

{% endblock %}

{% block footer %}

# Post-Update phase
#- include: _osconfig-post-upgrade.yml
#- include: _ardana-service-post-upgrade.yml
#- include: _ardana-base-post-upgrade.yml
#- include: ardana-upgrade-pkg-verify.yml

- include: ardana-status.yml

- include: pbfinish.yml
  vars:
    playbook_name: "ardana-update.yml"

{% endblock %}
0707010012035C000081A40000000000000000000000015BD0D1D20000139F000000FD0000000200000000000000000000006B00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/templates/ardana-upgrade-from-legacy.yml.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.
#}
{% extends "_ardana-default.yml.j2" %}

{% block header %}
# Pre-Upgrade Phase
- include: ardana-upgrade-pkg-query.yml
- include: upgrade-bootstrap.yml
- include: _osconfig-pre-upgrade.yml
# Bypass pre-upgrade scripts for services
# which will be installed for the first time
# or undergo major upgrades (monasca, rmq, db)
#- include: _ardana-service-pre-upgrade.yml

- include: FND-CLU-pre-upgrade.yml
- include: FND-AP2-pre-upgrade.yml
- include: kronos-pre-upgrade.yml

- include: _ardana-base-pre-upgrade.yml

- include: rabbitmq-stop.yml
  vars:
    rabbitmq_do_not_reset_node: true

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

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

# zypper dup will be unable to resolve conflicts with this package present
- hosts: SWF-ACC:SWF-OBJ:SWF-PRX:SWF-CON
  tasks:
    - become: yes
      package:
        state: absent
        name: liberasurecode-devel

# Upgrade phase
- include: _ardana-upgrade-base.yml

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

- hosts: FND-RMQ
  max_fail_percentage: 0
  tasks:
    - include: _ardana-remove-legacy-service.yml
      vars:
        service: epmd.socket
    - include: _ardana-remove-legacy-service.yml
      vars:
        service: epmd
    - pause:
        seconds: 5
    - command: pkill epmd
      become: true
      ignore_errors: true

- include: rabbitmq-disaster-recovery.yml

- include: _osconfig-upgrade.yml

- hosts: MON-AGN
  max_fail_percentage: 0
  become: yes
  vars_files:
    - roles/monasca-agent/defaults/main.yml
  vars:
    - old_monasca_agent_user_name: mon-agent
    - old_monasca_agent_group_name: mon-agent
  tasks:
  - service:
      name: monasca-agent
      state: stopped
      enabled: false
  - group:
      name: {{ '"{{ monasca_agent_group_name }}"' }}
      system: yes
  - user:
      name: {{ '"{{ monasca_agent_user_name }}"' }}
      system: yes
      groups: {{ '"{{ monasca_agent_group_name }}"' }}
      shell: {{ '"{{ monasca_agent_shell }}"' }}
  - shell: |
      chown {{ '--from={{ old_monasca_agent_user_name }}:adm {{ monasca_agent_user_name }}:adm' }} / -R
      chown {{ '--from={{ old_monasca_agent_user_name }}:{{ old_monasca_agent_group_name }} {{ monasca_agent_user_name }}:{{ monasca_agent_group_name }}' }} / -R
    ignore_errors: true

- hosts: KEY-API
  tasks:
    - include: _ardana-remove-legacy-service.yml
  vars:
    - service: barbican-api

- hosts: SWF-PRX
  tasks:
    - include: _ardana-remove-legacy-service.yml
  vars:
    - service: swiftlm-access-log-tailer

- hosts: SWF-ACC:SWF-CON:SWF-OBJ:SWF-PRX
  tasks:
    - include: _ardana-remove-legacy-service.yml
  vars:
    - service: swiftlm-mount

- hosts: SWF-PRX--first-member
  tasks:
    - include: _ardana-remove-legacy-service.yml
  vars:
    - service: swiftlm-uptime-monitor

- hosts: LOG-PRO
  tasks:
    - include: _ardana-remove-legacy-service.yml
  vars:
    - service: beaver

- hosts: FRE-API
  become: yes
  roles:
    - freezer-api
  tasks:
    - file:
        path: /etc/apache2/vhosts.d/freezer-modwsgi.conf
        state: absent
    - include: roles/FND-AP2/tasks/start_reload.yml
      vars:
        apache_restart_requested: yes

- hosts: LOG-SVR
  become: yes
  roles:
    - logging-server
  tasks:
    - file:
        path: /etc/apache2/vhosts.d/kronos-apache2.conf
        state: absent
    - include: roles/FND-AP2/tasks/start_reload.yml
      vars:
        apache_restart_requested: yes
{% endblock %}

{% block footer %}

# Post-Upgrade phase
- include: _osconfig-post-upgrade.yml
#- include: _ardana-service-post-upgrade.yml
- include: FND-CLU-post-upgrade.yml
- include: FND-AP2-post-upgrade.yml
- include: _ardana-base-post-upgrade.yml
- include: ardana-upgrade-pkg-verify.yml
# Ensure that spark-master service is running before checking status
- include: spark-start.yml
- include: ardana-status.yml
{% endblock %}
07070100120351000081A40000000000000000000000015BD0D1D200000519000000FD0000000200000000000000000000005F00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/templates/ardana-upgrade.yml.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.
#}
{% extends "_ardana-default.yml.j2" %}

{% block header %}
# Pre-Upgrade Phase
- include: ardana-pre-upgrade-status.yml
- include: ardana-upgrade-pkg-query.yml
- include: upgrade-bootstrap.yml
- include: _osconfig-pre-upgrade.yml
- include: _ardana-service-pre-upgrade.yml
- include: _ardana-base-pre-upgrade.yml
# Upgrade phase
- include: _ardana-upgrade-base.yml
- include: _osconfig-upgrade.yml

{% endblock %}

{% block footer %}

# Post-Upgrade phase
- include: _osconfig-post-upgrade.yml
- include: _ardana-service-post-upgrade.yml
- include: _ardana-base-post-upgrade.yml
- include: ardana-upgrade-pkg-verify.yml
- include: ardana-status.yml
{% endblock %}
07070100120356000081A40000000000000000000000015BD0D1D2000003EA000000FD0000000200000000000000000000006100000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/templates/createrepo-cloud-ptf.j2#!/bin/sh
#
# (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.
#

for CLOUD_PTF in /srv/www/suse-1*/*/repos/PTF; do
    if test ! -d "${CLOUD_PTF}"; then
        echo "Directory ${CLOUD_PTF} does not exist."
        exit 1
    fi

    createrepo "${CLOUD_PTF}"

    if gpg --list-secret-key {{ ansible_fqdn }} > /dev/null 2>&1; then
        gpg -a --detach-sign --yes "${CLOUD_PTF}/repodata/repomd.xml"
        gpg -a --export > "${CLOUD_PTF}/repodata/repomd.xml.key"
    fi

done
0707010012035D000081A40000000000000000000000015BD0D1D200000969000000FD0000000200000000000000000000005600000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/templates/hooks.yml.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.
#
# hook template to be included by specific ardana action templates
#
# note comment block to exclude copyright/license of template from being
# included in output added to calling templates
#}
{% set hook_dirs = deployer_setup_hooks | map('dirname') | map('basename') | unique | sort %}
# pre {{ item }} Third party hooks
{% for name in hook_dirs %}
{%   set pre_hook_path = deployer_setup_pre_hook | format(name=name, play=item) %}
{%   if pre_hook_path in deployer_setup_hooks %}
- include: {{ pre_hook_path }}
{%   endif %}
{% endfor %}

# {{ item }} services and Third party hooks
{% set plays = (lookup('file', '../files/' ~ item ~ '.list' ) |
               re_sub("\{#.*#}", "", flags='s')).split('\n') %}
{% for play in plays %}
{%   if play.startswith('#') or not play %}{# passthru of comments or blank lines #}
{{ play }}
{%   elif play.startswith(' ') %}{# means most likely addition of 'vars' to previous #}
{{ play }}
{%   else %}
{%     for name in hook_dirs %}
{%       set pre_play_hook_path = deployer_setup_pre_hook | format(name=name, play=play) %}
{%       if pre_play_hook_path in deployer_setup_hooks %}
- include: {{ pre_play_hook_path }}
{%       endif %}
{%     endfor %}
- include: {{ play }}.yml
{%     for name in hook_dirs %}
{%       set post_play_hook_path = deployer_setup_post_hook | format(name=name, play=play) %}
{%       if post_play_hook_path in deployer_setup_hooks %}
- include: {{ post_play_hook_path }}
{%       endif %}
{%     endfor %}
{%   endif %}
{% endfor %}

# post {{ item }} Third party hooks
{% for name in hook_dirs %}
{%   set post_hook_path = deployer_setup_post_hook | format(name=name, play=item) %}
{%   if post_hook_path in deployer_setup_hooks %}
- include: {{ post_hook_path }}
{%   endif %}
{% endfor %}
07070100120314000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004400000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/vars07070100120315000081A40000000000000000000000015BD0D1D2000008E2000000FD0000000200000000000000000000004D00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/deployer-setup/vars/main.yml#
# (c) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
ardanauser_home: "{{ ansible_env['HOME'] }}"

hlinux_distro: "cattleprod"

hlinux_apt_repo_loc: /media/cdrom
hlinux_apt_backup_loc: /tmp/backup.tar
foreign_apt_tarball_loc: "{{ ardanauser_home }}/foreign_apt_repo.tgz"
# The actual names of these tarballs contain an embedded timestamp so we have to search for them.
netboot_tarball_glob: "{{ hlinux_apt_repo_loc }}/extras/hLinux-{{ hlinux_distro }}-amd64-netboot-*.tar.gz"
grub_net_glob: "{{ hlinux_apt_repo_loc }}/extras/grub*efi"
deployer_setup_hlinux_qcow2: "{{ hlinux_apt_repo_loc }}/hos/hlinux.qcow2"
deployer_setup_qcow2_path: "{{ ardanauser_home }}/stage/images"

hlinux_ova_name: "hlinux.ova"
hlinux_ova_path: "{{ hlinux_apt_repo_loc }}/hos/{{ hlinux_ova_name }}"
target_ova_location: "{{ PACKAGE_CONSTANTS.REPO_DIR }}/{{ ardana_version }}/ova_images"
ova_repo_path: "{{ ardana_version }}/ova_images/{{ hlinux_ova_name }}"

hlinux_repo_loc: ardana/hlinux
foreign_repo_loc: ardana/foreign

hlinux_apt_repo_dir: "{{ PACKAGE_CONSTANTS.REPO_DIR }}/{{ hlinux_repo_loc }}"
foreign_apt_repo_dir: "{{ PACKAGE_CONSTANTS.REPO_DIR }}/{{ foreign_repo_loc }}"

hlinux_repo_url: "http://localhost:{{ deployer_server_port }}/{{ hlinux_repo_loc }}"
hlinux_repo_source: "'deb [arch=amd64] {{ hlinux_repo_url }} cattleprod main contrib non-free'"

# Optional extra YUM repo variables
yum_extras_loc: ardana/rhel7/yum/extras
yum_extras_dir: "{{ PACKAGE_CONSTANTS.REPO_DIR }}/{{ yum_extras_loc }}"

zypper_extras_loc: ardana/sles12/zypper/extras
zypper_extras_dir: "{{ PACKAGE_CONSTANTS.REPO_DIR }}/{{ zypper_extras_loc }}"

third_party_root_dir: "{{ ardanauser_home }}/third-party"
07070100120267000041ED0000000000000000000000045BD0D1D200000000000000FD0000000200000000000000000000003F00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/git-operations07070100120277000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004800000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/git-operations/defaults07070100120278000081A40000000000000000000000015BD0D1D20000083C000000FD0000000200000000000000000000005100000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/git-operations/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.
#
---
ardanauser_home: "{{ ansible_env['HOME'] }}"

home_dir: "{{ ardanauser_home }}"

git_operations_staging_directory: "{{ home_dir }}/openstack-input"

git_operations:
    main_repo: "{{ home_dir }}/openstack"
    upstream_branch: ardana
    site_branch: site
    cp_branch: cp-persistent
    ansible_branch: ansible
    temp_cp_branch: staging-cp-persistent
    temp_ansible_branch: staging-ansible
    cp_subdir: my_cloud/persistent_state
    cp_info_subdir: my_cloud/stage/info
    cp_info_target: my_cloud/info
    cp_html_subdir: my_cloud/stage/html
    cp_html_target: my_cloud/html
    ansible_subdir: my_cloud/stage

    # The directory where users can place edited metadata
    # files to trigger credentials changes
    change_credentials: change_credentials
    # The directory where new commits to the
    # ardana branch are readied
    ardana_scratch_dir: "{{ home_dir }}/scratch/ardana"

    # The directory to import a new Ardana OpenStack drop from
    ardana_import_dir: "{{ git_operations_staging_directory }}"

    # The directory where the CP inputs are assembled
    # and the ansible outputs are pulled from
    cp_target_dir: "{{ home_dir }}/scratch/cp"
    cp_scratch_dir: "{{ home_dir }}/scratch/.cp"

    # The directory we put together to run ansible
    # for a deployment
    ansible_target_dir: "{{ home_dir }}/scratch/ansible"
    ansible_scratch_dir: "{{ home_dir }}/scratch/.ansible"

    initial_tag_timestamp: 00000000T000000Z
07070100120268000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004500000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/git-operations/tasks07070100120276000081A40000000000000000000000015BD0D1D200000751000000FD0000000200000000000000000000006500000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/git-operations/tasks/_assemble-working-directory.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.
#

# Prepare a scratch directory from various checkouts
#
# Parameters:
#   repo: ~/ardana
#   target_dir: ~/cp-run (subdirs of this used as work dirs)
#   branches:
#     - name: site
#       copies:
#         - from: some relative path
#           to: some relative path
#         - ... etc ...
#     - name: cp-persistent
#       copies:
#         - ... etc ...
---

- name: git-operations | _assemble-working-directory | Clear out target directory
  file:
    dest: "{{ target_dir }}"
    state: absent

- name: git-operations | _assemble-working-directory | Create target directory
  file:
    dest: "{{ target_dir }}"
    state: directory

- name: git-operations | _assemble-working-directory | Assemble scratch content
  shell: >
    {% for branch in branches %}
        rm -rf .work &&
        git clone -b {{ branch.name | quote }} {{ repo | quote }} .work &&
        {% for copy in branch.copies %}
            if [ -e ./.work/{{ copy.from | quote }} ]; then
                mkdir -p ./{{ copy.to | dirname | quote }} &&
                rsync -a --exclude=.git .work/{{ copy.from | quote }} ./{{ copy.to | quote }}
            fi &&
        {% endfor %}
    {% endfor %}
    rm -rf .work
  args:
    chdir: "{{ target_dir }}"
07070100120273000081A40000000000000000000000015BD0D1D2000005EA000000FD0000000200000000000000000000005500000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/git-operations/tasks/_initialise.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.
#

# Create an empty git repository.
# Parameters:
#   repo: ~/ardana
#   branches:
#     - ardana
#     - site
#     - cp-persistent
#     - ansible
---
- name: git-operations | _initialise | Create repository
  command: >
    git init {{ repo }}
  args:
    creates: "{{ repo }}/.git"

- name: git-operations | _initialise | Configure git
  shell: >
    git config --global user.email "ardana@googlegroups.com" &&
    git config --global user.name "Ardana git user"
  args:
    chdir: "{{ repo }}"

- name: git-operations | _initialise | Create initial branches
  shell: >
    if ! git rev-parse --verify {{ item }}; then
        git checkout --orphan {{ item }} &&
        git rm -rf --ignore-unmatch . &&
        touch .gitignore &&
        git add -A &&
        git commit -a -m "Initial commit on {{ item }}"
    fi
  args:
    chdir: "{{ repo }}"
  with_items: branches
07070100120269000081A40000000000000000000000015BD0D1D20000044D000000FD0000000200000000000000000000005500000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/git-operations/tasks/_merge-site.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.
#

# Merge the site and openstack branch tips
#
# Ensure that the site branch is checked out.
# Merge from a new tip of the openstack branch.
#
# Parameters:
#   repo: ~/ardana
#   site_branch: site
#   upstream_branch: ardana
---

- name: git-operations | _merge-site | Merge new {{ upstream_branch }} branch to {{ site_branch }}
  shell: >
    git checkout {{ site_branch | quote }} &&
    git merge {{ upstream_branch | quote }}
  args:
    chdir: "{{ repo }}"
0707010012026A000081A40000000000000000000000015BD0D1D2000009E6000000FD0000000200000000000000000000005900000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/git-operations/tasks/_persist-to-git.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.
#

# Receive a new Ardana OpenStack drop
#
# Create a new commit on a specified branch
# We clone the branch into a scratch repo,
# unconditionally lay down the new directory,
# and commit those contents as a new commit,
# pushing the successful change back to the
# original branch.
#
# Parameters:
#   repo: ~/ardana
#   work_dir: ~/.ardana.new
#   commit_msg: "New drop"
#   branches:
#     - name: ardana
#       copies:
#       - from: ~/ardana.new (a directory of contents)
#         to: .
---

- name: git-operations | _persist-to-git | Clear scratch directory
  file:
    dest: "{{ work_dir }}"
    state: absent

- name: git-operations | _persist-to-git | Create scratch directory
  file:
    dest: "{{ work_dir }}"
    state: directory

- name: git-operations | _persist-to-git | Prep new commit
  shell: >
    {% for branch in branches %}
        rm -rf .work &&
        if ( cd {{ repo }} && git rev-parse --verify {{ branch.name | quote }} )
        then
            git clone -b {{ branch.name | quote }} {{ repo }} .work &&
            (
            cd .work &&
            git rm -rf .
            )
        else
            git clone {{ repo }} .work &&
            (
            cd .work &&
            git checkout --orphan {{ branch.name | quote }} &&
            git rm -rf --ignore-unmatch .
            )
        fi &&
        (
        cd .work &&
        {% for copy in branch.copies %}
            if [ -e {{ copy.from }} ]; then
              {% if copy.to | dirname != '' -%}
                  mkdir -p {{ copy.to | dirname | quote }} &&
              {%- endif %}
              cp -a {{ copy.from }}/. {{ copy.to }}
            fi &&
        {% endfor %}
        git add -A &&
        git commit --allow-empty -m "{{ commit_msg }}" &&
        git push origin {{ branch.name | quote }}
        ) &&
    {% endfor %}
    rm -rf .work
  args:
    chdir: "{{ work_dir }}"
0707010012026E000081A40000000000000000000000015BD0D1D200000BFC000000FD0000000200000000000000000000005F00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/git-operations/tasks/_promote-from-staging.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.
#

# Promote saved branches from staging
#
# At this stage, the CP persistent state we have is about to gain
# real-world semantics: it's going to be made 'live' by a deployment.
# Promote staging-cp-persistent and staging-ansible to the top of the
# cp-persistent and ansible branches, respectively.
# These cherry-picks should be accepted unconditionally.
# The staging-* branches are then deleted.
# (We don't want to do this part twice: in the eventuality that the
# user is picking up a deployment that stumbled from a midway point,
# we ensure this step is idempotent.)
#
# Parameters:
#   repo: ~/ardana
#   work_dir: ~/.ardana
#   merge_msg: "Your message goes here"
#   branches:
#     - from: staging-cp-persistent
#       to: cp-persistent
#     - from: staging-ansible
#       to: cp-ansible
---

# git >= 2.9.0 does not allow merging unrelated histories anymore. Need to force
# merge by providing --allow-unrelated-histories option.

- name: git-operations | _promote-from-staging | Evaluate git version
  shell: git --version
  register: git_version_result

- name: git-operations | _promote-from-staging | Prepare git-merge command line
  set_fact:
    git_merge_allow_unrelated_histories: "{{  git_version_result.stdout
      | split(' ') | last | version_compare('2.9.0', '>=')
      | ternary('--allow-unrelated-histories', '') }}"

- name: git-operations | _promote-from-staging | Clear out working directory
  file:
    dest: "{{ work_dir }}"
    state: absent

- name: git-operations | _promote-from-staging | Clear out working directory
  file:
    dest: "{{ work_dir }}"
    state: directory

- name: git-operations | _promote-from-staging | Update branches
  shell: >
    {% for branch in branches %}
        if ( cd {{ repo | quote }} && git rev-parse --verify {{ branch.from | quote }} );
        then
            rm -rf work &&
            git clone -b {{ branch.from | quote }} {{ repo | quote }} work &&
            (
                cd work &&
                git merge -s ours -m "{{ merge_msg }}" \
                  {{ git_merge_allow_unrelated_histories }} \
                  origin/{{ branch.to | quote }} &&
                git branch -f {{ branch.to | quote }} &&
                git push origin {{ branch.to | quote }} &&
                git push origin --delete {{ branch.from | quote }}
            )
        fi &&
    {% endfor %}
    rm -rf work
  args:
    chdir: "{{ work_dir }}"
0707010012026C000081A40000000000000000000000015BD0D1D20000046D000000FD0000000200000000000000000000005E00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/git-operations/tasks/_save-info-directory.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.
#

# Copy the info directory into the repo
#
# This is a simple directory copy-and-replace:
# the target is ignored by git.
#
# Parameters:
#   repo: ~/ardana
#   work_dir: ~/scratch/cp
#   from: my_cloud/stage/info
#   to: my_cloud/info
---

- name: git-operations | _persist-to-git | Clear target directory
  file:
    dest: "{{ repo }}/{{ to }}"
    state: absent

- name: git-operations | _persist-to-git | Copy source
  command: >
    cp -R "{{ work_dir }}/{{ from }}" "{{ repo }}/{{ to }}"
07070100120272000081A40000000000000000000000015BD0D1D200000555000000FD0000000200000000000000000000006600000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/git-operations/tasks/_tag-branches-for-deployment.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.
#

# Lay down tags before running a deployment
#
# At this moment, the tip of site, cp-persistent and ansible should all correspond.
# Lay down a timestamped tag on all three of those branches to record the deployment event.
#
# Parameters:
#   repo: ~/ardana
#   timestamp: 20150101T001020Z
#   branches:
#     - site
#     - cp-persistent
#     - ansible
---

- name: git-operations | _tag-branches-for-deployment | Lay down timestamped tags
  shell: >
    {% for branch in branches %}
        if ! git rev-parse --verify "deployment-{{ timestamp }}-{{ branch }}" ; then
            git tag "deployment-{{ timestamp }}-{{ branch }}" {{ branch | quote }}
        fi &&
    {% endfor %}
    true
  args:
    chdir: "{{ repo }}"
0707010012026D000081A40000000000000000000000015BD0D1D2000004DD000000FD0000000200000000000000000000005B00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/git-operations/tasks/check-repo-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.
#

# Check if a git repo has all changes committed.
# Parameters:
#   repo: ~/ardana
---
- name: git-operations | check-repo-status | Check for uncommitted changes
  shell: >
    git diff-index --quiet HEAD &&
    [ -z "$(git ls-files --others --exclude-standard)" ]
  args:
    chdir: "{{ repo }}"
  register: git_result
  ignore_errors: true

- name: git-operations | check-repo-status | Report uncommitted changes
  fail:
    msg: >
      You have uncommitted changes in {{ repo }}. You should review these
      (with a "git status" command) and resolve them before proceeding.
  when: git_result|failed
0707010012026B000081A40000000000000000000000015BD0D1D200000841000000FD0000000200000000000000000000005400000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/git-operations/tasks/initialise.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.
#

# Create an empty git repository.
---
- name: git-operations | initialise | Install required software
  apt:
    name: git
    state: present
  become: yes
  when: not ansible_os_family | lower | search('suse')

- name: git-operations | initialise | Install required software
  zypper:
    name: git-core
    state: present
  become: yes
  when: ansible_os_family | lower | search('suse')

- name: git-operations | initialise | Create initial repository
  include: _initialise.yml
  vars:
    repo: "{{ git_operations.main_repo }}"
    branches:
      - "{{ git_operations.upstream_branch }}"
      - "{{ git_operations.cp_branch }}"
      - "{{ git_operations.ansible_branch }}"

- name: git-operations | initialise | Ensure {{ git_operations.site_branch }} is checked out
  shell: >
    if git rev-parse --verify {{ git_operations.site_branch | quote }} ; then
        git checkout {{ git_operations.site_branch }}
    else
        git checkout {{ git_operations.upstream_branch }} &&
        git checkout -b {{ git_operations.site_branch }}
    fi
  args:
    chdir: "{{ git_operations.main_repo }}"

- name: git-operations | initialise | Lay down initial tags
  include: _tag-branches-for-deployment.yml
  vars:
    repo: "{{ git_operations.main_repo }}"
    timestamp: "{{ git_operations.initial_tag_timestamp }}"
    branches:
      - "{{ git_operations.site_branch }}"
      - "{{ git_operations.ansible_branch }}"
      - "{{ git_operations.cp_branch }}"
07070100120275000081A40000000000000000000000015BD0D1D2000006BE000000FD0000000200000000000000000000005800000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/git-operations/tasks/prepare-cp-run.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.
#

# Prepare a scratch directory to run the config processor
#
# Parameters:
#   repo: ~/ardana
#   target_dir: ~/cp-run (subdirs of this used as work dirs)
#   branches:
#     site:
#       - from: some relative path
#         to: some relative path
#       - ... etc ...
#     cp-persistent:
#       - ... etc ...
---

- name: git-operations | prepare-cp-run | Ensure all changes committed
  include: check-repo-status.yml
  vars:
    repo: "{{ git_operations.main_repo }}"

- name: git-operations | prepare-cp-run | Assemble CP contents
  include: _assemble-working-directory.yml
  vars:
    repo: "{{ git_operations.main_repo }}"
    target_dir: "{{ git_operations.cp_target_dir }}"
    branches:
      # The contents of the tree or subtree of each branch
      # in turn is copied into a subdirectory of target_dir.
      - name: "{{ git_operations.site_branch }}"
        copies:
          - from: .
            to: .
      - name: "{{ git_operations.cp_branch }}"
        copies:
          - from: "{{ git_operations.cp_subdir }}/."
            to: "{{ git_operations.cp_subdir }}"
07070100120271000081A40000000000000000000000015BD0D1D200000523000000FD0000000200000000000000000000006400000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/git-operations/tasks/ready-deployment-tree-help.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.
#

# Prepare a scratch directory to run the deployment from
#
# Parameters:
#   repo: ~/ardana
#   target_dir: ~/cp-run (subdirs of this used as work dirs)
#   branches:
#     site:
#       - from: some relative path
#         to: some relative path
#       - ... etc ...
#     ansible-persistent:
#       - ... etc ...
---

- name: git-operations | ready-deployment-tree-help | Tell the user what to expect
  debug:
    msg: >
      The directory {{ git_operations.ansible_target_dir }}/next/ardana/ansible
      contains a prepared ansible tree ready to run your deployment.
      You should cd into that directory and run:
      ansible-playbook -i hosts/verb_hosts site.yml
07070100120274000081A40000000000000000000000015BD0D1D200000C35000000FD0000000200000000000000000000005F00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/git-operations/tasks/ready-deployment-tree.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.
#

# Prepare a scratch directory to run the deployment from
#
# Parameters:
#   repo: ~/ardana
#   target_dir: ~/cp-run (subdirs of this used as work dirs)
#   branches:
#     site:
#       - from: some relative path
#         to: some relative path
#       - ... etc ...
#     ansible-persistent:
#       - ... etc ...
---

- name: git-operations | _ready-deployment-tree | Compute previously deployed version
  shell: >
    git tag -l 'deployment-*-{{ git_operations.site_branch }}' |
    sort |
    tail -1 |
    sed -re 's/^deployment-(.*)-.*$/\1/'
  args:
    chdir: "{{ git_operations.main_repo }}"
  register: last_deployment_timestamp

- name: git-operations | _ready-deployment-tree | Promote working branches
  include: _promote-from-staging.yml
  vars:
    repo: "{{ git_operations.main_repo }}"
    work_dir: "{{ git_operations.ansible_scratch_dir }}"
    merge_msg: "Merging promotion of saved output"
    branches:
      - from: "{{ git_operations.temp_cp_branch }}"
        to: "{{ git_operations.cp_branch }}"
      - from: "{{ git_operations.temp_ansible_branch }}"
        to: "{{ git_operations.ansible_branch }}"

- name: git-operations | _ready-deployment-tree | Assemble CP contents
  include: _assemble-working-directory.yml
  vars:
    repo: "{{ git_operations.main_repo }}"
    target_dir: "{{ git_operations.ansible_target_dir }}"
    branches:
      - name: "{{ git_operations.site_branch }}"
        copies:
          - from: .
            to: next/.
      - name: "{{ git_operations.ansible_branch }}"
        copies:
          - from: "{{ git_operations.ansible_subdir }}/."
            to: "next/{{ git_operations.ansible_subdir }}/."
      # We may also want to check out a previous version
      - name: "deployment-{{ last_deployment_timestamp.stdout }}-{{ git_operations.site_branch }}"
        copies:
          - from: .
            to: last/.
      - name: "deployment-{{ last_deployment_timestamp.stdout }}-{{ git_operations.ansible_branch }}"
        copies:
          - from: "{{ git_operations.ansible_subdir }}/."
            to: "last/{{ git_operations.ansible_subdir }}/."


- name: git-operations | _ready-deployment-tree | Lay down deployment tags
  include: _tag-branches-for-deployment.yml
  vars:
    repo: "{{ git_operations.main_repo }}"
    timestamp: "{{ '%Y%m%dT%H%M%SZ' | time_format }}"
    branches:
      - "{{ git_operations.site_branch }}"
      - "{{ git_operations.ansible_branch }}"
      - "{{ git_operations.cp_branch }}"
0707010012026F000081A40000000000000000000000015BD0D1D200000B5F000000FD0000000200000000000000000000005600000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/git-operations/tasks/receive-drop.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.
#

# Receive a new Ardana OpenStack drop
#
# Create a new commit on a specified branch
# We clone the branch into a scratch repo,
# unconditionally lay down the new directory,
# and commit those contents as a new commit,
# pushing the successful change back to the
# original branch.
---

- name: git-operations | receive-drop | Ensure our repo is in a ready state
  include: check-repo-status.yml
  vars:
    repo: "{{ git_operations.main_repo }}"

- name: git-operations | receive-drop | Add a .gitignore
  file:
    dest: "{{ git_operations.ardana_import_dir }}/.gitignore"
    state: touch

- name: git-operations | receive-drop | .gitignore *.pyc
  lineinfile:
    dest: "{{ git_operations.ardana_import_dir }}/.gitignore"
    regexp: "{{ item.re }}"
    line: "{{ item.line }}"
  with_items:
    - { re: "^\\*\\.pyc$", line: "*.pyc" }
    - { re: "^{{ git_operations.cp_info_target }}$", line: "{{ git_operations.cp_info_target }}" }
    - { re: "^{{ git_operations.cp_html_target }}$", line: "{{ git_operations.cp_html_target }}" }
    - { re: "^{{ git_operations.change_credentials }}$",
        line: "{{ git_operations.change_credentials }}" }
    - { re: "^ardana/ansible/ansible\\.cfg$", line: "ardana/ansible/ansible.cfg" }

- name: git-operations | receive-drop | Receive a new source-code drop
  include: _persist-to-git.yml
  vars:
    repo: "{{ git_operations.main_repo }}"
    work_dir: "{{ git_operations.ardana_scratch_dir }}"
    commit_msg: "New drop"
    branches:
      - name: "{{ git_operations.upstream_branch }}"
        copies:
          - from: "{{ git_operations.ardana_import_dir }}"
            to: .

- name: git-operations | receive-drop | Merge new Ardana OpenStack branch to site
  include: _merge-site.yml
  vars:
    repo: "{{ git_operations.main_repo }}"
    site_branch: "{{ git_operations.site_branch }}"
    upstream_branch: "{{ git_operations.upstream_branch }}"

- name: git-operations | receive-drop | Tell the user what to expect
  debug:
    msg: >
      The directory {{ git_operations.main_repo }} contains a prepared merge
      of your site configuration with the new upstream import.
      Please review it and, if all is okay, commit it.
      This manual stage is required prior to running the configuration processor.
07070100120270000081A40000000000000000000000015BD0D1D200000D77000000FD0000000200000000000000000000005800000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/git-operations/tasks/save-cp-output.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.
#

# Tentatively save the output from a successful CP run.
#
# We don't yet know if this CP output is going to be used or not,
# since the user may want to refine their configuration prior to actually
# running a deployment; nonetheless, the output must be retained.
#
# Therefore, we unconditionally copy the cp-persistent state to a new, transient
# branch: staging-cp-persistent
# Similarly, we unconditionally copy the ansible output to a new, transient
# staging-ansible branch.
# (Any old branches with thes names are deleted).
#
# Parameters:
#   repo: ~/ardana
#   target_dir: ~/cp-run (subdirs of this used as work dirs)
#   branches:
#     staging-sp-persistent:
#       - from: some relative path
#         to: some relative path
#       - ... etc ...
#     staging-ansible:
#       - ... etc ...
---

- name: git-operations | save-cp-output | Empty transient branches
  shell: >
    if git rev-parse --verify {{ git_operations.temp_cp_branch | quote }};
    then
      git branch -D {{ git_operations.temp_cp_branch | quote }}
    fi &&
    if git rev-parse --verify {{ git_operations.temp_ansible_branch | quote }};
    then
      git branch -D {{ git_operations.temp_ansible_branch | quote }}
    fi
  args:
    chdir: "{{ git_operations.main_repo }}"

- name: git-operations | save-cp-output | Get {{ git_operations.site_branch }} reference
  shell: >
    git rev-parse {{ git_operations.site_branch | quote }}
  args:
    chdir: "{{ git_operations.main_repo }}"
  register: site_tag

- name: git-operations | save-cp-output | Save CP outputs
  include: _persist-to-git.yml
  vars:
    repo: "{{ git_operations.main_repo }}"
    work_dir: "{{ git_operations.cp_scratch_dir }}"
    commit_msg: "Saved output from CP run on {{ site_tag.stdout }}"
    branches:
      - name: "{{ git_operations.temp_cp_branch }}"
        copies:
          - from: "{{ git_operations.cp_target_dir }}/{{ git_operations.cp_subdir }}"
            to: "{{ git_operations.cp_subdir }}"
      - name: "{{ git_operations.temp_ansible_branch }}"
        copies:
          - from: "{{ git_operations.cp_target_dir }}/{{ git_operations.ansible_subdir }}"
            to: "{{ git_operations.ansible_subdir }}"

- name: git-operations | save-cp-output | Copy my_cloud/info into place
  include: _save-info-directory.yml
  vars:
    repo: "{{ git_operations.main_repo }}"
    work_dir: "{{ git_operations.cp_target_dir }}"
    from: "{{ git_operations.cp_info_subdir }}"
    to: "{{ git_operations.cp_info_target }}"

- name: git-operations | save-cp-output | Copy my_cloud/html into place
  include: _save-info-directory.yml
  vars:
    repo: "{{ git_operations.main_repo }}"
    work_dir: "{{ git_operations.cp_target_dir }}"
    from: "{{ git_operations.cp_html_subdir }}"
    to: "{{ git_operations.cp_html_target }}"
070701001202D0000041ED0000000000000000000000045BD0D1D200000000000000FD0000000200000000000000000000003E00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/guard-cluster070701001202D3000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004700000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/guard-cluster/defaults070701001202D4000081A40000000000000000000000015BD0D1D20000030D000000FD0000000200000000000000000000005000000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/guard-cluster/defaults/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.
#
---
guard_cluster_names: "{{ play_hosts | cluster_consistency_check(hostvars) }}"
guard_cluster_control_planes: "{{ global.control_planes }}"
070701001202D1000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004400000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/guard-cluster/tasks070701001202D2000081A40000000000000000000000015BD0D1D2000003FA000000FD0000000200000000000000000000004D00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/guard-cluster/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.
#
---
# Note: This need to run only on one on the host group nodes to calutlate all
#       the control plain cluster names.
- name: guard-cluster | main | Check play hosts are in a single control plane
  fail:
    msg: >
      Must be run with --limit of a single control plane:
      {{ guard_cluster_control_planes }}
  when: (guard_cluster_names | length) > 1
  run_once: true
0707010012024F000041ED0000000000000000000000055BD0D1D200000000000000FD0000000200000000000000000000004700000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/guard-runtime-location07070100120255000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000005000000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/guard-runtime-location/defaults07070100120256000081A40000000000000000000000015BD0D1D200000662000000FD0000000200000000000000000000005900000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/guard-runtime-location/defaults/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.
#
---
ardanauser_home: "{{ ansible_env['HOME'] }}"

location: openstack

valid_dirs:
  openstack:
    - "{{ ardanauser_home }}/openstack/ardana/ansible"
  deploy:
    - "{{ git_operations.ansible_target_dir }}/next/ardana/ansible"
    - "{{ git_operations.ansible_target_dir }}/last/ardana/ansible"

warning:
  openstack: >
    The current playbook is designed to be run from
    ~/openstack/ardana/ansible. If you run it from an alternative
    directory, the results could be unpredictable.
  deploy: >
    Deployments should be run from the ansible directory
    under {{ git_operations.ansible_target_dir }}/next.
    The configuration processor output is not available to
    Ansible playbooks run from another location.

    In order to run a deployment, run the configuration
    processor first using
    "ansible-playbook -i hosts/localhost config-processor-run.yml";
    then ready the deployment directory structure using
    "ansible-playbook -i hosts/localhost ready-deployment.yml".
07070100120250000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004C00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/guard-runtime-location/meta07070100120251000081A40000000000000000000000015BD0D1D2000002D7000000FD0000000200000000000000000000005500000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/guard-runtime-location/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.
#
---
dependencies:
  # We need this for the value of some directories
  - git-operations
07070100120253000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004D00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/guard-runtime-location/tasks07070100120254000081A40000000000000000000000015BD0D1D2000004D6000000FD0000000200000000000000000000005600000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/guard-runtime-location/tasks/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.
#

# Ensure that Ansible is being run from the right place.
# This role can be included in a playbook to ensure that
# various parts of the deployment lifecycle are being run
# from the appropriate place.

# Parameters:
#   location: a member of valid_dirs and warning.
#   valid_dirs:
#     ardana:
#       - {{ ardanauser_home }}/openstack/ardana/ansible
#   warning:
#     ardana: "Your warning message goes here."
---

- name: guard-runtime-location | main | Ensure we're running in an expected location.
  fail:
    msg: "{{ warning[location] }}"
  when: playbook_dir not in valid_dirs[location]
07070100120294000041ED0000000000000000000000065BD0D1D200000000000000FD0000000200000000000000000000003A00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/installui0707010012029F000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004300000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/installui/defaults070701001202A0000081A40000000000000000000000015BD0D1D200000636000000FD0000000200000000000000000000004C00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/installui/defaults/main.yml#
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
ardanauser: "{{ ansible_env['USER'] }}"

ui_comp: installer-ui
ui_comp_dir: "{% if deployer_media_legacy_layout|bool -%}
                  {{ ui_comp | venv_dir }}
              {%- else -%}
                  /usr/share/ardana/ardana-installer-ui/web
              {%- endif -%}"

server_comp: installer-server
server_cfg_dir: "{% if deployer_media_legacy_layout|bool -%}
                     {{ server_comp | config_dir }}
                 {%- else -%}
                     /etc/ardana/ardana-installer-server
                 {%- endif -%}"
server_comp_cfg: "{{ server_cfg_dir }}/{{ server_comp }}.conf"
server_restart_required: false

log_dir: "/var/cache/ardana_installer"
tmp_dir: "/var/cache/ardana_installer"

systemd_config_dir: "/etc/systemd/system/{{ server_comp }}.service.d"
systemd_config_file: "{{ systemd_config_dir }}/local.conf"
db_file: "{{ tmp_dir }}/db.json"
progress_file: "{{ tmp_dir }}/progress.json"

# TODO add server_url back when https enabled, requires UI update
server_port: 3000
07070100120295000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004300000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/installui/handlers07070100120296000081A40000000000000000000000015BD0D1D20000028D000000FD0000000200000000000000000000004C00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/installui/handlers/main.yml#
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---

- name: installui_change
  set_fact:
    server_restart_required: true

07070100120297000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004000000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/installui/tasks0707010012029B000081A40000000000000000000000015BD0D1D20000042F000000FD0000000200000000000000000000004E00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/installui/tasks/configure.yml#
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Playbook for configuring Install UI
---

- name: installui | post-configure | Create server config dir (rpm)
  become: yes
  file:
    path: "{{ server_cfg_dir }}"
    state: directory
    mode: 0700
    owner: "{{ ardanauser }}"
    group: "{{ ardanauser }}"
  when: not deployer_media_legacy_layout|bool

- name: installui | post-configure | Apply server config
  become: yes
  template:
    src: "{{ server_comp }}.conf.j2"
    dest: "{{ server_comp_cfg }}"
  notify: installui_change
0707010012029A000081A40000000000000000000000015BD0D1D200000E9C000000FD0000000200000000000000000000004C00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/installui/tasks/install.yml#
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Playbook for setting up the installui on the deployer
---

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

- name: installui | install | Install Cloud Installer server (venv)
  become: yes
  install_package:
    name: installer-server
    service: installer-server
    state: present
    activate: act_on
  when: deployer_media_legacy_layout|bool
  notify: installui_change

- name: installui | install | Install Cloud Installer UI (venv)
  become: yes
  install_package:
    name: installer-ui
    service: installer-ui
    state: present
    activate: act_on
  when: deployer_media_legacy_layout|bool
  notify: installui_change

# Don't use 'mode' parameter in unarchive module due to ansible bug!
#   https://github.com/ansible/ansible-modules-core/issues/4813
- name: installui | install | Extract Cloud Installer UI tarball (venv)
  become: yes
  unarchive:
    dest: "{{ ui_comp | venv_dir }}"
    src: "{{ item }}"
    copy: no
    owner: "{{ ardanauser }}"
    group: "{{ ardanauser }}"
  with_fileglob:
    - "{{ ui_comp | jar_dir }}/cloudinstaller-*.tgz"

- name: installui | configure | Create systemd directory
  become: yes
  file:
    path: "{{ systemd_config_dir }}"
    state: directory

- name: installui | configure | Create log directory
  become: yes
  file:
    owner: "{{ ardanauser }}"
    group: "{{ ardanauser }}"
    path: "{{ log_dir }}"
    state: directory

- name: installui | configure | Create log file if non-existent
  become: yes
  copy:
    content: ""
    dest: "{{ log_dir }}/{{ server_comp }}.log"
    force: no
    owner: "{{ ardanauser }}"
    group: "{{ ardanauser }}"

- name: installui | configure | Change permissions of existing log file
  become: yes
  file:
    owner: "{{ ardanauser }}"
    group: "{{ ardanauser }}"
    path: "{{ log_dir }}/{{ server_comp }}.log"
    state: file

- name: installui | configure | Apply systemd template
  become: yes
  template:
    src: "local.conf.j2"
    dest: "{{ systemd_config_file }}"
  notify: installui_change
  when: deployer_media_legacy_layout|bool

- name: installui | install | Setup Install UI service (venv)
  become: yes
  setup_systemd:
    name: "{{ server_comp }}"
    service: "{{ server_comp }}"
    user: "{{ ardanauser }}"
    group: "{{ ardanauser }}"
    cmd: python
    args: >
      "{{ server_comp | venv_dir }}/lib/python2.7/site-packages/ardana_installer_server/main.py"
      --config-file {{ server_cfg_dir }}/{{ server_comp }}.conf
  when: deployer_media_legacy_layout|bool

- name: installui | install | Setup Install UI service (rpm)
  become: yes
  setup_systemd:
    name: "{{ server_comp }}"
    service: "{{ server_comp }}"
    user: "{{ ardanauser }}"
    group: "{{ ardanauser }}"
    install_path: /usr/bin
    cmd: ardana-installer-server
    args: >
      --config-file {{ server_cfg_dir }}/{{ server_comp }}.conf
  when: not deployer_media_legacy_layout|bool

- name: installui | configure | Create ardana installer temp directory
  become: yes
  file:
    path: "{{ tmp_dir }}"
    state: directory
    mode: 0700
    owner: "{{ ardanauser }}"
    group: "{{ ardanauser }}"

07070100120299000081A40000000000000000000000015BD0D1D20000048B000000FD0000000200000000000000000000004A00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/installui/tasks/start.yml#
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Start the Install UI
---

- name: installui | start | Restart Install UI service, if needed
  become: yes
  service:
    name: "{{ server_comp }}"
    state: restarted
  when: server_restart_required

- name: installui | start | Ensure that Install UI service is started and enabled
  become: yes
  service:
    name: "{{ server_comp }}"
    state: started
    enabled: yes

- name: installui | start | Wait for Install UI service to settle
  command: sleep 5

- name: installui | start | Check again to see if the service is started
  command: systemctl status {{ server_comp }}
07070100120298000081A40000000000000000000000015BD0D1D2000002D9000000FD0000000200000000000000000000004900000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/installui/tasks/stop.yml#
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Stop the Install UI
---

- name: installui | stop | Stop Day Zero UI service
  become: yes
  service:
    name: "{{ server_comp }}"
    state: stopped
0707010012029C000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004400000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/installui/templates0707010012029D000081A40000000000000000000000015BD0D1D20000062D000000FD0000000200000000000000000000005D00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/installui/templates/installer-server.conf.j2#
# (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]
log_file = {{ log_dir }}/{{ server_comp }}.log
default_log_levels = engineio=WARN,socketio=WARN

[general]
port = {{ server_port }}
db_file = /var/cache/ardana_installer/db.json
progress_file = /var/cache/ardana_installer/progress.json
restart_trigger_file = /var/cache/ardana_installer/cloud_install_ui_trigger.txt
ui_home = {{ ui_comp_dir }}
ardana_service_url : "{% if ARD_SVC is defined -%}
                        {{ ARD_SVC.advertises.vips.private[0].url }}
                      {%- else -%}
                        http://localhost:9085
                      {%- endif -%}"


[urls]
{% if HZN_WEB is defined -%}
  {%- set hzn = HZN_WEB.advertises.vips.public[0] -%}
  {%- if "://myardana.test" in HZN_WEB.advertises.vips.public[0].url -%}
    horizon: {{ hzn.protocol }}://{{ hzn.ip_address }}:{{ hzn.port }}
  {%- else -%}
    horizon: {{ hzn.url }}
  {%- endif -%}
{%- endif %}

{% if OPS_WEB is defined -%}
  opsconsole: {{ OPS_WEB.advertises.vips.public[0].url }}
{%- endif %}
0707010012029E000081A40000000000000000000000015BD0D1D200000350000000FD0000000200000000000000000000005200000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/installui/templates/local.conf.j2{#
#
# (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.
#
#}

[Service]
WorkingDirectory={% if deployer_media_legacy_layout|bool -%}
                     {{ server_comp | venv_dir }}
                 {%- else -%}
                     /usr/lib/python2.7/site-packages/ardana_installer_server
                 {%- endif -%}
07070100120288000041ED0000000000000000000000055BD0D1D200000000000000FD0000000200000000000000000000004200000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/package-bootstrap0707010012028D000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004B00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/package-bootstrap/defaults0707010012028E000081A40000000000000000000000015BD0D1D200000342000000FD0000000200000000000000000000005400000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/package-bootstrap/defaults/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.
#
---
# Values imported from package-constants role
name: packager
package_dir: "{{ PACKAGE_CONSTANTS.INSTALL_DIR }}"
service_dir: "{{ PACKAGE_CONSTANTS.SERVICE_DIR }}"
service_component: packager
07070100120289000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004700000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/package-bootstrap/meta0707010012028A000081A40000000000000000000000015BD0D1D2000002E7000000FD0000000200000000000000000000005000000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/package-bootstrap/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.
#
# We import 'package-constants' to get access to path constants
---
dependencies:
  - package-constants
0707010012028B000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004800000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/package-bootstrap/tasks0707010012028C000081A40000000000000000000000015BD0D1D200000A96000000FD0000000200000000000000000000005400000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/package-bootstrap/tasks/install.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.
#
# Bootstrap the 'packager' executable on a target system
# Inputs:
#   source: path to packager tarball on the host system, if copy is required
#   tarball: path on the target system for the packager tarball
#   target: directory to bootstrap into - defaults to '/opt/stack/venvs'
#   name: defaults to 'packager'
---
- name: package-bootstrap | install | Ensure tarball destination directory exists
  file:
    path: "{{ tarball | dirname }}"
    owner: root
    group: root
    mode: 0755
    state: directory
  become: yes
  when: source is defined and source

- name: package-bootstrap | install | Copy tarball to remote system
  copy:
    src: "{{ source }}"
    dest: "{{ tarball }}"
    owner: root
    group: root
    mode: 0644
  become: yes
  when: source is defined and source

- name: package-bootstrap | install | Ensure package installation directory is created
  file:
    path: "{{ package_dir }}/{{ name }}-{{ ardana_version }}"
    owner: root
    group: root
    mode: 0755
    state: directory
  become: yes

- name: package-bootstrap | install | Explode tarball at destination
  unarchive:
    src: "{{ tarball }}"
    dest: "{{ package_dir }}/{{ name }}-{{ ardana_version }}"
    owner: root
    group: root
    copy: no
  become: yes

- name: package-bootstrap | install | Ensure service installation directory is created
  file:
    path: "{{ service_dir }}/{{ service_component }}-{{ ardana_version }}"
    owner: root
    group: root
    mode: 0755
    state: directory
  become: yes

- name: package-bootstrap | install | Link service component venv
  file:
    path: "{{ service_dir }}/{{ service_component }}-{{ ardana_version }}/venv"
    src: "{{ package_dir }}/{{ name }}-{{ ardana_version }}"
    owner: root
    group: root
    mode: 0755
    state: link
  become: yes

- name: package-bootstrap | install | Mark service component as active
  file:
    path: "{{ service_dir }}/{{ service_component }}"
    src: "{{ service_component }}-{{ ardana_version }}"
    owner: root
    group: root
    mode: 0755
    state: link
  become: yes

070701001202EF000041ED0000000000000000000000045BD0D1D200000000000000FD0000000200000000000000000000004200000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/package-constants070701001202F5000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004800000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/package-constants/tasks070701001202F6000081A40000000000000000000000015BD0D1D2000003BE000000FD0000000200000000000000000000005100000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/package-constants/tasks/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.
#
---
- include_vars: "{{ playbook_dir }}/ardana_version.yml"
# non-SUSE
- include_vars: "{{ ansible_os_family | lower }}.yml"
  when: not ansible_os_family | lower | search('suse')
# for openSUSE and SLES, import the same vars file
- include_vars: "suse.yml"
  when: ansible_os_family | lower | search('suse')
070701001202F0000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004700000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/package-constants/vars070701001202F2000081A40000000000000000000000015BD0D1D2000002E1000000FD0000000200000000000000000000005200000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/package-constants/vars/debian.yml#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
package_venv_path_os_family: "{{ package_venv_locations.hlinux[ansible_architecture] }}"
070701001202F4000081A40000000000000000000000015BD0D1D2000002CF000000FD0000000200000000000000000000005000000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/package-constants/vars/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.
#
---
package_venv_path: "{{ ardana_version }}/{{ package_venv_path_os_family }}"
070701001202F1000081A40000000000000000000000015BD0D1D2000002DF000000FD0000000200000000000000000000005200000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/package-constants/vars/redhat.yml#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
package_venv_path_os_family: "{{ package_venv_locations.rhel[ansible_architecture] }}"
070701001202F3000081A40000000000000000000000015BD0D1D2000002DF000000FD0000000200000000000000000000005000000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/package-constants/vars/suse.yml#
# (c) Copyright 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.
#
---
package_venv_path_os_family: "{{ package_venv_locations.sles[ansible_architecture] }}"
070701001202A1000041ED0000000000000000000000065BD0D1D200000000000000FD0000000200000000000000000000004100000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/package-consumer070701001202A9000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004A00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/package-consumer/defaults070701001202AA000081A40000000000000000000000015BD0D1D2000002F6000000FD0000000200000000000000000000005300000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/package-consumer/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.
#
# Variables for getting to the package/venv servers
---
PACKAGE_CONSUMER:
  CACHE_DIR: /var/cache/ardana_packager
070701001202A2000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004600000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/package-consumer/meta070701001202A3000081A40000000000000000000000015BD0D1D2000002A7000000FD0000000200000000000000000000004F00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/package-consumer/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.
#
---
dependencies:
  - package-bootstrap
070701001202A4000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004700000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/package-consumer/tasks070701001202A6000081A40000000000000000000000015BD0D1D200000402000000FD0000000200000000000000000000005500000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/package-consumer/tasks/configure.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.
#
# Make this host consume packager repositories via our proxy
---
- name: package-consumer | configure | Configure packager.conf
  become: yes
  template:
    src: "packager.conf.j2"
    dest: "/etc/packager.conf"
    owner: "root"
    group: "root"
    mode: 0644

- name: package-consumer | configure | Download the manifest file
  become: yes
  install_package:
    cache: update
070701001202A5000081A40000000000000000000000015BD0D1D20000046D000000FD0000000200000000000000000000005300000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/package-consumer/tasks/install.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: package-consumer | install | Install ardana-packager
  become: yes
  package:
    name: python-ardana-packager
    state: present
  when: deployer_media_legacy_layout|bool == false

- include: ../../package-bootstrap/tasks/install.yml
  vars:
    source: "{{ PACKAGE_CONSTANTS.REPO_DIR }}/{{ package_venv_path }}/packager-{{ ardana_version }}.tgz"
    tarball: "{{ PACKAGE_CONSUMER.CACHE_DIR }}/packager-{{ ardana_version }}.tgz"
  when: deployer_media_legacy_layout|bool
070701001202A7000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004B00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/package-consumer/templates070701001202A8000081A40000000000000000000000015BD0D1D200000307000000FD0000000200000000000000000000005C00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/package-consumer/templates/packager.conf.j2{#
#
# (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.
#
#}
[repo]
url = {{ deployer_server |
         default('http://127.0.0.1:'~deployer_server_port) }}/{{ package_venv_path }}
07070100120257000041ED0000000000000000000000045BD0D1D200000000000000FD0000000200000000000000000000003D00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/package-repo07070100120258000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004200000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/package-repo/meta07070100120259000081A40000000000000000000000015BD0D1D2000002A7000000FD0000000200000000000000000000004B00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/package-repo/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.
#
---
dependencies:
  - package-bootstrap
0707010012025A000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004300000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/package-repo/tasks0707010012025C000081A40000000000000000000000015BD0D1D200000521000000FD0000000200000000000000000000005100000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/package-repo/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.
#
# Set up a host as a package repository
---
- name: package-repo | configure | Test package repository locations
  stat:
    path: "{{ PACKAGE_CONSTANTS.REPO_DIR }}/{{ ardana_version }}/{{ item }}"
  register: _venv_present_result
  with_items: package_venv_locations.values() | map('values') | sum(start=[]) | list

- name: package-repo | configure | Ready the index
  become: yes
  command: >
    ./create_index
    --dir={{ PACKAGE_CONSTANTS.REPO_DIR }}/{{ ardana_version }}/{{ item.item }}
  args:
    chdir: "{{ 'packager' | bin_dir if deployer_media_legacy_layout|bool else '/usr/bin/' }}"
  when: item.stat.exists
  with_items: _venv_present_result.results
0707010012025B000081A40000000000000000000000015BD0D1D200000438000000FD0000000200000000000000000000004F00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/package-repo/tasks/install.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.
#
---
# Install to PACKAGE_CONSTANTS_DIR: /opt/stack/venv
- name: package-repo | install | Test we include venv packages for distro
  stat:
    path: "{{ PACKAGE_CONSTANTS.REPO_DIR }}/{{ package_venv_path }}"
  register: _venv_dir_result

- include: ../../package-bootstrap/tasks/install.yml
  vars:
    tarball: "{{ PACKAGE_CONSTANTS.REPO_DIR }}/{{ package_venv_path }}/packager-{{ ardana_version }}.tgz"
  when: _venv_dir_result.stat.exists
070701001202D5000041ED0000000000000000000000055BD0D1D200000000000000FD0000000200000000000000000000004600000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/platform-pass-through070701001202DF000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004F00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/platform-pass-through/defaults070701001202E0000081A40000000000000000000000015BD0D1D200000327000000FD0000000200000000000000000000005800000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/platform-pass-through/defaults/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.
#
---

pass_through_output_file: "{{ lookup('env', 'HOME') }}/platform-pass-through.yml"
pass_through_service_components:
  - KEY-API
  - MON-API
  - MON-AGN
  - LOG-SVR
070701001202D6000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004C00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/platform-pass-through/tasks070701001202D8000081A40000000000000000000000015BD0D1D2000004FA000000FD0000000200000000000000000000005900000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/platform-pass-through/tasks/generate.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: platform-pass-through | generate | read in variables
  include_vars: "/tmp/platform-pass-through-{{ item }}.yml"
  with_items: "{{ pass_through_service_components }}"

- name: platform-pass-through | generate | render pass through file
  template:
    src: pass-through.yml.j2
    dest: "{{ pass_through_output_file }}"

- name: platform-pass-through | generate | clean temporary files
  file:
    path: /tmp/platform-pass-through-{{ item }}.yml
    state: absent
  with_items: "{{ pass_through_service_components }}"

- debug:
    msg: "Platform Pass-Through config generated and saved to {{ pass_through_output_file }}"
070701001202D7000081A40000000000000000000000015BD0D1D200000432000000FD0000000200000000000000000000005500000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/platform-pass-through/tasks/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.
#
---

- name: "{{ service }} | ensure pass through key is available"
  fail:
    msg: "pass through encryption key must be provided with '-e pass_through_key=<key>'"
  when: service is defined and pass_through_key is not defined

- name: "{{ service }} | pass variables to deployer"
  template:
    src: "{{ service }}.yml.j2"
    dest: "/tmp/platform-pass-through-{{ service }}.yml"
  delegate_to: localhost
  when: service is defined
070701001202D9000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000005000000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/platform-pass-through/templates070701001202DE000081A40000000000000000000000015BD0D1D20000059E000000FD0000000200000000000000000000005F00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/platform-pass-through/templates/KEY-API.yml.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.
#
#}
---
keystone_admin_token: "{{ KEY_API.vars.keystone_admin_token | openstack_user_password_encrypt(pass_through_key) }}"
keystone_admin_url: "{{ KEY_API.advertises.vips.admin[0].url }}"
keystone_private_url: "{{ KEY_API.advertises.vips.private[0].url }}"
keystone_public_url: "{{ KEY_API.advertises.vips.public[0].url }}"
keystone_admin_user: "{{ KEY_API.vars.keystone_admin_user }}"
keystone_admin_role: "{{ KEY_API.vars.keystone_admin_role }}"
keystone_admin_project: "{{KEY_API.vars.keystone_admin_tenant  }}"
keystone_service_role: "{{ KEY_API.vars.keystone_admin_role }}"
keystone_service_project: "{{ KEY_API.vars.keystone_service_tenant }}"
keystone_default_domain: "{{ KEY_API.vars.keystone_default_domain }}"
keystone_cloudadmin_domain: "{{ KEY_API.vars.keystone_cloudadmin_domain }}"
070701001202DD000081A40000000000000000000000015BD0D1D200000403000000FD0000000200000000000000000000005F00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/platform-pass-through/templates/LOG-SVR.yml.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.
#
#}
---
logging_rabbitmq_host: "{{ LOG_SVR.consumes_FND_RMQ.vips.private[0].ip_address }}"
logging_rabbitmq_port: "{{ LOG_SVR.consumes_FND_RMQ.vips.private[0].port }}"
logging_rabbitmq_user: "{{ LOG.consumes_FND_RMQ.vars.accounts.logging.username }}"
logging_rabbitmq_pass: "{{ LOG.consumes_FND_RMQ.vars.accounts.logging.password | openstack_user_password_encrypt(pass_through_key) }}"
070701001202DA000081A40000000000000000000000015BD0D1D200000371000000FD0000000200000000000000000000005F00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/platform-pass-through/templates/MON-AGN.yml.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.
#
#}
---
monasca_agent_user: "{{ MON_AGN.consumes_KEY_API.vars.keystone_monasca_agent_user }}"
monasca_agent_password: "{{ MON_AGN.consumes_KEY_API.vars.keystone_monasca_agent_password | openstack_user_password_encrypt(pass_through_key) }}"
070701001202DB000081A40000000000000000000000015BD0D1D20000030F000000FD0000000200000000000000000000005F00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/platform-pass-through/templates/MON-API.yml.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.
#
#}
---
monasca_private_url: "{{ MON_API.advertises.vips.private[0].url }}"
monasca_public_url: "{{ MON_API.advertises.vips.public[0].url }}"
070701001202DC000081A40000000000000000000000015BD0D1D200000744000000FD0000000200000000000000000000006400000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/platform-pass-through/templates/pass-through.yml.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.
#
#}
---
   product:
     version: 2

   pass-through:
      global:
        keystone_admin_token: "{{ keystone_admin_token }}"

        keystone_admin_url: "{{ keystone_admin_url }}"
        keystone_private_url: "{{ keystone_private_url }}"
        keystone_public_url: "{{ keystone_public_url }}"

        keystone_admin_user: "{{ keystone_admin_user }}"
        keystone_admin_role: "{{ keystone_admin_role }}"
        keystone_admin_project: "{{ keystone_admin_project }}"

        keystone_service_role: "{{ keystone_service_role }}"
        keystone_service_project: "{{ keystone_service_project }}"

        keystone_default_domain: "{{ keystone_default_domain }}"
        keystone_cloudadmin_domain: "{{ keystone_cloudadmin_domain }}"

        monasca_private_url: "{{ monasca_private_url }}"
        monasca_public_url: "{{ monasca_public_url }}"
        monasca_agent_user: "{{ monasca_agent_user }}"
        monasca_agent_password: "{{ monasca_agent_password }}"

        logging_rabbitmq_host: "{{ logging_rabbitmq_host }}"
        logging_rabbitmq_port: "{{ logging_rabbitmq_port }}"
        logging_rabbitmq_user: "{{ logging_rabbitmq_user }}"
        logging_rabbitmq_pass: "{{ logging_rabbitmq_pass }}"
070701001202F7000041ED0000000000000000000000045BD0D1D200000000000000FD0000000200000000000000000000003F00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/service-client070701001202FB000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004800000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/service-client/defaults070701001202FC000081A40000000000000000000000015BD0D1D200000325000000FD0000000200000000000000000000005100000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/service-client/defaults/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.
#
---

service_client: ""

service_client_cli: "{{ service_client | regex_replace('^(.*)client$', '\\\\1') }}"
service_client_bin_dir: "{{ service_client | bin_dir }}"
070701001202F8000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004500000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/service-client/tasks070701001202F9000081A40000000000000000000000015BD0D1D2000003C5000000FD0000000200000000000000000000005500000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/service-client/tasks/install-rpm.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.
#
# Task to install the service-client package
---
- name: service-client | install-rpm | Client install details
  debug:
    msg: >
      Client to install:
      python-{{ service_client }},
      CLI name: {{ service_client_cli }}
  run_once: true

- name: service-client | install-rpm | Install client rpm
  become: yes
  zypper:
    name: python-{{ service_client }}
    state: present
070701001202FA000081A40000000000000000000000015BD0D1D2000006B5000000FD0000000200000000000000000000005100000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/service-client/tasks/install.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.
#
# Task to install the service-client package
---
- name: service-client | install | Client install details
  debug:
    msg: >
      Client to install:
      python-{{ service_client }},
      CLI name: {{ service_client_cli }}
  run_once: true

- name: service-client | install | Update venv cache
  become: yes
  install_package:
    cache: update

- name: service-client | install | Install Python virtual environment client
  become: yes
  install_package:
    name: "{{ service_client }}"
    service: "{{ service_client }}"
    state: present
    activate: act_on

- name: service-client | install | Check CLI client is avalible
  stat:
    path: "{{ service_client_bin_dir }}/{{ service_client_cli }}"
  register: service_client_cli_result

- name: service-client | install | Enabling CLI client for all users
  become: yes
  file:
    src: "{{ service_client_bin_dir }}/{{ service_client_cli }}"
    dest: /usr/bin/{{ service_client_cli }}
    state: link
    force: yes
  when: service_client_cli_result.stat.exists and
        service_client_cli_result.stat.xusr
070701001203A3000041ED0000000000000000000000045BD0D1D200000000000000FD0000000200000000000000000000004400000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/service-guest-image070701001203A8000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004D00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/service-guest-image/defaults070701001203A9000081A40000000000000000000000015BD0D1D200000284000000FD0000000200000000000000000000005600000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/service-guest-image/defaults/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.
#

---
070701001203A4000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004A00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/service-guest-image/tasks070701001203A7000081A40000000000000000000000015BD0D1D2000003C9000000FD0000000200000000000000000000005E00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/service-guest-image/tasks/copy_image_file.yml#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#

---

- name: service-guest-image | copy-image-file | create temporary directory
  command: mktemp -d
  register: guest_image_tempdir
  run_once: true

- name: service-guest-image | copy-image-file | copy image to service host
  copy: src="{{ SRC_GUEST_IMAGE_DIR }}/" dest="{{ guest_image_tempdir.stdout }}"
  run_once: true
070701001203A6000081A40000000000000000000000015BD0D1D20000089A000000FD0000000200000000000000000000006400000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/service-guest-image/tasks/extract_image_package.yml#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---

- name: service-guest-image | extract_guest-image | create temporary directory
  command: mktemp -d
  register: src_guest_image_tempdir

- name: service-guest-image | extract_guest-image | extract archive
  unarchive: src={{ service_package }} dest={{ src_guest_image_tempdir.stdout }}
  when: deployer_media_legacy_layout | bool

- name: service-guest-image | extract_guest-image | get manifest file name
  shell: ls {{ src_guest_image_tempdir.stdout }}/*.yml
  register: manifest_file_name
  when: deployer_media_legacy_layout | bool

- name: service-guest-image | extract_guest-image | load guest-image metadata
  include_vars: "{{manifest_file_name.stdout}}"
  register: guest_image_metadata
  when: deployer_media_legacy_layout | bool

- name: service-guest-image | extract_guest-image | extract the rpm file
  become: yes
  zypper:
    name: "{{ service_package }}"
    state: present
  when: not (deployer_media_legacy_layout | bool)

- name: service-guest-image | extract_guest-image | register the qcow2 image file
  become: yes
  shell: ls openstack-octavia-amphora-image*.qcow2
  args:
    chdir: "/srv/tftpboot/files/openstack-octavia-amphora-image"
  register: src_octavia_image_file_name
  when: not (deployer_media_legacy_layout | bool)

- name: service-guest-image | extract_guest-image | copy image to temp_dir
  become: yes
  shell: cp openstack-octavia-amphora-image*.qcow2 {{ src_guest_image_tempdir.stdout }}
  args:
    chdir: "/srv/tftpboot/files/openstack-octavia-amphora-image"
  when: not (deployer_media_legacy_layout | bool)
070701001203A5000081A40000000000000000000000015BD0D1D2000016A5000000FD0000000200000000000000000000005B00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/service-guest-image/tasks/upload_image.yml#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---

# set the guest image name
- name: service-guest-image | upload-image | set image name for legacy media layout
  set_fact:
      img_name: "{{ IMAGE_NAME }}_{{ PRODUCT }}"
  when: deployer_media_legacy_layout | bool

- name: service-guest-image | upload-image | set image name for non legacy media layout
  set_fact:
      img_name: "{{ IMAGE_NAME }}"
  when: not (deployer_media_legacy_layout | bool)

# check for existing images with matching name to the new image
- name: service-guest-image | upload-image | get list of image ids
  shell: "{{ GLANCE_CLIENT }} image-list | grep {{ img_name }}| tr -d ' ' | cut -f 2 -d '|'"
  environment: &OS_ENV
    OS_AUTH_URL: "{{ openstack_auth_url }}"
    OS_ENDPOINT_TYPE: "{{ openstack_endpoint_type }}"
    OS_USER_DOMAIN_NAME: "{{ openstack_user_domain_name }}"
    OS_USERNAME: "{{ openstack_username }}"
    OS_PASSWORD: "{{ openstack_password }}"
    OS_PROJECT_DOMAIN_NAME: "{{ openstack_project_domain_name }}"
    OS_PROJECT_NAME: "{{ openstack_project_name }}"
    OS_CACERT: "{{ openstack_ca_file }}"
  register: image_id_list
  run_once: true

# if there is a match get the checksum, id and status for the image
- name: service-guest-image | upload-image | get image details for matched ids
  shell: "{{ GLANCE_CLIENT }} image-show {{ item}} | tr -d ' ' | egrep '(checksum|id|status)'"
  environment: *OS_ENV
  with_items: "{{image_id_list.stdout_lines}}"
  when: item != ""
  register: image_details
  run_once: true

# get the md5sum for the new image - legacy
- name: service-guest-image | upload-image | get checksum for new image for legacy
  shell: "md5sum {{ guest_image_tempdir.stdout }}/{{ IMAGE_NAME }}.qcow2 | cut -d ' ' -f 1"
  register: image_checksum
  when: image_id_list.stdout != "" and image_details.results|length > 0 and (deployer_media_legacy_layout | bool)
  run_once: true

# get the md5sum for the new image - non legacy
- name: service-guest-image | upload-image | get checksum for new image for non legacy
  shell: "md5sum {{ guest_image_tempdir.stdout }}/{{ IMAGE_NAME }}*.qcow2 | cut -d ' ' -f 1"
  register: image_checksum
  when: image_id_list.stdout != "" and image_details.results|length > 0 and not (deployer_media_legacy_layout | bool)
  run_once: true

# verify if the md5sum match and if the image is in ACTIVE status
- name: service-guest-image | upload-image | verify image checksum and status
  shell: "echo '{{ item.stdout }}' | grep id | cut -d '|' -f 3"
  with_items: "{{ image_details.results if image_id_list.stdout != '' and image_details.results|length > 0 else []}}"
  when: item.stdout != "" and image_checksum.stdout != "" and "|checksum|{{image_checksum.stdout}}" in "{{item.stdout}}" and "|status|active|" in "{{item.stdout}}"
  register: matched_image_ids
  run_once: true

# Use the id of the first image which matches the checksum
- name: service-guest-image | upload-image | get the image id
  shell: "echo {{ item.stdout }}"
  with_items: "{{ matched_image_ids.results | default([])}}"
  when: matched_image_ids is defined and not item|skipped and matched_image_ids.changed ==true and matched_image_ids.results|length > 0
  register: image_id_from_glance_lookup
  run_once: true

# export the matched image id from glance lookup to be used in service configuration
- name: service-guest-image | upload-image | use image id from glance lookup
  set_fact:
    service_guest_image_id: "{{ item }}"
  with_items: "{{image_id_from_glance_lookup.results | default([])}}"
  when: image_id_from_glance_lookup is defined and not item|skipped and image_id_from_glance_lookup.changed == true
  run_once: true

# upload new image in glance, if current image is not found in glance for legacy
- name: service-guest-image | upload-image | Upload new datastore images for legacy
  shell: "{{ GLANCE_CLIENT }} image-create --name {{ img_name }}
  --file {{ guest_image_tempdir.stdout }}/{{ IMAGE_NAME }}.qcow2
  --container-format bare --disk-format qcow2
  --visibility private | tr -d ' ' | grep id | cut -f 3 -d '|'"
  register: image_id_from_glance_upload
  environment: *OS_ENV
  when: image_id_from_glance_lookup.changed == false and (deployer_media_legacy_layout | bool)
  run_once: true

# upload new image in glance, if current image is not found in glance for non legacy
- name: service-guest-image | upload-image | Upload new datastore image for non legacy
  shell: "{{ GLANCE_CLIENT }} image-create --name {{ IMAGE_NAME }}
  --file {{ guest_image_tempdir.stdout }}/{{ IMAGE_NAME }}*.qcow2
  --container-format bare --disk-format qcow2
  --visibility private | tr -d ' ' | grep id | cut -f 3 -d '|'"
  register: image_id_from_glance_upload
  environment: *OS_ENV
  when: image_id_from_glance_lookup.changed == false and not (deployer_media_legacy_layout | bool)
  run_once: true

# if the image upload was done then export the new image id to be used in service configuration
- name: service-guest-image | upload-image | use image id from glance upload
  set_fact:
    service_guest_image_id: "{{image_id_from_glance_upload}}"
  when: image_id_from_glance_lookup.changed == false and image_id_from_glance_upload.stdout != ""
  run_once: true
07070100120279000041ED0000000000000000000000065BD0D1D200000000000000FD0000000200000000000000000000003A00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/sosreport07070100120285000081A40000000000000000000000015BD0D1D200000345000000FD0000000200000000000000000000004500000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/sosreport/README.txt
(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.


sosreport plugins
=================

We now use our sosreport/sos repo to build sosreport into a venv.

To add/modfify a plugin place it into the sos/plugins folder on
that repo which will then be included in the venv.
07070100120286000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004300000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/sosreport/defaults07070100120287000081A40000000000000000000000015BD0D1D2000004C8000000FD0000000200000000000000000000004C00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/sosreport/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.
#
---

sosreport_run_script: "/usr/local/bin/run-sosreport"

sosreport_deployer_archives: "/tmp/sosreport-report-archives"

sosreport_base_dir: "{{ 'sos' | jar_dir }}/python2.7/site-packages/sos"

sosreport_plugins: "
corosync,\
ardana,\
hpasm,\
iscsitarget,\
kronos,\
libvirt,\
monasca,\
mysql,\
openstack_ceilometer,\
openstack_cinder,\
openstack_manila,\
openstack_glance,\
openstack_heat,\
openstack_horizon,\
openstack_ironic,\
openstack_keystone,\
openstack_neutron,\
openstack_nova,\
openstack_swift,\
openvswitch,\
serverstatus,\
rabbitmq"

sosreportbinary: "sosreport"0707010012027A000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004000000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/sosreport/files0707010012027B000081A40000000000000000000000015BD0D1D200000063000000FD0000000200000000000000000000004900000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/sosreport/files/sos.conf[plugins]

#disable = rpm, selinux, dovecot

[tunables]

#rpm.rpmva = off
#general.syslogsize = 15
0707010012027C000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004000000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/sosreport/tasks0707010012027F000081A40000000000000000000000015BD0D1D200000684000000FD0000000200000000000000000000004C00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/sosreport/tasks/install.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: sosreport | install | Update venv cache
  become: yes
  install_package:
    cache: update
  when: ansible_os_family | lower != 'redhat'

- name: sosreport | install | Install sosreport
  become: yes
  install_package:
    name: sos
    service: sos
    state: present
  when: ansible_os_family | lower != 'redhat'

- name: sosreport | install | Install sos package for redhat
  become: yes
  package:
    name: sos
  when: ansible_os_family | lower == 'redhat'

- name: sosreport | install | add symlink
  become: yes
  file:
    src: "{{ 'sos' | bin_dir }}/sosreport"
    dest: /usr/local/bin/sosreport
    owner: root
    group: root
    state: link
  when: ansible_os_family | lower != 'redhat'

- name: sosreport | install | add conf file
  become: yes
  synchronize:
    src: "sos.conf"
    dest: "/etc/"
  when: inventory_hostname != "localhost"

- name: sosreport | install | add conf file
  become: yes
  synchronize:
    src: "sos.conf"
    dest: "/etc/"
  when: inventory_hostname == "localhost"
0707010012027D000081A40000000000000000000000015BD0D1D200000337000000FD0000000200000000000000000000005500000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/sosreport/tasks/install_git_repo.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: sosreport | install_git_repo | install sosreport git repo plugin
  become: yes
  template:
    src: git_repo.py.j2
    dest: "{{ sosreport_plugins_dir }}/git_repo.py"
0707010012027E000081A40000000000000000000000015BD0D1D200000332000000FD0000000200000000000000000000005500000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/sosreport/tasks/install_rabbitmq.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: sosreport | install_rabbitmq | install sosreport rabbitmq plugin
  become: yes
  template:
    src: rabbitmq.py.j2
    dest: "{{ sosreport_plugins_dir }}/rabbitmq.py"
07070100120281000081A40000000000000000000000015BD0D1D20000030B000000FD0000000200000000000000000000004900000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/sosreport/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: sosreport | main | calculate sosreport plugin directory
  set_fact:
    sosreport_plugins_dir: "{{ sosreport_base_dir }}/plugins"
07070100120280000081A40000000000000000000000015BD0D1D200000E12000000FD0000000200000000000000000000004800000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/sosreport/tasks/run.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.
#
# Run sosreport on all the nodes
---

- name: sosreport | run | Create sosreport timestamp
  set_fact:
    sos_timestamp: "{{ lookup('pipe','date +%Y%m%d%H%M%S') }}"

- name: sosreport | run | Create sosreport output directory name
  set_fact:
    output_dir: sosreport-{{ inventory_hostname }}-{{ sos_timestamp }}

- name: sosreport | run | Create sosreport output path
  set_fact:
    output_path: /tmp/{{ output_dir }}

- name: sosreport | run | Create sosreport output directory
  file:
    path: "{{ output_path }}"
    state: directory
    mode: 0700

- name: sosreport | run | Run sosreport
  become: yes
  command: >
    {{ sosreportbinary }} --quiet --batch \
    -e {{ sosreport_plugins }} --all-logs --tmp-dir "{{ output_path }}"
  async: "{{ timeout|default(0) }}"

- name: sosreport | run | Create sosreport README
  become: yes
  copy:
    content: |
      Note: sosreport output (excluding /var/log) is in the sosreport-*.tar.gz
      tar file.  "/var/log" output, collected separately to reduce temporary
      disk space use, is under "var/log"
    dest: "{{ output_path }}/README.txt"
    mode: 0644

- name: sosreport | run | Prepare to link to /var/log
  become: yes
  file:
    dest: "{{ output_path }}/var"
    state: directory
    mode: 0700

- name: sosreport | run | Link to /var/log
  become: yes
  file:
    src: /var/log
    dest: "{{ output_path }}/var/log"
    state: link

- name: sosreport | run | Create final tar file
  become: yes
  shell: |
    tar --exclude='{{ output_dir}}/var/log/*/*-json.log*' \
      --warning=no-file-changed \
      -czphf "{{ output_path }}".tar.gz \
      --owner "{{ ansible_env['USER'] }}" \
      --group "{{ ansible_env['USER'] }}" \
      -C /tmp "{{ output_dir }}"
    RESULT=$?
    if [ $RESULT -eq 1 ]
    then
        # tar produces an exit status of '1'
        # if files are updated during
        # tar. This is likely to happen with
        # log files, and can be safely ignored.
        RESULT=0
    fi
    exit $RESULT
  async: "{{ timeout|default(0) }}"

- name: sosreport | run | Set tar file permissions
  become: yes
  file:
    path: "{{ output_path }}.tar.gz"
    mode: 0600

- name: sosreport | run | Delete temporary data (main)
  become: yes
  shell: |
    rm "{{ output_path }}"/sosreport*
    rm "{{ output_path }}"/README.txt
    rm "{{ output_path }}"/var/log
    rmdir "{{ output_path }}"/var
    rmdir "{{ output_path }}"

- name: sosreport | run | Create local directory for collecting sosreports
  delegate_to: localhost
  file:
    path: "{{ sosreport_deployer_archives }}"
    state: "directory"
    mode: 0700
  run_once: yes

- name: sosreport | run | Retrieve sosreports result
  become: yes
  synchronize:
    mode: pull
    src: "{{ output_path }}.tar.gz"
    dest: "{{ sosreport_deployer_archives }}/"
    compress: no

- name: sosreport | run | Delete per-node tar file
  become: yes
  file:
    path: "{{ output_path }}.tar.gz"
    state: absent
07070100120282000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004400000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/sosreport/templates07070100120283000081A40000000000000000000000015BD0D1D200000547000000FD0000000200000000000000000000005300000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/sosreport/templates/git_repo.py.j2{#
#
# (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.
#
#}
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin


class git_repo(Plugin):
    """Git repo
    """
    plugin_name = "git_repo"

    option_list = [("log", "gathers Ardana OpenStack configuration git repo", "slow", False)]


class DebianGitRepo(git_repo, DebianPlugin):
    """Fetch the Git repo
    """
    def setup(self):

        super(DebianGitRepo, self).setup()

        self.add_copy_spec([
            "{{ git_operations.main_repo }}/",
        ])


class RedHatGitRepo(git_repo, RedHatPlugin):
    """Fetch the Git repo
    """
    def setup(self):

        super(RedHatGitRepo, self).setup()

        self.add_copy_spec([
            "{{ git_operations.main_repo }}/",
        ])
07070100120284000081A40000000000000000000000015BD0D1D2000007B6000000FD0000000200000000000000000000005300000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/sosreport/templates/rabbitmq.py.j2{#
#
# (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.
#
#}
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin


class rabbitmq_plugin(Plugin):
    """RabbitMQ information
    """
    plugin_name = "rabbitmq_plugin"

    option_list = [("log", "gathers Ardana OpenStack RabbitMQ details", "slow", False)]


class DebianSosPlugin(rabbitmq_plugin, DebianPlugin):
    """RabbitMQ information for Ardana OpenStack distributions
    """

    def setup(self):
        super(DebianSosPlugin, self).setup()

        self.add_copy_spec([
            "{{ rabbitmq_env.log_base }}/",
            "{{ rabbitmq_etc_dir }}/"
        ])
        self.add_cmd_output([
            "journalctl -u rabbitmq-server",
            "rabbitmqctl eval 'rabbit_diagnostics:maybe_stuck().'",
            "rabbitmqctl eval 'mnesia_locker:get_held_locks().'"
        ])


class RedHatSosPlugin(rabbitmq_plugin, RedHatPlugin):
    """RabbitMQ information for Ardana OpenStack distributions
    """

    def setup(self):
        super(RedHatSosPlugin, self).setup()

        self.add_copy_spec([
            "{{ rabbitmq_env.log_base }}/",
            "{{ rabbitmq_etc_dir }}/"
        ])
        self.add_cmd_output([
            "journalctl -u rabbitmq-server"
            "rabbitmqctl eval 'rabbit_diagnostics:maybe_stuck().'",
            "rabbitmqctl eval 'mnesia_locker:get_held_locks().'"
        ])
0707010012038E000041ED0000000000000000000000045BD0D1D200000000000000FD0000000200000000000000000000003D00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/supportutils07070100120394000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004600000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/supportutils/defaults07070100120395000081A40000000000000000000000015BD0D1D200000327000000FD0000000200000000000000000000004F00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/supportutils/defaults/main.yml#
# (c) Copyright 2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---

sosreport_deployer_archives: "/tmp/sosreport-report-archives"

supportutils_local_archive_path_prefix: "/var/log/nts_"

supportconfig_options: "-g -Q"

# timeout in seconds for supportconfig command
supportutils_timeout: 1800
0707010012038F000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004300000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/supportutils/tasks07070100120390000081A40000000000000000000000015BD0D1D20000031B000000FD0000000200000000000000000000004F00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/supportutils/tasks/install.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.
#
# Install and configure sosreport on all the nodes
---
- name: supportutils | install | Install supportutils-cloud-plugin
  become: yes
  package:
    state: present
    name: 'supportutils-plugin-suse-openstack-cloud'
07070100120393000081A40000000000000000000000015BD0D1D2000002AB000000FD0000000200000000000000000000004C00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/supportutils/tasks/main.yml#
# (c) Copyright 2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Install and configure supportuilts on all the nodes
---
# placeholder file for the role to be includable
07070100120392000081A40000000000000000000000015BD0D1D20000076E000000FD0000000200000000000000000000004B00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/supportutils/tasks/run.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.
#
# collect supportconfig from all nodes
---

- name: supportutils | run | Get timestamp for supportutils execution
  set_fact:
    suputils_timestamp: "{{ lookup('pipe','date +%Y%m%d%H%M%S') }}"

- name: supportutils | run | Create target output directory name suffix
  set_fact:
    suputils_tarbll_suffix: "{{ inventory_hostname }}_{{ suputils_timestamp }}"

- name: supportutils | run | collect supportconfig asynchronously
  become: yes
  command: supportconfig {{ supportconfig_options }} -B {{ suputils_tarbll_suffix }}
  async: "{{ supportutils_timeout }}"

- name: supportutils | run | Create local directory for collecting reports
  delegate_to: localhost
  file:
    path: "{{ sosreport_deployer_archives }}"
    state: "directory"
    mode: 0700
  run_once: yes

- name: supportutils | run | Retrieve supportutils tarball and md5 files
  become: yes
  synchronize:
    mode: pull
    src: "{{ supportutils_local_archive_path_prefix + suputils_tarbll_suffix + item }}"
    dest: "{{ sosreport_deployer_archives }}/"
    compress: no
  with_items:
    - '.tgz'
    - '.tgz.md5'

- name: supportutils | run | Delete per-node tarball and md5 file
  become: yes
  file:
    path: "{{ supportutils_local_archive_path_prefix + suputils_tarbll_suffix + item }}"
    state: absent
  with_items:
    - '.tgz'
    - '.tgz.md5'
070701001202BA000041ED0000000000000000000000055BD0D1D200000000000000FD0000000200000000000000000000003C00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/third-party070701001202CE000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004500000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/third-party/defaults070701001202CF000081A40000000000000000000000015BD0D1D200000B14000000FD0000000200000000000000000000004E00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/third-party/defaults/main.yml#
# (c) Copyright 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.
#
---

third_party_pkgs_dir: "pkgs"
third_party_debian_pkgs_dir_glob: "{{ third_party_root_dir }}/*/{{ third_party_pkgs_dir }}/debian/*"
third_party_rhel_pkgs_dir_glob: "{{ third_party_root_dir }}/*/{{ third_party_pkgs_dir }}/rhel/*"
third_party_sles_pkgs_dir_glob: "{{ third_party_root_dir }}/*/{{ third_party_pkgs_dir }}/suse/*"

third_party_ansible_dir: "ansible"
third_party_ansible_dir_glob: "*/{{ third_party_ansible_dir }}"
main_repo_ansible_dir: "{{ ardanauser_home }}/openstack/ardana/{{ third_party_ansible_dir }}"
main_repo_config_dir: "{{ ardanauser_home }}/openstack/my_cloud/config"

third_party_services_dir: "services"
third_party_services_dir_glob: "*/{{ third_party_services_dir }}/*"
main_repo_services_dir: "{{ ardanauser_home }}/openstack/ardana/{{ third_party_services_dir }}"

third_party_other_dir: "other"
third_party_other_dir_glob: "*/{{ third_party_other_dir }}/*/"

third_party_venvs_dir: "venvs"
third_party_venvs_dir_glob: "*/{{ third_party_venvs_dir }}/*/"

third_party_logging_dir: "logging"
third_party_logging_dir_glob: "*/{{ third_party_logging_dir }}/*"
main_repo_logging_dir: "{{ ardanauser_home }}/openstack/my_cloud/config/logging/vars"

third_party_scratch_dir: "{{ ardanauser_home }}/scratch/.third_party"

venv_locs:
  debian: hlinux_venv
  redhat: rhel_venv
  suse: sles_venv

distro_list: "{{ hostvars['localhost']['distro_list'] }}"

pkg_locs:
  debian: "{{ PACKAGE_CONSTANTS.REPO_DIR~'/'~ardana_version~'/'~package_venv_locations.hlinux[ansible_architecture] }}"
  redhat:  "{{ PACKAGE_CONSTANTS.REPO_DIR~'/'~ardana_version~'/'~package_venv_locations.rhel[ansible_architecture] }}"
  suse:  "{{ PACKAGE_CONSTANTS.REPO_DIR~'/'~ardana_version~'/'~package_venv_locations.sles[ansible_architecture] }}"

pkg_manifests:
  debian: "{{ (pkg_locs.debian + '/packages') | load_packages() }}"
  redhat: "{{ (pkg_locs.redhat + '/packages') | load_packages() }}"
  suse: "{{ (pkg_locs.suse + '/packages') | load_packages() }}"

base_manifests:
  debian: "{{ (pkg_locs.debian + '/base_packages') | load_packages() }}"
  redhat: "{{ (pkg_locs.redhat + '/base_packages') | load_packages() }}"
  suse: "{{ (pkg_locs.suse + '/base_packages') | load_packages() }}"
070701001202C8000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004100000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/third-party/meta070701001202C9000081A40000000000000000000000015BD0D1D2000002A4000000FD0000000200000000000000000000004A00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/third-party/meta/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.
#
---
dependencies:
  - deployer-setup
070701001202CA000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004200000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/third-party/tasks070701001202CD000081A40000000000000000000000015BD0D1D200000493000000FD0000000200000000000000000000005700000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/third-party/tasks/_create_symlinks.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: third-party | _create-symlnks | Clear scratch directory
  file:
    dest: "{{ work_dir }}"
    state: absent

- name: third-party | _create-symlnks | Create scratch directory
  file:
    dest: "{{ work_dir }}"
    state: directory

- name: third-party | _create-symlnks | Record matching dirs
  config_symlinks:
    in_files: "{{ third_party_root_dir }}/{{ dir_glob }}/config/*-symlinks.yml"
    config_path: "{{ work_dir }}"
    target_path: "{{ main_repo_ansible_dir }}"
    source_path: "{{ main_repo_config_dir }}"
070701001202CC000081A40000000000000000000000015BD0D1D2000005A0000000FD0000000200000000000000000000005600000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/third-party/tasks/_import-content.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: third-party | _import-content | Clear scratch directory
  file:
    dest: "{{ work_dir }}"
    state: absent

- name: third-party | _import-content | Create scratch directory
  file:
    dest: "{{ work_dir }}"
    state: directory

- name: third-party | _import-content | Record matching dirs
  shell: "ls -d -- {{ third_party_root_dir }}/{{ dir_glob }}"
  register: third_party_content_dirs_result
  failed_when: >
    third_party_content_dirs_result.rc != 0 and
    third_party_content_dirs_result.rc != 2

- name: third-party | _import-content | Copy third-party content to scratch directory
  copy:
    src: "{{ item }}/"
    dest: "{{ work_dir }}"
  with_items: "{{ third_party_content_dirs_result.stdout_lines }}"
  when: (third_party_content_dirs_result.stdout_lines | length) > 0
070701001202CB000081A40000000000000000000000015BD0D1D200000492000000FD0000000200000000000000000000005600000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/third-party/tasks/_persist-to-git.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: third-party | _persist-to-git | Commit current changes to branches
  shell: >
    {% for branch in branches %}
        {% for copy in branch.copies %}
            if [ -e {{ copy.from }} ]; then
              {% if copy.to | dirname != '' -%}
                  mkdir -p {{ copy.to | dirname | quote }} &&
              {%- endif %}
              cp -a {{ copy.from }}/. {{ copy.to }}
            fi &&
        {% endfor %}
        git add -A &&
        git commit --allow-empty -m "{{ commit_msg }}"
    {% endfor %}

070701001202E1000041ED0000000000000000000000065BD0D1D200000000000000FD0000000200000000000000000000004100000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-other070701001202ED000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004A00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-other/defaults070701001202EE000081A40000000000000000000000015BD0D1D2000002B2000000FD0000000200000000000000000000005300000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-other/defaults/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.
#
---
version: "{{ '%Y%m%dT%H%M%SZ' | time_format }}"070701001202E5000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004700000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-other/tasks070701001202E6000081A40000000000000000000000015BD0D1D200000BB1000000FD0000000200000000000000000000006300000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-other/tasks/create-thirdparty-other.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: thirdparty-other | create-thirdparty-other | Validate content name
  fail:
    msg: >
      Error: Ardana OpenStack service with name '{{ content_name }}' already exists.
      Please use a different name.
  when: >
    '{{ base_manifests[item] | package_max_version(content_name) }}' != ''
  with_items: "{{ distro_list }}"

- name: thirdparty-other | create-thirdparty-other | Get lsb_release details
  command: lsb_release -idrc
  register: _venv_lsb_release_result

- name: thirdparty-other | create-thirdparty-other | Generate SHA256 sums
  shell: sha256sum $(find -P {{ source }} -type f)
  register: sha256_result

- name: thirdparty-other | create-thirdparty-other | Create scratch directory
  set_fact:
    scratch_loc: "{{ lookup('pipe', 'mktemp -d') }}"

- name: thirdparty-other | create-thirdparty-other |
        Copy files to scratch zone
  become: yes
  copy:
    src: "{{ source }}"
    dest: "{{ scratch_loc }}/"

- name: thirdparty-other | create-thirdparty-other |
        Create metadata directory
  become: yes
  file:
    path: "{{ scratch_loc }}/META-INF"
    state: directory

- name: thirdparty-other | create-thirdparty-other | Write out manifest file
  become: yes
  template:
    src: manifest.j2
    dest: "{{ scratch_loc }}/META-INF/manifest.yml"

- name: thirdparty-other | create-thirdparty-other | Write out version file
  become: yes
  template:
    src: version.yml.j2
    dest: "{{ scratch_loc }}/META-INF/version.yml"

- name: thirdparty-other | create-thirdparty-other | Create directory for tarball
  set_fact:
    output_tar: >
      {{ lookup('pipe', 'mktemp -d') }}/{{ content_name }}-{{ version }}.tgz

- name: thirdparty-other | create-thirdparty-other | Package up content
  become: yes
  command: tar zcf {{ output_tar }} -C {{ scratch_loc }} .

- name: thirdparty-other | create-thirdparty-other | Copy content to venv locations
  become: yes
  copy:
    src: "{{ output_tar }}"
    dest: "{{ PACKAGE_CONSTANTS.REPO_DIR }}/{{ ardana_version }}/{{ venv_locs[item] }}/"
  with_items: "{{ distro_list }}"
  when: item != 'redhat' or (third_party_rhel_enabled | default(false) | bool)

- name: thirdparty-other | create-thirdparty-other | Remove scratch zones
  become: yes
  file:
    path: "{{ item }}"
    state: absent
  with_items:
    - "{{ scratch_loc }}"
    - "{{ output_tar | dirname }}"
070701001202E8000081A40000000000000000000000015BD0D1D20000034E000000FD0000000200000000000000000000005300000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-other/tasks/install.yml#
# (c) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---

- name: thirdparty-other | install | Install required packages
  become: yes
  package:
    name: "{{ item }}"
    state: present
  with_items:
    thirdparty_other_required_packages | default([])
070701001202E9000081A40000000000000000000000015BD0D1D2000003BC000000FD0000000200000000000000000000005000000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-other/tasks/main.yml#
# (c) Copyright 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: thirdparty-other | main | Set os-specific variables
  include_vars: "{{ ansible_os_family | lower }}.yml"
  when: not ansible_os_family | lower | search('suse')

- name: thirdparty-other | main | Set os-specific variables
  include_vars: "suse.yml"
  when: ansible_os_family | lower | search('suse')
070701001202E7000081A40000000000000000000000015BD0D1D2000003B7000000FD0000000200000000000000000000005100000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-other/tasks/setup.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: thirdparty-other | setup | setup parallel workers per extra directory
  add_host:
    name: task-other-{{ item.split('/')[-2] }}
    hostname: "{{ inventory_hostname }}"
    groups: parallel_other
    content_name: "{{ item.split('/')[-2] }}"
    source: "{{ item }}"
  with_items:
    - "{{ sources }}"070701001202EA000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004B00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-other/templates070701001202EB000081A40000000000000000000000015BD0D1D2000001AF000000FD0000000200000000000000000000005700000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-other/templates/manifest.j2# Manifest for: {{ content_name }}
---

# Ardana environment
environment:
{% for line in _venv_lsb_release_result.stdout_lines %}
  {{ line | lower | regex_replace('\t', ' ') |
     regex_replace('(distributor) (id:)', '\\1_\\2') |
     regex_replace('(description: )(.*)', '\\1"\\2"') |
     lower }}
{% endfor %}

# External files
external: |
{% for line in sha256_result.stdout_lines %}
{{ line | indent(2, true) }}
{% endfor %}070701001202EC000081A40000000000000000000000015BD0D1D20000030A000000FD0000000200000000000000000000005A00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-other/templates/version.yml.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.
#

# Version for: {{ content_name }}
---

file_format: 1
version: {{ ardana_version.split('-')[1] | quote }}
timestamp: {{ version | quote }}070701001202E2000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004600000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-other/vars070701001202E3000081A40000000000000000000000015BD0D1D2000002E3000000FD0000000200000000000000000000005100000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-other/vars/debian.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.
#
---
thirdparty_other_required_packages:
  - python-wheel
  - python-pkg-resources
  - python-debian
070701001202E4000081A40000000000000000000000015BD0D1D2000002CC000000FD0000000200000000000000000000004F00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-other/vars/suse.yml#
# (c) Copyright 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.
#
---
thirdparty_other_required_packages:
  - python-zypp
  - lsb-release
07070100120360000041ED0000000000000000000000065BD0D1D200000000000000FD0000000200000000000000000000004000000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-repo07070100120370000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004900000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-repo/defaults07070100120371000081A40000000000000000000000015BD0D1D200000299000000FD0000000200000000000000000000005200000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-repo/defaults/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.
#
---

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

- name: thirdparty-repo | configure | Create aptly configuration
  become: yes
  template:
    src: aptly.conf.j2
    dest: /etc/aptly.conf
    mode: "0644"
  when: ansible_os_family | lower == 'debian'

- name: thirdparty-repo | configure | Make sure thirdparty apt repo root exists
  become: yes
  file:
    name: "{{ apt_thirdparty_dir }}/Packages"
    state: directory
  when: ansible_os_family | lower == 'suse'

- name: thirdparty-repo | configure | Make sure thirdparty yum repo root exists
  become: yes
  file:
    name: "{{ yum_thirdparty_dir }}/Packages"
    state: directory

- name: thirdparty-repo | configure | Make sure thirdparty zypper repo root exists
  become: yes
  file:
    name: "{{ zypp_thirdparty_dir }}/Packages"
    state: directory
07070100120369000081A40000000000000000000000015BD0D1D20000034C000000FD0000000200000000000000000000005200000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-repo/tasks/install.yml#
# (c) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---

- name: thirdparty-repo | install | Install required packages
  become: yes
  package:
    name: "{{ item }}"
    state: present
  with_items:
    thirdparty_repo_required_packages | default([])
0707010012036D000081A40000000000000000000000015BD0D1D2000003BA000000FD0000000200000000000000000000004F00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-repo/tasks/main.yml#
# (c) Copyright 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: thirdparty-repo | main | Set os-specific variables
  include_vars: "{{ ansible_os_family | lower }}.yml"
  when: not ansible_os_family | lower | search('suse')

- name: thirdparty-repo | main | Set os-specific variables
  include_vars: "suse.yml"
  when: ansible_os_family | lower | search('suse')
07070100120367000081A40000000000000000000000015BD0D1D2000006E7000000FD0000000200000000000000000000005A00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-repo/tasks/update_apt_repo.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: thirdparty-repo | update_apt_repo | Make sure thirdparty repo exists
  become: yes
  aptly_repo:
    name: "{{ repo_name }}"
    state: present

- name: thirdparty-repo | update_apt_repo | Add thirdparty .deb packages to repo
  become: yes
  aptly_pkg:
    name: "{{ repo_name }}"
    pkg: "{{ item }}"
    state: present
  with_fileglob: "{{ import_fileglob }}"

- name: thirdparty-repo | update_apt_repo | Generate snapshot name
  set_fact:
    ss_name: "{{ lookup('pipe', 'date +%s') }}"

- name: thirdparty-repo | update_apt_repo | Take a snapshot of thirdparty repo's current state
  become: yes
  aptly_snapshot:
    name: "{{ ss_name }}"
    repo_name: "{{ repo_name }}"

- name: thirdparty-repo | update_apt_repo | Publish new snapshot
  become: yes
  aptly_publish:
    name: "{{ ss_name }}"
    distribution: cattleprod
    prefix: "{{ ss_name }}"
    signing: no
    from_snapshot: yes

- name: thirdparty-repo | update_apt_repo | Update "latest" symlink
  become: yes
  file:
    src: "{{ thirdparty_apt_repo_dir }}/public/{{ ss_name }}"
    path: "{{ thirdparty_apt_repo_dir }}/latest"
    state: link
0707010012036B000081A40000000000000000000000015BD0D1D200000794000000FD0000000200000000000000000000006200000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-repo/tasks/update_apt_repo_on_sles.yml#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---

- name: thirdparty-repo | update_apt_repo_on_sles | Copy new thirdparty .debians to repo
  become: yes
  copy:
    src: "{{ item }}"
    dest: "{{ apt_thirdparty_dir }}/Packages/"
    force: no
  with_fileglob: "{{ import_fileglob }}"

- name: thirdparty-repo | update_apt_repo_on_sles | Generate snapshot name
  set_fact:
    ss_dir: "{{ lookup('pipe', 'date +%s') }}"

- name: thirdparty-repo | update_apt_repo_on_sles | Make directory for new snapshot
  become: yes
  file:
    path: "{{ apt_thirdparty_dir }}/{{ ss_dir }}"
    state: directory
    mode: "0755"

- name: thirdparty-repo | update_apt_repo_on_sles | Add packages symlink to snapshot directory
  become: yes
  file:
    path: "{{ apt_thirdparty_dir }}/{{ ss_dir }}/Packages"
    src: "{{ apt_thirdparty_dir }}/Packages"
    state: link

- name: print snapshot directory
  debug:
    msg: "{{ apt_thirdparty_dir }}/{{ ss_dir }}/Packages"

- name: thirdparty-repo | apt_thirdparty_dir | Generate snapshot metadata
  become: yes
  command: >
    createrepo {{ apt_thirdparty_dir }}/{{ ss_dir }}

- name: thirdparty-repo | update_apt_repo_on_sles | Update 'latest' symlink to most recent snapshot
  become: yes
  file:
    path: "{{ apt_thirdparty_dir }}/latest"
    src: "{{ apt_thirdparty_dir }}/{{ ss_dir }}"
    state: link
07070100120368000081A40000000000000000000000015BD0D1D2000006FA000000FD0000000200000000000000000000005A00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-repo/tasks/update_yum_repo.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: thirdparty-repo | update_yum_repo | Copy new thirdparty .rpms to repo
  become: yes
  copy:
    src: "{{ item }}"
    dest: "{{ yum_thirdparty_dir }}/Packages/"
    force: no
  with_fileglob: "{{ import_fileglob }}"

- name: thirdparty-repo | update_yum_repo | Generate snapshot name
  set_fact:
    ss_dir: "{{ lookup('pipe', 'date +%s') }}"

- name: thirdparty-repo | update_yum_repo | Make directory for new snapshot
  become: yes
  file:
    path: "{{ yum_thirdparty_dir }}/{{ ss_dir }}"
    state: directory
    mode: 0755

- name: thirdparty-repo | update_yum_repo | Add packages symlink to snapshot directory
  become: yes
  file:
    path: "{{ yum_thirdparty_dir }}/{{ ss_dir }}/Packages"
    src: "{{ yum_thirdparty_dir }}/Packages"
    state: link

- name: thirdparty-repo | update_yum_repo | Generate snapshot metadata
  become: yes
  command: >
    createrepo {{ yum_thirdparty_dir }}/{{ ss_dir }}

- name: thirdparty-repo | update_yum_repo | Update 'latest' symlink to most recent snapshot
  become: yes
  file:
    path: "{{ yum_thirdparty_dir }}/latest"
    src: "{{ yum_thirdparty_dir }}/{{ ss_dir }}"
    state: link
0707010012036A000081A40000000000000000000000015BD0D1D200000810000000FD0000000200000000000000000000005D00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-repo/tasks/update_zypper_repo.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.
#
---

- name: thirdparty-repo | update_zypper_repo | Copy new thirdparty .rpms to repo
  become: yes
  copy:
    src: "{{ item }}"
    dest: "{{ zypp_thirdparty_dir }}/Packages/"
    force: no
  with_fileglob: "{{ import_fileglob }}"

- name: thirdparty-repo | update_zypper_repo | Generate snapshot name
  set_fact:
    ss_dir: "{{ lookup('pipe', 'date +%s') }}"

- name: thirdparty-repo | update_zypper_repo | Make directory for new snapshot
  become: yes
  file:
    path: "{{ zypp_thirdparty_dir }}/{{ ss_dir }}"
    state: directory
    mode: "0755"

- name: thirdparty-repo | update_zypper_repo | Add packages symlink to snapshot directory
  become: yes
  file:
    path: "{{ zypp_thirdparty_dir }}/{{ ss_dir }}/Packages"
    src: "{{ zypp_thirdparty_dir }}/Packages"
    state: link

- name: print snapshot directory
  debug:
    msg: "{{ zypp_thirdparty_dir }}/{{ ss_dir }}/Packages"

- name: thirdparty-repo | update_zypper_repo | Generate snapshot metadata
  become: yes
  command: >
    createrepo {{ zypp_thirdparty_dir }}/{{ ss_dir }}

- name: thirdparty-repo | update_zypper_repo | Update 'latest' symlink to most recent snapshot
  become: yes
  file:
    path: "{{ zypp_thirdparty_dir }}/latest"
    src: "{{ zypp_thirdparty_dir }}/{{ ss_dir }}"
    state: link

- name: thirdparty-repo | update_zypper_repo | Create directory.yast
  become: yes
  shell: "cd {{ zypp_thirdparty_dir }}; ls -A1 > directory.yast"
0707010012036E000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004A00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-repo/templates0707010012036F000081A40000000000000000000000015BD0D1D20000021A000000FD0000000200000000000000000000005800000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-repo/templates/aptly.conf.j2{
  "rootDir": "{{ thirdparty_apt_repo_dir }}",
  "downloadConcurrency": 4,
  "downloadSpeedLimit": 0,
  "architectures": ["all", "amd64", "arm64"],
  "dependencyFollowSuggests": false,
  "dependencyFollowRecommends": false,
  "dependencyFollowAllVariants": false,
  "dependencyFollowSource": false,
  "gpgDisableSign": false,
  "gpgDisableVerify": false,
  "downloadSourcePackages": false,
  "ppaDistributorID": "ubuntu",
  "ppaCodename": "",
  "skipContentsPublishing": false,
  "S3PublishEndpoints": {},
  "SwiftPublishEndpoints": {}
}07070100120361000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004500000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-repo/vars07070100120363000081A40000000000000000000000015BD0D1D2000002BF000000FD0000000200000000000000000000005000000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-repo/vars/debian.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.
#
---
thirdparty_repo_required_packages:
  - aptly
  - createrepo
07070100120365000081A40000000000000000000000015BD0D1D20000053A000000FD0000000200000000000000000000004E00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-repo/vars/main.yml#
# (c) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
# Thirdparty os agnostic repo variables
thirdparty_repo_loc: "ardana/{{ repo_name }}"
thirdparty_apt_repo_dir: "{{ PACKAGE_CONSTANTS.REPO_DIR }}/{{ thirdparty_repo_loc }}"

# Thirdparty APT repo variables
apt_thirdparty_loc: "ardana/hlinux/apt/{{ repo_name }}"
apt_thirdparty_dir: "{{ PACKAGE_CONSTANTS.REPO_DIR }}/{{ apt_thirdparty_loc }}"

# Thirdparty YUM repo variables
yum_thirdparty_loc: "ardana/rhel7/yum/{{ repo_name }}"
yum_thirdparty_dir: "{{ PACKAGE_CONSTANTS.REPO_DIR }}/{{ yum_thirdparty_loc }}"

# Thirdparty ZYPP repo variables
zypp_thirdparty_loc: "ardana/sles12/zypper/{{ repo_name }}"
zypp_thirdparty_dir: "{{ PACKAGE_CONSTANTS.REPO_DIR }}/{{ zypp_thirdparty_loc }}"
07070100120362000081A40000000000000000000000015BD0D1D2000002BF000000FD0000000200000000000000000000005000000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-repo/vars/redhat.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.
#
---
thirdparty_repo_required_packages:
  - aptly
  - createrepo
07070100120364000081A40000000000000000000000015BD0D1D2000002CA000000FD0000000200000000000000000000004E00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-repo/vars/suse.yml#
# (c) Copyright 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.
#
---
thirdparty_repo_required_packages:
  - createrepo
  - lsb-release
070701001203AA000041ED0000000000000000000000045BD0D1D200000000000000FD0000000200000000000000000000004000000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-venv070701001203AF000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004600000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-venv/tasks070701001203B2000081A40000000000000000000000015BD0D1D200000765000000FD0000000200000000000000000000005700000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-venv/tasks/_venv-import.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: thirdparty-venv | _venv-import |
        Get base version of latest unpatched venv
  set_fact:
    target_version: >
      {{ pkg_manifests[distro] | package_max_unpatched_version(parent) }}
  when: pkg_manifests[distro] != ""

- name: thirdparty-venv | _venv-import |
        Get next patch number for this venv
  set_fact:
    next_patch: >
      {{ pkg_manifests[distro] | package_next_patch_number(service, target_version) | default(1, true) }}
  when: pkg_manifests[distro] != ""

- name: thirdparty-venv | _venv-import |
        Get parent venv
  set_fact:
    parent_venv_loc: >
      {{ pkg_locs[distro] }}/{{ (pkg_manifests[distro] |
         package_get_details(parent, target_version))['file'] }}
  when: pkg_manifests[distro] != "" and
        (pkg_manifests[distro] |
          package_get_details(parent, target_version)) is not none

- name: thirdparty-venv | _venv-import |
        Create new service venv
  become: yes
  venv_edit:
    name: "{{ service }}"
    src: "{{ parent_venv_loc | default(omit) }}"
    dest: "{{ pkg_locs[distro] }}"
    wheelhouse: "{{ driver_deps_dir | default(omit) }}"
    wheels: "{{ search_result.stdout }}"
    version: "{{ ardana_version[4:] }}"
    patch: "{{ next_patch | default(1, true) }}"
070701001203B0000081A40000000000000000000000015BD0D1D200000C2B000000FD0000000200000000000000000000006200000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-venv/tasks/create-thirdparty-venvs.yml#
# (c) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#

- name: thirdparty-venv | create-thirdparty-venvs |
        Fail if parent is not an existing service
  fail:
    msg: "Error: Service '{{ parent }}' does not exist!"
  when: >
    parent_explicit | bool and
    (item != 'redhat' or (third_party_rhel_enabled | default(false) | bool))
    and
    (item != 'suse' or (third_party_sles_enabled | default(false) | bool))
    and
    pkg_manifests[item] != "" and
    "{{ pkg_manifests[item] | package_max_unpatched_version(parent) }}" == ""
  with_items: "{{ distro_list }}"

- name: thirdparty-venv | create-thirdparty-venvs |
        Make temp wheelhouse for content to install
  set_fact:
    wheelhouse: "{{ lookup('pipe', 'mktemp -d') }}"

- name: thirdparty-venv | create-thirdparty-venvs |
        Convert debs to wheels and add to wheelhouse
  include: deb-plugin.yml

- name: thirdparty-venv | create-thirdparty-venvs |
        Add source tarballs to wheelhouse
  include: src-plugin.yml

- name: thirdparty-venv | create-thirdparty-venvs |
        Add wheels to wheelhouse
  include: whl-plugin.yml

- name: thirdparty-venv | create-thirdparty-venvs |
        Get temp contents
  command: find -L {{ wheelhouse }} -type f -printf "%p "
  register: search_result

- name: thirdparty-venv | create-thirdparty-venvs |
        Warn if wheelhouse is empty
  debug:
    msg: "Warning: No content to install found."
  when: search_result.stdout == ''

- name: thirdparty-venv | create-thirdparty-venvs |
        Import content for Debian
  include: _venv-import.yml
  vars:
    distro: debian
  when: ((ansible_os_family | lower == 'debian') or
        (third_party_debian_enabled | default(false) | bool)) and
         "'debian' in distro_list and search_result.stdout != ''"

- name: thirdparty-venv | create-thirdparty-venvs |
        Import content for RHEL
  include: _venv-import.yml
  vars:
    distro: redhat
  when: (third_party_rhel_enabled | default(false) | bool) and
        "'redhat' in distro_list and search_result.stdout != ''"

- name: thirdparty-venv | create-thirdparty-venvs |
        Import content for SLES
  include: _venv-import.yml
  vars:
    distro: suse
  when: ((ansible_os_family | lower == 'suse') or
        (third_party_sles_enabled | default(false) | bool)) and
        "'suse' in distro_list and search_result.stdout != ''"

- name: thirdparty-venv | create-thirdparty-venvs |
        Remove scratch directory
  become: yes
  file:
    path: "{{ wheelhouse }}"
    state: absent
070701001203B7000081A40000000000000000000000015BD0D1D200000360000000FD0000000200000000000000000000005500000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-venv/tasks/deb-plugin.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: thirdparty-venv | deb-plugin |
        Convert debs to wheels and place in temp wheelhouse
  deb_to_wheel:
    src: "{{ item }}"
    dest: "{{ wheelhouse }}/{{ item | basename }}"
  with_fileglob: "{{ deb_glob }}"070701001203B3000081A40000000000000000000000015BD0D1D20000034D000000FD0000000200000000000000000000005200000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-venv/tasks/install.yml#
# (c) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---

- name: thirdparty-other | install | Install required packages
  become: yes
  package:
    name: "{{ item }}"
    state: present
  with_items:
    thirdparty_venv_required_packages | default([])
070701001203B6000081A40000000000000000000000015BD0D1D2000003BA000000FD0000000200000000000000000000004F00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-venv/tasks/main.yml#
# (c) Copyright 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: thirdparty-venv | main | Set os-specific variables
  include_vars: "{{ ansible_os_family | lower }}.yml"
  when: not ansible_os_family | lower | search('suse')

- name: thirdparty-venv | main | Set os-specific variables
  include_vars: "suse.yml"
  when: ansible_os_family | lower | search('suse')
070701001203B1000081A40000000000000000000000015BD0D1D2000006D1000000FD0000000200000000000000000000005000000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-venv/tasks/setup.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: thirdparty-venv | setup | load services.yml files
  set_fact:
    all_venvs:
      driver: "{{ item.split('/')[-4] }}"
      venv_id: "{{ item.split('/')[-2] }}"
      services: >
        {{ (lookup('template',
           third_party_root_dir+'/'+item.split('/')[-4]+'/venvs/'+item.split('/')[-2]+'/services.yml') |
           from_yaml).services }}
  register: venvs_result
  with_items:
    - "{{ drivers }}"

- name: thirdparty-venv | setup | Set all_venvs fact
  set_fact:
    all_venvs: >
      {{ venvs_result.results | map(attribute='ansible_facts.all_venvs') | list }}

- name: thirdparty-venv | setup | setup parallel workers per driver
  add_host:
    name: task-venvedit-{{ item.0.driver }}-{{ item.0.venv_id }}-{{ item.1.name }}
    hostname: "{{ inventory_hostname }}"
    groups: parallel_venvedit
    driver: "{{ item.0.driver }}"
    venv_id: "{{ item.0.venv_id }}"
    service: "{{ item.1.name }}"
    parent: "{{ item.1.parent | default(item.1.name) }}"
    parent_explicit: "{{ item.1.parent is defined }}"
  with_subelements:
    - "{{ all_venvs | default([]) }}"
    - services070701001203B5000081A40000000000000000000000015BD0D1D20000035E000000FD0000000200000000000000000000005500000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-venv/tasks/src-plugin.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: thirdparty-venv | src-plugin | Move source tarballs to wheelhouse
  file:
    src: "{{ item }}"
    dest: "{{ wheelhouse }}/{{ item | basename }}"
    mode: 0755
    state: link
  with_fileglob: "{{ src_glob }}"070701001203B4000081A40000000000000000000000015BD0D1D200000355000000FD0000000200000000000000000000005500000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-venv/tasks/whl-plugin.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: thirdparty-venv | whl-plugin | Move wheels to wheelhouse
  file:
    src: "{{ item }}"
    dest: "{{ wheelhouse }}/{{ item | basename }}"
    mode: 0755
    state: link
  with_fileglob: "{{ whl_glob }}"070701001203AB000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004500000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-venv/vars070701001203AC000081A40000000000000000000000015BD0D1D2000002B5000000FD0000000200000000000000000000005000000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-venv/vars/debian.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.
#
---
thirdparty_venv_required_packages:
  - virtualenv
070701001203AE000081A40000000000000000000000015BD0D1D200000375000000FD0000000200000000000000000000004E00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-venv/vars/main.yml#
# (c) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---

plugin_dir: "{{ third_party_root_dir }}/{{ driver }}/venvs/{{ venv_id }}"
deb_glob: "{{ plugin_dir }}/debs/*.deb"
whl_glob: "{{ plugin_dir }}/whls/*.whl"
src_glob: "{{ plugin_dir }}/src/*"

driver_deps_dir: "{{ plugin_dir }}/pip-deps/"
070701001203AD000081A40000000000000000000000015BD0D1D2000002BC000000FD0000000200000000000000000000004E00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/thirdparty-venv/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.
#
---
thirdparty_venv_required_packages:
  - python-virtualenv
07070100120306000041ED0000000000000000000000055BD0D1D200000000000000FD0000000200000000000000000000004200000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/upgrade-bootstrap0707010012030F000081A40000000000000000000000015BD0D1D2000002B8000000FD0000000200000000000000000000004D00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/upgrade-bootstrap/README.txt
(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.


upgrade-bootstrap
=================

Provides initial scripts needed for upgrading
07070100120310000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004B00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/upgrade-bootstrap/defaults07070100120311000081A40000000000000000000000015BD0D1D200000284000000FD0000000200000000000000000000005400000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/upgrade-bootstrap/defaults/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.
#
---

07070100120307000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004800000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/upgrade-bootstrap/tasks0707010012030B000081A40000000000000000000000015BD0D1D20000044A000000FD0000000200000000000000000000005600000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/upgrade-bootstrap/tasks/configure.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: Configure policy-rc.d defaults
  become: yes
  template:
     src: policy-rc.d.default
     dest: /etc/default/policy-rc.d
     owner: root
     group: root
     mode: 0644
  when: (ansible_os_family | lower) == 'debian'

- name: Configure /usr/sbin/policy-rc.d
  become: yes
  template:
     src: policy-rc.d
     dest: /usr/sbin/policy-rc.d
     owner: root
     group: root
     mode: 0755
  when: (ansible_os_family | lower) == 'debian'
07070100120308000081A40000000000000000000000015BD0D1D200000283000000FD0000000200000000000000000000005400000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/upgrade-bootstrap/tasks/install.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.
#
---
0707010012030C000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004C00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/upgrade-bootstrap/templates0707010012030E000081ED0000000000000000000000015BD0D1D200001352000000FD0000000200000000000000000000005800000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/upgrade-bootstrap/templates/policy-rc.d#!/bin/bash
#
# (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.
#

DEFAULTS="/etc/default/policy-rc.d"

DO_RUN=check
BEQUIET=
INITSCRIPTID=
ACTION=

SERVICES=""
DEFAULT_BLOCK_ACTIONS=""
# include defaults if available
[ -r "$DEFAULTS" ] && . "$DEFAULTS"

dohelp() {
 #
 # outputs help and usage
 #
cat <<EOF

policy-rc.d, Debian/SysVinit (/etc/rc?.d) initscript subsystem.
(c) Copyright 2015 Hewlett Packard Enterprise Development LP
(c) Copyright 2017 SUSE LLC

Usage:
  policy-rc.d [options] <initscript ID> <actions> [<runlevel>]
  policy-rc.d [options] --list <initscript ID> [<runlevel> ...]

  initscript ID - Initscript ID, as per update-rc.d(8)
  actions       - Initscript actions. Known actions are:
                      start, [force-]stop, restart,
                      [force-]reload, status
      WARNING: not all initscripts implement all of the above actions.
  runlevel      - Runlevel initscript is being executed under

Options:
  --quiet
     Quiet mode, no error messages are generated.
  --help
     Outputs help message to stdout
  --list
     instead of verifying policy, list (in a "human parseable" way) all
     policies defined for the given initscript id (for all runlevels if no
     runlevels are specified; otherwise, list it only for the runlevels
     specified), as well as all known actions and their fallbacks for the
     given initscript id (note that actions and fallback actions might be
     global and not particular to a single initscript id).

EOF
}

printerror () {
 #
 # prints an error message
 #  $* - error message
 #
if test x${BEQUIET} = x ; then
    echo `basename $0`: "$*" >&2
fi
}

verifyparameter () {
 #
 # Verifies if $1 is not null, and $# = 1
 #
if test $# -eq 0 ; then
    printerror syntax error: invalid empty parameter
    exit 103
elif test $# -ne 1 ; then
    printerror syntax error: embedded blanks are not allowed in \"$*\"
    exit 103
fi
return
}

check_is_in () {
 #
 # check if a string is in a space separated list of strings
 #
[[ ${2} =~ (^| )"${1}"($| ) ]] && return 0 || return 1
}

get_blocked_actions () {
 #
 # gets the list of blocked actions for the service or default
 # and saves it in the first argument provided
 #
local blocked_actions_var=${2}_block
# nested substitution trick in bash
local blocked_actions=${!blocked_actions_var}
if test "x${blocked_actions}" = "x" ; then
    blocked_actions="${DEFAULT_BLOCK_ACTIONS}"
fi
eval "$1=\${blocked_actions}"
}

state=I
while test $# -gt 0 && test ${state} != IIII ; do
    case "$1" in
      --help)   dohelp
                exit 0
                ;;
      --quiet)  BEQUIET=--quiet
                ;;
      --list)   DO_RUN=list
                ;;
      --*)      printerror syntax error: unknown option \"$1\"
                exit 103
                ;;
        *)      case ${state} in
                I)  verifyparameter $1
                    INITSCRIPTID=$1
                    ;;
                II) verifyparameter "$1"
                    ACTIONS="$1"
                    ;;
                III) verifyparameter $1
                    RUNLEVEL=$1
                    ;;
                esac
                state=${state}I
                ;;
    esac
    shift
done

if test "x${INITSCRIPTID}" = "x" ; then
    printerror syntax error: must provide an INITSCRIPTID argument
    exit 103
fi

if test "x${DO_RUN}" = "xlist" ; then
    if check_is_in "${INITSCRIPTID}" "${SERVICES}" ; then
        get_blocked_actions BLOCKED_ACTIONS "${INITSCRIPTID}"
        printf "service ${INITSCRIPTID}:\n"
        printf "    runlevel: all\n"
        printf "    deny actions: ${BLOCKED_ACTIONS}\n"
    else
        printf "no policy defined for initscript ID: ${INITSCRIPTID}\n"
    fi
    exit 0
fi

if test "x${SERVICES}" = "x" ; then
    # no services defined to block, so return straight away
    exit 0
fi

if test "x${ACTIONS}" = "x" ; then
    printerror syntax error: <ACTIONS> required
    exit 103
fi

# NOTE: this construct requires bash
if check_is_in "${INITSCRIPTID}" "${SERVICES}" ; then
    get_blocked_actions BLOCKED_ACTIONS ${INITSCRIPTID}
    for action in ${ACTIONS} ; do
        if check_is_in "${action}" "${BLOCKED_ACTIONS}" ; then
            echo "blocking '${action}' for ${INITSCRIPTID}" >&2
            exit 101
        fi
    done
fi

echo "Allowing '${ACTIONS}' for ${INITSCRIPTID}" >&2
exit 0
0707010012030D000081ED0000000000000000000000015BD0D1D2000004D0000000FD0000000200000000000000000000006000000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/upgrade-bootstrap/templates/policy-rc.d.default{#
#
# (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.
#
#}
# Default actions to block for all services listed
#
DEFAULT_BLOCK_ACTIONS="stop start restart reload"

# Services to apply policy actions on when called via invoke.rc-d
#
# SERVICES is a space separated list of services that should have a
# policy applied.
SERVICES=""

# It is possible to modify the actions to prevent on a per service basis
# by setting variables in the form <SERVICE>_block
#
# This would prevent the additional out of runlevel restart action from
# being executed in addtion to the start, restart and stop actions.
#testservice_block="start restart stop (restart)"
0707010012028F000041ED0000000000000000000000045BD0D1D200000000000000FD0000000200000000000000000000004700000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/validate-cluster-limit07070100120292000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000005000000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/validate-cluster-limit/defaults07070100120293000081A40000000000000000000000015BD0D1D200000357000000FD0000000200000000000000000000005900000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/validate-cluster-limit/defaults/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.
#
---
validate_cluster_limit_verb_hosts: ""

# Calulate if there are any missing hosts from the group.
validate_cluster_limit_missing_hosts: >
  {{ groups[validate_cluster_limit_verb_hosts] | difference(play_hosts) }}
07070100120290000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004D00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/validate-cluster-limit/tasks07070100120291000081A40000000000000000000000015BD0D1D2000003F2000000FD0000000200000000000000000000005600000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/validate-cluster-limit/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:  validate-cluster-limit | main | Check is across complete control plane
  fail:
    msg: >
      Play must run across all node in the control plane:
      [{{ validate_cluster_limit_verb_hosts }}] :
      {{ validate_cluster_limit_missing_hosts }}
  when: (validate_cluster_limit_missing_hosts | length) != 0
  run_once_per: validate_cluster_limit_verb_hosts
07070100120396000041ED0000000000000000000000055BD0D1D200000000000000FD0000000200000000000000000000003C00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/venv-editor070701001203A1000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004500000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/venv-editor/defaults070701001203A2000081A40000000000000000000000015BD0D1D20000049D000000FD0000000200000000000000000000004E00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/venv-editor/defaults/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.
#
---
# Values imported from package-constants role
venv_editor_package_dir: "{{ PACKAGE_CONSTANTS.INSTALL_DIR }}"

# Assumes 'source' is defined
venv_editor_source_dir: "{{ venv_editor_package_dir }}/{{ ((source | basename) | split('.'))[0] }}"

# Assumes 'source' and 'suffix' are defined
venv_editor_target_dir: "{{ venv_editor_package_dir }}/{{ ((source | basename) | split('.'))[0] }}{{ suffix }}"

# Assumes 'source' and 'suffix' are defined
destination: "{{ source | dirname }}/{{ ((source | basename) | split('.'))[0] }}{{ suffix }}.tgz"
07070100120398000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004100000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/venv-editor/meta07070100120399000081A40000000000000000000000015BD0D1D2000002E5000000FD0000000200000000000000000000004A00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/venv-editor/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.
#
# We import 'package-constants' to get access to path constants
---
dependencies:
  - package-constants
0707010012039A000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004200000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/venv-editor/tasks070701001203A0000081A40000000000000000000000015BD0D1D2000004F5000000FD0000000200000000000000000000005200000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/venv-editor/tasks/add-to-venv.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.
#
# Unpack an arbitrary venv into /opt/stack/venv.
#
# Parameters:
#   source: path to the venv tarball
#   suffix: string to add to the version number (eg, 001)
#   wheelhouse: directory containing wheels
#   wheel: string containing space-separated list of wheels to install
#
# (It may be possible to install other items into the venv; the pip
# invocation is reasonably flexible.)
---

- name: venv-editor | add-to-venv | Install additional pips
  pip:
    virtualenv: "{{ venv_editor_target_dir }}"
    state: "present"
    name: "{{ wheel }}"
    extra_args: >
      --no-index
      --find-links {{ wheelhouse }}
  become: yes
0707010012039E000081A40000000000000000000000015BD0D1D20000067D000000FD0000000200000000000000000000005400000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/venv-editor/tasks/relocate-venv.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.
#
# Unpack an arbitrary venv into /opt/stack/venv.
#
# Parameters:
#   source: path to the venv tarball
#   suffix: string to add to the version number (eg, 001)
---
- name: venv-editor | relocate-venv | Remove target directory
  file:
    path: "{{ venv_editor_target_dir }}"
    state: absent
  become: yes

- name: venv-editor | relocate-venv | Copy source to target directory
  command: >
    cp -a "{{ venv_editor_source_dir }}" "{{ venv_editor_target_dir }}"
  become: yes

- name: venv-editor | relocate-venv | Relocate the target venv shebang lines
  shell: |
    for file in *; do
      if [ -x "$file" ]; then
        sed -i -e "1s|^#!{{ venv_editor_source_dir }}|#!{{ venv_editor_target_dir }}|" "$file"
      fi
    done
  args:
    chdir: "{{ venv_editor_target_dir }}/bin"
  become: yes

- name: venv-editor | relocate-venv | Fix up activate script
  lineinfile:
    dest: "{{ venv_editor_target_dir }}/bin/activate"
    regexp: '^VIRTUAL_ENV='
    line: VIRTUAL_ENV="{{ venv_editor_target_dir }}"
  become: yes
0707010012039C000081A40000000000000000000000015BD0D1D200000434000000FD0000000200000000000000000000005500000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/venv-editor/tasks/repackage-venv.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.
#
# Unpack an arbitrary venv into /opt/stack/venv.
#
# Parameters:
#   source: path to the venv tarball
#   suffix: string to add to the version number (eg, 001)
#   destination: (optional) place to save the new venv tarball
#
# The destination will be computed automatically by default
---

- name: venv-editor | repackage-venv | Create the venv tarball
  command: tar zcvf {{ destination }} -C {{ venv_editor_target_dir }} .
  become: yes
0707010012039B000081A40000000000000000000000015BD0D1D200000486000000FD0000000200000000000000000000004E00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/venv-editor/tasks/tidy-up.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.
#
# Unpack an arbitrary venv into /opt/stack/venv.
#
# Parameters:
#   source: path to the venv tarball
---

- name: venv-editor | unpack-venv | Ensure package installation directory is removed
  file:
    path: "{{ venv_editor_source_dir }}"
    state: absent
  become: yes
  when: venv_editor_source_dir_stat is defined and not venv_editor_source_dir_stat.stat.exists

- name: venv-editor | unpack-venv | Ensure target directory is removed
  file:
    path: "{{ venv_editor_target_dir }}"
    state: absent
  become: yes
0707010012039F000081A40000000000000000000000015BD0D1D2000005A9000000FD0000000200000000000000000000005200000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/venv-editor/tasks/unpack-venv.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.
#
# Unpack an arbitrary venv into /opt/stack/venv.
#
# Parameters:
#   source: path to the venv tarball
---
- name: venv-editor | unpack-venv | See if package installation directory is already there
  stat:
    path: "{{ venv_editor_source_dir }}"
  register: venv_editor_source_dir_stat

- name: venv-editor | unpack-venv | Ensure package installation directory is created
  file:
    path: "{{ venv_editor_source_dir }}"
    owner: root
    group: root
    mode: 0755
    state: directory
  become: yes
  when: not venv_editor_source_dir_stat.stat.exists

- name: venv-editor | unpack-venv | Explode tarball at destination
  unarchive:
    src: "{{ source }}"
    dest: "{{ venv_editor_source_dir }}"
    owner: root
    group: root
    copy: no
  become: yes
  when: not venv_editor_source_dir_stat.stat.exists
0707010012039D000081A40000000000000000000000015BD0D1D2000004FB000000FD0000000200000000000000000000005300000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/venv-editor/tasks/update-index.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.
#
# Update the index for a venv repo directory
#
# Parameters:
#   destination: path to the venv repo dir
---

- name: venv-editor | update-index | Check if venv repo path exists
  stat:
    path: "{{ item | dirname }}"
  register: venv_repo_path_result
  with_items: "{{ destination }}"


- name: venv-editor | update-index | Ready the index
  become: yes
  command: ./create_index --dir={{ item.0 | dirname }}
  args:
    chdir: "{{ 'packager' | bin_dir if deployer_media_legacy_layout|bool else '/usr/bin/' }}"
  when: item.1.stat.exists
  with_together:
    - "{{ destination }}"
    - "{{ venv_repo_path_result.results }}"
0707010012025D000041ED0000000000000000000000055BD0D1D200000000000000FD0000000200000000000000000000004400000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/win-install-package07070100120265000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004D00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/win-install-package/defaults07070100120266000081A40000000000000000000000015BD0D1D2000003ED000000FD0000000200000000000000000000005600000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/win-install-package/defaults/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.
#
---
path_separator: \
win_pkg_conf_path: Ardana\OpenStack\etc
win_cache_path: Ardana\OpenStack\cache
win_dir_path: Ardana\OpenStack
win_service_run_file: ServiceRunner.ps1
win_log_file_location: AppData\Local\Ardana\OpenStack\Log

win_certs_dir: etc\ssl\certs
win_certs_path: "{{ [win_ardana_dir, win_certs_dir, 'ca-certificates.crt'] |
    join(path_separator) }}"
0707010012025E000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004A00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/win-install-package/tasks0707010012025F000081A40000000000000000000000015BD0D1D2000006DB000000FD0000000200000000000000000000005700000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/win-install-package/tasks/_setvars.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: win-install-package | _setvars | Get the system environment variables
  raw: "powershell [Environment]::GetEnvironmentVariable('ProgramFiles')"
  register: win_env_result

- name: win-install-package | _setvars | Create log folder
  win_file:
    path: "{{ win_log_file_location }}"
    state: directory

- name: win-install-package | _setvars | Get log file absolute path
  raw: powershell ((Resolve-Path -path "{{ win_log_file_location }}").path)
  register: win_log_path_result

- name: win-install-package | _setvars | setting programfiles path as fact
  set_fact:
    win_programfiles_path: "{{ win_env_result.stdout.split('\\r\n')[0] }}"

- name: win-install-package | _setvars | setting folder paths as facts
  set_fact:
    win_ardana_dir: "{{ [win_programfiles_path, win_dir_path] |
        join(path_separator) }}"
    win_cache_dir: "{{ [win_programfiles_path, win_cache_path] |
        join(path_separator) }}"
    win_packager_conf_dir: "{{ [win_programfiles_path, win_pkg_conf_path] |
        join(path_separator) }}"
    win_log_file_location: "{{ win_log_path_result.stdout_lines[0] }}"
07070100120261000081A40000000000000000000000015BD0D1D20000052B000000FD0000000200000000000000000000005C00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/win-install-package/tasks/check_version.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: win-install-package | check_version | Build URI for venv from packager
  win_build_url:
    service: "{{ win_service }}"
    cache_path: "{{ win_cache_dir }}"
    conf_path: "{{ win_packager_conf_dir }}"
  register: build_url_result

- name: win-install-package | check_version | set build_url as fact
  set_fact:
    build_url: "{{ build_url_result }}"

- name: win-install-package | check_version | check version of service
  raw: sc qc "{{ win_service_name }}"
  register: win_service_config_result
  ignore_errors: yes

- name: win-install-package | check_version | set win_service_config as fact
  set_fact:
    win_service_config: "{{ win_service_config_result }}"
07070100120262000081A40000000000000000000000015BD0D1D200000536000000FD0000000200000000000000000000005800000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/win-install-package/tasks/configure.yml#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- name: win-install-package | configure | set win_python_venv as fact
  set_fact:
    win_python_venv: "{{ [win_ardana_dir, win_service, build_url.svc_dir,
        win_service, 'Scripts', 'python.exe'] | join(path_separator) }}"

- name: win-install-package | configure | Install and configure Windows Service
  raw: powershell -file "{{ [win_ardana_dir, 'setup', win_service_run_file] |
    join(path_separator) }}" "{{ win_python_venv }}" "{{ win_service_name }}"
    "{{ build_url.svc_dir }}"

- name: win-install-package | configure | Restart the service when it crashes
  raw: sc failure "{{ win_service_name }}" reset=60 actions=
                restart/3000/restart/3000/restart/3000
07070100120260000081A40000000000000000000000015BD0D1D20000069E000000FD0000000200000000000000000000005600000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/win-install-package/tasks/install.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.
#
---

- include: _setvars.yml

- include: check_version.yml

- name:  win-install-package | install | Download the venv zip
  win_get_url:
    url: "{{ build_url.url }}"
    dest: "{{ [win_cache_dir, build_url.zip] | join(path_separator) }}"
  when: win_service_config.stdout.find("{{ build_url.svc_dir }}") == -1

- name:  win-install-package | install | Unzip the venv zip
  win_unzip:
    src: "{{ [win_cache_dir, build_url.zip] | join(path_separator) }}"
    dest: "{{ [win_ardana_dir, win_service, build_url.svc_dir] |
            join(path_separator) }}"
    creates: "{{ [win_ardana_dir, win_service, build_url.svc_dir] |
            join(path_separator) }}"
  when: win_service_config.stdout.find("{{ build_url.svc_dir }}") == -1

- name:  win-install-package | install | Update orig-prefix
  win_template:
    src: orig-prefix.txt.j2
    dest: "{{ [win_ardana_dir, win_service, build_url.svc_dir, win_service,
            'Lib', 'orig-prefix.txt'] | join(path_separator) }}"
  when: win_service_config.stdout.find("{{ build_url.svc_dir }}") == -1
07070100120263000041ED0000000000000000000000025BD0D1D200000000000000FD0000000200000000000000000000004E00000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/win-install-package/templates07070100120264000081ED0000000000000000000000015BD0D1D2000002C9000000FD0000000200000000000000000000006100000000ardana-ansible-8.0+git.1540411858.7223b0a/roles/win-install-package/templates/orig-prefix.txt.j2#jinja2: newline_sequence:"\r\n"
{#
#
# (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.
#
#}
{{ win_ardana_dir}}\Python-27
070701001203F6000081A40000000000000000000000015BD0D1D200000349000000FD0000000200000000000000000000004200000000ardana-ansible-8.0+git.1540411858.7223b0a/service-guest-image.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: localhost
  connection: local
  roles:
    - service-guest-image
  tasks:
    - include: roles/service-guest-image/tasks/extract_image_package.yml

- include: _octavia-guest-configure.yml
07070100120439000081A40000000000000000000000015BD0D1D200000374000000FD0000000200000000000000000000003900000000ardana-ansible-8.0+git.1540411858.7223b0a/show-hooks.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.
#
# Run a deployment using the configuration processor's saved state
---
- hosts: localhost
  connection: local
  tasks:
    - include_vars: roles/deployer-setup/defaults/main.yml
    - include: roles/deployer-setup/tasks/ardana-hooks-display.yml
070701001203EF000081A40000000000000000000000015BD0D1D2000005C9000000FD0000000200000000000000000000003300000000ardana-ansible-8.0+git.1540411858.7223b0a/site.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.
#
---
# Regather facts on all hosts in case of configuration changes that haven't
# been reflected in the fact cache
- include: pbstart.yml
  vars:
    playbook_name: "site.yml"

- include: ardana-refresh-facts.yml

- include: guard-deployment.yml
- include: osconfig-run.yml

# Regathering facts in light of host-name changes from osconfig-run.yml
- hosts: resources:localhost
  tasks:
  - action: setup

- include: installui-reconfigure.yml
- include: ardana-deploy.yml
- include: ardana-status.yml

- include: pbfinish.yml
  vars:
    playbook_name: "site.yml"
# Asynchronous delayed reset to switch ardana-service to use keystone
- include: _ardana-service-delayed-reset.yml

# Asynchronous delayed reset to the installer-ui server to pickup the
# new endpoint of the ardana-service
- include: _installui-server-delayed-reset.yml
07070100120426000081A40000000000000000000000015BD0D1D20000062B000000FD0000000200000000000000000000003F00000000ardana-ansible-8.0+git.1540411858.7223b0a/sosreport-deploy.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.
#
# Install and configure sosreport on all the nodes
---

- hosts: "all:!localhost:!*-local"
  max_fail_percentage: 0
  roles:
    - sosreport
  tasks:
    - include: roles/sosreport/tasks/install.yml
      when: ansible_os_family | lower != 'suse'

- hosts: "all:!localhost:!*-local"
  roles:
    - supportutils
  tasks:
    - include: roles/supportutils/tasks/install.yml
      when: (ansible_os_family | lower == 'suse') and not deployer_media_legacy_layout|bool

- hosts: FND-RMQ
  max_fail_percentage: 0
  roles:
    - sosreport
    - rabbitmq # Bring in the RabbitMQ environment
  tasks:
    - include: roles/sosreport/tasks/install_rabbitmq.yml
      when: deployer_media_legacy_layout | bool

- hosts: OPS-LM
  max_fail_percentage: 0
  roles:
    - sosreport
    - git-operations # Bring in the git variables
  tasks:
    - include: roles/sosreport/tasks/install_git_repo.yml
      when: deployer_media_legacy_layout | bool
070701001203C9000081A40000000000000000000000015BD0D1D200000474000000FD0000000200000000000000000000003C00000000ardana-ansible-8.0+git.1540411858.7223b0a/sosreport-run.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.
#
# Run the sosreport on all the nodes
---

- hosts: "all:!localhost:!*-local"
  max_fail_percentage: 100
  roles:
    - sosreport
  tasks:
    - include: roles/sosreport/tasks/run.yml
      when: ( deployer_media_legacy_layout|bool ) or ( ansible_os_family | lower != 'suse' )

- hosts: "all:!localhost:!*-local"
  roles:
    - supportutils
  tasks:
    - include: roles/supportutils/tasks/run.yml
      when: not deployer_media_legacy_layout|bool and ( ansible_os_family | lower == 'suse' )
070701001203CA000081A40000000000000000000000015BD0D1D200000329000000FD0000000200000000000000000000004000000000ardana-ansible-8.0+git.1540411858.7223b0a/sosreport-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.
#
# Upgrade sosreport
---

# For now, sosreport-upgrade = sosreport-upgrade and the package
# update is handled by _ardana-upgrade-base.yml
- include: sosreport-deploy.yml
0707010012024B000081A40000000000000000000000015BD0D1D2000002F6000000FD0000000200000000000000000000004200000000ardana-ansible-8.0+git.1540411858.7223b0a/supportutils-deploy.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.
#
# Install and configure supportutils on all the nodes
---
- hosts: "all:!localhost:!*-local"
  roles:
    - supportutils
  tasks:
    - include: roles/supportutils/tasks/install.yml
0707010012042E000081A40000000000000000000000015BD0D1D2000002E1000000FD0000000200000000000000000000003F00000000ardana-ansible-8.0+git.1540411858.7223b0a/supportutils-run.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.
#
# Run supportutils on all the nodes
---

- hosts: "all:!localhost:!*-local"
  roles:
    - supportutils
  tasks:
    - include: roles/supportutils/tasks/run.yml
070701001203ED000081A40000000000000000000000015BD0D1D2000002F6000000FD0000000200000000000000000000004300000000ardana-ansible-8.0+git.1540411858.7223b0a/supportutils-upgrade.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.
#
# Upgrade supportutils
---

# For now, supportutils-upgrade = supportutils-upgrade and the package
# update is handled by _ardana-upgrade-base.yml
- include: supportutils-deploy.yml
070701001203B9000081A40000000000000000000000015BD0D1D2000004A0000000FD0000000200000000000000000000004100000000ardana-ansible-8.0+git.1540411858.7223b0a/third-party-deploy.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.
#
# Install and configure aptly and createrepo on deployer
---

- hosts: localhost
  connection: local
  roles:
    - deployer-setup
    - thirdparty-repo
  tasks:
    - include: roles/thirdparty-repo/tasks/install.yml
    - include: roles/thirdparty-repo/tasks/configure.yml

- hosts: localhost
  connection: local
  roles:
    - thirdparty-other
  tasks:
    - include: roles/thirdparty-other/tasks/install.yml

- hosts: localhost
  connection: local
  roles:
    - thirdparty-venv
  tasks:
    - include: roles/thirdparty-venv/tasks/install.yml07070100120223000081A40000000000000000000000015BD0D1D200000743000000FD0000000200000000000000000000004100000000ardana-ansible-8.0+git.1540411858.7223b0a/third-party-import.yml#
# (c) Copyright 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.
#
# Top-level playbook for importing third-party content
---

- include: distro-list.yml
- include: _third-party-import-debian-pkgs.yml
  when: ansible_os_family | lower = 'debian' or
        (third_party_debian_enabled | default(false) | bool)
- include: _third-party-import-rhel-pkgs.yml
  when: third_party_rhel_enabled | default(false) | bool
- include: _third-party-import-sles-pkgs.yml
  when: ansible_os_family | lower = 'suse'
- include: _third-party-import-services.yml
- include: _third-party-import-ansible.yml
- include: _third-party-import-other.yml
- include: _third-party-import-venvs.yml
- include: _third-party-import-log-profiles.yml
- hosts: localhost
  connection: local
  roles:
    - venv-editor
    - package-constants
  tasks:
    - include: roles/venv-editor/tasks/update-index.yml
      vars:
        destination:
          - "{{ PACKAGE_CONSTANTS.REPO_DIR }}/{{ ardana_version }}/{{ package_venv_locations.hlinux[ansible_architecture] }}/"
          - "{{ PACKAGE_CONSTANTS.REPO_DIR }}/{{ ardana_version }}/{{ package_venv_locations.rhel[ansible_architecture] }}/"
          - "{{ PACKAGE_CONSTANTS.REPO_DIR }}/{{ ardana_version }}/{{ package_venv_locations.sles[ansible_architecture] }}/"
070701001203C6000081A40000000000000000000000015BD0D1D200000365000000FD0000000200000000000000000000004000000000ardana-ansible-8.0+git.1540411858.7223b0a/upgrade-bootstrap.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.
#
# Install and configure sosreport on all the nodes
---

- hosts: "all"
  roles:
    - upgrade-bootstrap

  tasks:
    - include: roles/upgrade-bootstrap/tasks/install.yml
    - include: roles/upgrade-bootstrap/tasks/configure.yml
070701001203BF000081A40000000000000000000000015BD0D1D2000009B9000000FD0000000200000000000000000000003800000000ardana-ansible-8.0+git.1540411858.7223b0a/venv-edit.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.
#
# Unpack an arbitrary venv into /opt/stack/venv.
#
# Parameters:
#   name: (optional) name of the produced venv. Required if source omitted.
#   source: (optional) path to the venv tarball
#   destination: (optional) directory to save the new venv tarball
#   wheelhouse: directory containing new wheels to install
#   wheels: space-separated list of wheels to install
#   version: (optional) version string for produced venv
#   patch: (optional) override default new patch number
#
# (At least one required of source and destination. If no source given,
#  name must be specified.)
# (The destination will be computed automatically by default)
---

- hosts: localhost
  connection: local
  pre_tasks:
    - fail:
        msg: |
          Please define the following parameters:
            name: (optional) name of the produced venv. Required if source omitted
            source: (optional) path to the venv tarball
            destination: (optional) directory to save the new venv tarball
            wheelhouse: directory containing new wheels to install
            wheels: space-separated list of wheels to install
            version: (optional) version string for produced venv
            patch: (optional) new patch version for edited venv (eg. 001)
      when: not (wheelhouse is defined and wheels is defined and
                  (source is defined or
                  (destination is defined and name is defined)))
  tasks:
    - include_vars: "{{ playbook_dir }}/ardana_version.yml"
    - venv_edit:
        name: "{{ name | default(omit) }}"
        src: "{{ source | default(omit) }}"
        dest: "{{ destination | default(omit) }}"
        wheelhouse: "{{ wheelhouse }}"
        wheels: "{{ wheels }}"
        version: "{{ version | default(ardana_version) }}"
        patch: "{{ patch | default(omit) }}"
      become: yes
07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!1503 blocks
openSUSE Build Service is sponsored by