roles/user/tasks/main.yml

changeset 29
9b3befb1c773
parent 28
6f7483dfe742
child 36
745c6a77bf68
equal deleted inserted replaced
28:6f7483dfe742 29:9b3befb1c773
8 groups: sudo 8 groups: sudo
9 append: true 9 append: true
10 register: user 10 register: user
11 tags: user 11 tags: user
12 12
13 - name: ssh : Pubkey for user 13 - name: "ssh : Pubkey for user"
14 authorized_key: 14 authorized_key:
15 manage_dir: true 15 manage_dir: true
16 user: "{{user.name}}" 16 user: "{{user.name}}"
17 key: "{{item}}" 17 key: "{{item}}"
18 with_file: 18 with_file:
19 - public_keys/{{user.name}} 19 - public_keys/{{user.name}}
20 tags: user, ssh 20 tags: user, ssh
21 21
22 - name: ssh : Ensure known_hosts keys 22 - name: "ssh : Ensure known_hosts keys"
23 become: true 23 become: true
24 become_user: "{{user.name}}" 24 become_user: "{{user.name}}"
25 lineinfile: 25 lineinfile:
26 dest: "{{user.home}}/.ssh/known_hosts" 26 dest: "{{user.home}}/.ssh/known_hosts"
27 state: present 27 state: present
29 create: true 29 create: true
30 mode: 0600 30 mode: 0600
31 with_dict: "{{hostkeys}}" 31 with_dict: "{{hostkeys}}"
32 tags: user, ssh 32 tags: user, ssh
33 33
34 - name: ssh : Purge invalid known_hosts keys 34 - name: "ssh : Purge invalid known_hosts keys"
35 become: true 35 become: true
36 become_user: "{{user.name}}" 36 become_user: "{{user.name}}"
37 lineinfile: 37 lineinfile:
38 dest: "{{user.home}}/.ssh/known_hosts" 38 dest: "{{user.home}}/.ssh/known_hosts"
39 state: absent 39 state: absent

mercurial