Adds in proxy role - Ubuntu 16.04

Building on from the previous commit https://review.openstack.org/427869
this add in a proxy role which sets up the environment and apt in case
this machine is based behind some form of proxy.

Change-Id: I1f2266f6443354aa954438801c0ddc84e78d6994
This commit is contained in:
Rick Box 2017-02-03 15:14:51 +00:00 committed by Jesse Pretorius (odyssey4me)
parent 952f91f004
commit a8a44e2002
6 changed files with 129 additions and 0 deletions

View File

@ -0,0 +1,28 @@
proxy_install
=========
This module sets up a web and apt proxy on Ubuntu 16
Requirements
------------
This module requires Ansible 2.x
Role Variables
--------------
See defaults for variables and descriptions
Dependencies
------------
This role has no dependencies
Example Playbook
----------------
Example to call:
- hosts: all
roles:
- { role: proxy_install }

View File

@ -0,0 +1,23 @@
---
# 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: proxy_install/defaults
# description: ALL our default variables for proxy_install go in here
#------------------------------------------------------------------------------
# Packages - All our required packages we need installing
#------------------------------------------------------------------------------
# - Proxy URL -
proxy: http://proxy.example.com:8080 # Example proxy URL
environment_path: /etc/environment # Default path for environment
apt_proxy_path: /etc/apt/apt.conf.d/80proxy # Default path for apt proxy

View File

@ -0,0 +1,22 @@
---
# 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.
#
galaxy_info:
author: "Rick Box - BBC R&D"
license: Apache2
min_ansible_version: 2.0
platforms:
- name: Ubuntu
versions:
- xenial
dependencies: []

View File

@ -0,0 +1,37 @@
---
# 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.
#
# module: proxy_install/tasks/configure
# description: Configure proxy_install
- name: Setup http proxy for APT
template:
src: 80proxy.j2
dest: "{{ apt_proxy_path }}"
mode: 0644
owner: root
group: root
- name: Setup http proxy environment variables
lineinfile:
dest: "{{ environment_path }}"
line: "{{ item.line }}"
regexp: "{{ item.regexp }}"
with_items:
- { line: "http_proxy={{ proxy }}", regexp: "^http_proxy=" }
- { line: "https_proxy={{ proxy }}", regexp: "^https_proxy=" }
- { line: "RSYNC_PROXY={{ proxy }}", regexp: "^RSYNC_PROXY=" }
- name: Change current environment variables, change disabled since it runs each time
shell: "export http_proxy={{ proxy }}; export https_proxy={{ proxy }}; export RSYNC_PROXY={{ proxy }}"
changed_when: false

View File

@ -0,0 +1,17 @@
---
# 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.
#
# module: proxy_install/tasks
# description: Install proxy_install onto an Ubuntu 16.xx server
- include: configure.yml

View File

@ -0,0 +1,2 @@
### MANAGED BY {{ role_path|basename }} ANSIBLE ROLE ###
Acquire::http::Proxy "{{ proxy }}";