blob: b1b287d9400b4277e18e3f002e5636bc1f5aba67 [file] [log] [blame]
Andy Baviere6c255f2017-09-15 16:13:37 -07001---
2
3# Copyright 2017-present Open Networking Foundation
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
Zack Williamsccf0bb12018-01-02 14:33:57 -070017- name: Check for .ssh directory
18 stat:
19 path: "{{ ansible_env.HOME }}/.ssh"
20 register: dotsshdir
21
22- name: Create .ssh directory if it doesn't exist
23 when: (not dotsshdir.stat.isdir) and (not dotsshdir.stat.islnk)
Andy Baviere6c255f2017-09-15 16:13:37 -070024 file:
25 path: "{{ ansible_env.HOME }}/.ssh"
26 state: directory
27 mode: 0700
28
29- name: Ensure SSH config file exists
30 file:
31 path: "{{ ansible_env.HOME }}/.ssh/config"
32 state: touch
33 mode: 0600
34
35# Assumes /tmp/vagrant_ssh_config has already been created...
36- name: Add SSH config block to config file
37 blockinfile:
38 path: "{{ ansible_env.HOME }}/.ssh/config"
39 state: present
40 block: "{{ lookup('file', '/tmp/vagrant_ssh_config' ) }}"
41 marker: "# {mark} CORD VAGRANT SSH"