dotfiles-ansible/roles/ssh/tasks/main.yml

26 lines
576 B
YAML

---
- name: Ensure 0700 permission on ~/.ssh directory
file:
path: ~/.ssh
mode: 0700
state: directory
- name: Create config file if it doesn't exists
file:
path: ~/.ssh/config
mode: 0600
state: touch
# Use blockinfile instead of lineinfile to have nice space
# between config section
- name: Configure OpenSSH to accept new host keys
blockinfile:
path: ~/.ssh/config
block: |
AddKeysToAgent no
StrictHostKeyChecking accept-new
insertbefore: BOF
marker: '# {mark} CUSTOM SSH CONFIG'
state: present
mode: 0600