ansible/playbooks/hosts/communityblog.fedorainfracloud.org.yml
2019-03-19 16:03:18 +00:00

80 lines
2.2 KiB
YAML

- name: check/create instance
hosts: communityblog.fedorainfracloud.org
gather_facts: False
vars_files:
- /srv/web/infra/ansible/vars/global.yml
- /srv/private/ansible/vars.yml
- /srv/web/infra/ansible/vars/fedora-cloud.yml
- /srv/private/ansible/files/openstack/passwords.yml
tasks:
- import_tasks: "{{ tasks_path }}/persistent_cloud.yml"
handlers:
- import_tasks: "{{ handlers_path }}/restart_services.yml"
- name: setup all the things
hosts: communityblog.fedorainfracloud.org
gather_facts: True
vars_files:
- /srv/web/infra/ansible/vars/global.yml
- /srv/private/ansible/vars.yml
- /srv/private/ansible/files/openstack/passwords.yml
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
pre_tasks:
- import_tasks: "{{ tasks_path }}/cloud_setup_basic.yml"
- name: set hostname (required by some services, at least postfix need it)
hostname: name="{{inventory_hostname}}"
tasks:
- name: add packages
package: state=present name={{ item }}
with_items:
- httpd
- php
- php-mysql
- mariadb-server
- mariadb
- mod_ssl
- php-mcrypt
- php-mbstring
- wget
- unzip
- postfix
- wordpress
- git
- name: enable httpd service
service: name=httpd enabled=yes state=started
- name: configure postfix for ipv4 only
raw: postconf -e inet_protocols=ipv4
- name: enable local postfix service
service: name=postfix enabled=yes state=started
- name: clone (or update) community blog theme
git: repo=https://pagure.io/communityblog-theme.git dest=/usr/share/wordpress/wp-content/themes/community-theme-git
- name: ensure symlink exists for theme
file: src=/usr/share/wordpress/wp-content/themes/community-theme-git/community-theme dest=/usr/share/wordpress/wp-content/themes/communityblog-theme-0.02 state=link
roles:
- basessh
- nagios_client
- mariadb_server
post_tasks:
- name: create databaseuser
mysql_user: name=commbloguser
host=localhost
state=present
password="{{ communityblog_db_password }}"
priv="wp.*:ALL"
- name: Wordpress cron
cron: name="Wordpress cron"
minute="*/10"
job="curl http://localhost:8008/wp-cron.php >/dev/null"