blob: c94099aaa5bf54efc8327c97ee7c92b69f07c9db [file] [log] [blame]
Andy Bavierafaa5302017-08-15 08:56:15 -07001# Copyright 2017-present Open Networking Foundation
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---
16
17- name: Ensure /opt/cord and /opt/cord_profile sym links
18 become: yes
19 file:
20 src: "{{ item.src }}"
21 dest: "{{ item.dest }}"
22 state: link
23 force: yes
24 with_items:
25 - { dest: '/opt/cord', src: '{{ config_cord_dir }}' }
26 - { dest: '/opt/cord_profile', src: '{{ config_cord_profile_dir }}' }
27
28- name: Ensure SSH keypair exists for Ansible login user
29 user:
30 name: "{{ ansible_user_id }}"
31 generate_ssh_key: yes
32 ssh_key_bits: 2048
33 ssh_key_type: rsa
34
35- name: Get public key for Ansible login user
36 slurp:
37 src: "{{ ansible_env.HOME }}/.ssh/id_rsa.pub"
38 register: pubkey
39
40- name: Ensure public key in authorized_keys
41 authorized_key:
42 user: "{{ ansible_user_id }}"
43 state: present
44 key: "{{ pubkey['content'] | b64decode }}"
45