Allow usage of Fedora24
This commit adds Fedora 24 image support for the interop challenge tasks. Change-Id: I489b2ebc70fe3de4b20694bbeac0abfa8841c5a8
This commit is contained in:
parent
f945a3ecd2
commit
1458afb4c6
|
@ -1,11 +1,20 @@
|
||||||
---
|
---
|
||||||
- name: Haproxy install
|
- name: Haproxy install
|
||||||
apt:
|
package:
|
||||||
name="{{ item }}"
|
name="{{ item }}"
|
||||||
state=latest
|
state=latest
|
||||||
update_cache=yes
|
update_cache=yes
|
||||||
with_items:
|
with_items:
|
||||||
- haproxy
|
- haproxy
|
||||||
|
when: ansible_distribution == 'Ubuntu'
|
||||||
|
|
||||||
|
- name: Haproxy install
|
||||||
|
package:
|
||||||
|
name="{{ item }}"
|
||||||
|
state=latest
|
||||||
|
with_items:
|
||||||
|
- haproxy
|
||||||
|
when: ansible_distribution == 'Fedora'
|
||||||
|
|
||||||
- name: Enable haproxy service
|
- name: Enable haproxy service
|
||||||
replace:
|
replace:
|
||||||
|
@ -13,6 +22,7 @@
|
||||||
regexp: "ENABLED=0"
|
regexp: "ENABLED=0"
|
||||||
replace: "ENABLED=1"
|
replace: "ENABLED=1"
|
||||||
backup: no
|
backup: no
|
||||||
|
when: ansible_distribution == 'Ubuntu'
|
||||||
|
|
||||||
- name: Place the haproxy configuration file
|
- name: Place the haproxy configuration file
|
||||||
copy:
|
copy:
|
||||||
|
@ -20,6 +30,15 @@
|
||||||
dest: /etc/haproxy/haproxy.cfg
|
dest: /etc/haproxy/haproxy.cfg
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
|
when: ansible_distribution == 'Ubuntu'
|
||||||
|
|
||||||
|
- name: Place the haproxy configuration file
|
||||||
|
copy:
|
||||||
|
src: templates/haproxy_fedora.cfg.j2
|
||||||
|
dest: /etc/haproxy/haproxy.cfg
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
when: ansible_distribution == 'Fedora'
|
||||||
|
|
||||||
- name: Add web servers to the haproxy
|
- name: Add web servers to the haproxy
|
||||||
lineinfile:
|
lineinfile:
|
||||||
|
@ -32,4 +51,3 @@
|
||||||
no_log: True
|
no_log: True
|
||||||
|
|
||||||
- service: name=haproxy state=restarted enabled=yes
|
- service: name=haproxy state=restarted enabled=yes
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
global
|
||||||
|
log /dev/log local0
|
||||||
|
log /dev/log local1 notice
|
||||||
|
chroot /var/lib/haproxy
|
||||||
|
user haproxy
|
||||||
|
group haproxy
|
||||||
|
daemon
|
||||||
|
|
||||||
|
defaults
|
||||||
|
log global
|
||||||
|
mode http
|
||||||
|
option httplog
|
||||||
|
option dontlognull
|
||||||
|
option redispatch
|
||||||
|
retries 3
|
||||||
|
contimeout 5000
|
||||||
|
clitimeout 50000
|
||||||
|
srvtimeout 50000
|
||||||
|
errorfile 400 /usr/share/haproxy/400.http
|
||||||
|
errorfile 403 /usr/share/haproxy/403.http
|
||||||
|
errorfile 408 /usr/share/haproxy/408.http
|
||||||
|
errorfile 500 /usr/share/haproxy/500.http
|
||||||
|
errorfile 502 /usr/share/haproxy/502.http
|
||||||
|
errorfile 503 /usr/share/haproxy/503.http
|
||||||
|
errorfile 504 /usr/share/haproxy/504.http
|
||||||
|
|
||||||
|
listen webfarm
|
||||||
|
bind 0.0.0.0:80
|
||||||
|
mode http
|
||||||
|
stats enable
|
||||||
|
stats uri /haproxy?stats
|
||||||
|
balance roundrobin
|
||||||
|
option httpclose
|
||||||
|
option forwardfor
|
|
@ -0,0 +1,19 @@
|
||||||
|
---
|
||||||
|
- name: Wait until server is up and runnning
|
||||||
|
local_action: wait_for port=22 host="{{ ansible_ssh_host | default(inventory_hostname) }}" search_regex=OpenSSH delay=10
|
||||||
|
become: no
|
||||||
|
|
||||||
|
- name: Check if running on Fedora
|
||||||
|
raw: "[ -f /etc/fedora-release ]"
|
||||||
|
register: fedora_release
|
||||||
|
ignore_errors: yes
|
||||||
|
|
||||||
|
- name: Install python2 for Ansible
|
||||||
|
raw: dnf install -y python2 python2-dnf libselinux-python
|
||||||
|
register: result
|
||||||
|
until: result|success
|
||||||
|
when: fedora_release.rc == 0
|
||||||
|
|
||||||
|
- name: Set SELinux to permisive
|
||||||
|
selinux: policy=targeted state=permissive
|
||||||
|
when: fedora_release.rc == 0
|
|
@ -8,9 +8,17 @@
|
||||||
|
|
||||||
- name: install scsitools
|
- name: install scsitools
|
||||||
package: name=scsitools state=latest
|
package: name=scsitools state=latest
|
||||||
|
when: ansible_distribution == 'Ubuntu'
|
||||||
|
|
||||||
|
- name: install sg3_utils
|
||||||
|
package: name=sg3_utils state=latest
|
||||||
|
when: ansible_distribution == 'Fedora'
|
||||||
|
|
||||||
- shell: /sbin/rescan-scsi-bus
|
- shell: /sbin/rescan-scsi-bus
|
||||||
when: diskflag.stat.exists == false
|
when: diskflag.stat.exists == false and ansible_distribution == 'Ubuntu'
|
||||||
|
|
||||||
|
- shell: /bin/rescan-scsi-bus.sh
|
||||||
|
when: diskflag.stat.exists == false and ansible_distribution == 'Fedora'
|
||||||
|
|
||||||
- shell: parted -s "{{ app_env.block_device_name }}" mklabel msdos
|
- shell: parted -s "{{ app_env.block_device_name }}" mklabel msdos
|
||||||
when: diskflag.stat.exists == false
|
when: diskflag.stat.exists == false
|
||||||
|
@ -36,7 +44,15 @@
|
||||||
file: path=/var/lib/mysql state=directory
|
file: path=/var/lib/mysql state=directory
|
||||||
|
|
||||||
- name: Install NFS server
|
- name: Install NFS server
|
||||||
package: name=nfs-kernel-server state=latest
|
package:
|
||||||
|
name=nfs-kernel-server
|
||||||
|
state=latest
|
||||||
|
update_cache=yes
|
||||||
|
when: ansible_distribution == 'Ubuntu'
|
||||||
|
|
||||||
|
- name: Install NFS server
|
||||||
|
package: name=nfs-utils state=latest
|
||||||
|
when: ansible_distribution == 'Fedora'
|
||||||
|
|
||||||
- name: Setup NFS database access
|
- name: Setup NFS database access
|
||||||
lineinfile:
|
lineinfile:
|
||||||
|
@ -57,6 +73,10 @@
|
||||||
shell: exportfs -a
|
shell: exportfs -a
|
||||||
|
|
||||||
- service: name=nfs-kernel-server state=restarted enabled=yes
|
- service: name=nfs-kernel-server state=restarted enabled=yes
|
||||||
|
when: ansible_distribution == 'Ubuntu'
|
||||||
|
|
||||||
|
- service: name=nfs-server state=restarted enabled=yes
|
||||||
|
when: ansible_distribution == 'Fedora'
|
||||||
|
|
||||||
- name: Mount the database data directory
|
- name: Mount the database data directory
|
||||||
mount:
|
mount:
|
||||||
|
@ -66,12 +86,29 @@
|
||||||
fstype: nfs
|
fstype: nfs
|
||||||
|
|
||||||
- name: Install mysql and libraries
|
- name: Install mysql and libraries
|
||||||
package: name={{ item }} state=latest
|
package:
|
||||||
|
name="{{ item }}"
|
||||||
|
state=latest
|
||||||
|
update_cache=yes
|
||||||
with_items:
|
with_items:
|
||||||
- mysql-server
|
- mysql-server
|
||||||
- python-mysqldb
|
- python-mysqldb
|
||||||
|
when: ansible_distribution == 'Ubuntu'
|
||||||
|
|
||||||
|
- name: Install mysql and libraries
|
||||||
|
package:
|
||||||
|
name="{{ item }}"
|
||||||
|
state=latest
|
||||||
|
with_items:
|
||||||
|
- mariadb-server
|
||||||
|
- python2-mysql
|
||||||
|
when: ansible_distribution == 'Fedora'
|
||||||
|
|
||||||
- service: name=mysql state=stopped enabled=yes
|
- service: name=mysql state=stopped enabled=yes
|
||||||
|
when: ansible_distribution == 'Ubuntu'
|
||||||
|
|
||||||
|
- service: name=mariadb state=stopped enabled=yes
|
||||||
|
when: ansible_distribution == 'Fedora'
|
||||||
|
|
||||||
- stat: path=/etc/mysql/my.cnf
|
- stat: path=/etc/mysql/my.cnf
|
||||||
register: mysqlflag
|
register: mysqlflag
|
||||||
|
@ -90,12 +127,26 @@
|
||||||
- name: Configure mysql 5.6+
|
- name: Configure mysql 5.6+
|
||||||
replace:
|
replace:
|
||||||
dest: "/etc/mysql/mysql.conf.d/mysqld.cnf"
|
dest: "/etc/mysql/mysql.conf.d/mysqld.cnf"
|
||||||
regexp: '^bind-address[ \t]*=[ ]*127\.0\.0\.1'
|
|
||||||
replace: "bind-address = {{ local_ip.stdout }}"
|
replace: "bind-address = {{ local_ip.stdout }}"
|
||||||
backup: no
|
backup: no
|
||||||
when: mysqlflag.stat.exists == true
|
when: mysqlflag.stat.exists == true
|
||||||
|
|
||||||
|
- stat: path=/etc/my.cnf
|
||||||
|
register: mariadbflag
|
||||||
|
|
||||||
|
- name: Configure MariaDB 10.1
|
||||||
|
ini_file:
|
||||||
|
dest=/etc/my.cnf
|
||||||
|
section=mysqld
|
||||||
|
option=bind-address
|
||||||
|
value={{ local_ip.stdout }}
|
||||||
|
when: mariadbflag.stat.exists == true
|
||||||
|
|
||||||
- service: name=mysql state=started enabled=yes
|
- service: name=mysql state=started enabled=yes
|
||||||
|
when: ansible_distribution == 'Ubuntu'
|
||||||
|
|
||||||
|
- service: name=mariadb state=started enabled=yes
|
||||||
|
when: ansible_distribution == 'Fedora'
|
||||||
|
|
||||||
- name: create wordpress database
|
- name: create wordpress database
|
||||||
mysql_db:
|
mysql_db:
|
||||||
|
@ -111,4 +162,3 @@
|
||||||
host: "%"
|
host: "%"
|
||||||
priv: 'decision2016.*:ALL'
|
priv: 'decision2016.*:ALL'
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
- name: Apache and php 5
|
- name: Apache and php 5
|
||||||
apt:
|
package:
|
||||||
name="{{ item }}"
|
name="{{ item }}"
|
||||||
state=latest
|
state=latest
|
||||||
update_cache=yes
|
update_cache=yes
|
||||||
|
@ -11,6 +11,20 @@
|
||||||
- nfs-common
|
- nfs-common
|
||||||
- unzip
|
- unzip
|
||||||
- ssmtp
|
- ssmtp
|
||||||
|
when: ansible_distribution == 'Ubuntu'
|
||||||
|
|
||||||
|
- name: Apache and php 5
|
||||||
|
package:
|
||||||
|
name="{{ item }}"
|
||||||
|
state=latest
|
||||||
|
with_items:
|
||||||
|
- httpd
|
||||||
|
- php
|
||||||
|
- php-mysqlnd
|
||||||
|
- nfs-utils
|
||||||
|
- unzip
|
||||||
|
- ssmtp
|
||||||
|
when: ansible_distribution == 'Fedora'
|
||||||
|
|
||||||
- shell: rm -rf /var/www/html/index.html
|
- shell: rm -rf /var/www/html/index.html
|
||||||
args:
|
args:
|
||||||
|
@ -22,6 +36,15 @@
|
||||||
state: directory
|
state: directory
|
||||||
owner: www-data
|
owner: www-data
|
||||||
group: www-data
|
group: www-data
|
||||||
|
when: ansible_distribution == 'Ubuntu'
|
||||||
|
|
||||||
|
- name: Creates share directory for wpcontent
|
||||||
|
file:
|
||||||
|
path: /var/www/html/wp-content/uploads
|
||||||
|
state: directory
|
||||||
|
owner: apache
|
||||||
|
group: apache
|
||||||
|
when: ansible_distribution == 'Fedora'
|
||||||
|
|
||||||
- name: Mount the directory using private IP
|
- name: Mount the directory using private IP
|
||||||
mount:
|
mount:
|
||||||
|
@ -40,6 +63,10 @@
|
||||||
when: hostvars.cloud.database.openstack.private_v4 == ""
|
when: hostvars.cloud.database.openstack.private_v4 == ""
|
||||||
|
|
||||||
- lineinfile: dest=/etc/apache2/apache2.conf line="ServerName localhost"
|
- lineinfile: dest=/etc/apache2/apache2.conf line="ServerName localhost"
|
||||||
|
when: ansible_distribution == 'Ubuntu'
|
||||||
|
|
||||||
|
- lineinfile: dest=/etc/httpd/conf/httpd.conf line="ServerName localhost"
|
||||||
|
when: ansible_distribution == 'Fedora'
|
||||||
|
|
||||||
- name: Download wordpress
|
- name: Download wordpress
|
||||||
get_url:
|
get_url:
|
||||||
|
@ -87,8 +114,19 @@
|
||||||
shell: chown -R www-data:www-data /var/www/html
|
shell: chown -R www-data:www-data /var/www/html
|
||||||
args:
|
args:
|
||||||
warn: no
|
warn: no
|
||||||
|
when: ansible_distribution == 'Ubuntu'
|
||||||
|
|
||||||
|
- name: Change ownership of wordpress
|
||||||
|
shell: chown -R apache:apache /var/www/html
|
||||||
|
args:
|
||||||
|
warn: no
|
||||||
|
when: ansible_distribution == 'Fedora'
|
||||||
|
|
||||||
- service: name=apache2 state=restarted enabled=yes
|
- service: name=apache2 state=restarted enabled=yes
|
||||||
|
when: ansible_distribution == 'Ubuntu'
|
||||||
|
|
||||||
|
- service: name=httpd state=restarted enabled=yes
|
||||||
|
when: ansible_distribution == 'Fedora'
|
||||||
|
|
||||||
- name: Install wordpress command line tool
|
- name: Install wordpress command line tool
|
||||||
get_url:
|
get_url:
|
||||||
|
|
|
@ -36,6 +36,24 @@
|
||||||
plugin install /tmp/wordpress-importer.zip --activate
|
plugin install /tmp/wordpress-importer.zip --activate
|
||||||
args:
|
args:
|
||||||
warn: no
|
warn: no
|
||||||
|
when: ansible_distribution == 'Ubuntu'
|
||||||
|
|
||||||
|
- name: Install wordpress importer plugin
|
||||||
|
shell: >
|
||||||
|
sudo -u apache /usr/local/bin/wp --path=/var/www/html
|
||||||
|
plugin install /tmp/wordpress-importer.zip
|
||||||
|
args:
|
||||||
|
warn: no
|
||||||
|
when: ansible_distribution == 'Fedora'
|
||||||
|
|
||||||
|
- name: Enable wordpress importer plugin
|
||||||
|
shell: >
|
||||||
|
sudo -u apache /usr/local/bin/wp --path=/var/www/html
|
||||||
|
plugin activate wordpress-importer
|
||||||
|
args:
|
||||||
|
warn: no
|
||||||
|
when: ansible_distribution == 'Fedora'
|
||||||
|
|
||||||
|
|
||||||
- name: Download wordpress sample posts
|
- name: Download wordpress sample posts
|
||||||
get_url:
|
get_url:
|
||||||
|
@ -52,3 +70,10 @@
|
||||||
shell: >
|
shell: >
|
||||||
sudo -u www-data wp --path=/var/www/html
|
sudo -u www-data wp --path=/var/www/html
|
||||||
import /tmp/posts/*.xml --authors=create --quiet
|
import /tmp/posts/*.xml --authors=create --quiet
|
||||||
|
when: ansible_distribution == 'Ubuntu'
|
||||||
|
|
||||||
|
- name: Import wordpress posts
|
||||||
|
shell: >
|
||||||
|
sudo -u apache /usr/local/bin/wp --path=/var/www/html
|
||||||
|
import /tmp/posts/*.xml --authors=create --quiet
|
||||||
|
when: ansible_distribution == 'Fedora'
|
||||||
|
|
|
@ -7,6 +7,18 @@
|
||||||
roles:
|
roles:
|
||||||
- "{{ action }}"
|
- "{{ action }}"
|
||||||
|
|
||||||
|
- name: Install python2 for ansible to work
|
||||||
|
hosts: dbservers, webservers, balancers, wps
|
||||||
|
gather_facts: false
|
||||||
|
user: "{{ app_env.ssh_user }}"
|
||||||
|
become: true
|
||||||
|
become_user: root
|
||||||
|
vars_files:
|
||||||
|
- "vars/{{ env }}.yml"
|
||||||
|
roles:
|
||||||
|
- common
|
||||||
|
environment: "{{ proxy_env }}"
|
||||||
|
|
||||||
- name: setup database
|
- name: setup database
|
||||||
hosts: dbservers
|
hosts: dbservers
|
||||||
user: "{{ app_env.ssh_user }}"
|
user: "{{ app_env.ssh_user }}"
|
||||||
|
|
Loading…
Reference in New Issue