blob: a9b6ef90f8a8c5db4c7fc7053429153d48f8a474 [file] [log] [blame]
---
# tasks file for apigee-opdk-setup-local-repository-archive
#- name: Clean up any old repos
# become: true
# file:
# path: '{{ apigeerepobasepath | default(opdk_installer_path) }}/repos'
# state: absent
- name: Ensure repo folders exists
become: true
file:
path: '{{ apigeerepobasepath | default(opdk_installer_path) }}/repos'
state: directory
- name: Ensure rsync is present
become: true
yum:
name: rsync
state: present
- block:
- name: Copy archive to target node
synchronize:
src: "{{ local_apigee_path }}/{{ apigee_archive_name }}"
dest: "{{ apigeerepobasepath | default(opdk_installer_path) }}/{{ apigee_archive_name }}"
rsync_opts: ['--partial-dir={{ opdk_installer_path }}']
# register: results
# failed_when: "'sudo: sorry, you must have a tty to run sudo' in results.stderr"
rescue:
- name: Update to include tty temporarily
become: yes
lineinfile:
path: /etc/sudoers
backrefs: yes
backup: yes
regexp: "^(Defaults)(.*)(requiretty)"
line: '\1\2!\3'
state: present
validate: '/usr/sbin/visudo -cf %s'
- name: Copy archive to target node
synchronize:
src: "{{ local_apigee_path }}/{{ apigee_archive_name }}"
dest: "{{ apigeerepobasepath | default(opdk_installer_path) }}/{{ apigee_archive_name }}"
rsync_opts: ['--partial-dir={{ opdk_installer_path }}']
- name: Restore tty modified temporarily
become: yes
lineinfile:
path: /etc/sudoers
backrefs: yes
backup: yes
regexp: "^(Defaults)(.*)(requiretty)"
line: '\1\2!\3'
state: present
validate: '/usr/sbin/visudo -cf %s'
- name: Unarchive on target node
become: true
unarchive:
src: '{{ apigeerepobasepath | default(opdk_installer_path) }}/{{ apigee_archive_name }}'
dest: '{{ apigeerepobasepath | default(opdk_installer_path) }}'
copy: false
owner: "{{ opdk_user_name }}"
group: "{{ opdk_group_name }}"