Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,30 @@ boxes = [
:box => "bento/ubuntu-18.04",
:ip => '10.0.0.14',
:cpu => "50",
:ram => "256"
:ram => "512"
},
{
:name => "debian-8",
:box => "bento/debian-8",
:ip => '10.0.0.16',
:ip => '10.0.0.15',
:cpu => "50",
:ram => "256"
:ram => "512"
},
{
:name => "debian-9",
:box => "bento/debian-9",
:ip => '10.0.0.17',
:ip => '10.0.0.16',
:cpu => "50",
:ram => "256"
:ram => "512"
},
{
:name => "centos-7",
:box => "centos/7",
:ip => '10.0.0.18',
:cpu => "80",
:ram => "1024"
}

]

Vagrant.configure("2") do |config|
Expand Down
32 changes: 32 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
---
tinyproxy_install: []

proxy_user: tinyproxy
proxy_group: tinyproxy

tinyproxy_configuration_file: /etc/tinyproxy/tinyproxy.conf

tinyproxy_tinyproxy_conf: "{{ tinyproxy_tinyproxy_conf_preset }}"

tinyproxy_port: 8888
Expand All @@ -10,3 +15,30 @@ tinyproxy_allow:
tinyproxy_connect_port:
- 443
- 563

tinyproxy_dependencies:
- tinyproxy

tinyproxy_tinyproxy_conf_preset:
- |
User {{ proxy_user }}
Group {{ proxy_group }}
Port {{ tinyproxy_port }}
Timeout 600
DefaultErrorFile "/usr/share/tinyproxy/default.html"
StatFile "/usr/share/tinyproxy/stats.html"
Logfile "/var/log/tinyproxy/tinyproxy.log"
LogLevel Info
PidFile "{{ pidfile | default("/run/tinyproxy/tinyproxy.pid") }}"
MaxClients 100
MinSpareServers 5
MaxSpareServers 20
StartServers 10
MaxRequestsPerChild 0
{% for allow in tinyproxy_allow %}
Allow {{ allow }}
{% endfor %}
ViaProxyName "tinyproxy"
{% for connect_port in tinyproxy_connect_port %}
ConnectPort {{ connect_port }}
{% endfor %}
45 changes: 45 additions & 0 deletions tasks/Debian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---

# Tasks for Ubuntu

- name: Set facts for Ubuntu 16 and Debian 8
set_fact:
tinyproxy_configuration_file: /etc/tinyproxy.conf
proxy_user: nobody
proxy_group: nogroup
when: (ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "14") or
(ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "16") or
(ansible_distribution == "Debian" and ansible_distribution_major_version == "8")

- name: Set facts for Ubuntu 18 and Debian 9
set_fact:
tinyproxy_configuration_file: /etc/tinyproxy/tinyproxy.conf
proxy_user: tinyproxy
proxy_group: tinyproxy
pidfile: /var/run/tinyproxy/tinyproxy.pid
when: (ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "18") or
(ansible_distribution == "Debian" and ansible_distribution_major_version == "9")


- name: Debian | Install the latest version of Tinyproxy
package:
name: "{{ tinyproxy_dependencies }}"
state: "{{ package_install_state | default('latest') }}"
when:
- ansible_os_family == 'Debian'
tags:
- configuration
- tinyproxy
- tinyproxy-dependencies

- name: install additional
apt:
name: "{{ tinyproxy_install }}"
state: "{{ package_install_state | default('latest') }}"
when:
- ansible_os_family == 'Debian'
tags:
- configuration
- tinyproxy
- tinyproxy-install

31 changes: 31 additions & 0 deletions tasks/RedHat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---

- name: Set fact for CentOS 7
set_fact:
gpgkey: https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7
when:
- ansible_distribution == "CentOS"
- ansible_distribution_major_version == "7"

- name: Set fact for CentOS 8
set_fact:
gpgkey: https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8
when:
- ansible_distribution == "CentOS"
- ansible_distribution_major_version == "8"

- name: RedHat | Install epel-release
yum_repository:
name: epel
description: EPEL YUM repo
baseurl: https://download.fedoraproject.org/pub/epel/$releasever/$basearch/
gpgkey: https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7
when:
- ansible_os_family == 'RedHat'

- name: RedHat | Install the latest version of Tinyproxy
yum:
name: "{{ tinyproxy_dependencies }}"
state: "{{ package_install_state | default('latest') }}"
when:
- ansible_os_family == 'RedHat'
44 changes: 17 additions & 27 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,25 @@
# tasks file for tinyproxy
---
- name: include variables
include_vars: "{{ item }}"
with_first_found:
- "_{{ ansible_distribution_release }}.yml"
- "_{{ ansible_distribution | lower }}.yml"
- _default.yml
tags:
- configuration
- tinyproxy
- tinyproxy-include-variables

- name: install dependencies
apt:
name: "{{ tinyproxy_dependencies }}"
state: "{{ apt_install_state | default('latest') }}"
update_cache: true
cache_valid_time: "{{ apt_update_cache_valid_time | default(3600) }}"
- debug:
msg: "{{ hostvars[inventory_hostname].ansible_distribution }}"
tags:
- configuration
- tinyproxy
- tinyproxy-dependencies

- name: install additional
apt:
name: "{{ tinyproxy_install }}"
state: "{{ apt_install_state | default('latest') }}"
- debug
- never
- debug:
msg: "{{ hostvars[inventory_hostname].ansible_distribution_major_version }}"
tags:
- configuration
- tinyproxy
- tinyproxy-install
- debug
- never
- debug:
msg: "{{ hostvars[inventory_hostname].ansible_distribution_version }}"
tags:
- debug
- never

- name: include OS specific tasks
include_tasks: "{{ ansible_os_family }}.yml"


- name: update configuration file
template:
Expand Down
4 changes: 3 additions & 1 deletion tests/post.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
apt:
name:
- curl
state: "{{ apt_install_state | default('latest') }}"
state: "{{ package_install_state | default('latest') }}"
update_cache: true
cache_valid_time: "{{ apt_update_cache_valid_time | default(3600) }}"
when:
- ansible_os_family == 'Debian'

- name: post | test installation
command: >
Expand Down
27 changes: 0 additions & 27 deletions vars/_bionic.yml

This file was deleted.

27 changes: 0 additions & 27 deletions vars/_default.yml

This file was deleted.

27 changes: 0 additions & 27 deletions vars/_stretch.yml

This file was deleted.

4 changes: 0 additions & 4 deletions vars/main.yml

This file was deleted.