Initial commit
[ta/infra-ansible.git] / roles / ansiblesync / tasks / main.yml
1 # Copyright 2019 Nokia
2
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 - name: Sync ansible files the other controllers
16   synchronize:
17     src: "{{ item.src }}"
18     dest: "{{ item.dest }}"
19     compress: no
20     archive: yes
21     recursive: yes
22   when: hostname != installation_controller
23   with_items:
24     - { src: "/etc/openstack_deploy", dest: "/etc/" }
25     - { src: "/etc/ansible/ansible.cfg", dest: "/etc/ansible/ansible.cfg" }
26     - { src: "/etc/userconfig/", dest: "/etc/userconfig/" }
27   tags:
28       - sync_ansible_files
29
30 - name: Sync virtual environment specific files to the other controllers
31   synchronize:
32     src: "{{ item.src }}"
33     dest: "{{ item.dest }}"
34     compress: no
35     archive: no
36     perms: yes
37   when:
38     - hostname != installation_controller
39     - virtual_env
40   with_items:
41     - { src: "/etc/userconfig/id_rsa", dest: "/root/.ssh/"}
42   tags:
43       - sync_ansible_files
44
45 - name: Set permissions for id_rsa
46   file:
47     path: "/root/.ssh/id_rsa"
48     owner: root
49     group: root
50     mode: 0400
51   when:
52     - hostname != installation_controller
53     - virtual_env