From 5ffb1dbfa8fc5c4fd83b896859e828315b093e22 Mon Sep 17 00:00:00 2001 From: Bertrand Benjamin Date: Wed, 12 Jan 2022 06:05:35 +0100 Subject: [PATCH] Feat: remove users role --- roles/users/.yamllint | 33 --------------- roles/users/README.md | 38 ------------------ roles/users/defaults/main.yml | 21 ---------- roles/users/files/id_encrypt_fool.pub | 1 - roles/users/handlers/main.yml | 2 - roles/users/molecule/default/INSTALL.rst | 23 ----------- roles/users/molecule/default/converge.yml | 8 ---- roles/users/molecule/default/molecule.yml | 14 ------- .../__pycache__/conftest.cpython-310.pyc | Bin 981 -> 0 bytes .../__pycache__/test_default.cpython-310.pyc | Bin 604 -> 0 bytes .../users/molecule/default/tests/conftest.py | 22 ---------- .../molecule/default/tests/test_default.py | 10 ----- roles/users/tasks/main.yml | 25 ------------ roles/users/tests/inventory | 2 - roles/users/tests/test.yml | 5 --- roles/users/vars/main.yml | 2 - 16 files changed, 206 deletions(-) delete mode 100644 roles/users/.yamllint delete mode 100644 roles/users/README.md delete mode 100644 roles/users/defaults/main.yml delete mode 100644 roles/users/files/id_encrypt_fool.pub delete mode 100644 roles/users/handlers/main.yml delete mode 100644 roles/users/molecule/default/INSTALL.rst delete mode 100644 roles/users/molecule/default/converge.yml delete mode 100644 roles/users/molecule/default/molecule.yml delete mode 100644 roles/users/molecule/default/tests/__pycache__/conftest.cpython-310.pyc delete mode 100644 roles/users/molecule/default/tests/__pycache__/test_default.cpython-310.pyc delete mode 100644 roles/users/molecule/default/tests/conftest.py delete mode 100644 roles/users/molecule/default/tests/test_default.py delete mode 100644 roles/users/tasks/main.yml delete mode 100644 roles/users/tests/inventory delete mode 100644 roles/users/tests/test.yml delete mode 100644 roles/users/vars/main.yml diff --git a/roles/users/.yamllint b/roles/users/.yamllint deleted file mode 100644 index 8827676..0000000 --- a/roles/users/.yamllint +++ /dev/null @@ -1,33 +0,0 @@ ---- -# Based on ansible-lint config -extends: default - -rules: - braces: - max-spaces-inside: 1 - level: error - brackets: - max-spaces-inside: 1 - level: error - colons: - max-spaces-after: -1 - level: error - commas: - max-spaces-after: -1 - level: error - comments: disable - comments-indentation: disable - document-start: disable - empty-lines: - max: 3 - level: error - hyphens: - level: error - indentation: disable - key-duplicates: enable - line-length: disable - new-line-at-end-of-file: disable - new-lines: - type: unix - trailing-spaces: disable - truthy: disable diff --git a/roles/users/README.md b/roles/users/README.md deleted file mode 100644 index 225dd44..0000000 --- a/roles/users/README.md +++ /dev/null @@ -1,38 +0,0 @@ -Role Name -========= - -A brief description of the role goes here. - -Requirements ------------- - -Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. - -Role Variables --------------- - -A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. - -Dependencies ------------- - -A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. - -Example Playbook ----------------- - -Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: - - - hosts: servers - roles: - - { role: username.rolename, x: 42 } - -License -------- - -BSD - -Author Information ------------------- - -An optional section for the role authors to include contact information, or a website (HTML is not allowed). diff --git a/roles/users/defaults/main.yml b/roles/users/defaults/main.yml deleted file mode 100644 index 5617e13..0000000 --- a/roles/users/defaults/main.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- -# defaults file for users -user1: - username: 'user1' - password: 'user1' - group: users - groups: - shell: '/bin/zsh' - -user2: - username: 'user2' - password: 'user2' - group: users - groups: wheel - system: yes - -users: ["{{ user1 }}", "{{ user2 }}"] - -public_key: - - user: "{{ user1 }}" - key: id_encrypt_fool.pub diff --git a/roles/users/files/id_encrypt_fool.pub b/roles/users/files/id_encrypt_fool.pub deleted file mode 100644 index 9685e81..0000000 --- a/roles/users/files/id_encrypt_fool.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFdDO8452/DpTR8taSKa/i+rgAvrYP9Fv9hYLMuphHQ+ user1@fool diff --git a/roles/users/handlers/main.yml b/roles/users/handlers/main.yml deleted file mode 100644 index 46e2ea7..0000000 --- a/roles/users/handlers/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# handlers file for users diff --git a/roles/users/molecule/default/INSTALL.rst b/roles/users/molecule/default/INSTALL.rst deleted file mode 100644 index 0c4bf5c..0000000 --- a/roles/users/molecule/default/INSTALL.rst +++ /dev/null @@ -1,23 +0,0 @@ -********************************* -Vagrant driver installation guide -********************************* - -Requirements -============ - -* Vagrant -* Virtualbox, Parallels, VMware Fusion, VMware Workstation or VMware Desktop - -Install -======= - -Please refer to the `Virtual environment`_ documentation for installation best -practices. If not using a virtual environment, please consider passing the -widely recommended `'--user' flag`_ when invoking ``pip``. - -.. _Virtual environment: https://virtualenv.pypa.io/en/latest/ -.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site - -.. code-block:: bash - - $ pip install 'molecule_vagrant' diff --git a/roles/users/molecule/default/converge.yml b/roles/users/molecule/default/converge.yml deleted file mode 100644 index 05e09cf..0000000 --- a/roles/users/molecule/default/converge.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Converge - hosts: all - become: true - tasks: - - name: "Include users" - include_role: - name: "users" diff --git a/roles/users/molecule/default/molecule.yml b/roles/users/molecule/default/molecule.yml deleted file mode 100644 index ba85140..0000000 --- a/roles/users/molecule/default/molecule.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -dependency: - name: galaxy -driver: - name: vagrant -platforms: - - name: archlinux - box: "archlinux/archlinux" - - name: Debian - box: "debian/bullseye64" -provisioner: - name: ansible -verifier: - name: testinfra diff --git a/roles/users/molecule/default/tests/__pycache__/conftest.cpython-310.pyc b/roles/users/molecule/default/tests/__pycache__/conftest.cpython-310.pyc deleted file mode 100644 index a24a6dc82bd599be90b2b2ace6c42c008069e37b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 981 zcmZWo&u`N(6t>+oO}p-gCd7oqAxDZv1L8U%(9}tjMu)ZmS}s-^yQ{k-F1FLsj@>vR z@jq-w{vK|TIC0`%;J|oJ*D=76pX28*@B7{-M=mcn5R3=CuhA!h(09AJJs^jk!_=D) z7zz=?j3hWEA;I>&l2pPbdo?}c+W0%-y~!2V?H^DBwQ#W- z^|VZK!>LF|Qkiay?aB49lpf4&n0g3d=9Z-B9KS``nu83U-o?m1h72pLVrf5voMV*X z31Y5shSf1rn;-Dd9o8;9yJzk_bcrwOtagbFp$$e3=U;n^uWhDPpKTrFnQuV0_GOk# z{mFo5ex5O|{8T19&J*rWgc+0=k@Z#Ni%gp+NjPgO+ede{QMRr4yIerqe~?El9IgXW zPG~9_RH6wV^CaAOxxd%he!bVByWKaP?$Q3iG2PkS>l76L&mNZ5^g!kb^A)Hob@i1@ zEwfAZM3}niKBG?3ZT_LIkf2E?OL6rV;XTn7uEgILN_0hSxXRiI;@MM}tE%$4X1$lRz1 z&dzQ_+lvB}f&a0QYI=VDFJ@7WW>L!jKVFdhRU(#I-;%aR)8fwDPivMxoQv(d$791`{g(eZd|Dq0JPkqMk$jqrA33%es2E|N|n9*%HDqE+F+rj cowvd=j6*?4Tz0h)0^0-)Vy-jsO4v diff --git a/roles/users/molecule/default/tests/__pycache__/test_default.cpython-310.pyc b/roles/users/molecule/default/tests/__pycache__/test_default.cpython-310.pyc deleted file mode 100644 index a63a9890a4e099c34ae6fac7741795d0db058ca0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 604 zcmZWnJx{|h5Vg|)CE|O6tr80zh(RzSgv7?s0VD>N$c-<>G>t3Usc4}K;)lS<5YH=|lXj|=P{(|2(Urbwo#Syw$!63*55mW^C_!-BE0=rl5!gK3n;=byby^Ejorc4D5ehJK80_A%U&2PA!@V|q)ksEJOcRn@9$-B(|OH_mx31-H;(U{iLfj5XE#coh9~T&R_@t!C&#zc)7v*Ajs)EDdNk z)6uHzHv<>?<&I`gMAvak@2|+$1D5klOA9O>KrvvvFtVLvSGHMyXfIW<7w_&cgNW@u zPrJMWhV@X6v_w>@R99kZEof#^D7co24M59GV&_{Oc5^cgjVA<&kQ!2}^l&`>i*QoXnqlMzkC5cdJl2naK YpQ$j9AXh)=DS?MR^cQVBQ%DwSAIR{tGXMYp diff --git a/roles/users/molecule/default/tests/conftest.py b/roles/users/molecule/default/tests/conftest.py deleted file mode 100644 index f7ddb3f..0000000 --- a/roles/users/molecule/default/tests/conftest.py +++ /dev/null @@ -1,22 +0,0 @@ -"""PyTest Fixtures.""" -from __future__ import absolute_import - -import os - -import pytest - - -def pytest_runtest_setup(item): - """Run tests only when under molecule with testinfra installed.""" - try: - import testinfra - except ImportError: - pytest.skip("Test requires testinfra", allow_module_level=True) - if "MOLECULE_INVENTORY_FILE" in os.environ: - pytest.testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ["MOLECULE_INVENTORY_FILE"] - ).get_hosts("all") - else: - pytest.skip( - "Test should run only from inside molecule.", allow_module_level=True - ) diff --git a/roles/users/molecule/default/tests/test_default.py b/roles/users/molecule/default/tests/test_default.py deleted file mode 100644 index 0cff669..0000000 --- a/roles/users/molecule/default/tests/test_default.py +++ /dev/null @@ -1,10 +0,0 @@ -"""Role testing files using testinfra.""" - - -def test_hosts_file(host): - """Validate /etc/hosts file.""" - f = host.file("/etc/hosts") - - assert f.exists - assert f.user == "root" - assert f.group == "root" diff --git a/roles/users/tasks/main.yml b/roles/users/tasks/main.yml deleted file mode 100644 index 3795f41..0000000 --- a/roles/users/tasks/main.yml +++ /dev/null @@ -1,25 +0,0 @@ ---- -# tasks file for users -- name: users -- Ensure wheel group exists - group: - name: wheel - state: present - -- name: create users - ansible.builtin.user: - name: "{{ item.username }}" - update_password: on_create - password: "{{ item.password | password_hash('sha512')}}" - group: "{{ item.group }}" - groups: "{{ item.groups }}" - shell: "{{ item.shell | default('/bin/bash') }}" - state: present - system: "{{ item.system | default('no') }}" - with_items: "{{ users }}" - -- name: ssh -- Add public key - authorized_key: - user: "{{ item.user.username }}" - key: "{{ lookup('file', item.key) }}" - state: present - with_items: "{{ public_key }}" diff --git a/roles/users/tests/inventory b/roles/users/tests/inventory deleted file mode 100644 index 878877b..0000000 --- a/roles/users/tests/inventory +++ /dev/null @@ -1,2 +0,0 @@ -localhost - diff --git a/roles/users/tests/test.yml b/roles/users/tests/test.yml deleted file mode 100644 index 7925515..0000000 --- a/roles/users/tests/test.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- hosts: localhost - remote_user: root - roles: - - users diff --git a/roles/users/vars/main.yml b/roles/users/vars/main.yml deleted file mode 100644 index 4070860..0000000 --- a/roles/users/vars/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# vars file for users