-
Notifications
You must be signed in to change notification settings - Fork 0
/
pre-requirments.yml
99 lines (82 loc) · 3.11 KB
/
pre-requirments.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
87
88
89
90
91
92
93
94
95
96
97
98
99
---
# - hosts: openstack
# remote_user: root
# gather_facts: True
# become: yes
# tasks:
- name: "install NTP Server"
yum: name=ntp state=present
- service: name=ntpd state=started enabled=yes
- name: "Verify NTP Server"
command: ntpq -p
register: ntpq
- debug: var=ntpq.stdout_lines
- name: "Install openstack-ocata repo"
yum: name=centos-release-openstack-ocata state=present
- lineinfile: path=/etc/yum.repos.d/CentOS-OpenStack-ocata.repo regexp='^enabled=1' line='enabled=0'
- name: "Install MariaDB-Server"
yum: name={{ item }} enablerepo=centos-openstack-ocata state=present
with_items:
- MySQL-python
- mariadb-server
- name: "maraiadb configuration"
lineinfile: dest=/etc/my.cnf
line={{ item.line }}
insertafter={{ item.insertafter }}
with_items:
- { line: "character-set-server=utf8", insertafter: '^\[mysqld\]' }
- { line: "max_connection=4096", insertafter: '^\[mysqld\]' }
- name: Start MySQL service
sudo: yes
service: name=mariadb state=started enabled=yes
- name: update mysql root password for all root accounts
mysql_user: name=root host={{ item }} password=admin
with_items:
- 127.0.0.1
- ::1
- localhost
# - name: mysql_secure_installation Command Test
# expect:
# command: mysql_secure_installation
# responses:
# 'Enter current password for root \(enter for none\):': "\n"
# 'Set root password? [Y/n]:': 'y'
# 'New password:': 'admin'
# 'Re-enter new password:': 'admin'
# 'Remove anonymous users? [Y/n]:': 'y'
# 'Disallow root login remotely? [Y/n]:': 'y'
# 'Remove test database and access to it? [Y/n]:': 'y'
# 'Reload privilege tables now? [Y/n]:': 'y'
#
# echo: yes
- name: copy .my.cnf file with root password credentials
template: src=my.cnf.j2 dest=/root/.my.cnf owner=root mode=0600
# - name: delete anonymous MySQL server user for server_hostname
# action: mysql_user user="" host={{ ansible_host }} state=absent
# tags: delete
- name: delete anonymous MySQL server user for localhost
action: mysql_user user="" state="absent"
- name: remove the MySQL test database
action: mysql_db db=test state=absent
- yum: name=epel-release state=present
- name: "Install basic tools"
yum: name={{ item }} state=present
with_items:
- vim
- emacs
- htop
- lshw
- wget
- name: "Install RabbitMQ and Memcached"
yum: name={{ item }} enablerepo=epel state=present
with_items:
- rabbitmq-server
- memcached
- name: Start MySQL service
sudo: yes
service: name={{ item }} state=started enabled=yes
with_items:
- rabbitmq-server
- memcached
- name: "add openstack user (set any password you like for password)"
script: rabbitmqctl.sh