-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotes.txt
More file actions
154 lines (125 loc) · 4.07 KB
/
notes.txt
File metadata and controls
154 lines (125 loc) · 4.07 KB
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
dnf --disablerepo '*' --enablerepo=extras swap centos-linux-repos centos-stream-repos
dnf distro-sync
reboot
ssh-keygen -t rsa
ssh-copy-id 192.168.5.73
ssh 192.168.5.73
copy cat ~/.ssh/id_rsa.pub to ~/.ssh/authorized_keys
and then ssh as root
ansible prod -m setup
touch roles/{r1,r2}/{tasks,handlers}/main.yml
ansible-playbook mproj.yml
ansible-playbook mproj.yml -e
ansible all -i 192.168.5.73, -m file -a "path=/file1 state=absent"
ansible all -i 192.168.5.73, -m yum -a "name=openssh state=latest"
ansible-playbook mproj.yml -e "x=no"
galera mariadb IP
centos-02 192.168.5.42
centos-03 192.168.5.46
ubuntu http://192.168.5.122/
-----------
sudo dnf install MariaDB-server
sudo systemctl start mariadb
firewall-cmd --permanent --zone=public --add-port=3306/tcp
firewall-cmd --permanent --zone=public --add-port=4444/tcp
firewall-cmd --permanent --zone=public --add-port=4567/tcp
firewall-cmd --permanent --zone=public --add-port=4567/udp
firewall-cmd --permanent --zone=public --add-port=4568/tcp
firewall-cmd --reload
firewall-cmd --list-all
setenforce 0
/etc/my.cnf.d/galera.cnf
[mysqld]
binlog_format=ROW
default_storage_engine=innodb
innodb_autoinc_lock_mode=2
bind-address=0.0.0.0
#Galera provider config
wsrep_on=ON
wsrep_provider=/usr/lib64/galera-4/libgalera_smm.so
#galera cluster config
wsrep_cluster_name="test_cluster"
wsrep_cluster_address="gcomm://192.168.5.73,192.168.5.234"
#galera sync
wsrep_sst_method=rsync
#galera node config
wsrep_node_name="db2.mydomain.org"
wsrep_node_address="192.168.5.234"
setsebool -P nis_enabled 1
systemctl stop mariadb
/var/lib/mysql/grastate.dat file and change safe_to_bootstrap to 1.
galera_new_cluster
systemctl start mariadb
mysql -uroot
CREATE USER 'appuser'@'%' IDENTIFIED BY 'appuser';
GRANT ALL PRIVILEGES ON *.* TO 'appuser'@'%';
flush privileges;
SHOW GLOBAL STATUS LIKE 'wsrep_cluster_size';
CREATE database my_db;
---------------
apt-get install nginx
systemctl start nginx
systemctl enable nginx
apt-get install python python-setuptools python-dev build-essential python-pip python-mysqldb
apt-get install python-dev default-libmysqlclient-dev libssl-dev
pip install flask flask-mysql uwsgi
-------------
CREATE database employee_db;
show databases;
use employee_db;
SHOW TABLES;
https://github.com/Dos2009/AAC-Lab1
mysql -uroot employee_db < employee_db.sql
SELECT * FROM employees;
------
web server
cp app.service /etc/systemd/system/
vi /etc/systemd/system/app.service
systemctl daemon-reload
systemctl status app
systemctl enable app
systemctl start app
systemctl status app
/usr/local/bin/uwsgi --ini app.ini
pip install pip --upgrade
pip3 install pip --upgrade
--------
cp app /etc/nginx/sites-available/
ln -s /etc/nginx/sites-available/app /etc/nginx/sites-enabled/
-------
run ansible as a different user
ansible-playbook mplay.yml -u centos -k
inside the mplay:
become: yes
become_user: centos
encrypt a var file with: ansible-vault encrypt r1/vars/main.yml put the key two times
ansible-vault decrypt r1/vars/main.yml
ansible-vault edit r1/vars/main.yml #edit the file
ansible-vault create r1/vars/main.yml # it does create and encrypt
then when you run the command as: ansible-playbook mplay.yml --ask-vault-pass
or ansible-playbook mplay.yml --vault-password-file code
-----------
ansible-galaxy to share codes https://galaxy.ansible.com/
you can get roles or full blown project called collection
you can install with
#roles
ansible-galaxy install arista.eos-route-control -p .
ansible-galaxy install singleplatform-eng.users -p .
#collection
ansible-galaxy collection install arista.eos -p .
if you want to intiate role structure
ansible-galaxy init test_role_galaxy
-------
Step 1: Go to the /etc/yum.repos.d/ directory.
[root@autocontroller ~]# cd /etc/yum.repos.d/
Step 2: Run the below commands
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
Step 3: Now run the yum update
[root@autocontroller ~]# yum update -y
-----
download the bundle
tar -xvf ansible-bundle
cd ansible
vi inventory
./setup.sh