openstack-ansible-ops/elk_metrics_6x/common_task_install_go1.10.1.yml
Kevin Carter cf78fd744d Add retries to all tasks with external deps
The tasks with external deps should all have a retry so to cater for
cases of intermittent service interruptions. This change adds retires
and tags to of the tasks with external deps.

Change-Id: Icd0a8143347bcbffc2a1e0a02da92091b59ed483
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-06-14 19:31:09 -05:00

63 lines
1.7 KiB
YAML

---
# Copyright 2018, 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.
- name: Check for go
stat:
path: /opt/go1.10.1/go/bin/go
register: go_path
- name: Install go
block:
- name: GET go
get_url:
url: "https://dl.google.com/go/go1.10.1.linux-amd64.tar.gz"
dest: "/opt/go1.10.1.linux-amd64.tar.gz"
checksum: "sha256:72d820dec546752e5a8303b33b009079c15c2390ce76d67cf514991646c6127b"
register: _get_task
until: _get_task is success
retries: 3
delay: 2
tags:
- package_install
- name: Create go directory
file:
path: "/opt/go1.10.1"
state: directory
- name: Unarchive go
unarchive:
src: "/opt/go1.10.1.linux-amd64.tar.gz"
dest: "/opt/go1.10.1"
remote_src: yes
- name: Create go defaults file
copy:
content: |
GOROOT=/opt/go1.10.1/go
GOPATH=/usr/local
PATH=${PATH}:${GOROOT}/bin
dest: /etc/default/go1.10.1
when:
- (elk_package_state | default('present')) == 'present'
- not go_path.stat.exists | bool
- name: Remove go
file:
path: "/opt/go1.10.1"
state: absent
when:
- (elk_package_state | default('present')) == 'absent'