浏览代码

refactoring

master
Markus Katharina Brechtel 6 年前
父节点
当前提交
0a6c970f37
共有 4 个文件被更改,包括 47 次插入36 次删除
  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 查看文件

@@ -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 查看文件

@@ -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 - name: password
user: user:
name: root name: root
password: "{{ root_password }}" password: "{{ root_password }}"
when: root_password is defined 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 查看文件

@@ -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 查看文件

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