forked from timurfeltin/terraform-ansible-wordpress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplaybook.yaml
99 lines (81 loc) · 3.11 KB
/
playbook.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
---
- hosts: all
become: true
tasks:
- name: Install aptitude using apt
apt: name=aptitude state=latest update_cache=yes force_apt_get=yes
- name: Install required system packages
apt: name={{ item }} state=latest update_cache=yes
loop: [ 'apt-transport-https', 'ca-certificates', 'curl', 'software-properties-common','python3-pip', 'python3-setuptools', 'virtualenv']
- name: Add Docker GPG apt Key
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: Add Docker Repository
apt_repository:
repo: deb https://download.docker.com/linux/ubuntu focal stable
state: present
- name: Update apt and install docker-ce
apt: update_cache=yes name=docker-ce state=latest
- name: Install Docker Module for Python
pip:
name: docker
- name: Add remote "ubuntu" user to "docker" group
remote_user: ubuntu
user:
name: "ubuntu"
group: "docker"
append: yes
tags:
- docker
- name: Install docker-compose
apt:
name: docker-compose
state: present
update_cache: yes
tags:
- docker
- name: Create docker/wordpress directory
file:
path: /opt/docker/wordpress
state: directory
owner: root
group: root
mode: 0755
- name: Create docker-compose file
template:
src: docker-compose.yml.j2
dest: /opt/docker/wordpress/docker-compose.yml
owner: root
group: root
mode: 0644
- name: Create docker/nginx-conf directory
file:
path: /opt/docker/wordpress/nginx-conf
state: directory
owner: root
group: root
mode: 0755
- name: Create nginx.conf file
template:
src: nginx.conf.j2
dest: /opt/docker/wordpress/nginx-conf/nginx.conf
owner: root
group: root
mode: 0644
- name: Create and start services
community.general.docker_compose:
project_src: /opt/docker/wordpress
- name: Let the docker containers start
pause:
minutes: 1
- name: Set up Wordpress using CLI
command: docker run -it --rm --volumes-from wordpress --network container:wordpress wordpress:cli wp core install --url="http://{{ public_dns }}" --title="test website" --admin_user=admin [email protected]
register: wpinstall
- name: Installing Plugin Simple History
command: docker run -it --rm --volumes-from wordpress --network container:wordpress wordpress:cli wp plugin install simple-history --activate
- name: Installing plugin Cloudimage - Responsive Images as a Service
command: docker run -it --rm --volumes-from wordpress --network container:wordpress wordpress:cli wp plugin install cloudimage --activate
- name: Installing plugin Reviews and Rating - Google Business
command: docker run -it --rm --volumes-from wordpress --network container:wordpress wordpress:cli wp plugin install g-business-reviews-rating --activate
- debug: "msg={{ wpinstall.stdout_lines[1] }}"