change ansible.cfg and inventory, so it works

This commit is contained in:
Your Name 2024-12-08 01:18:59 +01:00
parent 30ed190691
commit c9a139b593
3 changed files with 18 additions and 7 deletions

7
ansible.cfg Normal file
View file

@ -0,0 +1,7 @@
[defaults]
inventory = /root/ansible/inventory.ini
host_key_checking = False
private_key_file = /root/.ssh/id_ed25519
[inventory]
enable_plugins = yaml, ini

View file

@ -22,4 +22,5 @@ zabbix ansible_host=10.100.0.21
loadbalancer ansible_host=10.100.0.10 loadbalancer ansible_host=10.100.0.10
[lxc:vars] [lxc:vars]
ansible_user=root ansible_user=root

View file

@ -1,5 +1,5 @@
- name: Add users, make them passwordless sudoers and download their ssh keys - name: Add users, make them passwordless sudoers and download their ssh keys
hosts: hosts:
- lxc - lxc
- full_os - full_os
gather_facts: false gather_facts: false
@ -29,6 +29,7 @@
- name: Create user "mhrebik" - name: Create user "mhrebik"
ansible.builtin.user: ansible.builtin.user:
name: "mhrebik" name: "mhrebik"
append: true
groups: groups:
- sudo_passwordless - sudo_passwordless
append: true append: true
@ -37,14 +38,16 @@
- name: Create user matty - name: Create user matty
ansible.builtin.user: ansible.builtin.user:
name: "matty" name: "matty"
append: true
groups: groups:
- sudo_passwordless - sudo_passwordless
append: true append: true
password: "$y$j9T$UC70HSbFYAg7I306Q204R.$Jfvjvhrw.UIPL9WI6pX7LdWvuvJS1VH3DJT6EFHQ/XB" password: "$y$j9T$UC70HSbFYAg7I306Q204R.$Jfvjvhrw.UIPL9WI6pX7LdWvuvJS1VH3DJT6EFHQ/XB"
- name: Create user Kandertova - name: Create user kandertova
ansible.builtin.user: ansible.builtin.user:
name: "mhrebik" name: "kandertova"
append: true
groups: groups:
- sudo_passwordless - sudo_passwordless
append: true append: true
@ -61,13 +64,13 @@
ansible.builtin.authorized_key: ansible.builtin.authorized_key:
user: mhrebik user: mhrebik
key: "{{ item }}" key: "{{ item }}"
with_items: mhrebik_keys with_items: "{{ mhrebik_keys }}"
- name: Add matty keys - name: Add matty keys
ansible.builtin.authorized_key: ansible.builtin.authorized_key:
user: matty user: matty
key: "{{ item }}" key: "{{ item }}"
with_items: matty_keys with_items: "{{ matty_keys }}"
@ -76,4 +79,4 @@