Skip to content

Instantly share code, notes, and snippets.

@dmsimard
Last active March 14, 2017 22:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmsimard/e24d147e0b74f7e25c3efd82a8bf9a77 to your computer and use it in GitHub Desktop.
Save dmsimard/e24d147e0b74f7e25c3efd82a8bf9a77 to your computer and use it in GitHub Desktop.
0.12 migration issue
#!/bin/bash
yum -y install httpd mod_wsgi gcc python-devel libffi-devel openssl-devel redhat-rpm-config python-setuptools libselinux-python libxml2-devel libxslt-devel
setsebool -P httpd_unified 1
easy_install pip
pip install "Jinja2<2.9" "ara==0.10"
mkdir -p /var/www/ara/{.ansible,.ara}
export ANSIBLE_CONFIG=/var/www/ara/ansible.cfg
export ARA_DATABASE=sqlite:////var/www/ara/.ara/ansible.sqlite
export ara_location=$(python -c "import os,ara; print(os.path.dirname(ara.__file__))")
cat << EOF >/var/www/ara/ansible.cfg
[defaults]
# This directory is required to store temporary files for Ansible and ARA
local_tmp = /var/www/ara/.ansible/tmp
callback_plugins = $ara_location/plugins/callbacks
[ara]
# This will default the database and logs location to be inside that directory.
dir = /var/www/ara/.ara
EOF
cat << EOF > playbook.yml
---
- name: Something
hosts: localhost
gather_facts: no
tasks:
- debug:
msg: Something
EOF
ansible-playbook -i 'localhost' playbook.yml
ara playbook list
pip install ara==0.11 --upgrade
ara --version
ara playbook list
pip install ara==0.12.3 --upgrade
# ara-wsgi landed in 0.12
cp -p $(which ara-wsgi) /var/www/ara/
chown -R apache:apache /var/www/ara
cat << EOF > /etc/httpd/conf.d/ara.conf
<VirtualHost *:80>
# Replace ServerName by your hostname
ServerName ara.domain.tld
ErrorLog /var/log/httpd/ara-error.log
LogLevel warn
CustomLog /var/log/httpd/ara-access.log combined
WSGIDaemonProcess ara user=apache group=apache processes=4 threads=1
WSGIScriptAlias / /var/www/ara/ara-wsgi
SetEnv ANSIBLE_CONFIG /var/www/ara/ansible.cfg
<Directory /var/www/ara>
WSGIProcessGroup ara
WSGIApplicationGroup %{GLOBAL}
Require all granted
</Directory>
</VirtualHost>
EOF
systemctl enable httpd
systemctl restart httpd
ara --version
ara playbook list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment