mirror of
https://github.com/ivabus/pantry
synced 2024-11-23 00:45:07 +03:00
+ansible (#469)
* +ansible.com * cleanup old urls * add vault tests * re-run CI * re-run CI * add comment * remove unneded deps
This commit is contained in:
parent
06876ee7af
commit
966e7026ed
3 changed files with 73 additions and 0 deletions
1
projects/ansible.com/hosts.ini
Normal file
1
projects/ansible.com/hosts.ini
Normal file
|
@ -0,0 +1 @@
|
||||||
|
localhost ansible_connection=local
|
66
projects/ansible.com/package.yml
Normal file
66
projects/ansible.com/package.yml
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
distributable:
|
||||||
|
url: https://github.com/ansible/ansible/archive/v{{version}}.tar.gz
|
||||||
|
strip-components: 1
|
||||||
|
|
||||||
|
versions:
|
||||||
|
github: ansible/ansible/tags # reads github *tags*
|
||||||
|
strip: /^v/
|
||||||
|
|
||||||
|
dependencies:
|
||||||
|
python.org: '>=3.7'
|
||||||
|
|
||||||
|
build:
|
||||||
|
script: |
|
||||||
|
python-venv.sh {{prefix}}/bin/ansible
|
||||||
|
# manually register all the ansible-* executables with tea
|
||||||
|
#FIXME dirty hack, replace with a proper solution
|
||||||
|
for _EXEC in {{prefix}}/venv/bin/ansible-*; do
|
||||||
|
CMD_NAME="${_EXEC##*/}" # get text after the last slash (the command name)
|
||||||
|
TRG_BIN_NAME="{{prefix}}/bin/$CMD_NAME"
|
||||||
|
cp -v {{prefix}}/bin/ansible $TRG_BIN_NAME # copy the tea-configured executable with the correct name
|
||||||
|
# replace the original 'ansible' with the correct $CMD_NAME
|
||||||
|
sed -i.bak -e \
|
||||||
|
"s|/bin/ansible|/bin/$CMD_NAME|" \
|
||||||
|
$TRG_BIN_NAME
|
||||||
|
done
|
||||||
|
|
||||||
|
rm -v {{prefix}}/bin/ansible-*.bak
|
||||||
|
|
||||||
|
test:
|
||||||
|
script: |
|
||||||
|
ansible --version
|
||||||
|
ansible-playbook playbook.yml -i hosts.ini
|
||||||
|
|
||||||
|
#FIXME below is a test from the brew formula, but I'm not sure what it's testing
|
||||||
|
# ^ especially considering that 'requests' is not a part of ansible's dependencies
|
||||||
|
# Ensure requests[security] is activated
|
||||||
|
# py_script="import requests as r; r.get('https://mozilla-modern.badssl.com')"
|
||||||
|
# {{prefix}}/venv/bin/python -c "$py_script"
|
||||||
|
|
||||||
|
# Ensure ansible-vault can encrypt/decrypt files.
|
||||||
|
echo $SECRET_MESSAGE > vault-test-file.txt
|
||||||
|
echo $VAULT_PASSWORD > vault-password.txt
|
||||||
|
|
||||||
|
ansible-vault encrypt --vault-password-file vault-password.txt vault-test-file.txt
|
||||||
|
test "$(cat vault-test-file.txt)" != "$SECRET_MESSAGE" # encrypted
|
||||||
|
|
||||||
|
ansible-vault decrypt --vault-password-file vault-password.txt vault-test-file.txt
|
||||||
|
test "$(cat vault-test-file.txt)" = "$SECRET_MESSAGE" # decrypted
|
||||||
|
|
||||||
|
env:
|
||||||
|
VAULT_PASSWORD: "123456789"
|
||||||
|
SECRET_MESSAGE: "Hello world!"
|
||||||
|
|
||||||
|
|
||||||
|
provides:
|
||||||
|
- bin/ansible
|
||||||
|
- bin/ansible-config
|
||||||
|
- bin/ansible-connection
|
||||||
|
- bin/ansible-console
|
||||||
|
- bin/ansible-doc
|
||||||
|
- bin/ansible-galaxy
|
||||||
|
- bin/ansible-inventory
|
||||||
|
- bin/ansible-playbook
|
||||||
|
- bin/ansible-pull
|
||||||
|
- bin/ansible-test
|
||||||
|
- bin/ansible-vault
|
6
projects/ansible.com/playbook.yml
Normal file
6
projects/ansible.com/playbook.yml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
- hosts: all
|
||||||
|
gather_facts: False
|
||||||
|
tasks:
|
||||||
|
- name: ping
|
||||||
|
ping:
|
Loading…
Reference in a new issue