summaryrefslogtreecommitdiff
path: root/ansible-practice/system/15-fetch-file.yml
diff options
context:
space:
mode:
authorboom2 <blizzack@blizzack.com>2023-12-21 15:15:38 -0500
committerboom2 <blizzack@blizzack.com>2023-12-21 15:15:38 -0500
commita21b2f4bb64bd0f633d8a6a15f27a73103df70c0 (patch)
treea3f093905df3a0998c9652358f6983f3f6c3b9ca /ansible-practice/system/15-fetch-file.yml
parent9eae5e5a38469526142fa1e26756f1cd388be66d (diff)
- add slackware playbooks
-- conditional checks on slackware release verison -- rsync sbopkg
Diffstat (limited to 'ansible-practice/system/15-fetch-file.yml')
-rw-r--r--ansible-practice/system/15-fetch-file.yml45
1 files changed, 35 insertions, 10 deletions
diff --git a/ansible-practice/system/15-fetch-file.yml b/ansible-practice/system/15-fetch-file.yml
index ed8690d..0236efe 100644
--- a/ansible-practice/system/15-fetch-file.yml
+++ b/ansible-practice/system/15-fetch-file.yml
@@ -1,23 +1,48 @@
+# fetch/download a file(s) from managed nodes to the controller node
#
-# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/fetch_module.html
+# - use cases:
+# - pulling log files
+# - grabbing public keys
#
-# - need to play with looping thru items
#
---
- name: "15 - custom ansible - fetch file"
hosts: dev
become: yes # Run tasks with root/sudo privileges
+ vars:
+ sys_file_list:
+ - /etc/rc.d/rc.firewall
+ - /etc/ssh/sshd_config
+#
+# - playing w/ loops as well
+#
tasks:
- - name: pull sshd config
+ - name: pull sshd & firewall configs
ansible.builtin.fetch:
- src: /etc/ssh/sshd_config
+ src: "{{ item }}"
dest: ~/repos/ansible_repo/ansible-practice/system/
- tags: ['fetch_sshd_config']
+ loop: "{{ sys_file_list }}"
+ tags: ['fetch_sys_configs']
- - name: pull sshd config
- ansible.builtin.fetch:
- src: /etc/rc.d/rc.firewall
- dest: ~/repos/ansible_repo/ansible-practice/system/
- tags: ['fetch_firewall_config']
+#
+# - essentially, the same code as above except done one task at a time
+#
+# - name: pull sshd config
+# ansible.builtin.fetch:
+# src: /etc/ssh/sshd_config
+# dest: ~/repos/ansible_repo/ansible-practice/system/
+# tags: ['fetch_sshd_config']
+#
+# - name: pull firewall config
+# ansible.builtin.fetch:
+# src: /etc/rc.d/rc.firewall
+# dest: ~/repos/ansible_repo/ansible-practice/system/
+# tags: ['fetch_firewall_config']
+#
+# References
+#
+# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/fetch_module.html
+# https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_loops.html
+# https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html#list-variables