From cb149f64c3439ed12eaef348be08dba5db069702 Mon Sep 17 00:00:00 2001 From: L3D Date: Sun, 24 Mar 2024 18:52:54 +0100 Subject: [PATCH] Initial create user --- .gitignore | 26 +++++++++++++++++++++ .gitmodules | 9 ++++++++ README.md | 4 ++++ ansible.cfg | 28 +++++++++++++++++++++++ collections/ansible_collections/l3d/users | 1 + group_vars/all.yml | 14 ++++++++++++ hosts.ini | 2 ++ requirements.txt | 8 +++++++ roles/do1jlr.ansible_version | 1 + roles/l3d.packages | 1 + site.yml | 13 +++++++++++ 11 files changed, 107 insertions(+) create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 ansible.cfg create mode 160000 collections/ansible_collections/l3d/users create mode 100644 group_vars/all.yml create mode 100644 hosts.ini create mode 100644 requirements.txt create mode 160000 roles/do1jlr.ansible_version create mode 160000 roles/l3d.packages create mode 100644 site.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5159f69 --- /dev/null +++ b/.gitignore @@ -0,0 +1,26 @@ +# ---> Vim +# Swap +[._]*.s[a-v][a-z] +!*.svg # comment out if you don't need vector files +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] + +# Session +Session.vim +Sessionx.vim + +# Temporary +.netrwhist +*~ +# Auto-generated tag files +tags +# Persistent undo +[._]*.un~ + +# ---> Ansible +*.retry +*.vault +.vault +ansible/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..a5623cb --- /dev/null +++ b/.gitmodules @@ -0,0 +1,9 @@ +[submodule "collections/ansible_collections/l3d/users"] + path = collections/ansible_collections/l3d/users + url = https://github.com/roles-ansible/ansible_collection_users.git +[submodule "roles/do1jlr.ansible_version"] + path = roles/do1jlr.ansible_version + url = https://github.com/roles-ansible/ansible_role_versioncheck.git +[submodule "roles/l3d.packages"] + path = roles/l3d.packages + url = https://github.com/roles-ansible/ansible_role_packages.git diff --git a/README.md b/README.md index 2803ea2..8355549 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,7 @@ Ansible Playbook Collection um die Raspberry Pi Zero based Grobhandtaster zu konfigurieren +## Requirements +```bash +pip3 install -r requirements.txt +``` diff --git a/ansible.cfg b/ansible.cfg new file mode 100644 index 0000000..9c1a35d --- /dev/null +++ b/ansible.cfg @@ -0,0 +1,28 @@ +[defaults] +inventory = ./hosts.ini +remote_user = ansible +retry_files_enabled = false +nocows = true + +log_path = $HOME/.ansible/ansible_pi_buzzer.log + +forks = 20 +gathering = smart +fact_caching = jsonfile +fact_caching_connection = $HOME/.ansible/facts + +interpreter_python = /usr/bin/python3 + +[ssh_connection] +control_path = %(directory)s/%%h-%%r-%%p +ssh_args = -o StrictHostKeyChecking=accept-new -o ControlMaster=auto -o ControlPersist=600s +pipelining = true +retries = 10 + +[privilege_escalation] +become_method = sudo +become_user = root +become_ask_pass = false + +[passwordstore_lookup] +backend = gopass diff --git a/collections/ansible_collections/l3d/users b/collections/ansible_collections/l3d/users new file mode 160000 index 0000000..709abef --- /dev/null +++ b/collections/ansible_collections/l3d/users @@ -0,0 +1 @@ +Subproject commit 709abefcc96e89619d1d31f4b9e7879f069cd241 diff --git a/group_vars/all.yml b/group_vars/all.yml new file mode 100644 index 0000000..db0d2b0 --- /dev/null +++ b/group_vars/all.yml @@ -0,0 +1,14 @@ +--- +# l3d.users +l3d_users__default_users: + - name: l3d + state: 'present' + pubkeys: "{{ lookup('url', 'https://github.com/do1jlr.keys', split_lines=false) }}" + admin: true + admin_commands: 'ALL' + admin_ansible_login: true + admin_nopassword: true + +# l3d.packages +l3d_pkgs__install_python: true +l3d_pkgs__install_cli: true diff --git a/hosts.ini b/hosts.ini new file mode 100644 index 0000000..fb6fa0a --- /dev/null +++ b/hosts.ini @@ -0,0 +1,2 @@ +[zero] +l3dzero.local diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..883f266 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,8 @@ +jmespath>=1.0.1 +passlib[bcrypt]>=1.7.4 +ansible +ansible-core >= 2.16.0 +ansible-lint +yamllint +j2lint +netaddr >= 0.9.0 diff --git a/roles/do1jlr.ansible_version b/roles/do1jlr.ansible_version new file mode 160000 index 0000000..2bf5d7c --- /dev/null +++ b/roles/do1jlr.ansible_version @@ -0,0 +1 @@ +Subproject commit 2bf5d7c4369a8213b42829b14f78920e9906d099 diff --git a/roles/l3d.packages b/roles/l3d.packages new file mode 160000 index 0000000..43229cf --- /dev/null +++ b/roles/l3d.packages @@ -0,0 +1 @@ +Subproject commit 43229cf0d9561248625ada346c86e03f6fee4b71 diff --git a/site.yml b/site.yml new file mode 100644 index 0000000..e58aa62 --- /dev/null +++ b/site.yml @@ -0,0 +1,13 @@ +--- +- name: Check if ansible is not to old + hosts: localhost + roles: + - {role: do1jlr.ansible_version, tags: [default, version, default, always]} + +- name: General roles for all hosts + hosts: all + roles: + - {role: l3d.users.user, tags: [test, users, user]} + - {role: l3d.users.admin, tags: [test, users, admin]} + - {role: l3d.users.sshd, tags: [test, users, sshd]} + - {role: l3d.packages, tags: [packages, general]}