-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathos-infra.yml
86 lines (70 loc) · 2.58 KB
/
os-infra.yml
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
---
- hosts: [openstack]
# remote_user: root
tags:
all_hosts
tasks:
- name: "Install chrony(ntp) and add-apt-repository"
apt: name="{{ item }}" update_cache=yes state=latest
with_items:
- chrony
- software-properties-common
- name: "add apt repository"
command: add-apt-repository -y cloud-archive:liberty
- name: "upgrade packages"
apt: update_cache=yes upgrade=dist state=latest
- name: "install python-osclient"
apt: name="python-openstackclient" state=latest
- name: "write conf files"
template: src=./templates/chrony.conf.j2 dest=/etc/chrony/chrony.conf
notify:
- "restart services"
- name: "copy hosts file"
template: src=./templates/hosts.j2 dest=/etc/hosts
tags:
- multi-host
handlers:
- name: "restart services"
service: name=chrony enabled=yes state=restarted
- hosts: [os_controllers]
# remote_user: root
tasks:
- name: "set mariadb root password"
debconf: name="mariadb-server-5.5" question="{{ item }}" vtype="password" value="{{ mariadb_root_pass }}"
with_items:
- mysql-server/root_password
- mysql-server/root_password_again
- name: "Install SQL database"
apt: name="{{ item }}" update_cache=yes state=latest
with_items:
- mariadb-server
- python-pymysql
- python-mysqldb
- name: "Delete anonymous MariaDB user for localhost"
mysql_user: user="" state="absent" login_password="{{ mariadb_root_pass }}" login_user=root
- name: "Secure the MySQL root user"
mysql_user: user="root" password="{{ mariadb_root_pass }}" host="{{ item }}" login_user=root login_password="{{mariadb_root_pass}}"
with_items:
- 127.0.0.1
- localhost
- ::1
- "{{ ansible_hostname }}"
- name: "Remove the test database"
mysql_db: db=test state=absent login_user=root login_password="{{ mariadb_root_pass }}"
- name: "write Mysql conf files"
template: src=./templates/mysqld_openstack.cnf.j2 dest=/etc/mysql/conf.d/mysqld_openstack.cnf
notify:
- "restart services"
- name: "Install rabbitmq"
apt: name="rabbitmq-server" state=latest
- name: "Add rabbitmq user"
rabbitmq_user: user={{ rabbitmq_user }}
password={{ rabbitmq_pass }}
vhost=/
configure_priv=.*
read_priv=.*
write_priv=.*
state=present
handlers:
- name: "restart services"
service: name=mysql enabled=yes state=restarted