czwartek, 14 lipca 2016

Ansible playbook

---
- hosts: all
  sudo: yes
  tasks:
    - name: install tomcat
      apt: name=tomcat7 update_cache=yes state=latest
    - name: install tomcat-admin
      apt: name=tomcat7-admin update_cache=yes state=latest
    - name: install tomcat-examples
      apt: name=tomcat7-examples update_cache=yes state=latest
    - name: install tomcat7-admin
      apt: name=tomcat7-admin update_cache=yes state=latest
    - name: install tomcat7-docs
      apt: name=tomcat7-docs update_cache=yes state=latest
    - name: install libxml2-dev
      apt: name=libxml2-dev update_cache=yes state=latest
    - name: install apache benchmark
      apt: name=apache2-utils update_cache=yes state=latest
    - name: echo
      shell: echo Hello World!! > /tmp/hello_workd
    - name: deploy sample test application
      shell: cd /tmp/ && wget https://tomcat.apache.org/tomcat-7.0-doc/appdev/sample/sample.war && cp sample.war /var/lib/tomcat7/webapps/
    - name: install apache2
      apt: name=apache2 update_cache=yes state=latest
    - name: get tar.gz of tomcat7
      shell: wget http://ftp.piotrkosoft.net/pub/mirrors/ftp.apache.org/tomcat/tomcat-7/v7.0.70/bin/apache-tomcat-7.0.70.tar.gz
    - name: get zabbix repo
      shell: wget http://repo.zabbix.com/zabbix/3.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.0-1+trusty_all.deb && dpkg -i zabbix-release_3.0-1+trusty_all.deb && apt-get update -y && apt-get install zabbix-agent -y
    - name: restart tomcat service
      shell: /etc/init.d/tomcat7 restart
    - name: configure tomcat users
      shell: echo
    - name: enabled mod_rewrite
      apache2_module: name=rewrite state=present
      notify:
        - restart apache2
  handlers:
    - name: restart apache2
      service: name=apache2 state=restarted


marek@debian:~$ ansible-playbook playbook.yml --ask-sudo-pass
sudo password:

PLAY [all] ********************************************************************

GATHERING FACTS ***************************************************************
ok: [192.168.1.66]

TASK: [install tomcat] ********************************************************
ok: [192.168.1.66]

TASK: [install tomcat-admin] **************************************************
ok: [192.168.1.66]

TASK: [install tomcat-examples] ***********************************************
ok: [192.168.1.66]

TASK: [install tomcat7-admin] *************************************************
ok: [192.168.1.66]

TASK: [install tomcat7-docs] **************************************************
ok: [192.168.1.66]

TASK: [install libxml2-dev] ***************************************************
ok: [192.168.1.66]

TASK: [install apache benchmark] **********************************************
ok: [192.168.1.66]

TASK: [echo] ******************************************************************
changed: [192.168.1.66]

TASK: [deploy sample test application] ****************************************
changed: [192.168.1.66]

TASK: [install apache2] *******************************************************
ok: [192.168.1.66]

TASK: [get tar.gz of tomcat7] *************************************************
changed: [192.168.1.66]

TASK: [get zabbix repo] *******************************************************
changed: [192.168.1.66]

TASK: [restart tomcat service] ************************************************
changed: [192.168.1.66]

TASK: [configure tomcat users] ************************************************
changed: [192.168.1.66]

TASK: [enabled mod_rewrite] ***************************************************
ok: [192.168.1.66]

PLAY RECAP ********************************************************************
192.168.1.66               : ok=16   changed=6    unreachable=0    failed=0




Brak komentarzy:

Prześlij komentarz