add stuff actually

This commit is contained in:
Arya 2023-03-18 22:52:37 +05:30
parent 2023308015
commit 0865f50691
Signed by: arya
GPG Key ID: 842D12BDA50DF120
7 changed files with 51 additions and 7 deletions

View File

@ -0,0 +1,6 @@
# Testing ansible
```
ansible-galaxy collection install -r requirements.yml
ansible-playbook playbook.yaml
```

0
files/akis.pub Normal file
View File

2
files/arya.pub Normal file
View File

@ -0,0 +1,2 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICeUQKFE6j+legQS2aam8VlwaGJ1r5BfJevbMUxpAi6N aryakiran@zohomail.eu

0
files/devrand.pub Normal file
View File

0
files/midou.pub Normal file
View File

View File

@ -1,9 +1,43 @@
- name: My first play
---
- name: Install shit
hosts: ansibletest
tasks:
- name: Ping my hosts
ansible.builtin.ping:
- name: Print message
ansible.builtin.debug:
msg: Hello world
- name: Std Repo stuff
apt:
update_cache: true
name:
- vim
- curl
- wget
- sudo
- name: Add users
hosts: ansibletest
vars:
users:
- akis
- arya
- devrand
- midou
tasks:
- name: Add user
ansible.builtin.user:
name: "{{ item }}"
group: users
groups: users,sudo
password: $1$cGVmF3CO$CoJyouR8KHiol1xm8zF3l.
shell: /bin/bash
update_password: on_create
with_items:
- "{{ users }}"
- name: "Add authorized keys"
authorized_key:
user: "{{ item }}"
key: "{{ lookup('file', 'files/'+ item + '.pub') }}"
with_items:
- "{{ users }}"
- name: "Allow admin users to sudo without a password"
lineinfile:
dest: "/etc/sudoers" # path: in version 2.3
state: "present"
regexp: "^%sudo"
line: "%sudo ALL=(ALL) NOPASSWD: ALL"

2
requirements.yml Normal file
View File

@ -0,0 +1,2 @@
collections:
- name: community.docker