๋ฐ์ํ
250x250
Notice
Recent Posts
Recent Comments
Link
์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
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 |
Tags
- ์ฑ๊ธ์๋ฒ
- ํ๋ก์์ฝ์์คํ
- ์๋ผ์คํฑ์์น
- ๋น ๋ฐ์ดํฐ
- HBase
- ๋ฆฌ๋ ์ค RPM
- ํ์ด๋ธ
- hadoop
- ํ๋ก
- airflow
- ์ํ์น ์คํํฌ
- ๋ฐ์ดํฐ๋ถ์์ค์ ๋ฌธ๊ฐ
- kudu
- Apache spark
- LeetCode
- ๋ฆฌ๋ ์ค
- aws ccp
- CLF-C02
- ์ค์๋ธ ์ค์น
- ์คํํฌ
- standalone
- ํด ์ค์น
- ์ค์นผ๋ผ ๋ถ
- elastic stack
- ansible
- ์ค์๋ธ
- BIGDATA
- ํ๋ก์ค์น
- rpmbuild
- ๋ฆฟ์ฝ๋
Archives
- Today
- Total
data_lab
[ansible] mysql ์ค์นํ๊ธฐ ๋ณธ๋ฌธ
ansible ๋๋ ํฐ๋ฆฌ ๊ตฌ์กฐ
- /etc/ansible - ansible ํ
- hosts - ansible inventory ๋ก ์คํฌ๋ฆฝํธ๋ฅผ ๋ ๋ฆด ์๊ฒฉ ์๋ฒ ๋ชจ์
- ansible.cfg - ansible ํ๊ฒฝ ์ค์ ์ผ๋ก sh ์คํ sh,bash ์ผ์ง ์ ํํ๊ฑฐ๋ ansible ๋ก๊ทธ ๋จ๊ธฐ๋ ๋๋ ํฐ๋ฆฌ ์ค์
- roles - ansible ์คํํ playbook ๋ชจ์ (task ๋ชจ์์ด๋ผ๊ณ ์๊ฐํ๋ฉด ๋จ)
- mysql
- tasks - mysql ์ค์นํ๋ task ๋ชจ์
- templates - mysql ์ค์น ํ ํ๊ฒฝ ์ธํ ํ๋ ํ์ผ ๋ชจ์ (ex : my.ini)
- handlers - mysql service ์คํ
- mysql
- example_site.yml - roles์ ์์ฑ๋ tasks ์คํํ ํ์ผ
ํด๋น ์ฝ๋๋ github๋ฅผ ์ฐธ์กฐํ์์
https://github.com/ansible/ansible-examples/tree/master/wordpress-nginx
ansible.cfg ์ค์
** remote ์๋ฒ์ ssh-copy-id๋ก ์ฌ์ ์์ ๋์ด ์์ด์ผ ํ๋ค.
sudo ๊ถํ์ ์ค userid ์์ฑ
1
2
3
4
5
6
|
[defaults]
# some basic default values...
inventory = /etc/ansible/hosts
sudo_user = userId
ask_pass = False
|
cs |
{ANSIBLE_HOME}/roles/mysql/tasks/main.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
---
- name: Install Mysql package
yum: name={{ item }} state=present
with_items:
- http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
- mysql-community-server
- MySQL-python
- libselinux-python
- libsemanage-python
- name: Configure SELinux to start mysql on any port
seboolean: name=mysql_connect_any state=true persistent=yes
when: ansible_selinux.status == "enabled"
- name: Create Mysql configuration file
template: src=my.cnf.j2 dest=/etc/my.cnf
notify:
- restart mysql
- name: Start Mysql Service
service: name=mysqld state=started enabled=yes
|
cs |
{ANSIBLE_HOME}/roles/mysql/templates/my.cnf.j2
1
2
3
4
5
6
7
8
9
10
11
|
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
port=3306
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
|
cs |
{ANSIBLE_HOME}/roles/mysql/handlers/main.yml
1
2
3
|
---
- name: restart mysql
service: name=mysqld state=restarted
|
cs |
{ANSIBLE_HOME}/example_site.yaml
1
2
3
4
5
6
7
8
9
|
---
- name: Install MySQL
hosts: all
remote_user: userId
become: yes
become_method: sudo
roles:
- mysql
|
cs |
{ANSIBLE_HOME}/hosts ์ ์ค์น์คํฌ๋ฆฝํธ๋ฅผ ๋ ๋ฆด ์๊ฒฉ์๋ฒ์ ip๋ฅผ ์ ์ด ์ค๋ค.
ํด๋น ์คํฌ๋ฆฝํธ ์คํ ๋ช ๋ น์ด
1
|
$ ansible-playnook -i hosts example_site.yaml
|
cs |
728x90
๋ฐ์ํ
'LINUX' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฆฌ๋ ์ค] rpm ํ์ผ ๊ฒ์ฆ (0) | 2021.06.30 |
---|---|
[๋ฆฌ๋ ์ค] rpm file build ํ๋ ๋ฐฉ๋ฒ - 2 (0) | 2021.06.30 |
[๋ฆฌ๋ ์ค] rpm file build ํ๋ ๋ฐฉ๋ฒ -1 (0) | 2021.06.30 |
[ansible] ansible-playbook ์ต์ ์ ๋ฆฌ (0) | 2021.06.26 |
[ansible] ansible ์ค์น (0) | 2021.06.14 |