mirror of
https://github.com/Aviortheking/Blog_IMIE.git
synced 2025-04-23 03:12:11 +00:00
Add ansible files
This commit is contained in:
parent
a2459d3648
commit
5e9162060b
65
ops/ansible/apache2-debian.yml
Normal file
65
ops/ansible/apache2-debian.yml
Normal file
@ -0,0 +1,65 @@
|
||||
---
|
||||
- hosts: hifive
|
||||
become: yes
|
||||
become_user: root
|
||||
vars:
|
||||
http_port: 80
|
||||
domain: example.com
|
||||
tasks:
|
||||
- name: Install apache2
|
||||
apt:
|
||||
pkg:
|
||||
- apache2
|
||||
- python-passlib
|
||||
state: present
|
||||
|
||||
- name: Permissions apache2
|
||||
file:
|
||||
path: /etc/apache2
|
||||
owner: www-data
|
||||
group: www-data
|
||||
recurse: yes
|
||||
|
||||
- name: Permissions www
|
||||
file:
|
||||
path: /var/www
|
||||
owner: www-data
|
||||
group: www-data
|
||||
recurse: yes
|
||||
|
||||
- name: Start service httpd, if not started
|
||||
service:
|
||||
name: apache2
|
||||
state: started
|
||||
|
||||
- name: Enable service apache2, and not touch the state
|
||||
service:
|
||||
name: apache2
|
||||
enabled: yes
|
||||
|
||||
- name: Enable mod_rewrite
|
||||
apache2_module:
|
||||
name: rewrite
|
||||
state: present
|
||||
|
||||
- htpasswd:
|
||||
path: /etc/apache2/.htpasswd
|
||||
name: hifive
|
||||
password: hifive
|
||||
owner: root
|
||||
group: www-data
|
||||
mode: 0640
|
||||
|
||||
- name: Create virtual host file
|
||||
template:
|
||||
src: virtualhost.j2
|
||||
dest: /etc/apache2/sites-available/{{ domain }}.conf
|
||||
force: yes
|
||||
|
||||
- name: a2ensite {{ domain }}
|
||||
command: a2ensite {{ domain }}
|
||||
|
||||
- name: Reload service apache2
|
||||
service:
|
||||
name: apache2
|
||||
state: reloaded
|
25
ops/ansible/mariadb-debian.yml
Normal file
25
ops/ansible/mariadb-debian.yml
Normal file
@ -0,0 +1,25 @@
|
||||
---
|
||||
- hosts: hifive
|
||||
become: yes
|
||||
become_user: root
|
||||
tasks:
|
||||
- name: install mariadb
|
||||
apt:
|
||||
pkg:
|
||||
- mariadb-server
|
||||
- mariadb-client
|
||||
- mariadb-common
|
||||
- python-mysqldb
|
||||
state: present
|
||||
|
||||
- name: Create a new user bob
|
||||
mysql_user:
|
||||
name: bob
|
||||
password: bob
|
||||
priv: '*.*:ALL'
|
||||
state: present
|
||||
|
||||
- name: Create a new database bobdata
|
||||
mysql_db:
|
||||
name: bobdata
|
||||
state: present
|
0
ops/ansible/master.yml
Normal file
0
ops/ansible/master.yml
Normal file
25
ops/ansible/php7.0-debian.yml
Normal file
25
ops/ansible/php7.0-debian.yml
Normal file
@ -0,0 +1,25 @@
|
||||
---
|
||||
- hosts: hifive
|
||||
become: yes
|
||||
become_user: root
|
||||
tasks:
|
||||
- name: install php7
|
||||
apt:
|
||||
pkg:
|
||||
- php7.0
|
||||
- libapache2-mod-php7.0
|
||||
- php7.0-mysql
|
||||
- php7.0-curl
|
||||
- php7.0-json
|
||||
- php7.0-gd
|
||||
- php7.0-mcrypt
|
||||
- php7.0-msgpack
|
||||
- php7.0-memcached
|
||||
- php7.0-intl
|
||||
- php7.0-sqlite3
|
||||
- php7.0-gmp
|
||||
- php7.0-geoip
|
||||
- php7.0-mbstring
|
||||
- php7.0-xml
|
||||
- php7.0-zip
|
||||
state: present
|
38
ops/ansible/roles/README.md
Normal file
38
ops/ansible/roles/README.md
Normal file
@ -0,0 +1,38 @@
|
||||
Role Name
|
||||
=========
|
||||
|
||||
A brief description of the role goes here.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||
|
||||
- hosts: servers
|
||||
roles:
|
||||
- { role: username.rolename, x: 42 }
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
BSD
|
||||
|
||||
Author Information
|
||||
------------------
|
||||
|
||||
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
|
2
ops/ansible/roles/defaults/main.yml
Normal file
2
ops/ansible/roles/defaults/main.yml
Normal file
@ -0,0 +1,2 @@
|
||||
---
|
||||
# defaults file for roles
|
2
ops/ansible/roles/handlers/main.yml
Normal file
2
ops/ansible/roles/handlers/main.yml
Normal file
@ -0,0 +1,2 @@
|
||||
---
|
||||
# handlers file for roles
|
60
ops/ansible/roles/meta/main.yml
Normal file
60
ops/ansible/roles/meta/main.yml
Normal file
@ -0,0 +1,60 @@
|
||||
galaxy_info:
|
||||
author: your name
|
||||
description: your description
|
||||
company: your company (optional)
|
||||
|
||||
# If the issue tracker for your role is not on github, uncomment the
|
||||
# next line and provide a value
|
||||
# issue_tracker_url: http://example.com/issue/tracker
|
||||
|
||||
# Some suggested licenses:
|
||||
# - BSD (default)
|
||||
# - MIT
|
||||
# - GPLv2
|
||||
# - GPLv3
|
||||
# - Apache
|
||||
# - CC-BY
|
||||
license: license (GPLv2, CC-BY, etc)
|
||||
|
||||
min_ansible_version: 2.4
|
||||
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
# min_ansible_container_version:
|
||||
|
||||
# Optionally specify the branch Galaxy will use when accessing the GitHub
|
||||
# repo for this role. During role install, if no tags are available,
|
||||
# Galaxy will use this branch. During import Galaxy will access files on
|
||||
# this branch. If Travis integration is configured, only notifications for this
|
||||
# branch will be accepted. Otherwise, in all cases, the repo's default branch
|
||||
# (usually master) will be used.
|
||||
#github_branch:
|
||||
|
||||
#
|
||||
# Provide a list of supported platforms, and for each platform a list of versions.
|
||||
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
|
||||
# To view available platforms and versions (or releases), visit:
|
||||
# https://galaxy.ansible.com/api/v1/platforms/
|
||||
#
|
||||
# platforms:
|
||||
# - name: Fedora
|
||||
# versions:
|
||||
# - all
|
||||
# - 25
|
||||
# - name: SomePlatform
|
||||
# versions:
|
||||
# - all
|
||||
# - 1.0
|
||||
# - 7
|
||||
# - 99.99
|
||||
|
||||
galaxy_tags: []
|
||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||
# remove the '[]' above, if you add tags to this list.
|
||||
#
|
||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||
# Maximum 20 tags per role.
|
||||
|
||||
dependencies: []
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
2
ops/ansible/roles/tasks/main.yml
Normal file
2
ops/ansible/roles/tasks/main.yml
Normal file
@ -0,0 +1,2 @@
|
||||
---
|
||||
# tasks file for roles
|
17
ops/ansible/roles/templates/virtualhost.j2
Normal file
17
ops/ansible/roles/templates/virtualhost.j2
Normal file
@ -0,0 +1,17 @@
|
||||
<VirtualHost *:{{ http_port }}>
|
||||
ServerAdmin webmaster@{{ domain }}
|
||||
ServerName {{ domain }}
|
||||
ServerAlias www.{{ domain }}
|
||||
|
||||
DocumentRoot /var/www/{{ domain }}
|
||||
|
||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||
|
||||
<Directory "/var/www/{{ domain }}">
|
||||
AuthType Basic
|
||||
AuthName "Restricted Content"
|
||||
AuthUserFile /etc/apache2/.htpasswd
|
||||
Require valid-user
|
||||
</Directory>
|
||||
</VirtualHost>
|
2
ops/ansible/roles/tests/inventory
Normal file
2
ops/ansible/roles/tests/inventory
Normal file
@ -0,0 +1,2 @@
|
||||
localhost
|
||||
|
5
ops/ansible/roles/tests/test.yml
Normal file
5
ops/ansible/roles/tests/test.yml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- roles
|
2
ops/ansible/roles/vars/main.yml
Normal file
2
ops/ansible/roles/vars/main.yml
Normal file
@ -0,0 +1,2 @@
|
||||
---
|
||||
# vars file for roles
|
Loading…
x
Reference in New Issue
Block a user