Feat: remove users role
This commit is contained in:
parent
c61e3a7826
commit
5ffb1dbfa8
@ -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
|
@ -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).
|
@ -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
|
@ -1 +0,0 @@
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFdDO8452/DpTR8taSKa/i+rgAvrYP9Fv9hYLMuphHQ+ user1@fool
|
@ -1,2 +0,0 @@
|
||||
---
|
||||
# handlers file for users
|
@ -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'
|
@ -1,8 +0,0 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
become: true
|
||||
tasks:
|
||||
- name: "Include users"
|
||||
include_role:
|
||||
name: "users"
|
@ -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
|
Binary file not shown.
Binary file not shown.
@ -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
|
||||
)
|
@ -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"
|
@ -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 }}"
|
@ -1,2 +0,0 @@
|
||||
localhost
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- users
|
@ -1,2 +0,0 @@
|
||||
---
|
||||
# vars file for users
|
Loading…
Reference in New Issue
Block a user