summaryrefslogtreecommitdiffstats
path: root/recipes-devtools/python/python-ansible.inc
diff options
context:
space:
mode:
authorMark Asselstine <mark.asselstine@windriver.com>2018-09-18 16:27:26 -0400
committerBruce Ashfield <bruce.ashfield@windriver.com>2018-09-25 17:40:49 -0400
commit492de1f32fc0053b692e3173ea6d3d19052f7c97 (patch)
tree8483c70e61ac33cb291100a39c3f1440cad7854e /recipes-devtools/python/python-ansible.inc
parent25b67706fe7a7969da3af52bb7b912bf3a02510e (diff)
downloadmeta-cloud-services-492de1f32fc0053b692e3173ea6d3d19052f7c97.tar.gz
python-ansible: copy recipe from meta-overc (branch:master-oci)
This recipe was part of meta-overc as ansible was originally used to configure things in the OverC framework. The use of ansible was dropped, however, due to size concerns, the limited functionality we were using, increased boot times and other factors. It no longer makes sense to host this recipe in meta-overc and thus we are making it available as part of meta-cloud-services as it is still a useful tool for cloud deployments. Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'recipes-devtools/python/python-ansible.inc')
-rw-r--r--recipes-devtools/python/python-ansible.inc76
1 files changed, 76 insertions, 0 deletions
diff --git a/recipes-devtools/python/python-ansible.inc b/recipes-devtools/python/python-ansible.inc
new file mode 100644
index 0000000..f1b3771
--- /dev/null
+++ b/recipes-devtools/python/python-ansible.inc
@@ -0,0 +1,76 @@
1DESCRIPTION = "Ansible is a simple IT automation platform that makes your applications and systems easier to deploy."
2HOMEPAGE = "https://github.com/ansible/ansible/"
3SECTION = "devel/python"
4LICENSE = "GPLv3"
5LIC_FILES_CHKSUM = "file://COPYING;md5=8f0e2cd40e05189ec81232da84bd6e1a"
6
7SRCNAME = "ansible"
8
9SRC_URI = "http://releases.ansible.com/ansible/${SRCNAME}-${PV}.tar.gz"
10
11SRC_URI[md5sum] = "b1be8f05864a07c06b8a767dcd48ba1b"
12SRC_URI[sha256sum] = "cd4b8f53720fcd0c351156b840fdd15ecfbec22c951b5406ec503de49d40b9f5"
13
14
15S = "${WORKDIR}/${SRCNAME}-${PV}"
16
17ANSIBLE_WHITELIST_MODULES ?= "commands files system network/ovs __pycache__ service"
18
19do_install_append() {
20 set +e
21
22 # install hosts and conf
23 install -d ${D}/${sysconfdir}/ansible
24
25 # There is no default inventory configuration installed for ansible,
26 # so we use the example as a template to improve OOBE.
27 install ${S}/examples/hosts ${D}/${sysconfdir}/ansible/
28 install ${S}/examples/ansible.cfg ${D}/${sysconfdir}/ansible/
29
30 # do not gather machine's information, which could reduce setup time
31 sed -i "s|^#gathering = implicit|gathering = explicit|g" \
32 ${D}/${sysconfdir}/ansible/ansible.cfg
33
34 for d in $(ls ${D}/${libdir}/python${PYTHON_BASEVERSION}/site-packages/ansible/modules); do
35 if [ -d ${D}/${libdir}/python${PYTHON_BASEVERSION}/site-packages/ansible/modules/$d ]; then
36 match=
37 rm_target=
38 for w in ${ANSIBLE_WHITELIST_MODULES}; do
39 m=$(echo $w | grep $d)
40 if [ $? -eq 0 ]; then
41 match=t
42 match_word=$m
43 fi
44 done
45 if [ -n "$match" ]; then
46 echo $match_word | grep -q "/"
47 if [ $? -eq 0 ]; then
48 for d2 in $(ls ${D}/${libdir}/python${PYTHON_BASEVERSION}/site-packages/ansible/modules/$d); do
49 if [ -d ${D}/${libdir}/python${PYTHON_BASEVERSION}/site-packages/ansible/modules/$d/$d2 ]; then
50 sub_remove=t
51 for w in ${ANSIBLE_WHITELIST_MODULES}; do
52 m=$(echo $w | grep $d2)
53 if [ $? -eq 0 ]; then
54 sub_remove=
55 fi
56 done
57 if [ -n "$sub_remove" ]; then
58 echo "[info]: removing $d/$d2"
59 rm -rf ${D}/${libdir}/python${PYTHON_BASEVERSION}/site-packages/ansible/modules/$d/$d2
60 else
61 echo "[info]: whitlisting $d/$d2"
62 fi
63 fi
64 done
65 else
66 echo "[info]: whitlisting $d"
67 fi
68 else
69 echo "[info]: removing $d"
70 rm -rf ${D}/${libdir}/python${PYTHON_BASEVERSION}/site-packages/ansible/modules/$d
71 fi
72 fi
73 done
74}
75
76CLEANBROKEN = "1"