diff options
Diffstat (limited to 'recipes-devtools/python/python-ansible.inc')
| -rw-r--r-- | recipes-devtools/python/python-ansible.inc | 76 |
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 @@ | |||
| 1 | DESCRIPTION = "Ansible is a simple IT automation platform that makes your applications and systems easier to deploy." | ||
| 2 | HOMEPAGE = "https://github.com/ansible/ansible/" | ||
| 3 | SECTION = "devel/python" | ||
| 4 | LICENSE = "GPLv3" | ||
| 5 | LIC_FILES_CHKSUM = "file://COPYING;md5=8f0e2cd40e05189ec81232da84bd6e1a" | ||
| 6 | |||
| 7 | SRCNAME = "ansible" | ||
| 8 | |||
| 9 | SRC_URI = "http://releases.ansible.com/ansible/${SRCNAME}-${PV}.tar.gz" | ||
| 10 | |||
| 11 | SRC_URI[md5sum] = "b1be8f05864a07c06b8a767dcd48ba1b" | ||
| 12 | SRC_URI[sha256sum] = "cd4b8f53720fcd0c351156b840fdd15ecfbec22c951b5406ec503de49d40b9f5" | ||
| 13 | |||
| 14 | |||
| 15 | S = "${WORKDIR}/${SRCNAME}-${PV}" | ||
| 16 | |||
| 17 | ANSIBLE_WHITELIST_MODULES ?= "commands files system network/ovs __pycache__ service" | ||
| 18 | |||
| 19 | do_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 | |||
| 76 | CLEANBROKEN = "1" | ||
