From f30709d7dbe88d82c4df66c476db36cb5c0ce903 Mon Sep 17 00:00:00 2001 From: boom2 Date: Thu, 14 Dec 2023 17:24:25 -0500 Subject: - add "new_host" role for system setup - no longer use "all" to mention all hosts in playbooks - update of hosts file to now use localhost as "test" --- .../roles/new_host/tasks/backup_system_files.yml~ | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 home/.ansible/roles/new_host/tasks/backup_system_files.yml~ (limited to 'home/.ansible/roles/new_host/tasks/backup_system_files.yml~') diff --git a/home/.ansible/roles/new_host/tasks/backup_system_files.yml~ b/home/.ansible/roles/new_host/tasks/backup_system_files.yml~ new file mode 100644 index 0000000..3c899e5 --- /dev/null +++ b/home/.ansible/roles/new_host/tasks/backup_system_files.yml~ @@ -0,0 +1,34 @@ +--- +- name: check backup directory status + ansible.builtin.stat: + path: "{{ backup_etc_dir }}" + register: backup_dir + tags: ['backup_dir_status'] + +- name: create backup directory if it does not exist + ansible.builtin.file: + path: "{{ backup_etc_dir }}" + state: directory + become: true + become_user: root + when: backup_dir.stat.isdir is not defined + tags: ['create_backup_dir'] + +- name: backup of system files + ansible.builtin.copy: + src: /etc/{{ item }} + remote_src: true + dest: "{{ backup_etc_dir }}/" + mode: preserve + with_items: + - hosts.allow + - hosts.deny + - inetd.conf + - sudoers + - hosts + - fstab + - inittab + become: true + become_user: root + when: backup_dir.stat.isdir is defined + tags: ['backup_files'] -- cgit v1.2.3-54-g00ecf