Browse Source

refactoring

master
Markus Katharina Brechtel 7 years ago
parent
commit
0a6c970f37
4 changed files with 47 additions and 36 deletions
  1. +27
    -0
      tasks/fish.yml
  2. +3
    -36
      tasks/main.yml
  3. +14
    -0
      tasks/ssh.yml
  4. +3
    -0
      templates/ssh_authorized_keys.j2

+ 27
- 0
tasks/fish.yml View File

@@ -0,0 +1,27 @@
---

- name: fish package
package:
name: fish

- name: fish config directory
file:
path: /root/.config/fish/conf.d/
state: directory

- name: fish config files
template:
src: "{{ item }}.fish.j2"
dest: /root/.config/fish/conf.d/{{ item }}.fish
with_items:
- root-shell-aliases

- name: fish shell
user:
name: root
shell: /usr/bin/fish

- name: fetch fish history
fetch:
src: /root/.local/share/fish/fish_history
dest: host_files

+ 3
- 36
tasks/main.yml View File

@@ -1,44 +1,11 @@
---

- name: fish package
package:
name: fish

- name: fish config directory
file:
path: /root/.config/fish/conf.d/
state: directory

- name: fish config files
template:
src: "{{ item }}.fish.j2"
dest: /root/.config/fish/conf.d/{{ item }}.fish
with_items:
- root-shell-aliases

- name: fish shell
user:
name: root
shell: /usr/bin/fish

- name: fetch fish history
fetch:
src: /root/.local/share/fish/fish_history
dest: host_files

- name: ssh key
user:
name: root
generate_ssh_key: yes
ssh_key_type: ed25519
when: root_ssh_key

- name: password
user:
name: root
password: "{{ root_password }}"
when: root_password is defined

- file:
path: /root/.config/fish/conf.d/title.fish
state: absent
- include: ssh.yml

- include: fish.yml

+ 14
- 0
tasks/ssh.yml View File

@@ -0,0 +1,14 @@
---

- name: ssh key
user:
name: root
generate_ssh_key: yes
ssh_key_type: ed25519
when: root_ssh_key

- name: ssh authorized keys
template:
src: ssh_authorized_keys.j2
dest: /root/.ssh/authorized_keys
when: root_ssh_authorized_keys is defined

+ 3
- 0
templates/ssh_authorized_keys.j2 View File

@@ -0,0 +1,3 @@
{% for key in users[item].authorized_keys %}
{{ key }}
{% endfor %}