openstack-ansible/playbooks/repo-clone-mirror.yml
Jimmy McCrory c8630f72be Resolve ansible-lint ANSIBLE0008
ansible-lint 2.3.7 added a rule checking for use of the deprecated
'sudo' and 'sudo_user' directives. They have been replaced with 'become'
and 'become_user' respectively.

Change-Id: I2271fe8468840884f19f41abba37e696c6296350
2016-02-11 07:40:09 -08:00

69 lines
2.4 KiB
YAML

---
# Copyright 2015, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This play was built to seed an environment with packages that may be used
# from within the environment as found from a given mirror_source_host.
# Currently the mirror source host is set to the Rackspace build servers but
# could be targeted to wherever you'd like.
- name: Cloning the upstream repo mirror
hosts: repo_all[0]
gather_facts: false
user: root
pre_tasks:
- name: Delete old MANIFEST file if found
file:
state: absent
path: /tmp/MANIFEST.in
tasks:
- name: download MANIFEST.in
get_url:
url: "{{ repo_upstream_manifest_url }}"
dest: /tmp/MANIFEST.in
- name: Sync the upstream repo(s)
shell: |
{{ rsync_commands }} \
{{ rsync_flags }} \
--files-from=/tmp/MANIFEST.in \
{{ repo_upstream_url | netloc }}::{{ mirror_name }} {{ mirror_path }}
become: yes
become_user: "{{ repo_service_user_name }}"
- name: Create sync directories
file:
state: directory
path: "{{ mirror_path }}/{{ item }}"
owner: "{{ repo_service_user_name }}"
with_items: rsync_dirs
- name: Sync supporting directories
shell: |
{{ rsync_commands }} \
{{ rsync_flags }} \
{{ repo_upstream_url | netloc }}::{{ mirror_name }}/{{ item }}/ {{ mirror_path }}/{{ item }}
with_items: rsync_dirs
become: yes
become_user: "{{ repo_service_user_name }}"
vars:
rsync_commands: rsync
rsync_flags: "-avzlHAX"
rsync_dirs:
- container_images
- downloads
- "venvs/{{ openstack_release }}"
mirror_path: "{{ repo_service_home_folder }}/repo"
mirror_name: "openstack_mirror"
repo_upstream_url: "https://rpc-repo.rackspace.com"
repo_upstream_manifest_url: "{{ repo_upstream_url }}/os-releases/{{ openstack_release }}/MANIFEST.in"
repo_service_user_name: nginx