File ardana-ses-9.0+git.1554740095.48252d3.obscpio of Package ardana-ses

07070100E20F8C000081A4000003E800000064000000015CAB737F0000006E000001030000000400000000000000000000003100000000ardana-ses-9.0+git.1554740095.48252d3/.gitreview[gerrit]
host=gerrit.suse.provo.cloud
port=29418
project=ardana/ardana-extensions-ses.git
defaultremote=gozer
07070100E20F85000081A4000003E800000064000000015CAB737F0000279F000001030000000400000000000000000000002E00000000ardana-ses-9.0+git.1554740095.48252d3/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.

07070100E20FA9000081A4000003E800000064000000015CAB737F00000937000001030000000400000000000000000000003000000000ardana-ses-9.0+git.1554740095.48252d3/README.md#
# (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.
#

# Ardana SES (SUSE Enterprise Storage) Extension

This repo contains the SUSE OpenStack Cloud Ardana extension to support
SUSE Enterprise Storage / Ceph.

This includes the required ansible ardana scripts that are used to integrate
an existing SES cluster into a SUSE OpenStack Cloud (SOC).

## Requirements

* A deployed SES cluster
* A directory with:
  ses-config.yml
  ceph.client.cinder.keyring
  ceph.client.cinder-backups.keyring
  ceph.client.nova.keyring
  ceph.client.glance.keyring

....

# inputs required
Must have a directory that contains ses-config.yml, keyring
files for cinder, glance and nova.

Edit the settings.yml and change the ses_config_path, to point to the
location of the configuration directory on the deployer.

Repo structure:

```
├── ses-reconfigure.yml
├── ses-deploy.yml
├── roles
│   ├── ses_deploy
│   │   └── tasks
│   │       ├── main.yml
│   │       ├── install-qemu-package.yml
│   │       ├── install-python-libs.yml
│   │       └── install-client.yml
│   └── ses_common
│       ├── vars
│       │   ├── settings.yml
│       │   └── main.yml
│       ├── templates
│       │   └── ceph.conf.j2
│       └── tasks
│           ├── _include_setup.yml
│           ├── _create_ses_vars.yml
│           └── configure.yml
├── README.md
├── LICENSE
├── example
│   ├── ses_config.yml
│   ├── README.md
│   ├── ceph.client.glance.keyring
│   ├── ceph.client.cinder.keyring
│   └── ceph.client.cinder-backup.keyring
└── config
    └── ses-symlinks.yml
```

07070100E20F8D000041ED000003E800000064000000025CAB737F00000000000001030000000400000000000000000000002D00000000ardana-ses-9.0+git.1554740095.48252d3/config07070100E20F8E000081A4000003E800000064000000015CAB737F000002CE000001030000000400000000000000000000003E00000000ardana-ses-9.0+git.1554740095.48252d3/config/ses-symlinks.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.
#
---
symlinks:
  "ses/settings.yml": "roles/ses_common/vars/settings.yml"
  "ses/ceph.conf.j2": "roles/ses_common/templates/ceph.conf.j2"
07070100E20F86000041ED000003E800000064000000025CAB737F00000000000001030000000400000000000000000000002E00000000ardana-ses-9.0+git.1554740095.48252d3/example07070100E20F8B000081A4000003E800000064000000015CAB737F00000421000001030000000400000000000000000000003800000000ardana-ses-9.0+git.1554740095.48252d3/example/README.md#
# (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.
#

# It's assumed that the following is used as the mechanism for setting
# up the ceph cluster's users and pools.
# The nova pool is managed by the cinder user.
# http://docs.ceph.com/docs/master/rbd/rbd-openstack/

# This directory contains an example set of files that are required
# for the extension to work.

* ses-config.yml - all of the settings that point to the SES cluster
* ceph.client.cinder.keyring
* ceph.client.cinder_backup.keyring
* ceph.client.glance.keyring
07070100E20F89000081A4000003E800000064000000015CAB737F0000028D000001030000000400000000000000000000005000000000ardana-ses-9.0+git.1554740095.48252d3/example/ceph.client.cinder-backup.keyring#
# (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.
#
#
[client.cinder-backup]
key = AQDJvXhaVNo4DhAADywpAmHXEANLBlziobAT+g==
07070100E20F88000081A4000003E800000064000000015CAB737F00000286000001030000000400000000000000000000004900000000ardana-ses-9.0+git.1554740095.48252d3/example/ceph.client.cinder.keyring#
# (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.
#
#
[client.cinder]
key = AQCdfIRaxefEMxAAW4zp2My/5HjoST2Y8mJg8A==
07070100E20F87000081A4000003E800000064000000015CAB737F00000286000001030000000400000000000000000000004900000000ardana-ses-9.0+git.1554740095.48252d3/example/ceph.client.glance.keyring#
# (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.
#
#
[client.glance]
key = AQD9eYRachg1NxAAiT6Hw/xYDA1vwSWLItLpgA==
07070100E20F8A000081A4000003E800000064000000015CAB737F00000620000001030000000400000000000000000000003D00000000ardana-ses-9.0+git.1554740095.48252d3/example/ses_config.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.
#
---

ses_cluster_configuration:
    ses_cluster_name: ceph
    ses_radosgw_url: "https://192.168.56.8:8080/swift/v1"

    conf_options:
        ses_fsid: d5d7c7cb-5858-3218-a36f-d028df7b1111
        ses_mon_initial_members: ses-osd2, ses-osd3, ses-osd1
        ses_mon_host: 192.168.56.8, 192.168.56.9, 192.168.56.7
        ses_public_network: 192.168.56.0/21
        ses_cluster_network: 192.168.56.0/21

    cinder:
        rbd_store_pool: cinder
        rbd_store_pool_user: cinder
        keyring_file_name: ceph.client.cinder.keyring

    cinder-backup:
        rbd_store_pool: backups
        rbd_store_pool_user: cinder_backup
        keyring_file_name: ceph.client.cinder-backup.keyring

    # Nova uses the cinder user to access the nova pool, cinder pool
    # So all we need here is the nova pool name.
    nova:
        rbd_store_pool: nova

    glance:
        rbd_store_pool: glance
        rbd_store_pool_user: glance
        keyring_file_name: ceph.client.glance.keyring
07070100E422ED000041ED000003E800000064000000055CAB737F00000000000001030000000400000000000000000000002C00000000ardana-ses-9.0+git.1554740095.48252d3/roles07070100E428D4000041ED000003E800000064000000065CAB737F00000000000001030000000400000000000000000000003700000000ardana-ses-9.0+git.1554740095.48252d3/roles/ses_common07070100E428DB000041ED000003E800000064000000025CAB737F00000000000001030000000400000000000000000000003F00000000ardana-ses-9.0+git.1554740095.48252d3/roles/ses_common/library07070100E428DC000081A4000003E800000064000000015CAB737F00000B08000001030000000400000000000000000000005200000000ardana-ses-9.0+git.1554740095.48252d3/roles/ses_common/library/load_ses_config.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: load_ses_config
short_description: Loads the ses yaml config into a dictionary
description:
     - This module reads the ses_config.yml into a dictionary.
options:
  conf_dir:
    description:
      - The SES config directory that contains the ses_config file
    required: true
    default: null
  conf_file:
    description:
      - The SES config file name that lives in conf_dir
    required: true
    default: null
author:
'''

EXAMPLES = '''
# Example from Ansible Playbooks.
- load_ses_config:
    conf_dir: "{{ ses_config_path }}"
    conf_file: "{{ ses_config_file }}"
  register: ses_config

'''

from ansible.module_utils.basic import * #noqa
import yaml


def read_ses_config(conf_dir, conf_filename):
    """Read the config file from disk."""

    filename = conf_dir + '/' + conf_filename
    with open(filename, 'r') as stream:
        existing_yml = yaml.load(stream)
        return existing_yml


def run_module():

    module_args = dict(
        conf_dir=dict(type='str', required=True),
        conf_file=dict(type='str', required=True)
    )

    module = AnsibleModule(
        argument_spec=module_args,
        supports_check_mode=True
    )

    result = dict(
        changed=False,
        original_message='',
        message='',
        rc=0,
        ses_confg={}
    )

    conf_dir = module.params['conf_dir']
    conf_file = module.params['conf_file']

    if not conf_dir:
        module.fail_json(rc=255, msg="No SES config dir specified")
    if not conf_file:
        module.fail_json(rc=255, msg="No SES config filename specified")

    # read the yaml file
    try:
        ses_config = read_ses_config(conf_dir, conf_file)
    except Exception as exc:
        module.fail_json(
            rc=254,
            msg=exc.message if hasattr(exc, 'message') else exc)

    result['ses_config'] = ses_config
    if module.check_mode:
        # We are in --check mode, so don't migrate the original
        # config file.
        module.exit_json(**result)
    else:
        # write the new config out if we aren't in check mode
        result['changed'] = True

    module.exit_json(**result)


def main():
    run_module()


if __name__ == '__main__':
    main()
07070100E428DD000081A4000003E800000064000000015CAB737F00000A4C000001030000000400000000000000000000004E00000000ardana-ses-9.0+git.1554740095.48252d3/roles/ses_common/library/ses_clients.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: ses_clients
short_description: Creates a dict of unique ceph clients needed for ceph
description:
     - This module reads the ses_keyring_info and creates a dict of unique
       clients as defined in the original ses_config.yml.   The yaml can have
       dupes, but we can't generate ceph.conf with the dupes.
options:
  ses_keyring_info:
    description:
      - The generated keyring information created by _create_ses_vars.yml
    required: true
    default: null
author:
'''

EXAMPLES = '''
# Example from Ansible Playbooks.
- ses_clients:
    ses_keyring_info: "{{ ses_keyring_info }}"
  register: ses_clients_result

'''

from ansible.module_utils.basic import * #noqa


def run_module():

    module_args = dict(
        ses_keyring_info=dict(type='dict', required=True),
    )

    module = AnsibleModule(
        argument_spec=module_args,
        supports_check_mode=True
    )

    result = dict(
        changed=False,
        original_message='',
        message='',
        rc=0,
        ses_confg={}
    )

    ses_keyring_info = module.params['ses_keyring_info']

    if not ses_keyring_info:
        module.fail_json(rc=255, msg="No SES keyring information defined")

    # Generate a unique list of ceph clients and their filenames
    try:
        ses_clients = {}
        clients = ses_keyring_info['clientnames']
        files = ses_keyring_info['filenames']
        for client in clients:
            ses_clients[clients[client]] = files[client]

    except Exception as exc:
        module.fail_json(
            rc=254,
            msg=exc.message if hasattr(exc, 'message') else exc)

    result['ses_clients'] = ses_clients
    if module.check_mode:
        # We are in --check mode, so don't migrate the original
        # config file.
        module.exit_json(**result)
    else:
        # write the new config out if we aren't in check mode
        result['changed'] = True

    module.exit_json(**result)


def main():
    run_module()


if __name__ == '__main__':
    main()
07070100E428DE000041ED000003E800000064000000025CAB737F00000000000001030000000400000000000000000000003D00000000ardana-ses-9.0+git.1554740095.48252d3/roles/ses_common/tasks07070100E428E1000081A4000003E800000064000000015CAB737F000015BD000001030000000400000000000000000000005200000000ardana-ses-9.0+git.1554740095.48252d3/roles/ses_common/tasks/_create_ses_vars.yml#
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- name: ses_common | _create_ses_vars | Initialize ses_ceph_conf
  set_fact:
    ses_ceph_conf: "{{ ses_config['ceph_conf'] }}"
  when: >
    ses_config is defined and 'ceph_conf' in ses_config

- name: ses_common | _create_ses_vars | Initialize ses_cinder_conf
  set_fact:
    ses_cinder_conf: "{{ ses_config['cinder'] }}"
  when: >
    'cinder' in ses_config

- name: ses_common | _create_ses_vars | Initialize ses_cinder_backup_conf
  set_fact:
    ses_cinderbackup_conf: "{{ ses_config['cinder-backup'] }}"
  when: >
    'cinder-backup' in ses_config

- name: ses_common | _create_ses_vars | Initialize ses_nova_conf
  set_fact:
    ses_nova_conf: "{{ ses_config['nova'] }}"
  when: >
    'nova' in ses_config

- name: ses_common | _create_ses_vars | Initialize ses_glance_conf
  set_fact:
    ses_glance_conf: "{{ ses_config['glance'] }}"
  when: >
    'glance' in ses_config

# The following are global ses extension facts
- name: ses_common | _create_ses_vars | try and set radosgw url
  set_fact:
    ses_radosgw_url: >
      {{ ses_config['radosgw_urls'][0] }}
  when: >
      ('radosgw_urls' in ses_config and
      ses_config['radosgw_urls'])

# The following facts are used for the extension templating ceph.conf
# as well as the other service playbooks to set their respective conf file.
- name: ses_common | _create_ses_vars | Set SES conf facts
  set_fact:
    ses_conf_file_path: >
      /etc/ceph/ceph.conf
    ses_fsid: "{{ ses_ceph_conf.fsid }}"
    ses_mon_initial_members: >
      {{ ses_ceph_conf.mon_initial_members }}
    ses_mon_host: >
      {{ ses_ceph_conf.mon_host }}
    ses_public_network: >
      {{ ses_ceph_conf.public_network }}
    ses_cluster_network: >
      {{ ses_ceph_conf.cluster_network }}
  when: >
      ses_ceph_conf is defined

- name: ses_common | _create_ses_vars | Set SES keyring information
  set_fact:
    ses_keyring_info: {
      'filenames': {
        'cinder': "ceph.client.{{ ses_cinder_conf.rbd_store_user }}.keyring",
        'cinder-backup':
          "ceph.client.{{ ses_cinderbackup_conf.rbd_store_user }}.keyring",
        'glance': "ceph.client.{{ ses_glance_conf.rbd_store_user }}.keyring",
        'nova': "ceph.client.{{ ses_cinder_conf.rbd_store_user }}.keyring",
      },
      'keyrings': {
        'cinder': "{{ ses_cinder_conf.key }}",
        'cinder-backup': "{{ ses_cinderbackup_conf.key }}",
        'glance': "{{ ses_glance_conf.key }}",
        'nova': "{{ ses_cinder_conf.key }}"
      },
      'clientnames': {
        'cinder': "{{ ses_cinder_conf.rbd_store_user }}",
        'cinder-backup': "{{ ses_cinderbackup_conf.rbd_store_user }}",
        'glance': "{{ ses_glance_conf.rbd_store_user }}",
        'nova': "{{ ses_cinder_conf.rbd_store_user }}"
      }}

- name: ses_common | _create_ses_vars | Generate unique ses clients list
  ses_clients:
      ses_keyring_info: "{{ ses_keyring_info }}"
  register: ses_clients_result

- name: ses_common | _create_ses_vars | create ses_clients
  set_fact:
      ses_clients: "{{ ses_clients_result['ses_clients'] }}"
  when: >
      'ses_clients' in ses_clients_result

- name: ses_common | _create_ses_vars | Set SES Cinder facts
  set_fact:
    ses_cinder_pool_name: >
      {{ ses_cinder_conf.rbd_store_pool }}
    ses_cinder_user_name: >
      {{ ses_cinder_conf.rbd_store_user }}
    ses_cinder_keyring_file_path: >
      "/etc/ceph/ceph.client.{{ ses_cinder_conf.rbd_store_user }}.keyring"
    ses_cinder_keyring_value: >
      {{ ses_cinder_conf.key }}
    ses_cinder_secret_uuid: "{{ ses_secret_id }}"
  when: >
      ses_cinder_conf is defined

- name: ses_common | _create_ses_vars | Set SES Cinder Backup facts
  set_fact:
    ses_cinder_backup_pool_name: >
      {{ ses_cinderbackup_conf.rbd_store_pool }}
    ses_cinder_backup_user_name: >
      {{ ses_cinderbackup_conf.rbd_store_user }}
    ses_cinder_backup_keyring_file_path: >
      "/etc/ceph/ceph.client.{{ ses_cinderbackup_conf.rbd_store_user }}.keyring"
    ses_cinder_backup_keyring_value: >
      {{ ses_cinderbackup_conf.key }}
  when: >
      ses_cinderbackup_conf is defined

# Nova uses the cinder user and keyring, but we still need
# the nova pool name.  We have to set the ses_nova_user_name as a trigger
# to tell nova that ses is enabled.
- name: ses_common | _create_ses_vars | Set SES Nova facts
  set_fact:
    ses_nova_pool_name: >
      {{ ses_nova_conf.rbd_store_pool }}
    ses_nova_user_name: >
      {{ ses_cinder_conf.rbd_store_user }}
    ses_nova_secret_uuid: "{{ ses_secret_id }}"
  when: >
      ses_nova_conf is defined

- name: ses_common | _create_ses_vars | Set SES Glance facts
  set_fact:
    ses_glance_pool_name: >
      {{ ses_glance_conf.rbd_store_pool }}
    ses_glance_user_name: >
      {{ ses_glance_conf.rbd_store_user }}
    ses_glance_keyring_file_path: >
      "/etc/ceph/ceph.client.{{ ses_glance_conf.rbd_store_user }}.keyring"
    ses_glance_keyring_value: >
      {{ ses_glance_conf.key }}
  when: >
      ses_glance_conf is defined
07070100E428E0000081A4000003E800000064000000015CAB737F0000061D000001030000000400000000000000000000005000000000ardana-ses-9.0+git.1554740095.48252d3/roles/ses_common/tasks/_include_setup.yml#
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- name: ses_common | _include_setup | include settings
  include_vars: roles/ses_common/vars/settings.yml

- name: ses_common | _include_setup | include main vars
  include_vars: roles/ses_common/vars/main.yml

# We have to read the config yaml into a dictionary due to
# naming conflicts in the yaml file.
- name: ses_common | _include_setup | read the ses_config file
  load_ses_config:
    conf_dir: "{{ ses_config_path }}"
    conf_file: "{{ ses_config_file }}"
  when: >
    ses_config_path is defined
  register: ses_config_result
  delegate_to: 127.0.0.1

- name: ses_common | _include_setup | create ses_config
  set_fact:
    ses_config: "{{ ses_config_result['ses_config'] }}"
  when: >
    'ses_config' in ses_config_result

# this supports the file format from phase 2.
# the new format comes from SES5.5
- name: ses_common | _include_setup | create all SES integration vars
  include: _create_ses_vars.yml
  when: ses_config_path is defined and ses_config is defined
07070100E428DF000081A4000003E800000064000000015CAB737F00000E16000001030000000400000000000000000000004B00000000ardana-ses-9.0+git.1554740095.48252d3/roles/ses_common/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.
#
---
- name: ses_common | configure | Create ceph directory /etc/ceph
  become: yes
  file:
    path: /etc/ceph
    state: directory
    owner: "{{ ceph_user }}"
    group: "{{ ceph_group }}"
    mode: '0755'

- name: ses_common | configure | Copy ceph.conf
  template:
    src: roles/ses_common/templates/ceph.conf.j2
    dest: /etc/ceph/ceph.conf
    owner: "{{ ceph_user }}"
    group: "{{ ceph_group }}"
    mode: '0644'
  become: true

- name: ses_common | configure | Make sure {{ service }} group exists
  group:
    name: "{{ soc_service_groups.get(service) }}"
    state: present
  become: true

- name: ses_common | configure | Make sure {{ ceph_group }} group exists
  group:
    name: "{{ soc_service_groups.get(service) }}"
    state: present
  become: true

- name: ses_common | configure | Check for presence of user '{{ service }}'
  command: "id {{ soc_service_groups.get(service) }}"
  ignore_errors: True
  no_log: true
  changed_when: false
  failed_when: false
  register: service_user_chk_result

- name: ses_common | configure | Add user {{ service }}
  user:
    name: "{{ soc_service_groups.get(service) }}"
    createhome: no
    home: "/var/lib/{{ soc_service_groups.get(service) }}"
    shell: /sbin/nologin
  become: true
  when: service_user_chk_result.rc != 0

- name: ses_common | configure | Add user {{ service }} home
  become: yes
  file:
    path: "/var/lib/{{ soc_service_groups.get(service) }}"
    state: directory
    owner: "{{ soc_service_groups.get(service) }}"
    group: "{{ soc_service_groups.get(service) }}"
    mode: 0700
  when: service_user_chk_result.rc != 0

- name: ses_common | configure | Add user {{ service }} to {{ ceph_group }}
  user:
    name: "{{ soc_service_groups.get(service) }}"
    groups: "{{ ceph_group }}"
    append: yes
  become: true
  register: ses_group_add_result

  # Let Glance-API know it needs a restart if we just added the glance
  # user to the ceph group. Other services normally restart anyway.
- name: ses_common | configure | set the glance restart required flag?
  command: echo "restart required?"
  register: ardana_notify_glance_api_restart_required
  when: (ses_group_add_result.changed | bool) and '"glance" in service'

- name: ses_common | configure | copy {{ service }} keyring
  template:
    src: roles/ses_common/templates/client.keyring.j2
    dest: "/etc/ceph/{{ ses_keyring_info['filenames'][service] }}"
    owner: "{{ ceph_user }}"
    group: "{{ ceph_group }}"
    mode: '0640'
  become: true
  when: '"nova" not in service'

# Nova service uses the cinder user/client/keyring for communication to ceph
# so we need to copy the cinder keyring for setting up nova.
- name: ses_common | configure | copy cinder keyring for nova configuration only
  template:
    src: roles/ses_common/templates/client.keyring.j2
    dest: "/etc/ceph/{{ ses_keyring_info['filenames']['cinder'] }}"
    owner: "{{ ceph_user }}"
    group: "{{ soc_service_groups.get(service) }}"
    mode: '0640'
  become: true
  when: '"nova" in service'
07070100E428D8000041ED000003E800000064000000025CAB737F00000000000001030000000400000000000000000000004100000000ardana-ses-9.0+git.1554740095.48252d3/roles/ses_common/templates07070100E428DA000081A4000003E800000064000000015CAB737F00000501000001030000000400000000000000000000004E00000000ardana-ses-9.0+git.1554740095.48252d3/roles/ses_common/templates/ceph.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.
#
#}
[global]
fsid = {{ ses_fsid }}
mon_initial_members = {{ ses_mon_initial_members }}
mon_host = {{ ses_mon_host }}
auth_cluster_required = cephx
auth_service_required = cephx
auth_client_required = cephx
filestore_xattr_use_omap = true
public_network = {{ ses_public_network }}
cluster_network = {{ ses_cluster_network }}

# enable old ceph health format in the json output. This fixes the
# ceph_exporter. This option will only stay until the prometheus plugin takes
# over
mon_health_preluminous_compat = true
mon health preluminous compat warning = false

rbd default features = 3

{% for client in ses_clients %}
[client.{{ client }}]
keyring=/etc/ceph/{{ ses_clients[client] }}
{% endfor %}
07070100E428D9000081A4000003E800000064000000015CAB737F000002AC000001030000000400000000000000000000005300000000ardana-ses-9.0+git.1554740095.48252d3/roles/ses_common/templates/client.keyring.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.
#}
[client.{{ ses_keyring_info['clientnames'][service] }}]
key = {{ ses_keyring_info['keyrings'][service] }}
07070100E428D5000041ED000003E800000064000000025CAB737F00000000000001030000000400000000000000000000003C00000000ardana-ses-9.0+git.1554740095.48252d3/roles/ses_common/vars07070100E428D7000081A4000003E800000064000000015CAB737F0000033C000001030000000400000000000000000000004500000000ardana-ses-9.0+git.1554740095.48252d3/roles/ses_common/vars/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.
#
---
ceph_user: root
ceph_group: ceph

# The openstack service's group name for setting
# permissions on each of the keyring files for
# group read access
soc_service_groups:
   cinder: cinder
   cinder-backup: cinder
   nova: nova
   glance: glance
07070100E428D6000081A4000003E800000064000000015CAB737F000003FF000001030000000400000000000000000000004900000000ardana-ses-9.0+git.1554740095.48252d3/roles/ses_common/vars/settings.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.
---

# the directory where the ses config files are.
# ses_config_path: <path to the ses-config dir>
ses_config_file: ses_config.yml

# Allow nova libvirt images_type to be set to rbd?
# Set this to false, if you only want rbd_user and rbd_secret to be set
# in the [libvirt] section of hypervisor.conf
ses_nova_set_images_type: True

# The unique uuid for use with virsh for cinder and nova
ses_secret_id: 457eb676-33da-42ec-9a8c-9293d545c337
07070100E428E2000041ED000003E800000064000000045CAB737F00000000000001030000000400000000000000000000003800000000ardana-ses-9.0+git.1554740095.48252d3/roles/ses_convert07070100E428E3000041ED000003E800000064000000025CAB737F00000000000001030000000400000000000000000000004000000000ardana-ses-9.0+git.1554740095.48252d3/roles/ses_convert/library07070100E428E4000081A4000003E800000064000000015CAB737F00001916000001030000000400000000000000000000005B00000000ardana-ses-9.0+git.1554740095.48252d3/roles/ses_convert/library/convert_ses_config_yaml.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: convert_ses_config_yaml
short_description: Converts the cloud8 v1 ses_config yaml and keyrings to v2
description:
     - This module converts a cloud8 v1 manual ses_config.yml and associated
     keyring files into the v2 SES 5.5 single yaml file format.
options:
  conf_dir:
    description:
      - The SES config directory that contains the v1 ses_config file and
        the keyrings
    required: true
    default: null
  conf_file:
    description:
      - The SES config file name that lives in conf_dir
    required: true
    default: null
author:
'''

EXAMPLES = '''
# Example from Ansible Playbooks.
- convert_ses_config_yaml:
    conf_dir: "{{ ses_config_path }}"
    conf_file: "{{ ses_config_file }}"
  register: new_config

'''

from ansible.module_utils.basic import * #noqa
import ConfigParser
import io
import os
import yaml


def get_ini_config(filename):
    """Read an 'ini' format file."""

    with open(filename, 'r') as k:
        parser = ConfigParser.ConfigParser()
        lines = (line.strip() for line in k.readlines() if len(line.strip()))
        parser.readfp(io.BytesIO('\n'.join(lines)))
        return parser


def read_v1_config(conf_dir, conf_filename):
    """Read the config file from disk."""

    filename = conf_dir + '/' + conf_filename
    with open(filename, 'r') as stream:
        existing_yml = yaml.load(stream)
        return existing_yml


def get_keyring_value(service, conf_dir, config):
    """Read the keyring value out of an existing keyring file."""

    service_conf = config['ses_cluster_configuration'][service]
    keyring_filename = conf_dir + '/' + service_conf['keyring_file_name']

    service_ini = get_ini_config(keyring_filename)
    for section in service_ini.sections():
        if service_ini.has_option(section, 'key'):
            return service_ini.get(section, 'key')


def replace_yaml(conf_dir, conf_filename, ses_config,
                 destructive_replace=True):
    """move the old config out of the way and write the new config."""

    orig_file = conf_dir + '/' + conf_filename
    new_file = conf_dir + '/' + conf_filename + '.orig'
    os.rename(orig_file, new_file)

    output_file = conf_dir + '/' + conf_filename
    with open(output_file, 'w') as outfile:
        yaml.dump(ses_config, outfile, default_flow_style=False)


def build_new_config(old_conf, cinder_key, cinder_backup_key,
                     glance_key):
    """Construct the SES 5.5 format of the ceph config yaml."""

    ceph_conf = old_conf['ses_cluster_configuration']['conf_options']
    cinder_conf = old_conf['ses_cluster_configuration']['cinder']
    backup_conf = old_conf['ses_cluster_configuration']['cinder-backup']
    nova_conf = old_conf['ses_cluster_configuration']['nova']
    glance_conf = old_conf['ses_cluster_configuration']['glance']
    radosgw_url = []
    if 'ses_radosgw_url' in old_conf['ses_cluster_configuration']:
        radosgw_url = [old_conf['ses_cluster_configuration']['ses_radosgw_url']]
    ses_config = {
        "ceph_conf": {
            "fsid": ceph_conf['ses_fsid'],
            "mon_host": ceph_conf['ses_mon_host'],
            "mon_initial_members": ceph_conf['ses_mon_initial_members'],
            "cluster_network": ceph_conf['ses_cluster_network'],
            "public_network": ceph_conf['ses_public_network']
        },
        "cinder": {"key": cinder_key,
                   "rbd_store_pool": cinder_conf['rbd_store_pool'],
                   "rbd_store_user": cinder_conf['rbd_store_pool_user'],
                   },
        "cinder-backup": {
            "key": cinder_backup_key,
            "rbd_store_pool": backup_conf['rbd_store_pool'],
            "rbd_store_user": backup_conf['rbd_store_pool_user'],
        },
        "glance": {
            "key": glance_key,
            "rbd_store_pool": glance_conf['rbd_store_pool'],
            "rbd_store_user": glance_conf['rbd_store_pool_user'],
        },
        "nova": {
            "rbd_store_pool": nova_conf['rbd_store_pool']
        },
        "radosgw_urls": radosgw_url
    }

    return ses_config


def run_module():

    module_args = dict(
        conf_dir=dict(type='str', required=True),
        conf_file=dict(type='str', required=True)
    )

    module = AnsibleModule(
        argument_spec=module_args,
        supports_check_mode=True
    )

    result = dict(
        changed=False,
        original_message='',
        message='',
        rc=0,
        ses_confg={}
    )

    conf_dir = module.params['conf_dir']
    conf_file = module.params['conf_file']

    if not conf_dir:
        module.fail(rc=255, msg="No SES config dir specified")
    if not conf_file:
        module.fail(rc=255, msg="No SES config filename specified")

    # read the yaml file
    try:
        old_conf = read_v1_config(conf_dir, conf_file)
    except Exception as exc:
        module.fail(rc=254, msg=exc.message if hasattr(exc, 'message') else exc)

    # read the keyring files
    cinder_key = get_keyring_value('cinder', conf_dir, old_conf)
    cinder_backup_key = get_keyring_value('cinder-backup', conf_dir, old_conf)
    glance_key = get_keyring_value('glance', conf_dir, old_conf)

    # construct the final dict
    ses_config = build_new_config(old_conf, cinder_key,
                                  cinder_backup_key,
                                  glance_key)

    result['ses_config'] = ses_config
    if module.check_mode:
        # We are in --check mode, so don't migrate the original
        # config file.
        module.exit_json(**result)
    else:
        # write the new config out if we aren't in check mode
        replace_yaml(conf_dir, conf_file, ses_config)
        result['changed'] = True

    module.exit_json(**result)


def main():
    run_module()


if __name__ == '__main__':
    main()
07070100E428E5000041ED000003E800000064000000025CAB737F00000000000001030000000400000000000000000000003E00000000ardana-ses-9.0+git.1554740095.48252d3/roles/ses_convert/tasks07070100E428E6000081A4000003E800000064000000015CAB737F000004F5000001030000000400000000000000000000005800000000ardana-ses-9.0+git.1554740095.48252d3/roles/ses_convert/tasks/convert_ses_v1_config.yml#
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---
- name: ses_convert | convert_ses_v1_config | include settings
  include_vars: roles/ses_common/vars/settings.yml

- name: ses_convert | convert_ses_v1_config | include main vars
  include_vars: roles/ses_common/vars/main.yml

- name: ses_convert | convert_ses_v1_config | include the v1 ses config
  include_vars: "{{ ses_config_path }}/{{ ses_config_file }}"
  when: ses_config_path is defined

- name: ses_convert | convert_ses_v1_config | Call convert
  convert_ses_config_yaml:
    conf_dir: "{{ ses_config_path }}"
    conf_file: "{{ ses_config_file }}"
  when: >
    ses_config_path is defined and
    'ceph_conf' not in hostvars['localhost']
  register: new_ses_config_result
07070100E428CE000041ED000003E800000064000000035CAB737F00000000000001030000000400000000000000000000003700000000ardana-ses-9.0+git.1554740095.48252d3/roles/ses_deploy07070100E428CF000041ED000003E800000064000000025CAB737F00000000000001030000000400000000000000000000003D00000000ardana-ses-9.0+git.1554740095.48252d3/roles/ses_deploy/tasks07070100E428D2000081A4000003E800000064000000015CAB737F0000042E000001030000000400000000000000000000005000000000ardana-ses-9.0+git.1554740095.48252d3/roles/ses_deploy/tasks/install-client.yml#
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---

- name: ses_deploy | install-client | Install ceph client
  become: yes
  package:
    name: "{{ item }}"
    state: latest
  # the pkg names are identical on RedHat and SUSE.
  # No special condition needed
  with_items:
    - ceph-common

- name: ses_common | configure | Make sure {{ ceph_group }} group exists
  group:
    name: "{{ ceph_group }}"
    state: present
  become: true

- name: ses_deploy | install-client | Run install-python-libs
  include: install-python-libs.yml
07070100E428D0000081A4000003E800000064000000015CAB737F00000355000001030000000400000000000000000000005500000000ardana-ses-9.0+git.1554740095.48252d3/roles/ses_deploy/tasks/install-python-libs.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: ses_deploy | install-python-libs | Install Ceph python packages
  become: yes
  package:
    name: "{{ item }}"
    state: latest
  # the pkg names are identical on RedHat and SUSE.
  # No special condition needed
  with_items:
    - python-rbd
    - python-rados
07070100E428D1000081A4000003E800000064000000015CAB737F00000305000001030000000400000000000000000000005600000000ardana-ses-9.0+git.1554740095.48252d3/roles/ses_deploy/tasks/install-qemu-package.yml#
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
---

- name: ses_deploy | install-qemu-package | Install qemu-block-rbd
  become: yes
  package:
    name: qemu-block-rbd
    state: present
  when: ansible_os_family | lower | search('suse')
07070100E428D3000081A4000003E800000064000000015CAB737F00000397000001030000000400000000000000000000004600000000ardana-ses-9.0+git.1554740095.48252d3/roles/ses_deploy/tasks/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.
#
---
- name: ses_deploy | main | include setup
  include: ../../ses_common/tasks/_include_setup.yml

- name: ses_deploy | main | include common main vars
  include_vars: ../../ses_common/vars/main.yml

- name: ses_deploy | main | Install the ceph client code on Cinder node
  include: install-client.yml
  when: ses_config_path is defined
07070100E20FA8000081A4000003E800000064000000015CAB737F00000F00000001030000000400000000000000000000003500000000ardana-ses-9.0+git.1554740095.48252d3/ses-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.
#
---
- hosts: localhost
  roles:
    - ses_convert

  tasks:
    #############################################################
    # Detect if we have the original ses_config format of yaml
    # and keyring files.  If so, then automatically convert them
    # to the all in 1 yaml format
    #############################################################
    # Include the ses_config that is supplied by user/openATTIC
    - name: Try to convert a possible v1 config directory
      include: roles/ses_convert/tasks/convert_ses_v1_config.yml

- hosts: localhost
  roles:
    - ses_common
    - ses_deploy

  tasks:
    #############################################################
    # Include the input model's ses_config, which contains
    # config options from the ses deployment.  This config yaml
    # contains the cinder/nova/glance pools, users, keyring file
    # locations as well as the ceph.conf
    #############################################################

    # Include the ses_config that is supplied by user/openATTIC
    - name: include setup
      include: roles/ses_common/tasks/_include_setup.yml

##################################
# Now update each Swift Proxy node
##################################
- hosts: SWF-PRX
  roles:
    - ses_common
    - ses_deploy

  tasks:
    #############################################################
    # Include the input model's ses_config, which contains
    # config options from the ses deployment.  This config yaml
    # contains the cinder/nova/glance pools, users, keyring file
    # locations as well as the ceph.conf
    #############################################################

    # Include the ses_config that is supplied by user/openATTIC
    - name: include setup
      include: roles/ses_common/tasks/_include_setup.yml

##################################
# Now update each Cinder Volume node
##################################
- hosts: CND-VOL
  roles:
    - ses_common
    - ses_deploy

  tasks:
    - name: configure cinder
      include: >
        roles/ses_common/tasks/configure.yml service=cinder
      when: ses_config_path is defined

##################################
# Now update each Cinder Backup Node
##################################
- hosts: CND-BCK
  roles:
    - ses_common
    - ses_deploy

  tasks:
    - name: configure cinder
      include: >
        roles/ses_common/tasks/configure.yml service=cinder-backup
      when: ses_config_path is defined

##################################
# Now update each Nova node
##################################
- hosts: NOV-KVM
  roles:
    - ses_common
    - ses_deploy

  tasks:
    - name: Install the ceph qemu client code on Nova Compute node
      include: roles/ses_deploy/tasks/install-qemu-package.yml
      when: ses_config_path is defined

    - name: configure Nova
      include: >
        roles/ses_common/tasks/configure.yml service=nova
      when: ses_config_path is defined


##################################
# Now update each Glance node
##################################

- hosts: GLA-API
  roles:
    - ses_common
    - ses_deploy

  tasks:
    - name: configure glance
      include: >
        roles/ses_common/tasks/configure.yml service=glance
      when: ses_config_path is defined
07070100E20FAA000081A4000003E800000064000000015CAB737F00000F40000001030000000400000000000000000000003A00000000ardana-ses-9.0+git.1554740095.48252d3/ses-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.
#
---
- hosts: localhost
  roles:
    - ses_convert

  tasks:
    #############################################################
    # Detect if we have the original ses_config format of yaml
    # and keyring files.  If so, then automatically convert them
    # to the all in 1 yaml format
    #############################################################
    # Include the ses_config that is supplied by user/openATTIC
    - name: Try to convert a possible v1 config directory
      include: roles/ses_convert/tasks/convert_ses_v1_config.yml

- hosts: localhost
  roles:
    - ses_common

  tasks:
    #############################################################
    # Include the input model's ses_config, which contains
    # config options from the ses deployment.  This config yaml
    # contains the cinder/nova/glance pools, users, keyring file
    # locations as well as the ceph.conf
    #############################################################

    # Include the ses_config that is supplied by user/openATTIC
    - name: include setup
      include: roles/ses_common/tasks/_include_setup.yml

##################################
# Now update each Swift Proxy node
##################################
- hosts: SWF-PRX
  roles:
    - ses_common

  tasks:
    #############################################################
    # Include the input model's ses_config, which contains
    # config options from the ses deployment.  This config yaml
    # contains the cinder/nova/glance pools, users, keyring file
    # locations as well as the ceph.conf
    #############################################################

    # Include the ses_config that is supplied by user/openATTIC
    - name: include setup
      include: roles/ses_common/tasks/_include_setup.yml

##################################
# Now update each Cinder Volume node
##################################
- hosts: CND-VOL
  roles:
    - ses_common

  tasks:
    - name: include setup
      include: roles/ses_common/tasks/_include_setup.yml

    - name: configure cinder
      include: >
        roles/ses_common/tasks/configure.yml service=cinder
      when: ses_config_path is defined

##################################
# Now update each Cinder Backup Node
##################################
- hosts: CND-BCK
  roles:
    - ses_common

  tasks:
    - name: include setup
      include: roles/ses_common/tasks/_include_setup.yml

    - name: configure cinder
      include: >
        roles/ses_common/tasks/configure.yml service=cinder-backup
      when: ses_config_path is defined

##################################
# Now update each Nova node
##################################
- hosts: NOV-KVM
  roles:
    - ses_common

  tasks:
    - name: include setup
      include: roles/ses_common/tasks/_include_setup.yml

    - name: configure Nova
      include: >
        roles/ses_common/tasks/configure.yml service=nova
      when: ses_config_path is defined


##################################
# Now update each Glance node
##################################

- hosts: GLA-API
  roles:
    - ses_common

  tasks:
    - name: include setup
      include: roles/ses_common/tasks/_include_setup.yml

    - name: configure glance
      include: >
        roles/ses_common/tasks/configure.yml service=glance
      when: ses_config_path is defined
07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!126 blocks