Upload files to "playbooks"

This commit is contained in:
2026-10-10 14:30:30 +00:00
parent 9b621b7143
commit 6fc9e66ecd
4 changed files with 51 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
- import_playbook: user.yml
- import_playbook: software.yml
- import_playbook: script.yml
+12
View File
@@ -0,0 +1,12 @@
- name: copying over collector.py
hosts: server
become: true
tasks:
- name: copying script
ansible.builtin.copy:
src: ../collector.py
dest: /home/user/collector.py
owner: user
group: user
mode: 0755
+14
View File
@@ -0,0 +1,14 @@
- name: install software
hosts: server
become: true
tasks:
- name: update apt cache for debian machines
apt:
update_cache: yes
when: ansible_facts['os_family'] == "Debian"
- name: installing
ansible.builtin.package:
name: python3-psutil
state: present
+22
View File
@@ -0,0 +1,22 @@
- name: setting up user
hosts: server
become: true
tasks:
- name: creating user
ansible.builtin.user:
name: user
create_home: yes
shell: /bin/bash
- name: making .ssh directory
ansible.builtin.file:
path: /home/user/.ssh
owner: user
group: user
state: directory
- ansible.posix.authorized_key:
user: user
key: "{{ lookup('file', '/path/2/key.pub') }}"
state: present