From 114c5f6fe6afe34ed61c550c83170259b66c4fb2 Mon Sep 17 00:00:00 2001 From: Pig Monkey Date: Tue, 19 Jan 2016 21:36:21 -0800 Subject: [PATCH] add ssh role --- playbook.yml | 1 + roles/base/tasks/main.yml | 1 - roles/{base => ssh}/files/fuse.conf | 0 .../tasks/ssh.yml => ssh/tasks/main.yml} | 34 ++----------------- .../templates/sshd-socket-override.conf.j2 | 0 roles/{base => ssh}/templates/sshd_config.j2 | 0 6 files changed, 4 insertions(+), 32 deletions(-) rename roles/{base => ssh}/files/fuse.conf (100%) rename roles/{base/tasks/ssh.yml => ssh/tasks/main.yml} (79%) rename roles/{base => ssh}/templates/sshd-socket-override.conf.j2 (100%) rename roles/{base => ssh}/templates/sshd_config.j2 (100%) diff --git a/playbook.yml b/playbook.yml index 09260a9..8487947 100644 --- a/playbook.yml +++ b/playbook.yml @@ -3,6 +3,7 @@ become: yes roles: - { role: base, tags: ['base'] } + - { role: ssh, tags: ['ssh'] } - { role: dotfiles, tags: ['dotfiles'] } - { role: fonts, tags: ['fonts'] } - { role: x, tags: ['x'] } diff --git a/roles/base/tasks/main.yml b/roles/base/tasks/main.yml index aa79fd2..8f782cc 100644 --- a/roles/base/tasks/main.yml +++ b/roles/base/tasks/main.yml @@ -14,4 +14,3 @@ - include: sudo.yml - include: packages.yml - include: cron.yml -- include: ssh.yml diff --git a/roles/base/files/fuse.conf b/roles/ssh/files/fuse.conf similarity index 100% rename from roles/base/files/fuse.conf rename to roles/ssh/files/fuse.conf diff --git a/roles/base/tasks/ssh.yml b/roles/ssh/tasks/main.yml similarity index 79% rename from roles/base/tasks/ssh.yml rename to roles/ssh/tasks/main.yml index dfc3ba3..9c1a44f 100644 --- a/roles/base/tasks/ssh.yml +++ b/roles/ssh/tasks/main.yml @@ -1,76 +1,48 @@ --- - name: Install OpenSSH pacman: name=openssh state=present - tags: - - ssh - name: Push OpenSSH daemon configuration file template: src=sshd_config.j2 dest=/etc/ssh/sshd_config - tags: - - ssh - name: Create OpenSSH systemd unit file directory file: path=/etc/systemd/system/sshd.socket.d state=directory - when: ssh.enable_sshd == "True" - tags: - - ssh + when: ssh.enable_sshd == True - name: Push OpenSSH socket unit file template: src=sshd-socket-override.conf.j2 dest=/etc/systemd/system/sshd.socket.d/override.conf - when: ssh.enable_sshd == "True" - tags: - - ssh + when: ssh.enable_sshd == True - name: Enable and start OpenSSH service: name=sshd.socket enabled=yes state=started - when: ssh.enable_sshd == "True" - tags: - - ssh + when: ssh.enable_sshd == True - name: Install sshfs pacman: name=sshfs state=present - tags: - - ssh - name: Install autossh pacman: name=autossh state=present - tags: - - ssh - name: Copy fuse configuration file copy: src=fuse.conf dest=/etc/fuse.conf - tags: - - ssh - name: Install keychain pacman: name=keychain state=present - tags: - - ssh - name: Install x11-ask-pass pacman: name=x11-ssh-askpass state=present - tags: - - ssh - name: Export SSH_ASKPASS environment variable lineinfile: dest=/etc/profile state=present line="export SSH_ASKPASS=\"/usr/lib/ssh/x11-ssh-askpass\"" - tags: - - ssh - name: Make directory for user SSH key file: path=/home/{{ user.name }}/.ssh state=directory owner={{ user.name }} group={{ user.group }} - tags: - - ssh - name: Install user SSH key copy: src={{ ssh.user_key }} dest=/home/{{ user.name }}/.ssh/id_rsa mode=600 owner={{ user.name }} group={{ user.group }} when: ssh.user_key is defined - tags: - - ssh - name: Install Mosh pacman: name=mosh state=present - tags: - - ssh diff --git a/roles/base/templates/sshd-socket-override.conf.j2 b/roles/ssh/templates/sshd-socket-override.conf.j2 similarity index 100% rename from roles/base/templates/sshd-socket-override.conf.j2 rename to roles/ssh/templates/sshd-socket-override.conf.j2 diff --git a/roles/base/templates/sshd_config.j2 b/roles/ssh/templates/sshd_config.j2 similarity index 100% rename from roles/base/templates/sshd_config.j2 rename to roles/ssh/templates/sshd_config.j2