Initial commit
[ta/infra-ansible.git] / playbooks / set_keyring_owners.yml
1 ---
2
3 # Copyright 2019 Nokia
4
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #     http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 - name: Set keyrings owners for controller
18   hosts: controller
19   become: yes
20   become_method: sudo
21   become_user: root
22   gather_facts: no
23   vars:
24     cephkeys_access_group: "cephkeys"
25   tasks:
26   - name: Create cephkeys_access_group group
27     group:
28       name: "{{ cephkeys_access_group }}"
29     when: (ceph_configured | default(False))
30   - name: set keyrings owner
31     file:
32       path: "/etc/ceph/ceph.client.{{ item }}.keyring"
33       owner: "{{ item }}"
34       group: "{{ cephkeys_access_group }}"
35       mode: 0640
36     with_items:
37       - glance
38       - cinder
39     when: (ceph_configured | default(False))
40
41 - name: Set keyrings owners for caas_master
42   hosts: caas_master
43   become: yes
44   become_method: sudo
45   become_user: root
46   gather_facts: no
47   vars:
48     cephkeys_access_group: "cephkeys"
49   tasks:
50   - name: Create cephkeys_access_group group
51     group:
52       name: "{{ cephkeys_access_group }}"
53     when: (ceph_configured | default(False))
54   - name: set keyrings owner
55     file:
56       path: "/etc/ceph/ceph.client.caas.keyring"
57       # TODO: Probably CaaS should have an own user
58       owner: "{{ users.admin_user_name }}"
59       group: "{{ cephkeys_access_group }}"
60       mode: 0640
61     when: (ceph_configured | default(False))