<commit_before>---
# Copyright 2017, <NAME> <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT 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: Install ceph radosgw
  hosts: ceph-rgw
  user: root
  pre_tasks:
    - name: Ensure RGW service
      keystone:
        command: "ensure_service"
        endpoint: "{{ keystone_service_adminurl }}"
        login_user: "{{ keystone_admin_user_name }}"
        login_password: "{{ <PASSWORD> }}"
        login_project_name: "{{ keystone_admin_tenant_name }}"
        service_name: "{{ radosgw_service_name }}"
        service_type: "{{ radosgw_service_type }}"
        description: "{{ radosgw_service_description }}"
        insecure: "{{ keystone_service_adminuri_insecure }}"
      delegate_to: "{{ groups['utility_all'][0] }}"
      run_once: true
      when: radosgw_keystone | bool
      register: add_service
      until: add_service|success
      retries: 5
      delay: 2
      no_log: True
      tags:
        - ceph-rgw-setup
        - rgw-service-add

    - name: Ensure RGW user
      keystone:
        command: "ensure_user"
        endpoint: "{{ keystone_service_adminurl }}"
        login_user: "{{ keystone_admin_user_name }}"
        login_password: "{{ <PASSWORD> }}"
        login_project_name: "{{ keystone_admin_tenant_name }}"
        user_name: "{{ radosgw_admin_user }}"
        tenant_name: "{{ radosgw_admin_tenant }}"
        role_name: "{{ radosgw_role_name | default('service') }}"
        password: "{{ <PASSWORD> }}"
        insecure: "{{ keystone_service_adminuri_insecure }}"
      delegate_to: "{{ groups['utility_all'][0] }}"
      run_once: true
      when: radosgw_keystone | bool
      register: add_user
      until: add_user|success
      retries: 5
      delay: 10
      no_log: True
      tags:
        - ceph-rgw-setup
        - rgw-service-add

    - name: Ensure RGW user to admin role
      keystone:
        command: "ensure_user_role"
        endpoint: "{{ keystone_service_adminurl }}"
        login_user: "{{ keystone_admin_user_name }}"
        login_password: "{{ <PASSWORD> }}"
        login_project_name: "{{ keystone_admin_tenant_name }}"
        user_name: "{{ radosgw_admin_user }}"
        tenant_name: "{{ radosgw_admin_tenant }}"
        role_name: "{{ radosgw_role_name | default('admin') }}"
        insecure: "{{ keystone_service_adminuri_insecure }}"
      delegate_to: "{{ groups['utility_all'][0] }}"
      run_once: true
      register: add_admin_role
      when: radosgw_keystone | bool
      until: add_admin_role|success
      retries: 5
      delay: 10
      no_log: True
      tags:
        - ceph-rgw-setup
        - rgw-service-add

    - name: Ensure swiftoperator role
      keystone:
        command: "ensure_role"
        endpoint: "{{ keystone_service_adminurl }}"
        login_user: "{{ keystone_admin_user_name }}"
        login_password: "{{ <PASSWORD>stone_auth_admin_password }}"
        login_project_name: "{{ keystone_admin_tenant_name }}"
        role_name: "swiftoperator"
        insecure: "{{ keystone_service_adminuri_insecure }}"
      delegate_to: "{{ groups['utility_all'][0] }}"
      register: add_swiftoperator_role
      until: add_swiftoperator_role|success
      retries: 5
      delay: 10
      no_log: True
      tags:
        - ceph-rgw-setup
        - rgw-service-add

    - name: Ensure RGW endpoint
      keystone:
        command: "ensure_endpoint"
        endpoint: "{{ keystone_service_adminurl }}"
        login_user: "{{ keystone_admin_user_name }}"
        login_password: "{{ <PASSWORD> }}"
        login_project_name: "{{ keystone_admin_tenant_name }}"
        region_name: "{{ radosgw_service_region }}"
        service_name: "{{ radosgw_service_name }}"
        service_type: "{{ radosgw_service_type }}"
        insecure: "{{ keystone_service_adminuri_insecure }}"
        endpoint_list:
          - url: "{{ radosgw_service_publicurl }}"
            interface: "public"
          - url: "{{ radosgw_service_adminurl }}"
            interface: "admin"
          - url: "{{ radosgw_service_internalurl }}"
            interface: "internal"
      delegate_to: "{{ groups['utility_all'][0] }}"
      run_once: true
      register: add_endpoint
      when: radosgw_keystone | bool
      until: add_endpoint|success
      retries: 5
      delay: 10
      no_log: True
      tags:
        - ceph-rgw-setup
        - rgw-service-add

    - include: common-tasks/os-log-dir-setup.yml
      vars:
        log_dirs:
          - src: "/openstack/log/{{ inventory_hostname }}-ceph"
            dest: "/var/log/ceph"

    - include: common-tasks/os-lxc-container-setup.yml

    - name: Gather ceph-mon facts
      action: setup
      delegate_to: "{{ item }}"
      delegate_facts: yes
      with_items: "{{ groups[mon_group_name] }}"
      when:
        - inventory_hostname == ansible_play_hosts[0]
      tags:
        - ceph-mon-facts
  roles:
    - role: ceph-defaults
      tags:
        - skip_ansible_lint
    - role: ceph-common
      tags:
        - skip_ansible_lint
    - role: ceph-config
      tags:
        - skip_ansible_lint
    - role: ceph-rgw
      tags:
        - skip_ansible_lint
    - role: "rsyslog_client"
      rsyslog_client_log_rotate_file: ceph_log_rotate
      rsyslog_client_log_dir: "/var/log/ceph"
      rsyslog_client_config_name: "99-ceph-rsyslog-client.conf"
      tags:
        - "ceph-rsyslog-client"
        - "rsyslog-client"
    - role: "system_crontab_coordination"
      tags:
        - "system-crontab-coordination"
  vars:
    is_metal: "{{ properties.is_metal|default(false) }}"
    radosgw_keystone: yes
    # TODO(logan): Remove the following line once
    # upstream issue https://github.com/ceph/ceph-ansible/issues/2111 is fixed
    radosgw_ssl: no
    radosgw_civetweb_port: "{{ radosgw_service_port }}"
  tags:
    - ceph-rgw<commit_msg>Remove unused radosgw_ssl variable<commit_after>---
# Copyright 2017, <NAME> <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT 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: Install ceph radosgw
  hosts: ceph-rgw
  user: root
  pre_tasks:
    - name: Ensure RGW service
      keystone:
        command: "ensure_service"
        endpoint: "{{ keystone_service_adminurl }}"
        login_user: "{{ keystone_admin_user_name }}"
        login_password: "{{ <PASSWORD> }}"
        login_project_name: "{{ <EMAIL>_admin_tenant_name }}"
        service_name: "{{ radosgw_service_name }}"
        service_type: "{{ radosgw_service_type }}"
        description: "{{ radosgw_service_description }}"
        insecure: "{{ keystone_service_adminuri_insecure }}"
      delegate_to: "{{ groups['utility_all'][0] }}"
      run_once: true
      when: radosgw_keystone | bool
      register: add_service
      until: add_service|success
      retries: 5
      delay: 2
      no_log: True
      tags:
        - ceph-rgw-setup
        - rgw-service-add

    - name: Ensure RGW user
      keystone:
        command: "ensure_user"
        endpoint: "{{ keystone_service_adminurl }}"
        login_user: "{{ keystone_admin_user_name }}"
        login_password: "{{ <PASSWORD> }}"
        login_project_name: "{{ keystone_admin_tenant_name }}"
        user_name: "{{ radosgw_admin_user }}"
        tenant_name: "{{ radosgw_admin_tenant }}"
        role_name: "{{ radosgw_role_name | default('service') }}"
        password: "{{ <PASSWORD> }}"
        insecure: "{{ keystone_service_adminuri_insecure }}"
      delegate_to: "{{ groups['utility_all'][0] }}"
      run_once: true
      when: radosgw_keystone | bool
      register: add_user
      until: add_user|success
      retries: 5
      delay: 10
      no_log: True
      tags:
        - ceph-rgw-setup
        - rgw-service-add

    - name: Ensure RGW user to admin role
      keystone:
        command: "ensure_user_role"
        endpoint: "{{ keystone_service_adminurl }}"
        login_user: "{{ keystone_admin_user_name }}"
        login_password: "{{ <PASSWORD> }}"
        login_project_name: "{{ keystone_admin_tenant_name }}"
        user_name: "{{ radosgw_admin_user }}"
        tenant_name: "{{ radosgw_admin_tenant }}"
        role_name: "{{ radosgw_role_name | default('admin') }}"
        insecure: "{{ keystone_service_adminuri_insecure }}"
      delegate_to: "{{ groups['utility_all'][0] }}"
      run_once: true
      register: add_admin_role
      when: radosgw_keystone | bool
      until: add_admin_role|success
      retries: 5
      delay: 10
      no_log: True
      tags:
        - ceph-rgw-setup
        - rgw-service-add

    - name: Ensure swiftoperator role
      keystone:
        command: "ensure_role"
        endpoint: "{{ keystone_service_adminurl }}"
        login_user: "{{ keystone_admin_user_name }}"
        login_password: "{{ <PASSWORD> }}"
        login_project_name: "{{ keystone_admin_tenant_name }}"
        role_name: "swiftoperator"
        insecure: "{{ keystone_service_adminuri_insecure }}"
      delegate_to: "{{ groups['utility_all'][0] }}"
      register: add_swiftoperator_role
      until: add_swiftoperator_role|success
      retries: 5
      delay: 10
      no_log: True
      tags:
        - ceph-rgw-setup
        - rgw-service-add

    - name: Ensure RGW endpoint
      keystone:
        command: "ensure_endpoint"
        endpoint: "{{ keystone_service_adminurl }}"
        login_user: "{{ keystone_admin_user_name }}"
        login_password: "{{ <PASSWORD> }}"
        login_project_name: "{{ keystone_admin_tenant_name }}"
        region_name: "{{ radosgw_service_region }}"
        service_name: "{{ radosgw_service_name }}"
        service_type: "{{ radosgw_service_type }}"
        insecure: "{{ keystone_service_adminuri_insecure }}"
        endpoint_list:
          - url: "{{ radosgw_service_publicurl }}"
            interface: "public"
          - url: "{{ radosgw_service_adminurl }}"
            interface: "admin"
          - url: "{{ radosgw_service_internalurl }}"
            interface: "internal"
      delegate_to: "{{ groups['utility_all'][0] }}"
      run_once: true
      register: add_endpoint
      when: radosgw_keystone | bool
      until: add_endpoint|success
      retries: 5
      delay: 10
      no_log: True
      tags:
        - ceph-rgw-setup
        - rgw-service-add

    - include: common-tasks/os-log-dir-setup.yml
      vars:
        log_dirs:
          - src: "/openstack/log/{{ inventory_hostname }}-ceph"
            dest: "/var/log/ceph"

    - include: common-tasks/os-lxc-container-setup.yml

    - name: Gather ceph-mon facts
      action: setup
      delegate_to: "{{ item }}"
      delegate_facts: yes
      with_items: "{{ groups[mon_group_name] }}"
      when:
        - inventory_hostname == ansible_play_hosts[0]
      tags:
        - ceph-mon-facts
  roles:
    - role: ceph-defaults
      tags:
        - skip_ansible_lint
    - role: ceph-common
      tags:
        - skip_ansible_lint
    - role: ceph-config
      tags:
        - skip_ansible_lint
    - role: ceph-rgw
      tags:
        - skip_ansible_lint
    - role: "rsyslog_client"
      rsyslog_client_log_rotate_file: ceph_log_rotate
      rsyslog_client_log_dir: "/var/log/ceph"
      rsyslog_client_config_name: "99-ceph-rsyslog-client.conf"
      tags:
        - "ceph-rsyslog-client"
        - "rsyslog-client"
    - role: "system_crontab_coordination"
      tags:
        - "system-crontab-coordination"
  vars:
    is_metal: "{{ properties.is_metal|default(false) }}"
    radosgw_keystone: yes
    radosgw_civetweb_port: "{{ radosgw_service_port }}"
  tags:
    - ceph-rgw
{'fraction_non_alphanumeric': 0.11409988758631764, 'fraction_numerical': 0.005138911193190943, 'mean_word_length': 2.52134577325417, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 22, 'https://': 1, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5806860', 'n_tokens_mistral': 4221, 'n_tokens_neox': 4110, 'n_words': 791}