From 1cf050cd23ffca4c374e0cc43991dc9ad99c8a77 Mon Sep 17 00:00:00 2001 From: surtur Date: Mon, 31 Jul 2023 20:02:30 +0200 Subject: [PATCH] add user role + use it in the new nebula playbook --- ansible/host_vars/nebula.yml | 17 +++++++++++++++++ ansible/hosts | 2 ++ ansible/playbooks/nebula.yml | 9 +++++++++ ansible/roles/user/tasks/main.yml | 17 +++++++++++++++++ 4 files changed, 45 insertions(+) create mode 100644 ansible/host_vars/nebula.yml create mode 100644 ansible/playbooks/nebula.yml create mode 100644 ansible/roles/user/tasks/main.yml diff --git a/ansible/host_vars/nebula.yml b/ansible/host_vars/nebula.yml new file mode 100644 index 0000000..cbfd92a --- /dev/null +++ b/ansible/host_vars/nebula.yml @@ -0,0 +1,17 @@ +$ANSIBLE_VAULT;1.1;AES256 +39616261313830303335663535393433306636353632396331383165613839353630626561623635 +3439633336623533363664643330393032613465306633310a663263656261323766646266646566 +65316336363662303434356263646231383031663338663230353038353236623938303638616162 +3631663039646262340a663630343762303164313266333766313432306239666130656638333930 +35633632326565326633316330393130336665393466373135373834626266653864643035336362 +63626539646638623631386535623235653539333161326638323437663965396632346236396536 +38616234626266613838323262373761393539393133656133303830313532343137623461643366 +61643063633037636331623238633135363331636130663838343361363735646432373331303165 +32383762326132366637613433363936383431643137626334373936333164323866333538323638 +64333562323164363964353638356238646235643163626633346335383133623565386538646566 +62343633333663633965616637353666303165623937313735353563313632613631623162646132 +39306330373339326632356337366363333032383064363931333562623063353839323463346238 +33396364373234316161643235343332326333393331623132643364326130653232313066633364 +31666265373235613635316136356231643931303762636339376566643437313537633332386663 +39333265396566306333643337323362363936333134653265616565363339386564376536623634 +63373735613834353934 diff --git a/ansible/hosts b/ansible/hosts index 600f947..36b4b02 100644 --- a/ansible/hosts +++ b/ansible/hosts @@ -1,3 +1,5 @@ +nebula + [surtur] surtur.local diff --git a/ansible/playbooks/nebula.yml b/ansible/playbooks/nebula.yml new file mode 100644 index 0000000..257c262 --- /dev/null +++ b/ansible/playbooks/nebula.yml @@ -0,0 +1,9 @@ +--- +- hosts: nebula + vars_files: + - ../host_vars/nebula.yml + roles: + - role: user + vars: + user: "{{ users.testpcmt }}" +... diff --git a/ansible/roles/user/tasks/main.yml b/ansible/roles/user/tasks/main.yml new file mode 100644 index 0000000..35406a5 --- /dev/null +++ b/ansible/roles/user/tasks/main.yml @@ -0,0 +1,17 @@ +--- +- name: Create group "{{ user.group }}" + ansible.builtin.group: + name: "{{ user.group }}" + state: present + +- name: Create user "{{ user.name }}" + ansible.builtin.user: + name: "{{ user.name }}" + comment: "{{ user.comment }}" + create_home: "{{ user.create_home }}" + group: "{{ user.group }}" + groups: "{{ user.groups }}" + append: "{{ user.groups_append }}" + shell: "{{ user.shell }}" + system: "{{ user.system }}" +...