skylab
/
skylab-ansible
Archived
2
0
Fork 0

Add runtime group assignment based on OS platform

This commit is contained in:
Ethan Paul 2021-09-08 21:07:14 -04:00
parent 2814d42148
commit 8fd063d21d
No known key found for this signature in database
GPG Key ID: 6A337337DF6B5B1A
4 changed files with 37 additions and 6 deletions

View File

@ -1,6 +1,14 @@
---
- name: Group hosts by platform
hosts: all
tags:
- always
pre_tasks:
- include_tasks: tasks/meta/runtime-group-determination.yaml
- name: Bootstrap remote ansible environment
hosts: all,!network,!network
hosts: linux
tags:
- always
tasks:
@ -51,7 +59,7 @@
- name: Configure common server settings
hosts: all,!network
hosts: linux
vars_files:
- vars/packages.yaml
tasks:
@ -104,7 +112,7 @@
- name: Configure SSH
hosts: all,!network
hosts: linux
handlers:
- name: restart-sshd
become: true

1
playbooks/tasks Symbolic link
View File

@ -0,0 +1 @@
../tasks

View File

@ -1,6 +1,14 @@
---
- name: Group hosts by platform
hosts: all
tags:
- always
pre_tasks:
- include_tasks: tasks/meta/runtime-group-determination.yaml
- name: Update system
hosts: all,!network
hosts: linux
tags:
- packages
vars_files:
@ -14,7 +22,7 @@
state: latest
- name: Update unix accounts
hosts: all,!network
hosts: linux
tags:
- accounts
- access
@ -32,11 +40,13 @@
- "{{ skylab_group }}"
- "{{ skylab_group_admin }}"
- "{{ skylab_group_automation }}"
loop_control:
label: "{{ item.name }},{{ item.gid }}"
- name: Determine existing skylab users
changed_when: false
ansible.builtin.shell:
cmd: 'grep {{ skylab_group.name }} /etc/group | cut --delimiter : --fields 4 | tr "," "\n"'
cmd: 'grep "{{ skylab_group.name }}:" /etc/group | cut --delimiter : --fields 4 | tr "," "\n"'
register: _existing_skylab_accounts
- name: Delete removed user accounts

View File

@ -0,0 +1,12 @@
---
- name: Group EdgeOS hosts
when: ansible_kernel.endswith('UBNT')
changed_when: false
group_by:
key: edgeos
- name: Group supported Linux hosts
when: ansible_distribution == "Rocky"
changed_when: false
group_by:
key: linux