add stuff actually
This commit is contained in:
parent
2023308015
commit
0865f50691
@ -0,0 +1,6 @@
|
|||||||
|
# Testing ansible
|
||||||
|
```
|
||||||
|
ansible-galaxy collection install -r requirements.yml
|
||||||
|
ansible-playbook playbook.yaml
|
||||||
|
```
|
||||||
|
|
0
files/akis.pub
Normal file
0
files/akis.pub
Normal file
2
files/arya.pub
Normal file
2
files/arya.pub
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICeUQKFE6j+legQS2aam8VlwaGJ1r5BfJevbMUxpAi6N aryakiran@zohomail.eu
|
||||||
|
|
0
files/devrand.pub
Normal file
0
files/devrand.pub
Normal file
0
files/midou.pub
Normal file
0
files/midou.pub
Normal file
@ -1,9 +1,43 @@
|
|||||||
- name: My first play
|
---
|
||||||
|
- name: Install shit
|
||||||
hosts: ansibletest
|
hosts: ansibletest
|
||||||
tasks:
|
tasks:
|
||||||
- name: Ping my hosts
|
- name: Std Repo stuff
|
||||||
ansible.builtin.ping:
|
apt:
|
||||||
- name: Print message
|
update_cache: true
|
||||||
ansible.builtin.debug:
|
name:
|
||||||
msg: Hello world
|
- 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
2
requirements.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
collections:
|
||||||
|
- name: community.docker
|
Loading…
Reference in New Issue
Block a user