-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNOTES.txt
49 lines (42 loc) · 1.33 KB
/
NOTES.txt
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
vagrant:vagrant
[ubuntu]
sudo apt-add-repository ppa:ansible/ansible
sudo apt update
sudo apt -y upgrade
sudo apt -y install software-properties-common
sudo apt -y install ansible
sudo apt update
sudo vim /etc/ansible/hosts
ssh-keygen
ssh-copy-id 192.168.33.30 # this fails to connect [access denied], need to copy key from ~/.ssh/id_rsa.pub manually
ssh-copy-id 192.168.33.40 # worked just fine
[centos]
sudo yum update
sudo yum -y install epel-release
sudo yum -y install ansible
sudo vi /etc/ansible/hosts
ssh-keygen
ssh-copy-id 192.168.33.30 # this fails to connect [access denied], need to copy key from ~/.ssh/id_rsa.pub manually
ssh-copy-id 192.168.33.40 # worked just fine
[ansible]
ansible 192.168.33.30 -b -m apt -a "name=vim state=present"
# -b : become? for sudo
# -m : module
# -a : arguments
ansible 192.168.33.40 -b -m yum -a "name=vim state=present"
- roles
http://galaxy.ansible.com/
mkdir /vagrant/roles
cd roles
ansible-galaxy init mongodb # initialize role, builds structure
ansible-vault encrypt ./mongodb/vars/secrets.yml
ansible-playbook -b -i hosts --ask-vault-pass mean.yml # use -b or this won't work at all
ansible-galaxy init node #initialize role
ansible-playbook -b -i hosts --ask-vault-pass mean.yml
ansible-galaxy init nginx
[mongo]
$ mongo
> use admin
> db.auth('root','mypassword')
> use Posts
> show users