Add default ssh config with include directory

This commit is contained in:
Anthony Rose 2022-10-20 11:54:52 +01:00
parent ba09d4ae1a
commit b5a6ddbc22
4 changed files with 18 additions and 1 deletions

View file

@ -0,0 +1,6 @@
Host *
AddKeysToAgent yes
ServerAliveInterval 20
UpdateHostKeys ask
Include config.d/*.config

View file

@ -42,6 +42,11 @@
path: "{{ ansible_env.HOME }}/.ssh"
state: directory
mode: '0700'
- name: Create $HOME/.ssh/config.d
ansible.builtin.file:
path: "{{ ansible_env.HOME }}/.ssh/config.d"
state: directory
mode: '0700'
- name: Create $XDG_CONFIG_HOME/git
ansible.builtin.file:
path: "{{ ansible_env.XDG_CONFIG_HOME }}/git"

View file

@ -18,4 +18,4 @@
- import_tasks: dirs.yml
- import_tasks: dotfiles.yml
- import_tasks: vim.yml
- import_tasks: ssh-authorized-keys.yml
- import_tasks: ssh.yml

View file

@ -13,6 +13,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Copy default ssh config
ansible.builtin.copy:
src: ssh_config
dest: "{{ ansible_env.HOME }}/.ssh/config"
mode: '0600'
backup: yes
- name: Add home rsa key to authorized_keys
ansible.builtin.lineinfile:
path: "{{ ansible_env.HOME }}/.ssh/authorized_keys"