diff --git a/ansible.cfg b/ansible.cfg new file mode 100644 index 0000000..ff109d2 --- /dev/null +++ b/ansible.cfg @@ -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 diff --git a/inventory b/inventory.ini similarity index 96% rename from inventory rename to inventory.ini index d7e973c..7105f94 100644 --- a/inventory +++ b/inventory.ini @@ -22,4 +22,5 @@ zabbix ansible_host=10.100.0.21 loadbalancer ansible_host=10.100.0.10 [lxc:vars] -ansible_user=root \ No newline at end of file +ansible_user=root + diff --git a/playbooks/users.yml b/playbooks/users.yml index edcf15f..144cfb2 100644 --- a/playbooks/users.yml +++ b/playbooks/users.yml @@ -1,5 +1,5 @@ - name: Add users, make them passwordless sudoers and download their ssh keys - hosts: + hosts: - lxc - full_os gather_facts: false @@ -29,6 +29,7 @@ - name: Create user "mhrebik" ansible.builtin.user: name: "mhrebik" + append: true groups: - sudo_passwordless append: true @@ -37,14 +38,16 @@ - name: Create user matty ansible.builtin.user: name: "matty" + append: true groups: - sudo_passwordless append: true password: "$y$j9T$UC70HSbFYAg7I306Q204R.$Jfvjvhrw.UIPL9WI6pX7LdWvuvJS1VH3DJT6EFHQ/XB" - - name: Create user Kandertova + - name: Create user kandertova ansible.builtin.user: - name: "mhrebik" + name: "kandertova" + append: true groups: - sudo_passwordless append: true @@ -61,13 +64,13 @@ ansible.builtin.authorized_key: user: mhrebik key: "{{ item }}" - with_items: mhrebik_keys + with_items: "{{ mhrebik_keys }}" - name: Add matty keys ansible.builtin.authorized_key: user: matty key: "{{ item }}" - with_items: matty_keys + with_items: "{{ matty_keys }}" @@ -76,4 +79,4 @@ - \ No newline at end of file +