proxy_role/tasks/Gentoo_post.yml
2024-01-06 03:08:22 +00:00

105 lines
4.0 KiB
YAML

# -*- mode: yaml; indent-tabs-mode: nil; tab-width: 2; coding: utf-8-unix -*-
---
- name: "DEBUG: proxy Gentoo_post.yml"
debug:
verbosity: 1
msg: "DEBUG: Including proxy Gentoo_post.yml"
- name: proxy http equals
blockinfile:
dest: "{{ item.dest }}"
owner: "{{ item.owner }}"
group: "{{ item.group }}"
create: yes
marker: "# {mark} ANSIBLE MANAGED BLOCK proxy http equals"
# state: "{{ 'present' if HTTP_PROXYHOST != '' else 'absent' }}"
block: |
# emerge does not seem to pick up .gitconfig settings for proxy from ~portage/.gitconfig
# neded to get these form the environment or hosts.yml
# fucking google go calls home during COMPILE
#NO api/services/events/v1/events.pb.go:15:2: google.golang.org/grpc@v1.43.0: Get "https://proxy.golang.org/google.golang.org/grpc/@v/v1.43.0.zip": proxyconnect tcp: dial tcp 127.0.0.1:9128: connect: connection refused
# allow
#NO http_proxy={{HTTP_PROXYTYPE}}://{{HTTP_PROXYHOST}}:{{HTTP_PROXYPORT}}
#NO https_proxy={{HTTPS_PROXYTYPE}}://{{HTTPS_PROXYHOST}}:{{HTTPS_PROXYPORT}}
#NO socks_proxy={{SOCKS_PROXYTYPE}}://{{SOCKS_PROXYHOST}}:{{SOCKS_PROXYPORT}}
# NO RSYNC_PROXY={{HTTP_PROXYHOST}}:{{HTTP_PROXYPORT}}
http_proxy=http://127.0.0.1:666
https_proxy=http://127.0.0.1:666
socks_proxy=socks5h://127.0.0.1:666
no_proxy="{{ NO_PROXY }}"
RSYNC_PROXY=127.0.0.1:666
when:
- "item.bool == 'yes'"
with_items:
- dest: "/etc/portage/make.conf"
owner: "portage"
group: "portage"
mode: "0644"
bool: "{{ 'yes' if ansible_distribution == 'Gentoo' else 'no' }}"
- name: proxy http CURL_OPTS
blockinfile:
dest: "{{ item.dest }}"
owner: "{{ item.owner }}"
group: "{{ item.group }}"
create: yes
marker: "# {mark} ANSIBLE MANAGED BLOCK proxy http CURL_OPTS"
# state: "{{ 'present' if SOCKS_PROXY != '' else 'absent' }}"
block: |
CURL_OPTS="--cert-status --connect-timeout 30 {{ '--tlsv1.3' if BOX_TLS_VERSION == '1.3' else '--tlsv1.2' }} --location --proto-redir https --proto-default https --proto =https -x ${socks_proxy} --fail"
when:
- "item.bool == 'yes'"
with_items:
- dest: "/etc/portage/make.conf"
owner: "portage"
group: "portage"
mode: "0644"
bool: "{{ 'yes' if ansible_distribution == 'Gentoo' else 'no' }}"
- name: proxy http FETCHCOMMAND
blockinfile:
dest: "{{ item.dest }}"
owner: "{{ item.owner }}"
group: "{{ item.group }}"
create: yes
marker: "# {mark} ANSIBLE MANAGED BLOCK proxy http FETCHCOMMAND"
# state: "{{ 'present' if HTTP_PROXYHOST != '' else 'absent' }}"
block: |
#FETCHCOMMAND='wget -t 1 -T 10 --passive-ftp -O "\${DISTDIR}/\${FILE}" "\${URI}"'
FETCHCOMMAND='/usr/local/bin/scurl.bash -- --retry 1 --output "\${DISTDIR}/\${FILE}" "\${URI}"'
FETCHCOMMAND_HTTP='/usr/local/bin/scurl.bash -- --retry 1 --output "\${DISTDIR}/\${FILE}" "\${URI}"'
FETCHCOMMAND_HTTPS='/usr/local/bin/scurl.bash -- --retry 1 --output "\${DISTDIR}/\${FILE}" "\${URI}"'
RESUMECOMMAND='/usr/local/bin/scurl.bash -- -C - --retry 1 --output "\${DISTDIR}/\${FILE}" "\${URI}"'
RESUMECOMMAND_HTTP='/usr/local/bin/scurl.bash -- -C - --retry 1 --output "\${DISTDIR}/\${FILE}" "\${URI}"'
RESUMECOMMAND_HTTPS='/usr/local/bin/scurl.bash -- -C - --retry 1 --output "\${DISTDIR}/\${FILE}" "\${URI}"'
when:
- "item.bool == 'yes'"
with_items:
- dest: "/etc/portage/make.conf"
owner: "portage"
group: "portage"
mode: "0644"
bool: "{{ 'yes' if ansible_distribution == 'Gentoo' else 'no' }}"
- name: /etc/portage/make.conf PORTAGE_RSYNC_EXTRA_OPTS
blockinfile:
dest: /etc/portage/make.conf
create: no
marker: "# {mark} ANSIBLE MANAGED BLOCK proxy [PORTAGE_RSYNC_EXTRA_OPTS]"
block: |
PORTAGE_RSYNC_RETRIES=5
#mgorny suggested this speeds up sync, in my testing it makes a rather large difference
PORTAGE_RSYNC_EXTRA_OPTS="--omit-dir-times -4 --timeout=20"