| |
@@ -0,0 +1,179 @@
|
| |
+ ---
|
| |
+ - name: Install helpful development packages
|
| |
+ dnf: name={{ item }} state=present
|
| |
+ with_items:
|
| |
+ - git
|
| |
+ - vim-enhanced
|
| |
+
|
| |
+ - name: Install Fedora Hubs development packages
|
| |
+ dnf: name={{ item }} state=present
|
| |
+ with_items:
|
| |
+ - gcc
|
| |
+ - gcc-c++
|
| |
+ - libffi-devel
|
| |
+ - openssl-devel
|
| |
+ - postgresql
|
| |
+ - postgresql-devel
|
| |
+ - python-sphinx
|
| |
+ - python-virtualenvwrapper
|
| |
+ - python2-devel
|
| |
+ - python3-devel
|
| |
+ - redhat-rpm-config
|
| |
+ - sqlite-devel
|
| |
+
|
| |
+ - name: Install the distribution versions of requirements.txt
|
| |
+ dnf: name={{ item }} state=present
|
| |
+ with_items:
|
| |
+ - python-arrow
|
| |
+ - python-bleach
|
| |
+ - python-datanommer-models
|
| |
+ - python-decorator
|
| |
+ - python-dogpile-cache
|
| |
+ - python-fedmsg-core
|
| |
+ - python-fedmsg-meta-fedora-infrastructure
|
| |
+ - python-flask
|
| |
+ - python3-flask-oidc
|
| |
+ - python-fmn-lib
|
| |
+ - python-fmn-rules
|
| |
+ - python-gunicorn
|
| |
+ - python-html5lib
|
| |
+ - python-munch
|
| |
+ - python-psycopg2
|
| |
+ - pytz
|
| |
+ - python-sqlalchemy
|
| |
+ - python-markdown
|
| |
+ - python-pkgwat-api
|
| |
+ - python-six
|
| |
+ - python-pygments
|
| |
+ - python-pygments-markdown-lexer
|
| |
+ - python-retask
|
| |
+
|
| |
+ - name: Install packages for datanommer
|
| |
+ dnf: name={{ item }} state=present
|
| |
+ with_items:
|
| |
+ - datanommer-commands
|
| |
+ - fedmsg-hub
|
| |
+ - npm
|
| |
+ - postgresql-server
|
| |
+ - python-datanommer-consumer
|
| |
+ - python-fedmsg-meta-fedora-infrastructure
|
| |
+ - python-psycopg2
|
| |
+
|
| |
+
|
| |
+ # Add various helpful configuration files
|
| |
+ - name: Install a custom bashrc
|
| |
+ copy: src=bashrc dest=/home/{{ ansible_env.SUDO_USER }}/.bashrc
|
| |
+
|
| |
+ - name: Install the message of the day
|
| |
+ copy: src=motd dest=/etc/motd
|
| |
+
|
| |
+
|
| |
+ # Set up Postgres, create the necessary databases, and start up datanommer
|
| |
+ - name: Set up postgresql database
|
| |
+ command: postgresql-setup --initdb
|
| |
+ args:
|
| |
+ creates: /var/lib/pgsql/data/base
|
| |
+
|
| |
+ - name: Set up postgresql access rules to allow local access
|
| |
+ copy:
|
| |
+ src: pg_hba.conf
|
| |
+ dest: /var/lib/pgsql/data/pg_hba.conf
|
| |
+ owner: postgres
|
| |
+ group: postgres
|
| |
+ mode: 0600
|
| |
+ notify: restart postgresql
|
| |
+
|
| |
+ - name: Start and enable postgresql
|
| |
+ service: name=postgresql state=started enabled=yes
|
| |
+
|
| |
+ - name: Set up datanommer DB user
|
| |
+ postgresql_user:
|
| |
+ name: datanommer
|
| |
+ role_attr_flags: SUPERUSER,LOGIN
|
| |
+
|
| |
+ - name: Create datanommer database
|
| |
+ postgresql_db:
|
| |
+ name: datanommer
|
| |
+ owner: datanommer
|
| |
+
|
| |
+ - name: Set up datanommer
|
| |
+ copy: src=datanommer.py dest=/etc/fedmsg.d/datanommer.py
|
| |
+ notify: restart fedmsg-hub
|
| |
+
|
| |
+ # TODO unfortunately this always runs as there doesn't appear to be
|
| |
+ # an easy way to check if it needs to run
|
| |
+ - name: Create datanommer database tables
|
| |
+ command: datanommer-create-db
|
| |
+
|
| |
+ - name: Start and enable fedmsg-hub
|
| |
+ service: name=fedmsg-hub state=started enabled=yes
|
| |
+
|
| |
+
|
| |
+ # Set up the Python development environment
|
| |
+ - name: Install Fedora Hubs requirements.txt into hubs virtualenv
|
| |
+ become_user: "{{ ansible_env.SUDO_USER }}"
|
| |
+ pip:
|
| |
+ requirements: /home/{{ ansible_env.SUDO_USER }}/devel/requirements.txt
|
| |
+ virtualenv: /home/{{ ansible_env.SUDO_USER }}/.virtualenvs/hubs/
|
| |
+
|
| |
+ - name: Install Fedora Hubs test-requirements.txt into hubs virtualenv
|
| |
+ become_user: "{{ ansible_env.SUDO_USER }}"
|
| |
+ pip:
|
| |
+ requirements: /home/{{ ansible_env.SUDO_USER }}/devel/requirements.txt
|
| |
+ virtualenv: /home/{{ ansible_env.SUDO_USER }}/.virtualenvs/hubs/
|
| |
+
|
| |
+ - name: Install bleach into hubs virtualenv
|
| |
+ become_user: "{{ ansible_env.SUDO_USER }}"
|
| |
+ pip:
|
| |
+ name: bleach
|
| |
+ virtualenv: /home/{{ ansible_env.SUDO_USER }}/.virtualenvs/hubs/
|
| |
+
|
| |
+ - name: Install gunicorn into hubs virtualenv
|
| |
+ become_user: "{{ ansible_env.SUDO_USER }}"
|
| |
+ pip:
|
| |
+ name: gunicorn
|
| |
+ virtualenv: /home/{{ ansible_env.SUDO_USER }}/.virtualenvs/hubs/
|
| |
+
|
| |
+ - name: Update httplib2 trust store
|
| |
+ copy:
|
| |
+ src: /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
|
| |
+ dest: /home/{{ ansible_env.SUDO_USER }}/.virtualenvs/hubs/lib/python2.7/site-packages/httplib2/cacerts.txt
|
| |
+ remote_src: True
|
| |
+
|
| |
+ - name: Add a basic Hubs configuration file
|
| |
+ copy: src=hubs_config dest=/home/{{ ansible_env.SUDO_USER }}/devel/config
|
| |
+ become_user: "{{ ansible_env.SUDO_USER }}"
|
| |
+
|
| |
+ - name: Configure application to authenticate with iddev.fedorainfracloud.org
|
| |
+ shell: >
|
| |
+ source ~/.bashrc &&
|
| |
+ workon hubs &&
|
| |
+ oidc-register https://iddev.fedorainfracloud.org/ http://localhost:5000
|
| |
+ become_user: "{{ ansible_env.SUDO_USER }}"
|
| |
+ args:
|
| |
+ creates: client_secrets.json
|
| |
+ chdir: "/home/{{ ansible_env.SUDO_USER }}/devel/"
|
| |
+
|
| |
+ - name: Populate the Fedora Hubs database
|
| |
+ shell: >
|
| |
+ source ~/.bashrc &&
|
| |
+ workon hubs &&
|
| |
+ python populate.py
|
| |
+ become_user: "{{ ansible_env.SUDO_USER }}"
|
| |
+ args:
|
| |
+ creates: /var/tmp/hubs.db
|
| |
+ chdir: "/home/{{ ansible_env.SUDO_USER }}/devel/"
|
| |
+
|
| |
+ # Set up JavaScript requirements
|
| |
+ - name: Install npm packages
|
| |
+ command: npm install
|
| |
+ become_user: "{{ ansible_env.SUDO_USER }}"
|
| |
+ args:
|
| |
+ creates: node_modules
|
| |
+ chdir: /home/{{ ansible_env.SUDO_USER }}/devel/hubs/static/client
|
| |
+
|
| |
+ - name: Build JavaScript assests
|
| |
+ command: node_modules/.bin/webpack
|
| |
+ become_user: "{{ ansible_env.SUDO_USER }}"
|
| |
+ args:
|
| |
+ chdir: /home/{{ ansible_env.SUDO_USER }}/devel/hubs/static/client
|
| |
This is a first pass at a Vagrantfile and Ansible role to automate the
setup of a development environment. Ths Ansible role is not quite
complete and there are a few manual steps required after
vagrant up
which are noted in the VMs message of the day. This also adds a basic
dev guide document which, at the moment, only includes Vagrant
instructions. I plan to organize the documentation and update the README
in a separate commit.
closes #254
Signed-off-by: Jeremy Cline jeremy@jcline.org