Использование Ansible

ansible raleigh -m shell -a 'echo $TERM'
ansible serv14 -m copy -a "src=~/123 dest=/root/"
ansible serv14 -m file -a "dest=~/123 mode=600"
ansible all -s -m shell -a 'apt-get install -y nodejs'
ansible serv14 -m service -a "name=apache2 state=started"
ansible all -m setup //Gathering facts and infor of remotes.
## PLAYBOOKS:( in file book1.yaml)
---
- hosts: local
  vars:
   - docroot: /var/www/serversforhackers.com/public
  tasks:
   - name: Add Nginx Repository
     apt_repository: repo='ppa:nginx/stable' state=present
     register: ppastable

   - name: Install Nginx
     apt: pkg=nginx state=installed update_cache=true
     when: ppastable|success
     register: nginxinstalled
     notify:
      - Start Nginx

   - name: Create Web Root
     when: nginxinstalled|success
     file: dest={{ '{{' }} docroot {{ '}}' }} mode=775 state=directory owner=www-data group=www-data
     notify:
      - Reload Nginx

  handlers:
   - name: Start Nginx
     service: name=nginx state=started

    - name: Reload Nginx
      service: name=nginx state=reloaded

Комментариев нет :

Отправить комментарий

Благодарю за ваше участие!