From 34163da6d62cbfc227c69def8b3d200c5ecee4e6 Mon Sep 17 00:00:00 2001 From: Mitesh Sharma Date: Tue, 19 Nov 2024 09:30:17 +0530 Subject: [PATCH] update --- .../defaults/main.yml | 8 +++++-- .../tasks/common/clone-workshop-content.yml | 20 ++++++++++++++++ .../ansible_bu_setup_workshop/tasks/rhel.yml | 23 ++++--------------- 3 files changed, 30 insertions(+), 21 deletions(-) create mode 100644 ansible/roles/ansible_bu_setup_workshop/tasks/common/clone-workshop-content.yml diff --git a/ansible/roles/ansible_bu_setup_workshop/defaults/main.yml b/ansible/roles/ansible_bu_setup_workshop/defaults/main.yml index 61d6c518183..30e4f245268 100644 --- a/ansible/roles/ansible_bu_setup_workshop/defaults/main.yml +++ b/ansible/roles/ansible_bu_setup_workshop/defaults/main.yml @@ -12,9 +12,13 @@ ansible_bu_setup_workshop_aap_packages: - ansible-core - ansible-navigator -# Ansible BU exercise base directory +# Ansible BU exercise content repo +ansible_bu_setup_workshop_content_git_repo: https://github.com/ansible/workshops.git +ansible_bu_setup_workshop_content_git_version: devel + +# Ansible BU exercise base directory ansible_bu_setup_workshop_exercise_src: ansible_rhel -# Destination directory where exercise will be copied +# Destination directory where exercise will be copied # /home/{{ student_name }}/[Destination directory] ansible_bu_setup_workshop_exercise_dest: rhel-workshop diff --git a/ansible/roles/ansible_bu_setup_workshop/tasks/common/clone-workshop-content.yml b/ansible/roles/ansible_bu_setup_workshop/tasks/common/clone-workshop-content.yml new file mode 100644 index 00000000000..cf8aec284a9 --- /dev/null +++ b/ansible/roles/ansible_bu_setup_workshop/tasks/common/clone-workshop-content.yml @@ -0,0 +1,20 @@ +--- +- name: Clone rhel-workshop + ansible.builtin.git: + repo: "{{ ansible_bu_setup_workshop_content_git_repo }}" + dest: /tmp/workshops + version: "{{ ansible_bu_setup_workshop_content_git_version }}" + +- name: Copy rhel-workshop to users home + ansible.builtin.copy: + src: "/tmp/workshops/exercises/{{ ansible_bu_setup_workshop_exercise_src }}/" + dest: "/home/{{ student_name }}/{{ ansible_bu_setup_workshop_exercise_dest }}/" + remote_src: true + owner: "{{ student_name }}" + group: "{{ student_name }}" + mode: '0755' + +- name: Clean workshop clone directory + ansible.builtin.file: + path: "/tmp/workshops" + state: absent diff --git a/ansible/roles/ansible_bu_setup_workshop/tasks/rhel.yml b/ansible/roles/ansible_bu_setup_workshop/tasks/rhel.yml index 63c12a48070..0b8c4652153 100644 --- a/ansible/roles/ansible_bu_setup_workshop/tasks/rhel.yml +++ b/ansible/roles/ansible_bu_setup_workshop/tasks/rhel.yml @@ -19,23 +19,8 @@ dest: "/home/{{ student_name }}/setup.yml" owner: "{{ student_name }}" group: "{{ student_name }}" - -- name: Clone rhel-workshop - ansible.builtin.git: - repo: https://github.com/ansible/workshops.git - dest: /tmp/workshops - version: devel -- name: Copy rhel-workshop to users home - ansible.builtin.copy: - src: "/tmp/workshops/exercises/{{ ansible_bu_setup_workshop_exercise_src }}/" - dest: "/home/{{ student_name }}/rhel-workshop/{{ ansible_bu_setup_workshop_exercise_dest }}/" - remote_src: true - owner: "{{ student_name }}" - group: "{{ student_name }}" - mode: '0755' - -- name: Clean workshop clone directory - ansible.builtin.file: - path: "/tmp/workshops" - state: absent +- name: Clone workshop content + ansible.builtin.include_tasks: + file: ./common/clone-workshop-content.yml + \ No newline at end of file