-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
51 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
FROM alpine | ||
MAINTAINER Matt Martz <[email protected]> | ||
|
||
COPY clean_collections.py /tmp/clean_collections.py | ||
COPY execute.sh /execute.sh | ||
COPY playbook.yml /playbook.yml | ||
|
||
RUN set -x && \ | ||
apk add --no-cache python3 py3-pip openssl-dev python3-dev libffi-dev ca-certificates gcc make musl-dev git yaml-dev && \ | ||
apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community rust cargo && \ | ||
apk add --no-cache python3 py3-pip openssl-dev python3-dev libffi-dev ca-certificates gcc make musl-dev git yaml-dev rust cargo && \ | ||
pip3 install -U pip && \ | ||
pip3 install ansible jmespath netaddr && \ | ||
apk del openssl-dev python3-dev libffi-dev gcc make musl musl-dev git yaml pkgconf rust cargo | ||
apk del py3-pip openssl-dev python3-dev libffi-dev ca-certificates gcc make musl-dev git yaml rust cargo && \ | ||
python3 /tmp/clean_collections.py && \ | ||
rm -rf /root/.cache && \ | ||
rm -rf /root/.cargo | ||
|
||
COPY execute.sh /execute.sh | ||
COPY playbook.yml /playbook.yml | ||
|
||
CMD ["/bin/sh", "/execute.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
import shutil | ||
import ansible_collections | ||
|
||
root = ansible_collections.__path__[0] | ||
|
||
for namespace in os.listdir(root): | ||
namespace = os.path.join(root, namespace) | ||
if not os.path.isdir(namespace): | ||
continue | ||
for collection in os.listdir(namespace): | ||
collection = os.path.join(namespace, collection) | ||
if not os.path.isdir(collection): | ||
continue | ||
for path in os.listdir(collection): | ||
path = os.path.join(collection, path) | ||
basename = os.path.basename(path) | ||
if basename != 'plugins': | ||
if os.path.isdir(path): | ||
shutil.rmtree(path) | ||
else: | ||
os.unlink(path) | ||
else: | ||
modules = os.path.join(path, 'modules') | ||
if os.path.isdir(modules): | ||
shutil.rmtree(modules) |