mirror of https://github.com/ansible/ansible.git
Support ignoring of certificates for ansible-galaxy during SCM cloning (#67616)
* Support ignoring of certificates for ansible-galaxy during SCM cloning * Add integration tests installing a role from an untrusted repository Test installing the role without --ignore-certs fails Test installing the role with --ignore-certs is successfulpull/77196/merge
parent
2769f5621b
commit
ea7f24a1d5
@ -0,0 +1,2 @@
|
||||
minor_changes:
|
||||
- ansible-galaxy - the option to skip certificate verification now also applies when cloning via SCM (git/hg) (https://github.com/ansible/ansible/issues/41077)
|
@ -1,5 +1,13 @@
|
||||
- name: remove unwanted packages
|
||||
- name: remove git package
|
||||
package:
|
||||
name: git
|
||||
state: absent
|
||||
when: git_install.changed
|
||||
- name: remove openssl package
|
||||
package:
|
||||
name: openssl
|
||||
state: absent
|
||||
when: ansible_distribution not in ["MacOSX", "Alpine"] and openssl_install.changed
|
||||
- name: remove openssl package
|
||||
command: apk del openssl
|
||||
when: ansible_distribution == "Alpine" and openssl_install.changed
|
||||
|
@ -1,6 +1,12 @@
|
||||
- name: remove auto-installed packages from FreeBSD
|
||||
- name: remove git from FreeBSD
|
||||
pkgng:
|
||||
name: git
|
||||
state: absent
|
||||
autoremove: yes
|
||||
when: git_install.changed
|
||||
- name: remove openssl from FreeBSD
|
||||
pkgng:
|
||||
name: openssl
|
||||
state: absent
|
||||
autoremove: yes
|
||||
when: openssl_install.changed
|
||||
|
@ -0,0 +1,20 @@
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import sys
|
||||
import ssl
|
||||
|
||||
if __name__ == '__main__':
|
||||
if sys.version_info[0] >= 3:
|
||||
import http.server
|
||||
import socketserver
|
||||
Handler = http.server.SimpleHTTPRequestHandler
|
||||
httpd = socketserver.TCPServer(("", 4443), Handler)
|
||||
else:
|
||||
import BaseHTTPServer
|
||||
import SimpleHTTPServer
|
||||
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
|
||||
httpd = BaseHTTPServer.HTTPServer(("", 4443), Handler)
|
||||
|
||||
httpd.socket = ssl.wrap_socket(httpd.socket, certfile='./cert.pem', keyfile='./key.pem', server_side=True)
|
||||
httpd.serve_forever()
|
@ -1,11 +1,57 @@
|
||||
- hosts: localhost
|
||||
vars:
|
||||
ws_dir: '{{ lookup("env", "OUTPUT_DIR") }}/ansible-galaxy-webserver'
|
||||
tasks:
|
||||
- name: install git
|
||||
- name: install git & OpenSSL
|
||||
package:
|
||||
name: git
|
||||
when: ansible_distribution not in ["MacOSX", "Alpine"]
|
||||
register: git_install
|
||||
- name: save install result
|
||||
|
||||
- name: install OpenSSL
|
||||
package:
|
||||
name: openssl
|
||||
when: ansible_distribution not in ["MacOSX", "Alpine"]
|
||||
register: openssl_install
|
||||
|
||||
- name: install OpenSSL
|
||||
command: apk add openssl
|
||||
when: ansible_distribution == "Alpine"
|
||||
register: openssl_install
|
||||
|
||||
- name: setup webserver dir
|
||||
file:
|
||||
state: directory
|
||||
path: "{{ ws_dir }}"
|
||||
|
||||
- name: copy webserver
|
||||
copy:
|
||||
src: testserver.py
|
||||
dest: "{{ ws_dir }}"
|
||||
|
||||
- name: Create rand file
|
||||
command: dd if=/dev/urandom of="{{ ws_dir }}/.rnd" bs=256 count=1
|
||||
|
||||
- name: Create self-signed cert
|
||||
shell: RANDFILE={{ ws_dir }}/.rnd openssl req -x509 -newkey rsa:2048 \
|
||||
-nodes -days 365 -keyout "{{ ws_dir }}/key.pem" -out "{{ ws_dir }}/cert.pem" \
|
||||
-subj "/C=GB/O=Red Hat/OU=Ansible/CN=ansible-test-cert"
|
||||
|
||||
- name: start SimpleHTTPServer
|
||||
shell: cd {{ ws_dir }} && {{ ansible_python.executable }} {{ ws_dir }}/testserver.py
|
||||
async: 120 # this test set can take ~1m to run on FreeBSD (via Shippable)
|
||||
poll: 0
|
||||
|
||||
- wait_for: port=4443
|
||||
|
||||
- name: save results
|
||||
copy:
|
||||
content: '{{ git_install }}'
|
||||
dest: '{{ lookup("env", "OUTPUT_DIR") }}/git_install.json'
|
||||
content: "{{ item.content }}"
|
||||
dest: '{{ lookup("env", "OUTPUT_DIR") }}/{{ item.key }}.json'
|
||||
loop:
|
||||
- key: git_install
|
||||
content: "{{ git_install }}"
|
||||
- key: openssl_install
|
||||
content: "{{ openssl_install }}"
|
||||
- key: ws_dir
|
||||
content: "{{ ws_dir | to_json }}"
|
||||
|
Loading…
Reference in New Issue