Posts

Showing posts with the label ansible

How to structure Ansible code

 ├── README.md ├── alpha-beta-ssh-key-user1.sh ├── alpha-beta-ssh-key-user2.sh ├── alpha-beta-ssh-key-user3.sh ├── release-rc-ssh-key-user1.sh ├── release-rc-ssh-key-user2.sh ├── release-rc-ssh-key-user3.sh ├── ansible.cfg ├── group_vars │   ├── all │   │   └── common.yml │   ├── alpha │   │   ├── server1.yml │   │   └── server2.yml │   ├── beta │   │   ├── server1.yml │   │   └── server2.yml │   ├── rc │   │   ├── server1.yml │   │   └── server2.yml │   └── release │       ├── server1.yml │       └── server2.yml ├── hosts │   ├── project1 │   └── project2 ├── playbooks │   ├── hello-world.yml │   ├── install-java.yml │   ├── kill-pm2.yml │   ├── install-nginx.yml │   ├── nginx-force-sta...

Ansible- [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

 The solution is that you add your server address into the /etc/ansible/hosts 127.0.0.1 abc.com.vn

How to install Ansible

https://www.snel.com/support/how-to-install-ansible-on-centos-7/ Install Ansible on Ubuntu $ sudo apt-get install software-properties-common $ sudo apt-add-repository ppa:ansible/ansible $ sudo apt-get update $ sudo apt-get install ansible Install Ansible on Centos # NOTE: Before installing Ansible you may need to install the epel-release repo # for RHEL or # Scientific Linux. Additional details on how to install EPEL can be found at # http://fedoraproject.org/wiki/EPEL $ sudo yum install ansible For Gentoo Linux users, installing Ansible can be accomplished fairly easily. The following command-line syntax can be leveraged to accomplish the installation: # The first command is optional, you may need to unmask the Ansible package prior to running emerge: $ echo 'app-admin/ansible' >> /etc/portage/package.accept_keywords $ emerge -av app-admin/ansible PKG for FreeBSD FreeBSD-specific users can use  pkg install  to install the Ansible control server solution and get Ansible...

First steps on Ansible

 https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#installing-ansible-on-ubuntu https://docs.ansible.com/ansible/latest/user_guide/playbooks_best_practices.html Ping remote server with ansible ansible all -i 122.248.226.169,  -m ping -u ubuntu 122.248.266.169 is the remote host -m ping: is ping -u ubuntu: is remote user