-
Notifications
You must be signed in to change notification settings - Fork 4
Ansible in my pansible #111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| { | ||
| "package": { | ||
| "name": "PostMaster", | ||
| "repo": "PostMaster", | ||
| "subject": "stackfocus", | ||
| "desc": "PostMaster is a beautiful web application to manage domains, users, and aliases on a Linux mail server ", | ||
| "website_url": "https://github.com/StackFocus/PostMaster", | ||
| "issue_tracker_url": "https://github.com/StackFocus/PostMaster/issues", | ||
| "vcs_url": "https://github.com/StackFocus/PostMaster.git", | ||
| "licenses": ["AGPL"], | ||
| "labels": ["Postmaster", "Stackfocus", "Flask"], | ||
| "public_download_numbers": true, | ||
| "public_stats": true | ||
| }, | ||
| "version": { | ||
| "name": "1.0.0", | ||
| "desc": "Abbey Road" | ||
| }, | ||
| "files": | ||
| [ | ||
| {"includePattern": "*.deb" } | ||
| ], | ||
| "publish": true | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,25 @@ | ||
| language: python | ||
| python: | ||
| language: python | ||
| python: | ||
| - "2.7" | ||
| install: | ||
| install: | ||
| - pip install -r requirements.txt | ||
| before_script: | ||
| - ./pylint-check.py | ||
| script: | ||
| script: | ||
| - py.test -v --cov postmaster --cov-report term-missing tests/ | ||
| after_success: | ||
| after_success: | ||
| - coveralls | ||
|
|
||
| before_deploy: | ||
| - gem install fpm | ||
| - ./build_release.sh | ||
|
|
||
| deploy: | ||
| provider: bintray | ||
| file: .bintray_descriptor.json | ||
| user: thatarchguy | ||
| key: | ||
| secure: qoGnfUwsoajFoclGpmhTFj8rP6botEqdXHBOP8xG3EvdNMvF1FNhH6DjhKBF3bwQf7/VEczz/TqVaTsOgrdHJvVLTxYSckM569wbdFLn6/b1MohdBaxu1/mcXXw+RVTjep45cwlzaMQoe3aZn8KPtjfal5Bitc2U2cNepkoaj+nftNGpCZVh1pWI/uQXlKQK/CfzS8mQSKrdsRuBvko88R7Th8otqdSwx+dM+IwtimJsupAhlbpU5XlK01zNn++QVvZ3kkPGWVxRFLlPhDhWWxK/RmTBLZ/HqoE6oyHBsd+e8ydLvVovMjAdagBq4ABXPstSr9/vYfaS9o6RTaqWbt0MFdkUpQdpfUnFARay8rPYJkzkRdqRll5byRh9IHxZc34z+j3lVjbzKRyb0kfeCTDdidULJytWa3SWN4xdCMhyyjjpULsMI1X4RYYtO89Uc85BlD0AQrWCkmJ7rqpUPxkaSfBEuhotTi0PUyUIaU1xLpgtNQFf70Pf3bSEG6W3XDR3vy2k6yiZWWSRAQWSbxTA64DmW0wk/q9ePxso3uqzALYU1M5WflEEnCBkXGFQh8MqAmugHjP7BMjoe+vlJFt5ddoa7yNV14EkvbHY/rb1JVA2Oa4FgVVyt0JOYEnPIvD+NY0VjFHWrOAro3uKHNlOg5nUaMEddwIuKZpoZgo= | ||
| dry-run: true | ||
| on: | ||
| tags: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,22 @@ | ||
| # -*- mode: ruby -*- | ||
| # vi: set ft=ruby : | ||
|
|
||
| $script = <<SCRIPT | ||
| #!/bin/bash | ||
| if [ ! -f /usr/bin/ansible-playbook ]; then | ||
| apt-get update | ||
| apt-get install -y software-properties-common | ||
| apt-add-repository ppa:ansible/ansible | ||
| apt-get update | ||
| apt-get install -y ansible | ||
| fi | ||
|
|
||
| ansible-playbook -i "localhost," -c local /opt/postmaster/git/ops/ansible/site.yml --extra-vars="remote_user=vagrant" --extra-vars="provision_type=dev" | ||
| SCRIPT | ||
|
|
||
| Vagrant.configure(2) do |config| | ||
| config.vm.box = "puphpet/ubuntu1404-x64" | ||
| config.vm.network "forwarded_port", guest: 80, host: 8080 | ||
| config.vm.synced_folder "./", "/opt/postmaster/git" | ||
| config.vm.provision "shell", path: "ops/Vagrant.sh" | ||
| config.vm.box = "puphpet/ubuntu1404-x64" | ||
| config.vm.network "forwarded_port", guest: 8082, host: 8080 | ||
| config.vm.synced_folder "./", "/opt/postmaster/git" | ||
| config.vm.provision "shell", inline: $script | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| #!/bin/bash | ||
| REVISION=`git describe --abbrev=0 --tags | cut -c 2-` | ||
| fpm -s dir -t deb -n "postmaster" -v $REVISION --prefix /opt/postmaster/git --description 'PostMaster is a beautiful web application to manage domains, users, and aliases on a Linux mail server' --url 'https://github.com/StackFocus/PostMaster' --after-install ops/ansible/run_ansible.sh -d git -d python -d python-pip -d python-dev -d python-virtualenv -d libldap2-dev -d libssl-dev -d libsasl2-dev -d libffi-dev -d apache2 -d libapache2-mod-wsgi -d libmysqlclient-dev ./ |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| --- | ||
| remote_user: "postmaster" | ||
| provision_type: "" |
Empty file.
3 changes: 2 additions & 1 deletion
3
ops/apache.conf → ...ster_deploy/files/apache2/postmaster.conf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| --- | ||
| - name: restart nginx | ||
| become: yes | ||
| service: name=nginx state=restarted | ||
|
|
||
| - name: validate nginx configuration | ||
| become: yes | ||
| command: nginx -t -c /etc/nginx/nginx.conf | ||
| changed_when: False | ||
|
|
||
| - name: reload nginx | ||
| become: yes | ||
| service: name=nginx state=reloaded | ||
|
|
||
| - name: reload apache | ||
| become: yes | ||
| service: name=apache2 state=reloaded | ||
|
|
||
| - name: restart apache | ||
| become: yes | ||
| service: name=nginx state=restarted |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| --- | ||
|
|
||
| - name: Create PostMaster User | ||
| user: name={{remote_user}} comment="PostMaster Service Account" | ||
|
|
||
| - name: Install main list of packages | ||
| apt: pkg={{item}} state=installed update_cache=true | ||
| become: yes | ||
| with_items: | ||
| - git | ||
| - python | ||
| - python-pip | ||
| - python-dev | ||
| - python-virtualenv | ||
| - libldap2-dev | ||
| - libssl-dev | ||
| - libsasl2-dev | ||
| - libffi-dev | ||
| - apache2 | ||
| - libapache2-mod-wsgi | ||
| - libmysqlclient-dev | ||
| when: provision_type == "dev" | ||
|
|
||
| - name: Create virtualenv directory | ||
| file: path=/opt/postmaster/env state=directory owner={{remote_user}} group={{remote_user}} mode=0775 recurse=yes | ||
| become: yes | ||
|
|
||
| - name: Create logs directory | ||
| file: path=/opt/postmaster/logs state=directory owner={{remote_user}} group=www-data mode=0775 recurse=yes | ||
| become: yes | ||
|
|
||
| - pip: requirements=/opt/postmaster/git/requirements.txt virtualenv=/opt/postmaster/env | ||
|
|
||
| - include: mysql.yml | ||
| when: provision_type == "dev" | ||
|
|
||
| - name: Enable wsgi module for apache2 | ||
| apache2_module: state=present name=wsgi | ||
|
|
||
| - name: Check whether to copy the apache2 vhost file | ||
| stat: path=/etc/apache2/sites-available/postmaster.conf | ||
| register: apache2_config | ||
|
|
||
| - name: Copy apache2 vhost config over | ||
| become: yes | ||
| copy: src=apache2/postmaster.conf dest=/etc/apache2/sites-available/postmaster.conf mode=0644 | ||
| when: apache2_config.stat.exists == False | ||
|
|
||
| - name: Enable new vhost | ||
| command: a2ensite postmaster.conf | ||
| become: yes | ||
|
|
||
| - name: Ensure apache is started and enabled to start at boot. | ||
| become: yes | ||
| service: name=apache2 state=restarted enabled=yes | ||
|
|
||
| - name: Ensure apache is reloaded | ||
| become: yes | ||
| service: name=apache2 state=reloaded | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| --- | ||
| # mysql setup | ||
|
|
||
| - name: Set MySQL root password before installing | ||
| become: yes | ||
| debconf: name='mysql-server' question='mysql-server/root_password' value='vagrant' vtype='password' | ||
|
|
||
| - name: Confirm MySQL root password before installing | ||
| become: yes | ||
| debconf: name='mysql-server' question='mysql-server/root_password_again' value='vagrant' vtype='password' | ||
|
|
||
| - name: Installing MySQL | ||
| become: yes | ||
| apt: pkg=mysql-server state=latest | ||
|
|
||
| - name: Install mysql-python globally for this next command :( | ||
| pip: name=MySQL-python | ||
| become: yes | ||
|
|
||
| - name: Create default database for mysql | ||
| mysql_db: name=servermail state=present login_user=root login_password=vagrant | ||
|
|
||
| - name: Cleans the migration scripts | ||
| command: /opt/postmaster/env/bin/python /opt/postmaster/git/manage.py clean | ||
| args: | ||
| chdir: /opt/postmaster/git | ||
| removes: /opt/postmaster/git/db | ||
|
|
||
| - name: Migrate tables | ||
| command: /opt/postmaster/env/bin/python /opt/postmaster/git/manage.py createdb | ||
| args: | ||
| chdir: /opt/postmaster/git | ||
| creates: /opt/postmaster/git/db/migrations |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| #!/bin/bash | ||
| ansible-playbook -i "localhost," -c local /opt/postmaster/git/ops/ansible/site.yml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # This playbook deploys the whole application stack in this site. | ||
| - name: install postmaster | ||
| hosts: all | ||
|
|
||
| roles: | ||
| - postmaster_deploy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you reloading when it's restarted just above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because apache2 is fickle :P