Browse Source

update role definitions for new ansible version

master
parent
commit
fffae747b9
6 changed files with 14 additions and 15 deletions
  1. +1
    -1
      tasks/home.yml
  2. +2
    -2
      tasks/linger.yml
  3. +4
    -5
      tasks/setup_Debian.yml
  4. +3
    -3
      tasks/ssh.yml
  5. +1
    -1
      tasks/user_groups.yml
  6. +3
    -3
      tasks/users.yml

+ 1
- 1
tasks/home.yml View File

@@ -7,4 +7,4 @@
group: "{{ item }}" group: "{{ item }}"
mode: "{{ users[item].homedir_mode | default(700) }}" mode: "{{ users[item].homedir_mode | default(700) }}"
state: directory state: directory
with_items: "{{ users.keys() }}"
loop: "{{ users.keys() | list }}"

+ 2
- 2
tasks/linger.yml View File

@@ -4,7 +4,7 @@
stat: stat:
path: /var/lib/systemd/linger/{{item}} path: /var/lib/systemd/linger/{{item}}
register: _users_systemd_linger_stat register: _users_systemd_linger_stat
with_items: "{{ users.keys() }}"
loop: "{{ users.keys() | list }}"
when: when:
- users[item].linger is defined - users[item].linger is defined


@@ -13,7 +13,7 @@
loginctl loginctl
{{ users[item].linger | ternary('enable','disable') }}-linger {{ users[item].linger | ternary('enable','disable') }}-linger
{{item}} {{item}}
with_items: "{{ users.keys() }}"
loop: "{{ users.keys() | list }}"
when: when:
- users[item].linger is defined - users[item].linger is defined
- ( - (


+ 4
- 5
tasks/setup_Debian.yml View File

@@ -1,8 +1,7 @@
--- ---


- name: install debian packages - name: install debian packages
package:
name: "{{ item }}"
with_items:
- dbus
- libpam-systemd
apt:
pkg:
- dbus
- libpam-systemd

+ 3
- 3
tasks/ssh.yml View File

@@ -5,7 +5,7 @@
name: "{{ item }}" name: "{{ item }}"
generate_ssh_key: yes generate_ssh_key: yes
ssh_key_type: ed25519 ssh_key_type: ed25519
with_items: "{{ users.keys() }}"
loop: "{{ users.keys() | list }}"


- name: ssh directory - name: ssh directory
file: file:
@@ -14,7 +14,7 @@
group: "{{ item }}" group: "{{ item }}"
mode: "700" mode: "700"
state: directory state: directory
with_items: "{{ users.keys() }}"
loop: "{{ users.keys() | list }}"


- name: ssh authorized keys - name: ssh authorized keys
template: template:
@@ -22,5 +22,5 @@
dest: "{{ users[item].home | default('/home/'+item) }}/.ssh/authorized_keys" dest: "{{ users[item].home | default('/home/'+item) }}/.ssh/authorized_keys"
owner: "{{ item }}" owner: "{{ item }}"
group: "{{ item }}" group: "{{ item }}"
with_items: "{{ users.keys() }}"
loop: "{{ users.keys() | list }}"
when: users[item].ssh_authorized_keys is defined when: users[item].ssh_authorized_keys is defined

+ 1
- 1
tasks/user_groups.yml View File

@@ -4,4 +4,4 @@
group: group:
name: "{{ item }}" name: "{{ item }}"
gid: "{{ user_groups[item].gid }}" gid: "{{ user_groups[item].gid }}"
with_items: "{{ user_groups.keys() }}"
loop: "{{ user_groups.keys() | list }}"

+ 3
- 3
tasks/users.yml View File

@@ -4,7 +4,7 @@
group: group:
name: "{{ item }}" name: "{{ item }}"
gid: "{{ users[item].gid }}" gid: "{{ users[item].gid }}"
with_items: "{{ users.keys() }}"
loop: "{{ users.keys() | list }}"
when: users[item].gid is defined when: users[item].gid is defined


- name: account - name: account
@@ -15,12 +15,12 @@
uid: "{{ users[item].uid }}" uid: "{{ users[item].uid }}"
home: "{{ users[item].home | default('/home/'+item) }}" home: "{{ users[item].home | default('/home/'+item) }}"
shell: "{{ users[item].shell | default('/usr/bin/fish') }}" shell: "{{ users[item].shell | default('/usr/bin/fish') }}"
with_items: "{{ users.keys() }}"
loop: "{{ users.keys() | list }}"
notify: restart systemd-logind.service notify: restart systemd-logind.service


- name: password - name: password
user: user:
name: "{{ item }}" name: "{{ item }}"
password: "{{ users[item].password }}" password: "{{ users[item].password }}"
with_items: "{{ users.keys() }}"
loop: "{{ users.keys() | list }}"
when: users[item].password is defined when: users[item].password is defined

Loading…
Cancel
Save