summaryrefslogtreecommitdiff
path: root/ansible-practice/system/09-playbook-copy-system-files-on-controller.yml~
diff options
context:
space:
mode:
authorboom2 <blizzack@blizzack.com>2023-12-19 22:23:26 -0500
committerboom2 <blizzack@blizzack.com>2023-12-19 22:23:26 -0500
commita6ddee3b7d7ca882772677013c7e02bb7a27a526 (patch)
tree481d99a7351f79495b6eb1dcb7c8444186c26cae /ansible-practice/system/09-playbook-copy-system-files-on-controller.yml~
parent870d6c431b8abaf3df05dc33c45a187f85652f2d (diff)
- removed backup files
- add .gitignore - journal entries on slack packages - add two new ansible playbooks on create/update users
Diffstat (limited to 'ansible-practice/system/09-playbook-copy-system-files-on-controller.yml~')
-rw-r--r--ansible-practice/system/09-playbook-copy-system-files-on-controller.yml~81
1 files changed, 0 insertions, 81 deletions
diff --git a/ansible-practice/system/09-playbook-copy-system-files-on-controller.yml~ b/ansible-practice/system/09-playbook-copy-system-files-on-controller.yml~
deleted file mode 100644
index 90ca529..0000000
--- a/ansible-practice/system/09-playbook-copy-system-files-on-controller.yml~
+++ /dev/null
@@ -1,81 +0,0 @@
-# create backup copies of system files on control node
-#
-# https://www.freekb.net/Article?id=759
-# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/copy_module.html
-# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/file_module.html
-# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/copy_module.html
-# https://phoenixnap.com/kb/ansible-check-if-file-exists
-# https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html#registering-variables
-# https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_conditionals.html
-#
-# https://www.howtouselinux.com/post/ansible-copy-module-examples-to-copy-file-to-remote-server
-#
-#
-# had to run the command like so:
-#
-# ansible-playbook 09-playbook-copy-system-files.yml --ask-become-pass
-#
-# -or-
-#
-# ansible-playbook 09-playbook-copy-system-files.yml -K
-#
-# -or-
-#
-# ansible-playbook 09-playbook-copy-system-files.yml --become -K
-#
-
----
-- name: "09 - custom ansible - backup system files"
- hosts: localhost
- tasks:
- - 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
- when: backup_dir.stat.isdir is not defined
- tags: ['create_backup_dir']
-
-#- name: Print a debug message
-# ansible.builtin.debug:
-# msg: "isdir isn't defined (path doesn't exist)"
-# when: backup_dir.stat.islnk is not defined
-
-# - name: backup '/etc/fstab'
-# ansible.builtin.copy:
-# src: /etc/fstab
-# remote_src: true
-# dest: "{{ backup_etc_dir }}/fstab"
-## backup: true
-# when: backup_dir.stat.isdir is defined
-# delegate_to: localhost
-# run_once: true
-# tags: ['fstab']
-
-# - name: backup '/etc/fstab' locally
-# ansible.builtin.shell: sudo cp -a /etc/fstab {{ backup_etc_dir }}/
-# delegate_to: localhost
-# run_once: true
-# when: backup_dir.stat.isdir is defined
-# tags: ['fstab']
-
- - name: backup special '/etc/' files locally
- ansible.builtin.shell: |
- sudo cp -a /etc/hosts.allow {{ backup_etc_dir }}/
- cp -a /etc/hosts.deny {{ backup_etc_dir }}/
- cp -a /etc/inetd.conf {{ backup_etc_dir }}/
- cp -a /etc/sudoers {{ backup_etc_dir }}/
- cp -a /etc/hosts {{ backup_etc_dir }}/
- cp -a /etc/fstab {{ backup_etc_dir }}/
- cp -a /etc/inittab {{ backup_etc_dir }}/
- exit 0
- delegate_to: localhost
- run_once: true
- when: backup_dir.stat.isdir is defined
- tags: ['fstab']
-