-
-
Save brain64bit/4c47b002307c077c998a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo apt-get install python-pip | |
$ sudo pip install boto | |
$ sudo pip install https://github.com/KMK-ONLINE/ansible/zipball/elasticache_redis_vpc | |
create new file with name "hostfile" : | |
[yudaserver] | |
128.199.146.166 | |
create new file with name "nginx.yml" : | |
- name: DEPLOYMENT | |
hosts: yudaserver | |
sudo: yes | |
user: cog | |
gather_facts: yes | |
tasks: | |
- name: Install Nginx | |
apt: pkg={{item}} update_cache=yes state=latest | |
with_items: | |
- nginx | |
- php5-fpm | |
oke, right now we can running ansible-playbook: | |
$ ansible-playbook nginx.yml -i hostfile -v | |
COPY SSH_KEY To server, and make sure ssh to server without password,run this command in your local machine | |
$ ssh-keygen -t rsa | |
$ ssh-copy-id [email protected] | |
$ ssh [email protected] | |
test your connection to yudaserver | |
$ ansible yudaserver -i hostfile -m ping | |
ssh to yudaserver. and edit file "/etc/sudoers" if we want passwordless to sudo : | |
$ sudo vim /etc/sudoers | |
cog ALL=(ALL:ALL) NOPASSWD: ALL | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment