blob: 469309e1e281b47658378ade64209326d20836db [file] [log] [blame]
---
# tasks file for apigee-opdk-setup-local-repository-archive
#- name: Clean up any old repos
# become: true
# file:
# path: '{{ apigeerepobasepath }}/repos'
# state: absent
- name: Ensure repo folders exists
become: true
file:
path: '{{ apigeerepobasepath }}/repos'
state: directory
owner: "{{ opdk_user_name }}"
group: "{{ opdk_group_name }}"
- 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 }}/{{ 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 }}/{{ 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 }}/{{ apigee_archive_name }}'
dest: '{{ apigeerepobasepath }}'
copy: false
owner: "{{ opdk_user_name }}"
group: "{{ opdk_group_name }}"